Pixel Burst
NewCustomize
center
Colors
Background
Cell size48px
Gap0px
Radius0px
Spread1.8
Core3.5
Scatter0.35
Flicker0.50
Pulse0.60
Speed1.0
Grain0.000
Hover0.60
Installation
npx shadcn@latest add https://uibrik.com/r/pixel-burst.jsonAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/pixel-burst/pixel-burst.tsx"use client"; import { ShaderSurface, type ShaderBackgroundProps } from "../_shader-background/ShaderSurface"; import { paletteOf, type ShadeStep } from "../_shader-background/shades"; // Square pixels bursting out of a source cell. Next to the source they sit in a checkerboard, // tinted by the direction they lie in (one colour to the left, another above, and so on), and they // pale with distance until only a few loose pixels are left, fading in and out on their own. A soft // ring pulses out from the source now and then, lighting the checkerboard as it passes, and the // pointer leaves a short trail of lit pixels. Sources sit in the centre, on one edge or on both // sides; with two, each pixel belongs to the nearer one. const SHADER = /* glsl */ ` uniform float u_cell; // cell size, css px uniform float u_gap; // gap between cells, css px uniform float u_round; // cell corner radius, css px uniform float u_spread; // how far the burst reaches, cells uniform float u_core; // radius of the solid checkerboard, cells uniform float u_scatter; // share of loose pixels beyond it uniform float u_flicker; // how often loose pixels come and go uniform float u_pulse; // strength of the ring that pulses out uniform float u_hover; // strength of the pointer trail uniform float u_layout; // 0 centre, 1 left, 2 right, 3 sides, 4 top, 5 bottom const float TAU = 6.2831853;
Adds the files to
components/uibrik/pixel-burst. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/pixel-burst.Usage
import { PixelBurst } from "@/components/uibrik/pixel-burst/pixel-burst";<PixelBurst layout="center" colors={["#6c63ff", "#3ec6e0", "#45d39b", "#b57cf6"]} background="" cellSize={48} gap={0} radius={0} spread={1.8} core={3.5} scatter={0.35} flicker={0.5} pulse={0.6} speed={1} grain={0} animate interactive hover={0.6} ripples> …</PixelBurst>Props
PixelBurst- layout
- Type "center" | "left" | "right" | "sides" | "top" | "bottom"
- "center"
- Where the burst comes from: the centre, one edge, or both sides.
- color
- Type string
- "#6c63ff"
- Colour of the pixels; drawn in shades of it.
- colors
- Type string[]
- ["#6c63ff","#3ec6e0","#45d39b","#b57cf6"]
- Hex colours, 2 to 6, laid round the source (right, top, left, bottom for the centre). Overrides color.
- background
- Type string
- ""
- Base colour behind the pixels; empty follows the page.
- cellSize
- Type number
- 48
- Size of a pixel.
- gap
- Type number
- 0
- Gap between pixels.
- radius
- Type number
- 0
- Corner radius of each pixel.
- spread
- Type number
- 1.8
- How far the burst reaches before fading, in cells.
- core
- Type number
- 3.5
- Radius of the solid checkerboard round the source, in cells.
- scatter
- Type number
- 0.35
- Share of loose pixels beyond the checkerboard.
- flicker
- Type number
- 0.5
- How often loose pixels come and go; 0 holds them still.
- pulse
- Type number
- 0.6
- Strength of the ring that pulses out from the source; 0 turns it off.
- speed
- Type number
- 1
- Animation speed; 1 is the designed pace.
- grain
- Type number
- 0
- Film grain strength.
- animate
- Type boolean
- true
- Move on its own. Off draws one still frame.
- interactive
- Type boolean
- true
- React to the pointer.
- hover
- Type number
- 0.6
- Strength of the loose trail of pixels the pointer lights, in the palette's colours.
- ripples
- Type boolean
- true
- A click sends a ring of light across the pixels.
- children
- Type ReactNode
- –
- Content shown on top of the background.
- className
- Type string
- –
- Classes for the box; it fills whatever size you give it.