Updated
Particle Scatter
Customize
Wave speed1.25
Particles3000
Scatter min18px
Scatter max44px
Text size48px
Installation
npx shadcn@latest add https://uibrik.com/r/particle-scatter.jsonAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/particle-scatter/particle-scatter.tsx"use client"; import { useSyncExternalStore, useMemo } from "react"; import { cn } from "@/lib/utils"; import ShatterText from "../scatter-text/shatter-text"; // Same type scale and props as the other text effects. type EffectProps = { play: number }; const TEXT = "text-[length:var(--text-effect-size,1.25rem)] leading-[1.4] text-zinc-700 font-medium dark:text-zinc-200"; // Tracks the `dark` class on <html>, the class-based dark mode shadcn sets up. // For colours that live outside CSS: WebGL uniforms, canvas fills and // motion-animated values can't use Tailwind's `dark:` variant. function subscribe(onChange: () => void) { const observer = new MutationObserver(onChange); observer.observe(document.documentElement, { attributes: true, attributeFilter: ["class"], }); return () => observer.disconnect(); } const getSnapshot = () => document.documentElement.classList.contains("dark");
Adds the files to
components/uibrik/particle-scatter. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/particle-scatter. Builds on Scatter Text.Usage
import { ParticleScatter } from "@/components/uibrik/particle-scatter/particle-scatter";const words = ["Scatter the words", "Gather them again", "Into something new"];<ParticleScatter play={0} words={words} waveSpeed={1.25} particleCount={3000} scatterMin={18} scatterMax={44}/>Where to use Particle Scatter
Clickable hero headlines
Each press breaking the phrase into particles makes the hero interactive.
Pairs with Scatter Text
Portfolio intros
Particles regrouping into the next phrase work for introducing several roles.
Tech brands
A particle effect suits AI, data and science products.
Props
ParticleScatter- words
- Type string[]
- ["Scatter the words","Gather them again","Into something new"]
- Cycled through, one per play.
- waveSpeed
- Type number
- 1.25
- Speed of the scatter wave.
- particleCount
- Type number
- 3000
- Particles sampled across the text.
- scatterMin
- Type number
- 18
- Closest a particle scatters.
- scatterMax
- Type number
- 44
- Farthest a particle scatters.
- playrequired
- Type number
- –
- Each change plays the effect again; 0 shows its resting state.