You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pixel Art Studio is a browser-based pixel art editor built with React and Canvas API. It features a complete toolset including pen, eraser, flood fill, color history, animation frames, and GIF export. Built as a learning journey from vanilla JS to React.
git clone https://github.com/chaima-sahli/pixel-art-studio.git
cd pixel-art-studio
2. Install dependencies
npm install
3. Start development server
npm run dev
๐ฎ Usage
Select a tool - Pen (P), Eraser (E), Fill (F), or Eyedropper (I)
Choose a color - Click preset colors, recent colors, or use the custom picker
Draw - Click and drag on the canvas
Add frames - Draw different frames and click โ to save
Export - Download as PNG or GIF animation
Auto-save - Your work is automatically saved to localStorage
๐ฉ๐ฝโ๐ณ The Process
Built the vanilla JS version first to understand Canvas API basics. Then ported to React.
Step
What I Did
Why
1. Grid & Rendering
2D array with fillRect per cell
Learned manual pixel manipulation
2. Mouse Events
mousedown, mousemove, mouseup with coordinate mapping
Understood event handling and coordinate systems
3. Flood Fill
Iterative stack approach (recursion crashed on larger grids)
Learned about algorithm optimization
4. React Migration
Global vars โ useState, render() โ useEffect, UI โ components
Understood React's mental model
5. Polish
Custom colors, grid sizing, PNG export
Added user-friendly features
Why both versions? Building in vanilla JS first gave me a deep understanding of the Canvas API and DOM manipulation. Porting to React showed me how frameworks abstract away the complexity while adding structure and maintainability.