A museum gyroscope on a brass gimbal: gravity-torque precession, bearing friction, gimbal constraints and a release with a bump stop.
A museum gyroscope on a brass gimbal: gravity-torque precession, bearing friction, gimbal constraints and a release with a bump stop.
No runs posted yet. Be the first: post yours and tag @wikiwayne.
PRECESSION LAB: Gyroscope on a Brass Gimbal
HOOK OBJECT: window.__gyro
Build "PRECESSION LAB": a polished three-axis gyroscope on a walnut-and-brass demonstration stand in Three.js. A jeweled rotor spins inside nested gimbals; gravity and a movable counterweight create torque that makes the axis precess instead of simply falling over. A fingertip nudge changes the rotor's angular momentum, and a release test shows the difference between free spin, supported precession and a toppled gimbal.
LOOK
- Style: museum instrument product photography, palette walnut #4C2D1C, brass #D4A34E, steel #D7E0E8, ruby bearing #D84355, ivory dial #F3E9CE, backdrop #11161E.
- Subject: a 40 cm brass gyroscope with a visibly spoked rotor, three nested gimbal rings with engraved degree scales, ruby bearings, adjustable counterweight on a threaded rod, and a circular protractor base on a walnut plinth.
- FIRST FRAME (t = 0, no input): three-quarter 42-degree elevated view of the spinning gyroscope and stand filling at least 55% of the screen height, warm rim light, soft contact shadow, top-left instrument readout away from the rotor.
MOTION / PLAY
- Controls: drag the rotor rim or press Space to spin it up; A/D moves the counterweight along the threaded rod; W/S changes gimbal support friction; R releases the outer gimbal lock; mouse/touch orbit and setCameraOrbit(azimuthDeg, elevationDeg, distance) frame the instrument.
- Rigid-body approximation: keep rotor spin angular velocity, gimbal orientation and support torque in explicit state. Gravity torque from counterweight displacement produces precession about the vertical, with damping from bearing friction. Rotor and gimbal axes must remain orthogonal within 1 degree.
- Unlocking the outer gimbal removes its support torque, allowing the assembly to tilt toward the table with visible wobble; it must stop at the physical bump-stop rather than falling through the plinth.
- ATTRACT MODE: with no input, a 28–30 s demonstration spins the rotor, moves the counterweight through three positions, changes friction, unlocks and relocks the gimbal, then resets to a centered precession. Any input takes over; after 8 s idle it resumes.
SOUND
- Rotor spin produces a filtered bearing whirr whose pitch follows angular velocity.
- Counterweight detents click softly as it moves along the rod.
- Bearing creak rises with support friction; gimbal release gives a brass clack and bump-stop gives a muted wooden knock.
COUNTERS
stats() returns { fps, spinRpm, precessionDeg, counterweightMm, releases, bumpStops, bearingLoadN }.
- spinRpm: actual rotor angular speed in revolutions per minute.
- precessionDeg: accumulated precession angle of the supported axis in degrees.
- counterweightMm: signed counterweight displacement along the rod.
- releases: +1 only when the outer gimbal lock is actually released.
- bumpStops: +1 when the unlocked assembly visibly reaches its mechanical stop.
- bearingLoadN: computed load from counterweight torque and rotor spin.
- On screen: top-left pill with RPM, precession, counterweight and releases, never over the gyroscope.
CHECKS for ?test=1
With ?test=1, run an accelerated self-test that measures real positions and real events (not self-set flags) and logs "TEST n PASS" or "TEST n FAIL: reason" to the console and to window.__testResults:
1. First frame: gyroscope and stand span at least 50% of the screen height, spinRpm starts above 600, and the three gimbal axes are mutually orthogonal within 1 degree.
2. Precession physics: with positive counterweight displacement, precessionDeg accumulates in the correct direction and increases by at least 20 degrees over 5 s; reversing the counterweight reverses precession direction.
3. Friction effect: increasing bearing friction measurably reduces spinRpm and precession rate over 3 s without changing rotor orientation constraints.
4. Release safety: releasing the outer lock increments releases once, produces visible tilt/wobble and one bumpStops event, and never lets the assembly pass through the plinth.
5. Attract demonstration: advancing 30 s visits at least three counterweight positions, records one release and one bump-stop, and resets to a stable centered gyroscope with zero console errors.
KEEP IT SHORT
- Keep the whole file under about 1,500 lines (soft target) so you can write it in one pass and finish well inside 15 minutes.
- Save lines with helpers, loops and instancing, not by dropping features. Everything above must really work: no placeholders, no TODOs.
BUILD RULES (all required):
- Deliver ONE self-contained HTML file: inline CSS and JS, no build step, no local assets. Libraries only from a CDN. If you use Three.js, use exactly this import map: {"imports":{"three":"https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js","three/addons/":"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/"}}
- It must open straight from disk in desktop Chrome and on an iPhone (Safari), fill the full screen, handle resize and touch, and stay smooth (target 60 fps).
- It must look stunning in the very FIRST frame: no black screen, no loading wait, no tiny subject. The main subject fills at least 50% of the screen height.
- SOUND (required): all sound is made in code with Web Audio (no audio files). Show a small "🔊 TAP FOR SOUND" chip; on the first tap create ONE AudioContext, route everything through a master gain of 0.6 into a DynamicsCompressor, and hide the chip. Also expose enableAudio() on the hook object named at the top.
- Expose the hook object named at the top with: setCameraOrbit(azimuthDeg, elevationDeg, distance) (or an equivalent camera setter), advance(seconds) that steps the simulation exactly that much for still captures, enableAudio(), and stats() returning {fps, ...the counters named above}. Use a fixed random seed of 360 so every run is the same.
- Every on-screen counter must count a real event you can see happen. No fake numbers.
- No text overlapping the subject; any label must be readable in a paused frame.
- No brand logos, no real people, no copyrighted characters, brand names or logos.
FAILURE MODES TO AVOID
- A spinning decorative wheel with no gravity torque, precession or changing counterweight behavior.
- Gimbals rotating through one another, losing orthogonality or falling through the display plinth.
- Spin and precession counters driven by a timer instead of explicit angular state.
- Release button that increments a counter without a visible mechanical change.
- Tiny instrument or HUD text across the rotor face.
- The same variable declared twice, or methods called on objects that don't exist yet.
SELF-TEST LOOP
- If you can run code: build the file, open it, read the console, run ?test=1, and take screenshots at 3 s, 10 s and 30 s at 1280x720 and 390x844. Look at the screenshots and fix what looks wrong. Fix and retest until all 5 checks pass with zero console errors. Mark anything you could not run as UNMEASURED; never invent results.
- If you are chat-only: go through this prompt line by line, check your code against each line, and fix anything that would fail. Then write one corrected, complete file.
- Final answer: ONE complete HTML file in ONE code block, then the 5 checks marked PASS, FAIL or UNMEASURED. No snippets, no "rest unchanged".
Built one? Post it on X and tag @wikiwaynePost on X