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.
The prompt
Act as a senior creative technologist and front-end engineer. Build Starling Drift, an interactive nocturnal murmuration physics playground in a single self-contained HTML file. The simulation renders 120 autonomous boids on a full-bleed HTML5 canvas using cohesion, alignment, and separation steering forces. Include these exact features: 1. A floating glassmorphic control panel with real-time range sliders for Cohesion, Alignment, Separation, and Max Speed, plus a reset-to-defaults button. 2. Cursor interaction modes toggled via segmented buttons for Attract, Scatter, and Off, responding to both mouse and touch drag. 3. A live telemetry bar displaying active boid count, average flock speed, and frames per second. 4. Keyboard shortcuts: Space to pause or resume, R to scatter-reset positions, and M to cycle cursor mode. 5. Responsive layout fitting 360px to 1280px viewports with zero horizontal overflow, a deep midnight-slate palette with luminous cyan-to-amber directional boid chevrons, and prefers-reduced-motion support that shortens motion trails. 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 the exact three steering forces and four sliders prevents vague physics and ensures immediate visual responsiveness.
- Requiring an IIFE, inline styles, and zero external dependencies guarantees the simulation runs offline in any sandboxed preview.
- Explicit keyboard shortcuts and prefers-reduced-motion rules bake in accessibility without extra prompting.
Paste the prompt into Gemini, ChatGPT, or Claude, then save the generated code as an .html file and open it in any browser—or preview it directly in Canvas or Artifacts.
Common edits
- Add a predator boid that the flock actively flees from when enabled.
- Include a color-theme toggle to switch between nocturnal cyan, bioluminescent green, and sunset amber.
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 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.
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 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 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
- Animated Solar System in HTML With True Orbital Periods
- Build an Animated SVG World Clock with Sweeping Hands and Five Time Zones