A collection of standalone canvas-based generative animations with a SvelteKit gallery frontend.
- Gallery: SvelteKit 2 + Svelte 5, TypeScript, Vite
- Shaders: Standalone HTML files in
static/, no build step. Each is self-contained with inline JS. - Rendering: Mix of Canvas 2D and WebGL. No external dependencies.
src/routes/+page.svelte — Homepage with featured grid
src/routes/gallery/ — Gallery pages with filtering
src/routes/shader/[id]/ — Individual shader detail pages
static/*.html — Standalone shader pages
src/lib/shaders.ts — Shader catalog metadata (ALL shader entries)
src/lib/color-schemes.ts — 6 color scheme definitions
scripts/generate-previews.mjs — Preview sprite sheet generator
static/previews/*.webp — Generated preview sprites for gallery cards
npm run dev— Dev servernpm run build— Production buildnode scripts/generate-previews.mjs— Generate all preview spritesnode scripts/generate-previews.mjs --only=shader-id— Generate preview for one shadernode scripts/generate-videos.mjs --shader=shader-id— Generate highlight video for one shadernode scripts/generate-videos.mjs --shader=shader-id --format=reel— Generate 9:16 vertical reelnode scripts/generate-videos.mjs --all— Generate videos for all shaders- Formats:
landscape(1920x1080, default),reel(1080x1920),square(1080x1080) - Additional flags:
--fps=60,--output=dir(default:videos/),--no-captions - Requires
puppeteerandffmpeg
- Formats:
- Each shader is a single HTML file:
<style>+<canvas id="canvas">+<script>IIFE - Label format: shader name in a fixed
.labeldiv - Dark background (#0a0a0a), warm amber accent palette (rgba(200, 149, 108, ...))
- Respect
prefers-reduced-motionwhere applicable - Use
visibilitychangeto pause when offscreen - Target 60fps on normal laptops — if a technique can't hit 60fps, use a different technique
- Shaders must be highly reusable — designed to drop into any website as a background, hero section, or design asset
Every new shader requires ALL of the following:
Create static/shader-name.html following the existing format:
- Single HTML file:
<style>+<canvas id="canvas">+<script>IIFE - Dark background (#0a0a0a)
- Fixed
.labeldiv with shader name requestAnimationFrameloop withvisibilitychangepause- Handle canvas resize with DPR (capped at 2)
All shaders must respond to user input:
mousemove/touchmovefor cursor trackingmouseleave/touchendto reset- The interaction should meaningfully affect the visual (not just cosmetic)
Define 2+ parameters controllable via postMessage:
window.addEventListener('message', function(e) {
if (e.data && e.data.type === 'param') {
switch (e.data.name) {
case 'PARAM_NAME': paramValue = e.data.value; break;
}
}
});The gallery uses 6 color schemes applied via CSS filter on the iframe:
- Amber (default):
filter: none— shader renders in its native colors - Mono:
grayscale(1) - Blue:
hue-rotate(175deg) - Rose:
hue-rotate(300deg) saturate(1.1) - Emerald:
hue-rotate(90deg) saturate(1.2) - Arctic:
hue-rotate(180deg) saturate(0.5) brightness(1.1)
Since schemes work via hue-rotate, design native colors in warm/amber tones so other schemes produce good results. If a shader looks best in a non-amber scheme, set defaultScheme in its catalog entry.
If the shader is inspired by someone NOT already in the project, add entries to:
src/lib/inspiration-intros.ts— keyed by slug (e.g.'daft-punk'), a 3-4 sentence poetic description of the celebrity's artistic identity and associated color palettesrc/lib/inspiration-palettes.ts— keyed by slug, withprimary(hex for card border tint) andcolors(2-4 hex colors for ambient glow on the inspiration gallery page)
Add an entry to the shaders array in src/lib/shaders.ts:
{
id: 'shader-name', // URL-safe kebab-case
file: 'shader-name.html', // filename in static/
title: 'Shader Name', // display name
desc: 'Description.', // one-line description
inspiration: 'Celebrity', // optional celebrity inspiration
tags: ['fill', 'noise'], // from: fill, object, particles, physics, noise, organic, geometric
technique: 'webgl', // 'webgl' or 'canvas-2d'
defaultScheme: 'blue', // optional: override default color scheme
params: [
{ name: 'PARAM_NAME', label: 'Param Label', min: 0, max: 2, step: 0.1, default: 1.0 }
]
}Run the preview generator to create gallery card thumbnails:
node scripts/generate-previews.mjs --only=shader-nameThis creates static/previews/shader-name.webp — a vertical sprite sheet with 6 frames (one per color scheme). Requires the dev server to NOT be running on the same port.
- Open
http://localhost:5173/shader/shader-nameand check it renders correctly - Test all parameters via the detail page sliders
- Test mouse/touch interaction
- Verify 60fps performance
- Check that color scheme switching works (amber, blue, etc.)
- Verify the preview sprite shows correctly in the gallery grid