跪拜 Guibai
← All articles
Frontend · JavaScript

Pixel Effects as Code: 244 JavaScript FX with a Live Gallery and a Claude Code Skill

By 柳杉 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Pixel game developers can stop hand-tweaking animation frames and instead treat effects as live, editable code with built-in combat timing. The Claude Code skill hints at a workflow where assistants modify effect logic directly, not just pixel output.

Summary

Finding game-ready pixel effects usually means digging through sprite sheets and re-coloring frames by hand. pixelfx instead ships each effect as a small JavaScript file that draws itself frame by frame. The library currently holds 244 effects, grouped into fire, explosion, water, ice, lightning, magic, weather, items, and UI motion, all browsable in a live gallery where you can tweak speed, colors, orientation, and even random seeds.

The code is split into per-effect modules and core utilities. Effects declare metadata plus a draw function; `Painter` handles low-level pixel, line, circle, and glow drawing with a separate glow layer; `createFx` manages playback via `update(dt)` and `draw(frame)`. The same code can export sprite sheets and JSON for engines like Godot or Unity.

A notable design choice is attaching attack timing data to some effects: wind-up, hit-stop, and target recoil are recorded, so a slash or fireball can align with character animations rather than float over a static sprite. The project also bundles a Claude Code skill for editing or generating new effects, and everything is MIT licensed.

Takeaways
— pixelfx contains 244 code-defined pixel effects across categories like fire, ice, lightning, magic, weather, and items.
— Each effect is a standalone JavaScript file that draws itself based on time, so it can run live, be re-paletted, mirrored, or rotated without re-editing sprites.
— The online gallery plays each effect live and lets you adjust speed, background, color, orientation, and random seeds.
— Some attack effects embed character action timing — wind-up, hit-stop, and target recoil — as data instead of hardcoding the visuals alone.
— Core drawing goes through a Painter utility that composites normal pixels and a secondary glow layer for bloom-like highlights.
— createFx manages playback with update(dt) and draw(frame), taking position, flip, and palette options at creation.
— Effects can be exported as sprite sheets and JSON for use in non-JavaScript engines like Godot or Unity.
— A Claude Code skill is included to help modify or create effects from the existing library.
— All code and effects are MIT licensed and allowed in commercial projects.
Conclusions

Encoding attack timing as data alongside visuals is a deliberate attempt to bridge the gap between VFX libraries and character animation, which most effect packs ignore.

The fixed random seed per effect makes deterministic playback and reproducible sprite exports, a practical necessity that also simplifies testing and debugging.

This is an example of effects-as-code gaining ground in game dev circles, where the tradeoff between runtime flexibility and engine compatibility is handled by offering sprite-sheet export as an escape hatch.

Concepts & terms
Code-defined effect
An effect that is not a pre-baked sprite sheet but a small program that computes pixels on the fly, allowing runtime color changes, transforms, and deterministic replay.
Fixed random seed
A constant seed value stored in the effect code so that all random-looking details (spark positions, ember paths) reproduce identically every run, enabling stable exports and predictable behavior.
Claude Code skill
A packaged set of instructions and tools that lets Claude (Anthropic's coding assistant) load, inspect, and edit pixelfx effects directly from a project workspace.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗