Build a simple drawing canvas with brush sizes, colors, eraser, undo, clear, and fill…
- User
Build a simple drawing canvas with brush sizes, colors, eraser, undo, clear, and fill tool. Starts with a sample doodle.
Assistant
I'll build a drawing canvas app. Let me first explore the project structure.
I'll update the title and build the drawing canvas app.
Now the main app. I'll build a full-featured drawing canvas with brush sizes, colors, eraser, undo, clear, and a flood-fill tool that starts with a sample doodle.
Now let me build to confirm everything works.
The build succeeded. I've created Doodle Studio, a fully functional drawing canvas app.
Features
- 🖌 Brush tool — smooth freehand drawing with pointer capture (works with mouse, trackpad, and touch)
- 🧽 Eraser — paints white to erase
- 🪣 Fill tool — flood-fill algorithm with color tolerance; click any area to fill it
- Colors — 12 preset swatches plus a custom color picker
- Brush sizes — 5 sizes (2–30px) with live visual previews
- ↩︎ Undo — history stack (up to 40 steps) that captures state before every stroke, fill, and clear
- 🗑 Clear — wipes the canvas to white (also undoable)
- ⬇ Save — downloads your artwork as a PNG bonus
- Starter doodle — the canvas opens with a hand-coded scene (house, tree, sun, clouds, hills) so there's something to play with right away — try the fill tool on the sky or grass!
The UI is styled with Tailwind in a clean, colorful layout that's responsive and scales the canvas to fit the screen while keeping precise coordinate mapping for drawing and filling.
Files built:
index.html,src/App.tsx