# Tiny Sprites - Design A CSS-based sprite library for Hono JSX with a dev tool for tuning animations. ## Sprite Component ### API ```tsx import { Sprite } from 'tiny-sprites' // Grid layout ``` ### Props | Prop | Type | Required | Description | |------|------|----------|-------------| | src | string | yes | URL to spritesheet | | width | number | yes | Frame width in pixels | | height | number | yes | Frame height in pixels | | frames | number | yes | Total frame count | | frameDuration | number | yes | Milliseconds per frame | | columns | number | no | Columns in grid (omit for horizontal strip) | | class | string | no | Pass-through CSS class | | style | string | no | Pass-through inline styles | | playing | boolean | no | Animation state, default true | ### Rendering The component outputs a `
` with inline styles plus a ` ``` Keyframe names are hashed from props to avoid collisions. When `playing={false}`, sets `animation-play-state: paused`. ## Dev Tool A Bun server for tuning sprite animations. ### Features - Drag & drop spritesheet files - Form inputs: width, height, frames, columns, frameDuration - Live preview - Copy generated `` code - Download spritesheet ### Routes ``` GET / → UI POST /upload → Accept spritesheet, return temp URL GET /sprites/:filename → Serve uploaded spritesheets ``` No database. Files served from temp directory. ## Project Structure ``` tiny-sprites/ ├── src/ │ ├── sprite.tsx # component │ ├── hash.ts # Hash function for keyframe names │ └── dev/ │ ├── cli.ts # CLI entry point │ ├── server.tsx # Dev server (Bun.serve + Hono) │ ├── index.tsx # Dev tool UI page │ └── preview.tsx # Live preview component ├── assets/ # Existing sprites ├── docs/plans/ ├── package.json └── tsconfig.json ``` ## Package.json ```json { "name": "tiny-sprites", "type": "module", "exports": { ".": "./src/sprite.tsx" }, "bin": { "tiny-sprites": "src/dev/cli.ts" }, "scripts": { "dev": "bun --hot src/dev/server.tsx", "test": "bun test" }, "dependencies": { "hono": "^4" }, "devDependencies": { "bun-types": "latest" } } ``` ## Dependencies - Bun (runtime) - Hono (routing + JSX) No other dependencies.