Build an Interactive Double-Pendulum Chaos Visualizer in HTML
Create a single-file HTML5 Canvas double-pendulum simulator with RK4 physics, draggable bobs, gravity presets, trail controls, and a twin-pendulum divergence mode.
You getone complete HTML file in a single code block, then 3 short ideas to extend it.
The prompt
Act as a senior creative technologist and physics simulation developer. Build an original, self-contained interactive web app called Double-Pendulum Chaos Lab in a single HTML file.
Core mechanic: Simulate a double pendulum using fourth-order Runge-Kutta (RK4) numerical integration on an HTML5 Canvas, with a toggleable twin pendulum offset by 0.001 radians to visualize chaotic divergence.
Follow these rules:
1. Interactive controls: Allow users to drag either pendulum bob directly on the canvas with mouse or touch to set starting angles, plus Play/Pause, Reset, and Clear Trail buttons, and Space/R/T keyboard shortcuts.
2. Physics and presets: Include gravity preset buttons for Earth, Moon, and Jupiter, and a trail fade slider.
3. Live telemetry: Display real-time angle readouts and the divergence angle between the primary and twin pendulums.
4. Layout and theme: Use a clean dark laboratory palette with high-contrast cyan and magenta trails, responsive from 360px to 1280px with no horizontal overflow.
5. Accessibility and constraints: Respect prefers-reduced-motion, use zero external libraries, fonts, network calls, localStorage, or form tags, and wrap all JavaScript in an IIFE.
Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.Example output
Tips and common edits
Why this works
- Specifying RK4 integration prevents energy drift and keeps the pendulum motion smooth and physically believable.
- Requiring pointer-based bob dragging makes the chaos intuitive to explore without complex angle input fields.
- Isolating all logic in an IIFE with zero external dependencies guarantees the file runs offline on the first try.
Paste this prompt into Gemini, ChatGPT, or Claude. Save the generated code as pendulum-chaos.html and open it in any modern browser, or preview it directly in Canvas or Artifacts.
Common edits
- Add Web Audio API chime triggers whenever the lower bob crosses the vertical axis.
- Include sliders for rod lengths and bob masses to explore asymmetric pendulum ratios.
Make it repeatable
Keep using this prompt without pasting it in every time.
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
Build an Interactive Flocking Boids Physics Playground in HTML
A ready-to-use prompt that generates a self-contained HTML5 canvas boids simulation with real-time flocking sliders, cursor attract/scatter modes, and live telemetry.
Build a Click-to-Launch Fireworks Celebration Animation in One HTML File
A prompt that produces a single HTML page where clicks, taps or keys launch fireworks with gravity, fading trails, soft synthesized pops and a mute toggle.
Build an Animated Dawn-to-Night Landscape Scene in a Single HTML File
You get one HTML file that draws a canvas valley village whose sky, sun, moon, stars, clouds and window lights all follow a single time-of-day scrubber with autoplay.
Build an Interactive Particle Network Background in HTML
You get one HTML file with a full-screen canvas particle network that links nearby dots, follows mouse or touch, and has density, color and low-power controls.
Build a Confetti and Fireworks Celebration Effect in a Single HTML File
A ready-to-paste prompt that builds a reusable canvas confetti and fireworks layer with color theme presets, burst size control, Web Audio pops and automatic particle cleanup.
Build a Parallax Starfield Night Sky Hero Section on Canvas in One HTML File
A prompt that produces a single HTML hero section with a three-layer canvas starfield, pointer and tilt parallax, shooting stars, a density slider and a calm mode.
- Build a Beat-Synced Kinetic Typography Quote Animation in One HTML File
- Build a Self-Drawing SVG Lighthouse Line Animation in One HTML File
- Build an Animated Heart Blood Flow Diagram in HTML
- Build an Animated Gradient Glitch Title Hero Header in One HTML File
- Build an Animated Nonprofit Impact Stats Counter Section in One HTML File
- Build an Animated SVG World Clock with Sweeping Hands and Five Time Zones