244 pixel art effects, every one a small piece of code. Plus a Claude Code skill to make your own.
Get the docs and license ready to publish
rehan-remade652e0bbac0a6
diff --git a/LICENSE b/LICENSEindex c9a7b32..687fccb 100644--- a/LICENSE+++ b/LICENSE@@ -1,6 +1,9 @@MIT LicenseCopyright (c) 2026 Patch+Copyright (c) 2026 Hugo Duprez, for the parts adapted from Sprite Fusion's open-source+pixel art VFX (https://www.spritefusion.com/pixel-art-vfx): src/core/sim.js and the+effects that say so at the top of their filePermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealdiff --git a/README.md b/README.mdindex 5c8c89b..7d28b3e 100644--- a/README.md+++ b/README.md@@ -15,7 +15,8 @@ picky pixel artist would: draft, render, look, refine.The method is [Hugo Duprez](https://x.com/HugoDuprez)'s, from [How to make (good) pixel art effects withClaude](https://www.spritefusion.com/blog/how-to-make-good-pixel-art-effects-with-claude): code is clay, trust youreyes, feed your references. His [open-source effects](https://www.spritefusion.com/pixel-art-vfx) at Sprite Fusion-set the bar. This repo is our take on the idea at library scale, with a skill to keep going.+set the bar, and `src/core/sim.js` and the effects that say so at the top adapt his code. This repo is our take on+the idea at library scale, with a skill to keep going.## what's in it.@@ -118,21 +119,21 @@ bar. `node tools/serve.mjs` runs the gallery locally with your effects in it.## how it works.-- **An effect is a function of time.** `draw(p, t, o)` draws the frame at `t` seconds. No simulation state, no- images, so any frame can be drawn in any order: scrubbed, looped, or rendered to a sheet.-- **Two buffers.** `color` takes hard, opaque pixels; transparency is faked with a 4×4 ordered dither, so it stays- pixel art. `light` takes additive glow, added on top. Hot things look hot because of the light buffer.-- **Seeded everything.** Particles get their own repeatable random numbers (`burst`, `cycle`, `rng(seed, i)`), and- their motion is closed-form (`fly`: gravity and drag without stepping), so frame 40 is the same every time.- Loops tile in time with no seam.+- **Two kinds of effect, no images.** Pure effects export `draw(p, t, o)`, the frame at `t` seconds from `t` alone, so+ loops tile with no seam. Simulated effects export `create(o)` and step real particles, debris and lights at 120 Hz,+ so sparks bounce and smoke rolls the same at any frame rate.+- **Two buffers.** `color` takes pixels: opaque, dithered or truly translucent. `light` takes additive glow, added on+ top. Hot things look hot because of the light buffer.+- **Seeded everything.** Every random number comes from the effect's seed, so frame 40 is the same every time.- **Local space.** Effects draw around their own origin; the painter places, mirrors and rotates them. Directional- effects face right. A 12×19 stock character stands in for status effects, auras and hits.+ effects face right. A 24×38 stock character stands in for status effects, auras and hits.- **Same frame shape as Sprite Fusion's VFX** (`{ w, h, ox, oy, color, light }`), so both libraries can draw intoone frame.## license.-MIT, code and effects. Use them in anything, commercial included. The Patch Pixel font in `gallery/fonts` is-Patch's own and not covered; see its notice.+MIT, code and effects. Use them in anything, commercial included. Parts are adapted from Hugo Duprez's MIT effects,+as the [license](LICENSE) notes. The Patch Pixel font in `gallery/fonts` is Patch's own and not covered; see its+notice.Made by [Patch](https://patch.gg).diff --git a/docs/AUTHORING.md b/docs/AUTHORING.mdindex f9b97ce..4e56104 100644--- a/docs/AUTHORING.md+++ b/docs/AUTHORING.md@@ -143,12 +143,12 @@ The method is Hugo Duprez's ([How to make (good) pixel art effects withClaude](https://www.spritefusion.com/blog/how-to-make-good-pixel-art-effects-with-claude)): code is clay, trustyour eyes, feed your references.-1. **Reference first.** Find the closest of his effects (`~/patch/pixelfx-ref/sheets/`), look at it, read its- source (`~/patch/pixelfx-ref/src/<name>.ts`) for the choreography and numbers.+1. **Reference first.** Find the closest of [his effects](https://www.spritefusion.com/pixel-art-vfx), look at it, and+ read its source for the choreography and numbers. His code uses world units, 2 per pixel.2. **Say it in one line** with the art direction, then draft.3. **Render and look**: `node tools/render.mjs <id> --zoom 3` (contact sheet in `records/<id>/contact.png`;`--all` every frame, `--mp4` motion).-4. **Benchmark**: `node ~/patch/pixelfx-ref/tools/compare.mjs <out.png> <hisSpec> <id> --theirs ... --ours ...`- puts his and yours at the same height. If his has more detail, light or life, yours isn't done.+4. **Benchmark**: put his and yours next to each other at the same height on screen. If his has more detail, light+ or life, yours isn't done.5. **Fix the worst thing, render again.** Three rounds minimum; showpieces take more.6. **Check**: `node tools/check.mjs <id>` until it passes clean.diff --git a/skills/pixelfx/SKILL.md b/skills/pixelfx/SKILL.mdindex b53960f..1c012b4 100644--- a/skills/pixelfx/SKILL.md+++ b/skills/pixelfx/SKILL.md@@ -1,16 +1,15 @@---name: pixelfx-description: Make pixel art effects and sprite animations in code with the pixelfx library, which has about 300 ready-made ones (fire, explosions, water, ice, lightning, sci-fi, melee, impacts, projectiles, spawn and death, arcane, holy, shadow, status, nature, weather, UI, pickups, transitions, critters) to drop into a game, recolor, export as sprite sheets or remix, plus a draft, render, look, refine loop that makes new ones look hand-animated. Use when someone wants pixel art VFX, sprite animations or sprite sheets, game juice, a specific effect ("a frost nova for my mage", "a coin pickup sparkle"), wants to use or export a pixelfx effect in Godot, Unity, Phaser or a canvas game, or wants their pixel effects to look better.+description: Make pixel art effects and sprite animations in code with the pixelfx library, which has 232 ready-made ones (fire, explosions, water, ice, lightning, sci-fi, melee, impacts, projectiles, spawn and death, arcane, holy, shadow, status, nature, weather, UI, pickups, transitions, critters) to drop into a game, recolor, export as sprite sheets or remix, plus a draft, render, look, refine loop that makes new ones look hand-animated. Use when someone wants pixel art VFX, sprite animations or sprite sheets, game juice, a specific effect ("a frost nova for my mage", "a coin pickup sparkle"), wants to use or export a pixelfx effect in Godot, Unity, Phaser or a canvas game, or wants their pixel effects to look better.license: MITcompatibility: Node 18 or newer. ffmpeg is optional (GIF and MP4 previews).---# pixelfx-Pixel art effects as code. Each effect is one small file, `src/fx/<category>/<name>.js`, that draws a frame as a-function of time into two buffers: **color** (hard pixels, faded with ordered dither) and **light** (additive-glow). Because a frame is just `draw(p, t)`, an effect can be played live, scrubbed, recolored, mirrored, looped-and rendered to a sprite sheet for any engine.+Pixel art effects as code. Each effect is one file, `src/fx/<category>/<name>.js`, that draws into two buffers:+**color** (pixels: opaque, dithered or truly translucent) and **light** (additive glow). No images, so an effect+can be played live, recolored, mirrored, reseeded and rendered to a sprite sheet for any engine.The method is Hugo Duprez's ([How to make (good) pixel art effects withClaude](https://www.spritefusion.com/blog/how-to-make-good-pixel-art-effects-with-claude)): code is clay, trust@@ -76,21 +75,24 @@ For the full library: `node tools/render.mjs <category> --sheet` does a whole ca## 3. Make a new one-Read `docs/AUTHORING.md` first: it is the contract (meta, `draw(p, t, o)`, local coordinates, seamless loops,-ending empty), the painter API, the helpers and the quality bar. Then:+Read `docs/AUTHORING.md` first: it is the contract (meta, `draw(p, t, o)` for pure effects or `create(o)` for+simulated ones, local coordinates, seamless loops, ending empty), the toolkit, the painter API and the quality bar.+Then:1. **Say it in one line** with art direction: what it is, how it moves, its palette, its timing. "A frost nova:crystals erupt in a ring from the feet outward, a white flash at the center, shards spin off, the floor staysfrosted and fades."2. **Find references** in the library: `node tools/list.mjs <words>`, then read the two or three closest effect- files. Borrow their techniques (a merged heat field for fireballs, `p.arc` for smears, `cycle` for seamless- particles, `tileFbm` scrolls for flames and water).+ files and borrow their techniques (`Particles` and `Bits` in `src/core/sim.js` for sparks, smoke and debris,+ `p.disc` for translucent volumes, `cycle` for seamless particles, `tileFbm` scrolls for flames and water). Look at+ the closest of [Hugo Duprez's effects](https://www.spritefusion.com/pixel-art-vfx) too: they are the quality bar.+ If his has more detail, light or life at the same size on screen, yours isn't done.3. **Draft.** `node tools/new.mjs <category>/<name>` (add `--loop` for a loop) gives a working file. When thedirection is open, write 3 to 5 genuinely different drafts (`<name>-a.js` .. `-e.js`), render them all(`node tools/render.mjs "<category>/<name>-*"`) and look at every contact sheet before choosing. Show the userthe strongest two or three if they're around (`--gif` makes animations to share).4. **Look, judge, fix.** Render, open `records/<id>/contact.png`, and judge like a picky pixel artist. Fix the- worst thing, render again. Two to four rounds is normal; a showpiece takes more. `--all` shows every frame,+ worst thing, render again. Three rounds minimum; a showpiece takes more. `--all` shows every frame,`--mp4` shows motion at full speed.5. **Check.** `node tools/check.mjs <id>` catches drawing outside the canvas, one-shots that don't end empty,loop seams, unseeded randomness and slow frames. Fix until it passes clean. Delete the drafts you didn't keep.@@ -105,18 +107,18 @@ What to look for, and the usual fix:| stiff or mechanical | vary every particle (size, speed, delay, life), add secondary motion (sparks, smoke, debris) || washed out | less glow (k 0.2 to 0.5), darker edge steps, keep white for the hottest core only || flat | light from one side: brighter top-left, darker bottom-right step; a darker ramp step at the base |-| smooth gradients, vector look | hard ramp steps in color, dither for fades, softness only in light |+| smooth gradients, vector look | hard ramp steps in color; softness only in light and in translucent smoke |+| a checkerboard where smoke should be | `SMOKE`, `VAPOUR` or `DUST` particles, or `p.disc`: truly translucent, lit on top || seam when a loop wraps | `cycle`, `loopNoise(phase)`, whole-cell `tileNoise` scrolls, `sin(phase * TAU * n)` || a one-shot that pops off | let it shrink, dither out or fall away before t = duration |-Directional effects face right, ground effects stand on y = 0, actor effects wrap `o.actor` (a 12 x 19 stock-character's mask), and nothing uses `Math.random`. Generic motifs are fine; never recreate a specific game's+Directional effects face right, ground effects stand on y = 0, actor effects wrap `o.actor` (a 24 x 38 stock+character's mask and pixels), and nothing uses `Math.random`. Generic motifs are fine; never recreate a specific game'ssprites, characters or logos.## 4. Native code instead of JSIf the game can't run JS and a sprite sheet isn't enough (an effect that follows a moving target, or needs-per-instance colors at runtime), port the effect: it is a pure function of time. Keep the two-buffer idea, the-4x4 Bayer threshold for alpha, the palette ramp lookups and the closed-form particle motion (`fly` in-`src/core/particles.js`); a GDScript or C# port of one effect is usually under 150 lines. Render the JS original-and your port side by side to check they match.+per-instance colors at runtime), port the effect. Pure effects are a function of time; simulated ones step the particles in+`src/core/sim.js`. Keep the two-buffer idea, the 4x4 Bayer threshold for dithered alpha and the palette ramp lookups.+Render the JS original and your port side by side to check they match.