Skip to content

Spinning Top

A painted tin top whirring on a polished floor, leaning, precessing and wandering in a small circle. Loops perfectly.

3D object, V2 Objects3DSeamless loop, verified92 lines of codev1.0.0

In Machines & clockwork, Toys, games & parties, Patterns & illusions

Next: Ball ClockSurprise me

Spinning Top preview
Starting live preview…
00:00:00:00 / 00:00:00:01

Live, running the real source at reduced resolution.

Your current settings go with it. Combine several clips and hand them over together from your sequence.

Effect controls

Presets

36

Whole turns about its own axis per loop.

1
1

The preview runs the same code your AI receives. These settings travel with the hand-off.

Info

What it is

A painted tin top spinning on its steel tip on a polished floor: its coloured spiral flickers as it turns, it leans and precesses in a slow circle, wobbles with the nutation of a real gyroscope and wanders in a small orbit across the floor, a bright reflection of it below. Choose the paint (carnival, jade, mono or sunset), how fast it spins, how far it leans, how far it wanders, the backdrop and whether the camera drifts.

Reuse it in your own idea

  • Toy brand title: Carnival top.
  • Physics explainer: Jade and gold, slow.
  • Hypnotic loop: Black and white blur.

Which part is reusable

src/spinning-top.js is the ingredient your AI reuses. demo.js is only the example scene around it, and uses chrome-material only for the demo.

Good to know

  • The motion is a prescribed gyroscope-like formula, not rigid-body dynamics: it never slows or falls.
  • At high spin counts the spiral strobes at 30 frames a second.

Technical details

Technical details
Implementation
Three.js 0.185.1 (WebGL) · ES module src/spinning-top.js
Exports
  • createSpinningTop({ finish?, spin?, lean?, wander? }) => { group, setProgress(progress), dispose() }
  • FINISHES: { carnival, jade, mono, sunset }
Dependencies (exact)
  • three@0.185.1 (source) — Renderer, geometry and shader materials.
  • chrome-material@1.1.0 (demo) — Studio environment light, backdrop and contact shadow.
  • apw-runtime@1.0.0 (demo) — Demo harness.
How it fits a scene

Coordinates: The tip stands on y = 0 and wanders on an ellipse of radius up to 0.9; the top is 2.4 tall.

Lighting: A warm key light with a shadow map and the studio environment on the clear-coated paint, steel and polished floor.

Timing: setProgress(progress) sets the spin, lean and position; frames render in any order.

Output
1080×1080, 30 fps, 12 s · procedural (computed from the frame number) · seamless loop — The top spins a whole number of turns, precesses twice, wobbles eleven times and wanders once round its small circle per loop, and the camera drift is a sine of the loop, so the last frame meets the first.
Tested
Rendered 360 frames on 2026-10-06 in Chrome 154.0.8037.97 headless on Linux 7.0.0-38-generic (x64), Node 22.14.0 (WebGL 2 via SwiftShader (software)). Same frame twice from fresh pages: identical. Loop: Frame 0 vs end state (progress 1): mean |Δ| 0.0000, max |Δ| 0 of 255.
Performance
About eight meshes and one shadow map. A couple of milliseconds a frame on an integrated Intel GPU. Software WebGL renders in about a second a frame.
Export a video yourself
Download the source, then in the folder: npm install npm run render -- spinning-top/1.0.0 --out my-video.mp4Needs Node 18+, ffmpeg and Chrome/Chromium. Add --params my-settings.json (from Copy settings) for your own settings.
Version
1.0.0 · sha256:5ddd85fb2711d819…
Files
License
MIT. Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder. License details
Provenance
Adapted from the owner's threejs-sketches/physics-simulation/spinning-top (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original object: lathe-turned painted tin with a canvas spiral, precession and nutation as whole-cycle sines, a wandering tip on a glossy floor and an exact loop.
BinMore like this

Ball Clock

3D object3DSeamless loop16 seconds