Skip to content

Newton's Cradle

Polished balls on a walnut base: one swings in, one swings out, click after click. Loops perfectly.

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

In Science & maths, Machines & clockwork, Light, glass & shine, Toys, games & parties

Next: Pendulum WaveSurprise me

Newton's Cradle 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

5
1
36
4

Whole cycles of the swing in each loop.

3

Changes the wood grain.

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

Info

What it is

The classic executive toy on a glossy black table in a dark studio: a row of polished balls hung on V-shaped strings from two chrome rails, on a bevelled walnut base with brass feet. The end ball swings up and strikes the row, the far ball takes the motion and swings out, falls back and strikes again, the middle balls standing still, and so on. The balls mirror the studio and are mirrored in the table. Choose the finish of the balls (chrome, gold, black chrome or copper), the number of balls, whether one or two are lifted, how wide the swing is, how many clicks per loop, and the wood of the base.

Reuse it in your own idea

  • Satisfying loop: Chrome on walnut, camera drift on.
  • Cause and effect: Gold on black with two lifted, behind a title about chain reactions.
  • Desk scene: add the group to your own table and call update with your timeline.

Which part is reusable

src/newtons-cradle.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 swing is an idealised cycle (a cosine in the swinging ball, the middle balls perfectly still): no slow loss of energy, no jitter of the middle balls.
  • Balls do not rotate: they are smooth, untextured spheres.

Technical details

Technical details
Implementation
Three.js 0.185.1 (WebGL) · ES module src/newtons-cradle.js
Exports
  • createNewtonsCradle({ balls?, lift?, finish?, base?, amplitude?, seed?, anisotropy? }) => { group, height, count, update(time, loopSeconds, { cycles? }), dispose() }
  • cradleSwing(u) => { left, right }
  • FINISHES: { chrome, gold, black, copper }
  • BASES: { walnut, maple, ebony }
Dependencies (exact)
  • three@0.185.1 (source) — Renderer, geometry and physical metals.
  • chrome-material@1.1.0 (demo) — Studio environment light and backdrop.
  • apw-runtime@1.0.0 (demo) — Demo harness.
How it fits a scene

Coordinates: 1 unit = 10 cm. The balls have a radius of 0.5 and touch at rest; the rails stand 6.75 above the base; strings run from rails 1.9 apart to the top of each ball.

Lighting: Physical metals: needs scene.environment for the balls to mirror the room; a shadow-casting key light draws the strings' and balls' shadows on the base.

Timing: update(time, loopSeconds, { cycles }) is a pure function of time; frames render in any order.

Output
1080×1080, 30 fps, 9.6 s · procedural (computed from the frame number) · seamless loop — The swing repeats a whole number of cycles per loop, and a cycle starts and ends with the near end ball at the top of its swing, so the last frame meets the first.
Tested
Rendered 288 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 fifty meshes built once; only the balls and their strings are reposed each frame. Smooth at 1080p on laptop GPUs. Software WebGL (no GPU) renders slowly.
Export a video yourself
Download the source, then in the folder: npm install npm run render -- newtons-cradle/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:3b445b06dc672622…
Files
License
MIT. Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder. Third-party: three.js 0.185.1 (MIT). License details
Provenance
Adapted from the owner's threejs-sketches/webgpu-newton-cradle (mechanical-kinetic, MIT), rebuilt for AI Pixel Wizard in October 2026: V-strung polished balls on a chrome frame and walnut base, a four-quarter swing that loops exactly, a mirrored table, studio light and shadows, and the frame/time contract.
BinMore like this

Gyroscope

3D object3DSeamless loop16 seconds

Ferrofluid

3D object3DSeamless loop16 seconds

Ball Clock

3D object3DSeamless loop16 seconds

Hourglass

3D object3DSeamless loop16 seconds