Click Spark
Web (React)
A physics-based canvas effect that bursts colorful sparks wherever the user clicks.
A physics-based canvas effect that creates a burst of colorful sparks originating from the exact coordinates of a user's click.
Click Anywhere
Click inside this bounding box to trigger the canvas spark effect!
Installation
CLI
npx @modus-ui/cli add click-sparkManual
- Copy the code from the component tab.
- Create a file at
components/ui/click-spark.tsx. - Paste the code.
Usage
Wrap any container with ClickSpark.
tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
sparkColor | string | "hsl(var(--primary))" | Colour of the sparks. |
sparkSize | number | 10 | Length of each spark in pixels. |
sparkRadius | number | 25 | Distance the sparks travel in pixels. |
sparkCount | number | 8 | Number of sparks per click. |
duration | number | 500 | Milliseconds the sparks last. |
easing | "linear" | "ease-in" | "ease-out" | "ease-in-out" | "ease-out" | Easing of the spark motion. |
extraScale | number | 1 | Multiplier for spark distance and size. |
Comments