Skip to content

Ball Clock

Steel balls roll down twin rails, round the bend and up again. Loops perfectly.

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

In Machines & clockwork, Toys, games & parties

Next: Spinning TopSurprise me

Ball Clock 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

14
1

Whole laps of the track each ball makes per loop.

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

Info

What it is

A kinetic desk toy on a wooden board: steel balls roll one after another down a zig-zag of twin brass rails, gathering speed as they fall, drop round the bottom bend and are carried up the side to start again. The balls are spaced evenly round the closed track, so there is always a ball in every part of it. Choose the number of balls, the finish (steel, brass, copper, black), the board (walnut, oak, slate, white), how many laps a loop holds, the backdrop and whether the camera drifts.

Reuse it in your own idea

  • Time or flow title: Steel balls, walnut.
  • Luxury desk-toy loop: Brass balls, slate.
  • Cheerful product loop: Copper, white board.

Which part is reusable

src/ball-clock.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 balls follow a prescribed speed, not a physical simulation: they never bunch up or collide.
  • There is no dial: the balls count nothing, they only circulate.

Technical details

Technical details
Implementation
Three.js 0.185.1 (WebGL) · ES module src/ball-clock.js
Exports
  • createBallClock({ balls?, metal?, board?, laps? }) => { group, setProgress(progress), dispose() }
  • METALS: { steel, brass, copper, black }
Dependencies (exact)
  • three@0.185.1 (source) — Renderer, geometry and physical 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 board is 9.4 × 10.4 in the xy plane facing +z, the track a closed spline inside it, .

Lighting: A key light with a shadow map and the studio environment on the polished balls and brass rails.

Timing: setProgress(progress) places every ball by table lookup; frames render in any order.

Output
1080×1080, 30 fps, 16 s · procedural (computed from the frame number) · seamless loop — The balls are spaced evenly round a closed track and each makes a whole number of laps per loop, with a speed that depends only on its height, so the pattern returns exactly; the camera drift is a sine of the loop.
Tested
Rendered 480 frames on 2026-10-05 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 14 instanced balls, two tube rails and a couple of boxes, one shadow map. A few 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 -- ball-clock/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:bc36459fdcea3d41… · other versions: 1.0.1
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/mechanical-kinetic/ball-clock (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original object: evenly spaced balls on a closed twin-rail track with a fall-speed table, rolling rotation and an exact loop.
BinMore like this

Hourglass

3D object3DSeamless loop16 seconds