Pixel wizard
Pixel art at 120 × 120: a spell with palette lighting
- 0–3 s night on the cliff, the wizard breathes, shifts his weight and blinks, grass and beard sway, fireflies blink
- 3–7.4 s he raises the staff, the rune circle builds glyph by glyph, sparks spiral into the crystal, the robe billows in the updraft
- 7.4–8.6 s he ducks, thrusts, the bolt forks and arcs into the sky, recoil, the orb swells
- 8.6–11 s impact with hit-stop and screen shake, the sigil builds in five ticks, everything lit teal, his shadow falls across the pillar
- 11–16 s the sigil breaks up into sparks, embers die on the rock, the rune circle goes out glyph by glyph, he plants the staff again
- Pixel art
- 16 s Loop
- 1080² · 30 fps
- Canvas 2D
- 1.2 MB
Prompt
Build a 16-second looping pixel-art scene, 1080×1080: an old wizard on a cliff at night charges and casts a spell that lights up the whole scene, then settles back to idle. Animate it like a pixel artist would, frame by frame: anticipation, follow-through, overlap.
DESIGN
- Real pixel art: draw everything into a 120×120 buffer of palette indices (whole logic pixels only, no anti-aliasing, no alpha, no soft gradients), then scale it up ×9 onto the 1080 canvas with imageSmoothingEnabled = false and image-rendering: pixelated. Lines with Bresenham, ellipses and circles as pixel-perfect loops (no L-shaped double pixels).
- Palette, 24 colours: void #0a0a17 · night #121634 #1b2150 #283070 #3d4a92 · pale blue #6c7cc0 · white #f2f4ff · stone #1a1424 #2e2638 #4a3e52 #6f6276 · wood #2a1c18 #5c3a26 · teal #0e5a66 #1fa3a6 · mint #7ef0d6 · robe #2a1846 #4b2a78 #7d4fae · skin #d79a78 #94563f · beard #c9c6dc · gold #e8b64a · bronze #9a6a2a. Dark teal doubles as moss and grass at night.
- Scene with depth: sky in four night bands with 4-row Bayer-dithered seams; a moon (top right) with a crescent shadow, craters and a four-step dither halo; 48 stars twinkling in white, mint, gold and lilac at whole-number rates per loop; two cloud layers drifting left at different speeds (shaped from ellipses, light top edge, grey-white where they cross the moon); two birds with a 4-frame wing beat; a far ridge with snow-dusted peaks; a mid layer of hills and pines; a valley falling into black with mist in two speeds. Foreground: a rocky ledge (11-row top plane, dark stratified cliff face, moss over the lip, cracks, rocks, 20 grass tufts) and a broken pillar with mortar courses, cracks, moss and three carved runes. Five gold fireflies wander and blink near the ledge. The camera sways on a 16 s sine; the layers shift by 0.6 / 1.4 / 3 px, rounded.
- The wizard faces left, about 36 px tall: a pointed hat bent back with a gold band and wide brim, a face in shadow under the brim, a long white beard, a purple robe (dark front edge, lilac moon rim at the back, fold lines, belt, gold hem), boots. The head is a hand-drawn sprite; the robe is rasterised row by row; the front arm is a bell sleeve with a gold cuff, the fist holds a staff with an upright crystal; the back arm sits behind the body. An automatic 1-px dark outline around the figure, plus inner outlines where arm and staff cross the body.
- Light without gradients: every colour has a ramp of four palette colours (base → lighter own hue → teal → mint/white). Each source (crystal, rune, bolt, orb, burst) gives a level 0–3 from its distance: hard bands on sky, clouds and mountains, a narrow 4×4 Bayer edge on ledge, pillar and wizard. Pixels whose neighbour towards the light lies further back get +1 (rim light) — so the rim on the wizard, the cloud edges and the ridge lines follow the source from the crystal to the orb in the sky. The wizard's body stays purple, only his edge towards the light glows. Crystal, bolt, orb and burst cast shadows by marching rays from ledge and pillar to the light. The moon is never lit or painted over by the spell.
STORYBOARD
0–3 Idle: he breathes (1 px, 2 s cycle), shifts his weight onto the back foot and back (the planted staff tilts with his hand), blinks, hem and beard tip sway out of phase, a glint runs over the crystal, grass sways, fireflies blink.
3–7.4 Wind-up and charge: a dip, then he pulls the staff up, overshoots and settles. A rune circle builds in order: the outer ring is drawn by a white pen head, eight different glyphs pop in one every 2 ticks (white on the first tick), then the inner ring. The rune light grows with every glyph, the crystal light in eight steps. 42 motes spiral into the crystal, a dashed halo tightens around it, light columns rise off the ring, pebbles lift off and hover, grass bends away, the hem billows in two stages and flutters, the carved runes on the pillar light up one after the other, the spell shows as a mint pixel in his eye, his hand trembles.
7.4–8.6 Cast: he ducks 2 px, leans back and pulls the staff behind him; then lunges (2 ticks, overshoot), the back arm flies out as a counterweight. A cross flare and four jagged lightning forks for two ticks; a bolt arcs up and left with a stepped trail and shed sparks; recoil, the back foot steps back, he catches himself. At the target an orb swells in steps while two dotted rings contract into it; the pebbles drop.
8.6–11 Climax: impact with a 3-frame hit-stop — a white eight-ray star, ledge and pillar one light level up — then five ticks of 1-px screen shake. The sigil builds in five ticks (ring 4 → ring 8 → ring 12 + inner ring → half the star → full eight-point star with notches); two shock rings expand and break into gaps. The scene goes teal: ledge, ridge lines, cloud edges, the wizard's front edge, the pillar's top; his shadow lies across the pillar and the ledge behind him; the pillar runes flash white. The blast pushes him back, hat tip, beard and sleeve trail behind. 52 sparks fly out with 2–3 px tails that cool down the ramp (white → mint → teal → dark teal). The teal falls back one step every quarter second.
11–16 Decay: the sigil breaks up in the order it was built and sheds sparks; embers drift down, half of them in front of the ledge, where they land, flare for a tick and cool out; the rune circle goes out glyph by glyph (each flares and leaves a rising spark), then the rings retract. He lowers the staff in two stages, plants it with a dip and a puff of dust, the fireflies come back, he breathes again — exactly as at frame 0.
MOTION
Sprite poses on 12 fps ticks: 15 poses, eased keyframes, positions rounded to whole pixels. Overlap as a pure function of time: hat tip, beard tip and hem take the body's position 2–3 ticks earlier plus 0.6 × its change, clamped to ±2 px. Effects on 30 fps. A seeded PRNG for every random value; every periodic element completes a whole number of cycles in 16 s. Banned: sub-pixel positions, smoothing, alpha blending, soft glows, colours outside the palette.
TECHNIQUE
- One self-contained HTML page plus one JS file (no inline script, no libraries, no network requests). Stage exactly 1080×1080 CSS px, or the size named above (1080×1920 for portrait).
- Expose window.MOTION = { duration, fps: 30, width, height, seek(t) } with the stage size in width and height. seek(t) redraws the frame for time t from scratch: no state between frames, no Math.random (seeded PRNG only), no Date, no CSS transitions, no timers.
- Loop: seek(0) and seek(duration) must look identical.
- With ?render=1 the stage sits unscaled at the top left (for frame capture). Without it, scale the stage to fit the window and loop with requestAnimationFrame.
- prefers-reduced-motion: show one representative still, no loop.
CHECK
Render stills at the listed times, look at every one, fix anything that overlaps, is cut off, aliased or unreadable, then render again. Report only when frame 0 equals the last frame.
Stills: every 0.5 s, plus every sprite tick from 0.5 s before to 0.5 s after each transition (3.0, 7.4–7.6, 8.6, 11, 11.9, the loop point) as 4× crops of the figure and the effects. How to recreate it
-
Give the prompt to a coding agent
Create an empty folder and paste the prompt into Claude Code, Codex or Cursor. The agent writes one HTML page and one script — the animation then runs right in the browser.
-
Let it check the stills
The prompt makes the agent render stills and look at them itself. Only refine what you don't like in the picture: “scene 3 is too busy” works better than a new prompt.
-
Render to MP4
Because every animation can draw any frame exactly through
window.MOTION.seek(t), a small script renders it frame by frame — no stutter, no screen recording. Then ffmpeg joins the frames into a clip.
# 1 · Render every frame (Chrome, Node ≥ 22) node render.mjs http://localhost:3000/ \ frames/ frames 30 # 2 · Join the frames into an MP4 ffmpeg -framerate 30 -i frames/%05d.png \ -c:v libx264 -preset slow -crf 22 \ -pix_fmt yuv420p -movflags +faststart \ my-motion.mp4
Background
An old wizard on a cliff at night raises his staff, a rune circle builds glyph by glyph, sparks charge the crystal, then his spell bursts into a sigil in the sky and floods the scene with teal. Real pixel art: 120 × 120 logic pixels, 24 colours, light without gradients, animated tick by tick. 16 seconds, built as code, with a prompt to recreate it.
What I learned building it
In pixel art, light isn't a gradient but a colour swap: every colour has a ramp of four palette colours, and the light only picks the step. But the figure only came alive through delay – hat tip, beard and hem follow the body two or three ticks later and swing past.
Inspiration
The starting point was a prompt by @majidmanzarpour ((opens in a new tab)) on Skillry. You'll find the original wording there; the prompt above is my own version.
More motions
-
An agent platform, introduced UI motion 0:15 -
Agents that pick the model UI motion 0:14 -
A sentence becomes an app UI motion 0:15 -
An operating system, introduced UI motion 0:47.2 -
Your new design partner Voice-over 0:54.3 -
Ten kilometres, floating UGC ad 0:12.6 -
The journey of an order Explainer 0:34 -
Make it move Kinetic typography 0:08 -
From noise to a workflow Particles 0:14 -
The Gimli Glider Voice-over 0:19 -
Oscilloscope intro Oscilloscope 0:20 -
A keystroke in cross-section Explainer 0:20 -
A ring called Orbit UI motion 0:10 -
The bug that wants to stay Short film 0:20 -
Shin, not foot Voice-over 0:17 -
Jellyfish in a light shaft Organic loop 0:18 -
A logo that comes alive Logo reveal 0:08 -
How circles draw any shape Explainer 0:20 -
The shortest war Voice-over 0:16 -
Loose mosaic wall Mosaic 0:20 -
Near fall Physics simulation 0:09 -
A Negroni, explained Explainer 0:20 -
Where the fuel money goes Voice-over 0:19.5 -
One print, nothing else Title sequence 0:20 -
Infinite zoom into the detail Infinite zoom 0:15 -
Cube stack Short film 0:07 -
A request at 22:47 Chat story 0:17 -
Claude Code in three steps Voice-over 0:17.5 -
The inbox factory Isometric loop 0:12 -
From 0 to 100 % soft Physics simulation 0:10 -
One line, three inks Showreel 0:20 -
The request breaks out Physics simulation 0:15 -
The slicing machine Isometric loop 0:09 -
How backlinks work Explainer 0:20 -
A ball that grows with every bounce Physics simulation 0:10 -
One shape, fourteen states UI motion 0:14 -
What makes a home Paper cut-out 0:20 -
Words that carry Kinetic typography 0:20 -
Shard logo reveal Logo reveal 0:11