Most frontend work spends all day fighting state machines, nested div wrappers, and stiff CSS transitions.
Then you wire Three.js inside an Astro island, drop real math and physics directly into your animation loop variables, and suddenly frontend development feels like building a musical instrument.
For Issue 01 of Biology and the Science of Thought, I’m celebrating software engineer and independent writer Nick M (Photon Lines) for his visual essay, A Visual Intro to Complex Numbers.
While building the interactive 3D WebGL sandbox for Nick’s card, two things stood out: how cleanly Astro + Three.js stay out of each other's way, and how underrated complex numbers are for everyday frontend motion.
1. Why Astro + Three.js Is the Sweet Spot for 3D Frontends
Heavy SPA frameworks constantly fight your requestAnimationFrame loop for main-thread budget. Astro flips that architecture:
- Zero-JS Static Shell: Typography, bilingual UI controls, and citations ship as fast, zero-overhead HTML and CSS.
- Isolated 60fps Canvas Island: Your Three.js scene mounts only where needed, owning its GPU and memory state without triggering virtual-DOM re-renders on every frame.
When your framework stops fighting the browser, your variables stop holding dead booleans like isOpen = true and start holding living physics: angular velocity, spring damping, phase angles, and complex radii.
2. How Complex Numbers Supercharge Frontend Motion
In 1545, Girolamo Cardano hit √−108 and thought algebra was broken. Four centuries later, schools still teach i as an "imaginary" trick—when in frontend graphics and shaders, a complex number z = x + iy is simply a 2D vector with a superpower: multiplication equals rotation plus scaling.
Instead of juggling clunky rotation matrices or calling atan2 on every frame, De Moivre’s polar form (z = r(cos θ + i sin θ)) lets two variables (r and θ) drive an entire 3D choreography:
// Multiply two complex numbers (a + bi)(c + di): stretch & turn in 2 lines const multiplyComplex = (a, b, c, d) => ({ re: a * c - b * d, im: a * d + b * c, }); // Inside your Three.js animation loop: // Dragging z updates one base point; its powers z, z², z³... form instant spirals let zn = { re: z.x, im: z.y }; for (let k = 1; k <= MAX_POWERS; k++) { orbMeshes[k].position.set( zn.re, Math.sin(clockTime * 2 + k * 0.4) * 0.15, zn.im ); zn = multiplyComplex(zn.re, zn.im, z.x, z.y); } Watch what happens to your UI motion just by sliding a single complex variable z across the golden unit circle (|z| = 1):
- Inside the circle (
|z| < 1): Every powerz, z², z³…naturally decays inward—giving you organic, damped spiral-in transitions for free. - Outside the circle (
|z| > 1): Powers expand outward into logarithmic spirals. - Right on the unit circle (
|z| = 1): Pure, lossless orbital rotation with zero drift and zero matrix bloat. - Roots of Unity (
zⁿ = 1): NeedNUI nodes, particles, or radial menu items spaced with geometric precision? Steppingθ = 2πk / Naround the complex plane snaps symmetries into place instantly—the exact same math behind FFT audio visualizers and 2D GLSL fragment shaders.
3. Touching the Physics Before Reading the Formula
In my Complex Numbers 3D sandbox for Issue 01, I added two small physics interactions: leave your pointer completely still over the canvas for 6 seconds and the whole structure gently collapses and rebuilds itself; click 8 times rapidly and it triggers the roots of unity.
Why? Because your hands understand invariants faster than your eyes parse equations.
That conviction connects directly to Chapter 5 of my opening monograph (exploring why quantum mechanics and phase coherence reach for the complex plane in the first place) and honors Nick M’s decision in 2026 to end all paid subscriptions on Photon Lines—making visual math 100% free for everyone.
Spin z With Your Hands & Read Nick’s Essay
- Play with the Astro + Three.js 3D Sandbox (Card No. 06): scienceofthought.securedme.ca/articles/nick-m/
- Read Chapter 5 of the Opening Monograph: scienceofthought.securedme.ca/articles/opening-essay/#chapter-5 (DOI:
10.5281/zenodo.24702921) - Read Nick M’s Original Visual Essay on Photon Lines: A Visual Intro to Complex Numbers
For fellow frontend & creative coders: What is your favorite piece of pure math or physics (springs, complex planes, quaternions, Perlin noise, Verlet integration) to sneak into UI and Three.js variables?