r/creativecoding • • Oct 20 '26

Ten morphing dot-orb animations in plain canvas, no libraries (~5 KB gzipped)

I made a small set of dot animations for loaders and “AI is thinking” states, and they turned into something I like watching for their own sake. There are ten shapes: sphere, wave, spikes, constellation, torus, helix, galaxy, ticks, cube and clusters. Any of them can morph into any other.

How it works:

  • Every shape uses the same number of dots, so a morph just moves each dot from where it is in one shape to its slot in the next one.
  • The sphere spreads its dots with the golden angle (a Fibonacci sphere), which is why it looks even without any clumping at the poles.
  • Dots don’t all leave at once. Each one gets a small delay based on its height, so the morph cascades from top to bottom. A cubic ease-in-out plus a slight outward swell halfway through stops it looking mechanical.
  • Every morph starts from exactly what’s on screen at that moment, motion included, so interrupting one halfway doesn’t make anything jump.
  • The 3D is two rotations and a cheap perspective divide. Depth then drives dot size and brightness.

The colour comes from the canvas’s CSS color, and the glow is just CSS: filter: drop-shadow(0 0 5px currentColor) drop-shadow(0 0 14px currentColor).
It’s one file with no build step. Drop a <canvas data-orb="torus"> on a page and it starts.

Live demo: https://shazmoghaddam.github.io/orbs
Repo (MIT): https://github.com/ShazMoghaddam/orbs
You can also see one running on a real page in the Contact section of my site: https://shazmoghaddam.github.io

Happy to answer questions about any of the shapes. The torus rolling inside out took the longest to get right.

2 Upvotes

0 comments sorted by