Particle Logo

How to add a particle logo animation to a React or Next.js app

The React export is one .tsx file with your logo built in. It works in any React app; in the Next.js App Router it needs one extra line.

Updated

What you get

1. Export the component

  1. Open the workbench.
  2. Upload your logo: click to choose a PNG, SVG, JPG or WebP file, drag it onto the page, or paste it with Ctrl+V / ⌘+V. Logos on a transparent or plain background work best; if parts are missing, adjust the sampling density and threshold.
  3. Pick one of the 9 effects and adjust particle size, shape (square or round) and speed.
  4. Click Export Code, open the React tab and choose Download File (or copy the code). This format requires Pro.

2. Add it to your app

Save the file as src/components/PixelLogoLoader.tsx, then:

import { PixelLogoLoader } from './components/PixelLogoLoader';

export default function Hero() {
  return <PixelLogoLoader height={420} />;
}

Next.js App Router

The exported file has no 'use client' directive. It uses hooks and the canvas, so add 'use client'; as the first line of PixelLogoLoader.tsx (or import it only from client components):

'use client';

import React, { useEffect, useRef } from 'react';
// ...the rest of the file stays the same

3. Props

PropTypeDefaultWhat it does
variantstringeffect chosen at exportWhich effect plays; see the values below
widthnumber | string'100%'Numbers are pixels
heightnumber | string420Numbers are pixels
autoPlaybooleantrueLoops the animation: one cycle of duration seconds, then a 1.2 s hold
durationnumber3.2Seconds per cycle
progressnumbernone0 to 100. When set, the animation follows this value instead of playing on its own
colorsstring[]palette chosen at exportParticle colors; points that carry their own color (original colors) keep it
particleSizenumbersize chosen at exportBase particle size, scaled to the container
particleShape'square' | 'circle'shape chosen at exportSquare or round particles
speedMultipliernumberspeed chosen at exportHow fast particles move toward their targets
interactivebooleantrueHover pushes particles away; a click sends a shockwave
classNamestringnoneAdded to the wrapper div
styleCSSPropertiesnoneMerged after the default wrapper styles, so it can override them

The wrapper div has a black background, 16 px rounded corners, a thin border and a shadow by default. Override them with style:

<PixelLogoLoader
  height={320}
  style={{ background: 'transparent', border: 'none', boxShadow: 'none' }}
/>

progress, variant, duration, autoPlay, speedMultiplier and interactive are read on every frame, so changes apply immediately. colors, particleSize and particleShape are only used when the particles are created (on mount and when the container is resized); to change them later, give the component a new key so it remounts. Values for variant:

variant valueEffect
condenseQuantum Condense
mobius-flowMobius Contour Flow
vortexVortex Singularity
scanHologram Raster Scan
diffusion-denoiseDiffusion Denoise
flux-waveSuperconducting Flux Wave
swarm-assemblyAutonomous Swarm Assembly
gravitational-slingshotSlingshot Time Reversal
cymatics-resonanceCymatics Resonance

4. Use it as a loading screen

With progress set, the particles only move as far as that value, so the logo completes when loading completes:

import { useEffect, useState, type ReactNode } from 'react';
import { PixelLogoLoader } from './components/PixelLogoLoader';

export function AppShell({ children }: { children: ReactNode }) {
  const [progress, setProgress] = useState(0);
  const [ready, setReady] = useState(false);

  useEffect(() => {
    // Replace these with your own loading steps
    const steps = [() => fetch('/api/user'), () => fetch('/api/projects')];
    (async () => {
      for (let i = 0; i < steps.length; i++) {
        await steps[i]();
        setProgress(((i + 1) / steps.length) * 100);
      }
      setReady(true);
    })();
  }, []);

  if (!ready) return <PixelLogoLoader progress={progress} height={360} />;
  return <>{children}</>;
}

5. Performance and accessibility

Open the workbench

More guides