Build an automated spirograph that draws hypnotic geometric patterns with adjustable…
- User
Build an automated spirograph that draws hypnotic geometric patterns with adjustable gear ratios, pen position, color gradients, and drawing speed. Auto-starts.
Assistant
I'll build an automated, hypnotic spirograph app. Let me first explore the project structure.
Let me check the existing setup files.
This is a clean React 19 + Vite + Tailwind v4 setup. Now I'll build the spirograph app. Let me start with the math/utility library that handles the hypotrochoid/epitrochoid equations, color interpolation, and pattern generation.
Now let me add the global styles and custom slider styling.
Now the reusable UI primitives (sliders, toggles, segmented control, buttons).
Now the core canvas component with the dual-canvas animation loop (persistent trail + live overlay for the pen tip and gears).
Now the control panel with all the adjustable parameters.
Now the main App that ties it all together with state management and layout.
Now let me update the page title and then build to verify everything compiles.
The build succeeds. Now let me refine a couple of things: fix the mobile layout so the canvas isn't pushed off-screen (cap the panel height on mobile), and clean up the glow slider label.
Let me rebuild to confirm everything still compiles cleanly after the refinements.
The build is clean. Let me do a final review of the core animation logic to make sure there are no subtle runtime issues.
The implementation is complete and the build passes cleanly. Here's what I built:
Hypno·Spiro — Automated Spirograph Studio
An auto-starting spirograph that draws mesmerizing geometric art using the hypotrochoid / epitrochoid parametric equations, with a dual-canvas rendering system (a persistent trail layer + a live overlay for the glowing pen tip and gears).
Core features (all the requested controls)
- ⚙️ Gear ratios — Outer ring (R) and moving gear (r) sliders in "teeth" units, with a toggle between Inside (hypotrochoid) and Outside (epitrochoid) rolling modes. Live readout of lobes & revolutions.
- 🖊️ Pen position — adjustable offset
dfrom the gear center, controlling whether you get sharp cusps or soft looping curves. - 🎨 Color gradients — 10 curated palettes plus the gradient is interpolated along the path as it draws, so every stroke shifts through the colors. An "Auto color" mode swaps palettes between patterns.
- ⚡ Drawing speed — normalized so any pattern completes in a similar hypnotic ~7s regardless of complexity (simple or dense).
Automation & polish
- Auto-starts the moment the page loads.
- Auto-evolve — when a pattern finishes it holds the clean result briefly, then generates a fresh aesthetically-tuned random pattern in an endless gallery.
- Neon glow toggle with adjustable intensity, Show gears (animates the rolling gear + ring + pen arm), line-width control.
- A glowing pen dot follows the exact tip of the curve as it draws.
- Save PNG, Randomize, Clear, Pause/Resume, and a live progress bar.
Technical notes
- Math lives in
src/lib/spiro.ts(curve equations, closed-curve period via GCD, palette interpolation, smart randomizer). - The animation uses
requestAnimationFramereading from refs (no per-frame React re-renders) and a debounced structural reset so dragging sliders keeps the in-progress drawing clean until you release. - HiDPI-aware canvases, a ResizeObserver for responsiveness, and a glassmorphism dark UI that stacks cleanly on mobile.
It's ready to go — it'll start spinning its first 12-lobed rosette the instant it loads.
Files built:
src/lib/spiro.ts,src/index.css,src/components/controls.tsx,src/components/SpirographCanvas.tsx,src/components/ControlPanel.tsx,src/App.tsx,index.html
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.