Glitch Garden

Create a tiny generative art sandbox where users “grow” a garden of animated geometric plants by tweaking sliders (seed, symmetry, color rules, wind, and glitch intensity) and clicking to plant new shapes on a canvas. Each plant is a reusable component with its own parameters, can be rearranged via drag-and-drop, and the whole garden can be saved/loaded from localStorage as named scenes. Include an export panel to download the current garden as PNG/SVG and a randomize button that generates a cohesive new theme while keeping the scope limited to a single-page React app.

To Do30
Scaffold app stack

Run: npm create vite@latest . -- --template react-ts && npm i && npm i -D tailwindcss postcss autoprefixer && npx tailwindcss init -p && npm i @tailwindcss/vite && npm i lucide-react class-variance-authority clsx tailwind-merge && npx shadcn@latest init

by system

Add Tailwind globals

Configure Tailwind content paths and add Tailwind directives to src/index.css.

by system

Set up shadcn utils

Add src/lib/utils.ts with cn() helper and ensure shadcn/ui path aliases work.

by system

Create app layout

Implement src/App.tsx as a single-page layout with header, left controls, and main canvas area.

by system

Add UI primitives

Generate shadcn/ui components needed (Button, Slider, Input, Label, Select, Separator, Dialog, Tabs).

by system

Define garden types

Create src/types/garden.ts defining Plant, PlantParams, Theme, and Scene types.

by system

Seeded RNG helper

Add src/lib/rng.ts implementing a deterministic seeded RNG used by theme and plant generation.

by system

Color rule helpers

Add src/lib/colorRules.ts to produce cohesive palettes and per-plant color assignments from a Theme.

by system

Theme randomizer

Add src/lib/theme.ts to generate a cohesive Theme from a seed and randomize within bounded ranges.

by system

Garden state store

Create src/state/useGardenStore.ts using React context + reducer to manage plants, theme, and selection.

by system

Controls panel UI

Create src/components/ControlsPanel.tsx with slider controls for seed, symmetry, wind, glitch, and color rule.

by system

Wire controls to state

Connect ControlsPanel to useGardenStore to update global parameters and regenerate theme when seed changes.

by system

Randomize theme button

Add src/components/RandomizeButton.tsx to randomize theme while preserving current plant positions.

by system

Canvas stage component

Create src/components/GardenCanvas.tsx rendering an SVG stage with background and a plants layer.

by system

Click-to-plant handler

Implement click handling in GardenCanvas to add a new plant at pointer coordinates using current parameters.

by system

Plant generator logic

Add src/lib/plantFactory.ts to create Plant instances with stable IDs and per-plant params derived from theme.

by system

Base plant renderer

Create src/components/plants/PlantRenderer.tsx that dispatches to specific plant geometry components by type.

by system

Sprout plant component

Implement src/components/plants/SproutPlant.tsx as an animated geometric sprout honoring symmetry and palette.

by system

Bloom plant component

Implement src/components/plants/BloomPlant.tsx as a radial bloom with oscillation driven by wind.

by system

Shard plant component

Implement src/components/plants/ShardPlant.tsx as angular shards with glitch jitter controlled by intensity.

by system

Wind animation hook

Add src/hooks/useWind.ts producing a time-based wind value for subtle sway animations.

by system

Glitch jitter hook

Add src/hooks/useGlitch.ts to generate deterministic jitter offsets per plant based on seed and intensity.

by system

Selectable plant wrapper

Create src/components/PlantItem.tsx that wraps a plant with selection ring and pointer interactions.

by system

Drag and drop plants

Implement simple pointer-based dragging in PlantItem to update plant position in store without external libs.

by system

Z-order bring-to-front

Add store action to raise selected plant to top and wire it to a small toolbar button.

by system

Scene serialization

Add src/lib/sceneStorage.ts to save/load named scenes to localStorage with versioning and validation.

by system

Scenes panel UI

Create src/components/ScenesPanel.tsx to list scenes, load, save-as, rename, and delete.

by system

Export panel UI

Create src/components/ExportPanel.tsx with buttons for Export PNG and Export SVG plus size/background options.

by system

Export implementation

Add src/lib/exporters.ts to serialize the SVG and to rasterize to PNG via canvas without external services.

by system

Polish and shortcuts

Add src/components/Hotkeys.tsx for shortcuts (R randomize, S save, Del delete) and tighten styling.

by system

In Progress0
In Review0
Done0