cd ../portfolio
Phase 1 // The Bridge Pivot Point

SpritesheetGen

A web-based spritesheet generator -- and the first JavaScript project ever. Built to solve a real problem: creating game art for Godot. The bridge from game engine to browser. The moment everything changed.

Created May 22, 2025 Size 199 KB Stars 1 First JavaScript Project

Project Overview

SpritesheetGen was born from necessity. Making games in Godot meant needing spritesheets, and existing tools were either expensive or clunky. So: build one in the browser. This was the first JavaScript project -- the Canvas API felt like magic after GDScript. Drawing pixels directly, manipulating image data, exporting to formats Godot could read. The web became a creative tool, not just a deployment target.

199 KB
Entire Project Size
83%
JavaScript
1st
JS Project Ever

Technology

Pure vanilla JavaScript. No frameworks, no build tools. Canvas 2D API for rendering, DOM for the editor UI, Blob API for exports.

JavaScript 83%
CSS 11%
HTML 6%
Canvas 2D API ImageData Blob API FileReader DOM Events requestAnimationFrame JSON Export

Application Architecture

A single-page app before knowing what SPAs were. The canvas handles rendering while a layer system manages drawing state.

SpritesheetGen/ index.html # Single page application js/ canvas-engine.js # Drawing surface + pixel grid tools.js # Brush, eraser, fill, line, rect layers.js # Layer stack with opacity color-picker.js # HSL color picker widget templates.js # Walk/Run/Idle overlays animation.js # Frame preview + playback export.js # PNG + Godot .tres metadata css/ editor.css # Dark editor theme templates/ walk-template.png # 8-frame walk cycle guide run-template.png idle-template.png

Key Features

🖌
Drawing Tools
Brush, eraser, flood fill, line, and rectangle. Each tool snaps to the pixel grid for clean sprite art.
📊
Template Overlays
Semi-transparent Walk, Run, and Idle animation guides that show proper frame placement.
📋
Layer System
Multiple layers with opacity control. Draw the body on one layer, details on another.
🎨
Color Picker
HSL color picker with palette saving. Quick-swap between primary and secondary colors.
Animation Preview
Real-time preview of the spritesheet playing at configurable frame rates. See your art move.
📦
Godot Export
Exports PNG spritesheet plus .tres metadata file that Godot imports directly as AnimatedSprite2D.

Code Snapshot

The flood fill algorithm -- the first time pixel manipulation clicked. Reading and writing individual pixels from Canvas ImageData.

tools.js -- flood fill
function floodFill(ctx, x, y, fillColor) {
    const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
    const data = imageData.data;
    const targetColor = getPixelColor(data, x, y);

    // Don't fill if clicking on same color
    if (colorsMatch(targetColor, fillColor)) return;

    const stack = [[x, y]];

    while (stack.length > 0) {
        const [cx, cy] = stack.pop();
        const idx = (cy * canvas.width + cx) * 4;

        if (cx < 0 || cx >= canvas.width) continue;
        if (cy < 0 || cy >= canvas.height) continue;
        if (!colorsMatch(getPixelAt(data, idx), targetColor)) continue;

        // Set pixel
        data[idx] = fillColor.r;
        data[idx + 1] = fillColor.g;
        data[idx + 2] = fillColor.b;
        data[idx + 3] = 255;

        // Push neighbors
        stack.push([cx + 1, cy], [cx - 1, cy],
                   [cx, cy + 1], [cx, cy - 1]);
    }

    ctx.putImageData(imageData, 0, 0);
}

Development Timeline

May 22, 2025
Project Created -- First Line of JavaScript
2 days after DreamBlaster. Needed spritesheets, decided to build the tool.
Day 2
Canvas Drawing Engine
Pixel grid rendering, mouse input, brush tool. First pixels drawn in the browser.
Day 4
Full Tool Suite
Fill, line, rectangle, eraser. Template overlays for animation guides.
Day 6
Godot Export + Animation Preview
The tool actually works. Exports to Godot. Realizes: the web can be the platform, not just the tool.

What This Project Taught

01

Canvas API is a Game Engine for the Browser

Coming from Godot, the Canvas 2D API felt familiar. getContext('2d') was basically a drawing surface. ImageData gave pixel-level control. The browser was not just for websites -- it was a creative runtime.

02

Tools Build Skills Faster Than Tutorials

Learning JavaScript by building a tool you actually need beats any course. Every feature required research: "how to do flood fill in JS", "how to export canvas to PNG." The project was the curriculum.

03

The Bridge Matters Most

SpritesheetGen bridged Godot and the web. It was a tool for making game assets, but building it taught web development. The bridge project -- the one connecting what you know to what you want to learn -- is the most valuable project you can build.

04

199 KB is All You Need

No React. No Webpack. No node_modules. The entire application is 199 KB. It loads instantly and works everywhere. This lesson would echo through every project that came after.