Skip to content

Differential Gear

A car differential at work: ring gear, carrier, spider and side gears with the two shafts speeding apart and back. Loops perfectly.

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

In Science & maths, Machines & clockwork

Next: GyroscopeSurprise me

Differential Gear 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

1
1

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

Info

What it is

The mechanism that lets the two wheels of a car turn at different speeds in a corner: a ring gear driven by a pinion, a carrier drum turning with it, a cross-pin with two spider gears and two bevel side gears on the axle shafts. The carrier turns a whole number of times per loop while the two shafts speed up and slow down against each other and the spider gears spin on their pin by exactly the difference. Choose the metal, the turns per loop, how far the shafts slip apart, the backdrop colour and whether the camera sways.

Reuse it in your own idea

  • Explainer: Steel, one turn.
  • Vintage workshop: Brass, warm.
  • Energetic loop: Fast, copper.

Which part is reusable

src/differential-gear.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

  • Gear teeth are visual, not meshed exactly; the teeth of different gears may pass through each other.
  • The pinion drives the ring gear as a spur gear for clarity.

Technical details

Technical details
Implementation
Three.js 0.185.1 (WebGL) · ES module src/differential-gear.js
Exports
  • createDifferential({ metal?, turns?, slip? }) => { group, setProgress(progress), dispose() }
  • METALS: { steel, brass, copper, blackened }
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 axle runs along x through the origin; the ring gear (radius 2.8) and carrier are centred on it; the pinion sits below at y ≈ −3.3.

Lighting: A warm key light with a shadow map and the studio environment.

Timing: setProgress(progress) sets every angle in closed form; frames render in any order.

Output
1080×1080, 30 fps, 16 s · procedural (computed from the frame number) · seamless loop — The carrier turns a whole number of times per loop, the shaft slip and the spider spin are sines of the loop and the camera sway is a sine of the loop, so the last frame meets the first.
Tested
Rendered 480 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
A few thousand triangles and four instanced tooth sets plus a shadow map: about a millisecond 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 -- differential-gear/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:074487e644506cb6… · 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/objects-scenes/differential-gear (MIT) and rebuilt for AI Pixel Wizard in October 2026 as an original studio object: bevel gears from cones with instanced teeth, a toothed ring gear and pinion, and carrier and shaft angles in closed form on an exact loop.
BinMore like this

Gyroscope

3D object3DSeamless loop16 seconds

Music Box

3D object3DSeamless loop12 seconds