← All effects

FX-006 · Particle Field

Interactive particle background.

Rings of charged particles orbit a collider, seen at an angle. The pointer is a magnet: particles leave their orbit to swarm it, then spring back. Press and hold to charge, and let go to fire a collision.

  • Weight4.5 KB
  • LibraryNone
  • PhonesLighter
  • Licence€39

Live · Collide

Hold. Let go.

Press and hold on the rings to charge, then let go to fire. The longer the hold, the bigger the collision.

A finger works too: hold on the rings to charge, let go to collide. Touch screens get fewer particles at half the frame rate.

Live · Repel

Or push back.

Set the magnet to repel, and the pointer clears a path through the rings.

Live · Spin

Scroll spins it.

Scrolling spins the rings up, and the machine tilts as it moves through the viewport.

01 — Details

What it does.

A magnet for a pointer

Particles leave their orbit to swarm the pointer and spring back. Attract, repel or off.

Collisions

Press and hold to charge, let go to fire a shockwave as strong as the charge, with a readout at the impact.

Tied to the scroll

Scrolling spins the rings up, and the whole machine tilts through the viewport.

One canvas

It fades in after the page has loaded, sleeps off screen, and uses fewer particles on touch screens.

02 — Prompt

Free AI prompt.

Paste this into your AI coding tool to build the effect in your own stack. It carries the behaviour, the build and the traps we hit in production. It is free for pitches and personal work.

Build an interactive particle accelerator background for this website on one canvas, in plain JavaScript.

Behaviour
- Rings of particles orbit a collider, seen at an angle, with a few fast beam particles leaving streaks.
- The pointer is a magnet: nearby particles leave their orbit to swarm it, then spring back.
- Press and hold to charge, with a ring tightening round the pointer. Let go to fire a shockwave as strong as the charge, with a readout at the impact. A press that becomes a drag or a scroll fires nothing.
- Scrolling spins the rings up, and the machine tilts as it moves through the viewport.

Build
- Give each particle a ring, an angle, a speed and an offset, and project it onto a tilted, rotated ellipse.
- Add a displacement with its own velocity: spring it back to the orbit, add the magnet force within about 190px, and damp it each frame.
- Scale the count to the area, at one particle per 900 square pixels, up to 900.

Must hold
- Stop drawing when the canvas is off screen or the tab is hidden.
- Start after the page has loaded and fade it in. On touch screens, use fewer particles at half the frame rate, moving at the same speed.
- Presses on links and buttons must not charge it.
- Take colours from CSS custom properties. Additive blending works on dark grounds, and source-over on light ones.
- With prefers-reduced-motion, draw one still frame.

Done when it holds 60fps on a laptop, sleeps off screen, and a scroll on a phone never fires a collision.

03 — Code

Or drop it in.

With a licence, the finished effect is one attribute. The small runtime fetches what it needs and removes everything again if the element goes.

<script src="/fx/sitefx.js"></script>

<section data-fx="field" data-fx-field-x="70">
  Your hero
</section>
OptionDefaultWhat it does
data-fx-field-count900Particles, scaled down on small screens
data-fx-field-rings3Rings, from 1 to 5
data-fx-field-x50Collider centre, % across
data-fx-field-y50Collider centre, % down
data-fx-field-scale1Ring size
data-fx-field-magnetattractattract, repel or off

04 — FAQ

Questions.

Does it slow the page down?

It is one canvas that starts after the page has loaded and sleeps off screen. Touch screens get fewer particles at half the frame rate.

Does it work on phones?

Yes. A finger holds and charges like a mouse, and a press that turns into a scroll fires nothing.

Does it need WebGL or a library?

No. It is a plain 2D canvas on the small SiteFX runtime.

Will it match my theme?

Yes. Ink, accent and blend mode are CSS variables, so themes recolour it live.

Licence

Particle Field · €39

One effect, yours to keep. Unlimited client projects, 1 developer, 12 months of updates. Prices exclude VAT.