Fireflies

Free

Soft points of light that wander, pulse and move away from the pointer. Warm by default, white for a quiet background.

ParticlesCanvasauto-playinteractivelightweightmobile-friendly

Code

Updates live with your settings.

Preparing the code…

How to use

  1. 1

    Add the files

    Copy the files from the Code section into a folder named fireflies/ in your project. They are plain TypeScript; the React wrapper is one file and the engine does not depend on it.

  2. 2

    Drop in the component

    Place <Fireflies /> inside a positioned container with a size; it fills the container. Every setting is a prop, and changing a prop updates the running effect.

  3. 3

    Other frameworks

    Vue, Svelte, Astro or plain HTML: use the engine directly, or copy the AI Prompt and let your assistant write the wrapper for your stack. The prompt carries this exact code.

Props

PropTypeDefaultDescription
countnumber 5–40090How many points of light.
sizenumber 0.5–6 px2Base radius of a point.
sizeJitternumber 0–10.6How much sizes differ between points.
depthnumber 0–10.6Smaller points move slower and dimmer, as if further away.
speednumber 0–3 x1Overall speed.
direction"drift" | "rise" | "fall""drift"Which way the field tends to move.
wandernumber 0–10.6How much each path curves.
twinklenumber 0–10.7Pulse of brightness. 0 keeps every point steady.
colorstring (#hex)"#ffd27a"Colour of the points.
glownumber 0–10.6Soft halo around each point.
backgroundstring (#hex)"#0a0a0a"Painted behind the points unless Transparent is on.
transparentbooleanfalsePaint nothing behind the points, so your page shows through.
pointerMode"repel" | "attract" | "off""repel"Whether points flee from the pointer or gather toward it.
pointernumber 0–10.5How strongly points react.
pointerRadiusnumber 40–400 px160Distance within which the pointer has an effect.
maxDprnumber 1–22Cap on device pixel ratio.

Performance

Bundle
~3 KB gzipped, no dependencies
Cost
Low
Renders on
CPU (Canvas 2D)
Reduced motion
Respected
  • Canvas 2D with one pre-rendered sprite per colour; the cost scales with count, not with glow.
  • Pauses when off-screen or when the tab is hidden.
  • With prefers-reduced-motion a single still frame is drawn.

Related