Mechanisms, written as code
Describe a machine.
Watch it move.
A CSS-like language for mechanisms. Say how the parts connect, drive one, and GearScript animates the rest in 3D, right in your browser.
Free · open source · no sign-up · nothing to install
01 · Paths
Send parts along a path.
Give a part a curve and a lap time, and it follows. GearScript works out where it is at every moment.
r(θ) = a(1 − e²) ⁄ (1 + e cos θ)
θ = 0°r = 0 kmv = 0 km/s
Probe { forever: along: Orbit 12s; }
02 · Timing
Say when, not every frame.
Give a start time and an end time. GearScript fills in every moment in between, with the easings you know from CSS.
Probe { 0s..4s: rotate: 0deg -> 180deg ease-in-out; }
t = 0.00 srotate = 0°
Drag the slider: the satellite turns exactly as the rule says.
03 · Connections
Connect parts and they move together.
Hinges, sliders, gears, belts and pins are built in. Swing the first panel and the rest follow.
Wing2::Plate { hinge: edge.left on Wing1.edge.right; } Mast::Rod { slider: axis on Body.face.top; }
04 · Light and sound
Add light and sound.
Parts can glow, and sounds play on cue. Every sound is generated, so all of it is free to use.
Beacon { luminosity: 0 -> 100%; } Probe { sound: Ping every 1.5s; }
06 · Errors and AI
Errors that tell you the fix.
Every message says how to fix it, so AI assistants can fix their own code too.
W0560 Probe and Shield pass through each other at 3.2 s. fix: move one of them, or connect them with a hinge.
07 · Get started
Start with one line.
Crank { forever: rotate: 180deg/s; } // half a turn every second
Try an example, then export a video, a GIF or a 3D page.