LibraryEffects
ParticleMorph
A WebGL particle field that morphs through a queue of shapes.
ParticleMorph
Status: internal
Package path: packages/effects/src/particle-morph/
Import: @ziteox/effects/particle-morph
A particle field that gathers into a shape, holds it, scatters back into a loose field, then gathers into the next shape in the queue, on a loop. It fills the box you give it, so it works as a background behind content or inline at a fixed height. The field leans gently toward the pointer.
Preview
Usage
As a background, positioned behind your content:
import { ParticleMorph } from "@ziteox/effects/particle-morph";
export function Banner() {
return (
<section style={{ position: "relative", minHeight: 480 }}>
<ParticleMorph style={{ position: "absolute", inset: 0 }} />
{/* content */}
</section>
);
}Inline, with your own shapes, colours and timing:
<ParticleMorph
height={320}
shapes={["torus", "box"]}
color="#7C9CFF"
colorAlt="#4B6BDB"
holdSeconds={4}
/>Text and images can be stages too:
<ParticleMorph
stages={[
{ type: "text", text: "Hello" },
{ type: "shape", shape: "sphere" },
{ type: "image", src: "/mark.svg", size: 5 },
]}
/>Install peer dependencies in your app:
pnpm add three @react-three/fiberExample preset: ziteox.com
The slower four-shape queue behind the ziteox.com home hero. It is an example, not the default.
<ParticleMorph
stages={[
{ type: "shape", shape: "sphere" },
{ type: "shape", shape: "cloud" },
{ type: "shape", shape: "servers" },
{ type: "shape", shape: "torus", offset: [0, 0.6, 0] },
]}
gatherSeconds={11}
holdSeconds={3.5}
scatterSeconds={6}
opacity={0.9}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
shapes | ParticleShape[] | ["sphere", "torus", "box"] | Shapes to morph through, looped. ParticleShape is "sphere" | "torus" | "box" | "cloud" | "servers" |
stages | ParticleMorphStage[] | Full stage list (shape, text or image, each with an optional [x, y, z] offset); overrides shapes | |
color | string | --zx-particle-color, then #3BEA9C | Main particle colour |
colorAlt | string | --zx-particle-color-alt, then #21AB70 | Second particle colour |
particleCount | number | 3000 | Particles in the shapes (a small roaming pool is added) |
gatherSeconds | number | 4.2 | Time to gather into a shape |
holdSeconds | number | 2.8 | Time a finished shape is held |
scatterSeconds | number | 2.5 | Time to scatter back into the field |
fade | boolean | true | Fade the field out towards its edges |
opacity | number | 1 | Opacity of the whole field |
compactBelow | number | 640 | Container width (px) below which the lighter small-size tuning is used |
width / height | CSS length | "100%" | Size; by default it fills its container |
reducedMotionFallback | ReactNode | null | Rendered instead of the animation for prefers-reduced-motion |
tuning | ParticleMorphTuning | Advanced engine values (point sizes, intensity, roaming pool, stagger) | |
className / style | On the wrapper |
Behaviour
- Client-only.
threeand@react-three/fiberload lazily the first time aParticleMorphmounts in the browser, so pages that don't use it never download them. - The render loop pauses while the field is out of view.
- Tuning follows the container width, not the viewport, so it looks the same wherever it is placed.
prefers-reduced-motion: reducerendersreducedMotionFallback(nothing by default).- Decorative:
aria-hiddenwithpointer-events: none.