Bash.tv → GitHub → itch.io

Explosions, smoke, sparks, dust, trails, confetti, rain, magic and environmental effects. A pooled Canvas 2D particle system with bursts and continuous emitters, ranges for speed, angle, life, size and color, gravity and drag, size, alpha and color over life, additive blending, shapes and sprites, a global cap, and ready presets, plus guidance for GPU particles in Pixi, Phaser and three.js and ...

Download skill (.zip) Files on GitHub

Particle effects

Drop-in: assets/particles.js (tests: burst counts, cap and dropped count, life, pooling, emitter rate and duration, drawing restores blend state; rendered in a browser).

import { Particles, PRESETS } from "./core/particles.js";
const fx = new Particles({ max: 1500, rng: rng.next });
fx.burst(enemy.x, enemy.y, PRESETS.explosion);
fx.burst(player.x, player.y + 12, PRESETS.dust, 4);                    // footstep (from an animation event)
fx.burst(x, y, { ...PRESETS.sparks, angle: [hitAngle - 0.6, hitAngle + 0.6] });   // directional
const trail = fx.emitter({ ...PRESETS.trail, x: rocket.x, y: rocket.y });   // move it: trail.x = rocket.x;  trail.stop()
const rain = fx.emitter({ ...PRESETS.rain, x: cam.x, y: cam.top - 20, spreadX: cam.w });
// update: fx.update(dt)     draw (world space): fx.draw(ctx)

Presets: explosion, smoke, sparks, dust, hit, trail, confetti, rain, magic. Every field is a number or a [min, max] range; colors is a gradient over life; sizeEnd/alphaEnd are end values; blend: "lighter" for glow.

Make effects read well

Performance