PixiJS Particle System
A modern, flexible particle system for PixiJS - inspired by the original Particle Emitter, but rebuilt with a clean TypeScript-first architecture and more expressive API.
Features
- Built for PixiJS, provides seamless integration with V8's
ParticleContainerandParticleobjects. - Provides strong typing, great IntelliSense and predictable API.
- Behavior orientated design allows for pluggable behaviors for custom effects.
- Flexible yet simple API, start small and scale up to advanced usage.
- Optimized for real-time effects.
- Comes with built-in behaviors to get started immediately:
AlphaBehaviorColorBehaviorMovementBehaviorRotationBehaviorScaleBehaviorSpawnBehaviorTextureBehavior
Installation
⚠️ This library is still under active development and not yet published to NPM.
You can clone the repo and install it locally:
git clone git@github.com:danielpokladek/pixi-particle-system.git
cd pixi-particle-system
pnpm install
pnpm buildOr add it directly as a GitHub dependency:
pnpm add github:danielpokladek/pixi-particle-systemQuick Start
Here's the minimum required to get particles on the screen:
import { Emitter } from "pixi-particle-system";
import { ParticleContainer } from "pixi.js";
// Create a particle container and add it to your app/stage
const container = new ParticleContainer();
app.stage.addChild(container);
// Create an emitter (the "brain" of the particle system)
const emitter = new Emitter(container);
// Start emitting particles
emitter.play();⚠️ Particles default to a 1x1 white texture. If you don't see anything, assign a custom texture using
TextureBehavioror custom scale usingScaleBehavior.
Configuration Example
const emitter = new Emitter(container, {
emitterVersion: 0,
minParticleLifetime: 0.4,
maxParticleLifetime: 0.4,
spawnInterval: 0.01,
spawnChance: 1,
maxParticles: 50,
addAtBack: true,
particlesPerWave: 1,
alphaBehavior: {
listData: {
list: [
{ value: 0.0, time: 0.0 },
{ value: 1.0, time: 0.5 },
{ value: 0.0, time: 1.0 }
]
},
mode: "list"
},
colorBehavior: {
listData: {
list: [
{ value: "#ff0000", time: 0 },
{ value: "#00ff00", time: 0.5 },
{ value: "#0000ff", time: 1 },
],
},
mode: "random",
},
movementBehavior: {
xListData: {
list: [
{ value: 50, time: 0 },
{ value: 150, time: 1 },
],
},
yListData: {
list: [
{ value: -100, time: 0 },
{ value: 450, time: 1 },
],
},
space: "local",
mode: "acceleration",
},
scaleBehavior: {
mode: "list",
listData: {
list: [
{ value: 0, time: 0 },
{ value: 100, time: 1 },
],
},
},
spawnBehavior: {
shape: "rectangle",
width: 400,
height: 400,
},
});
emitter.play();Documentation
Full documentation, API reference, and guides: TBA (Will be linked once GitHub Pages deployment is live.)
Development
git clone git@github.com:danielpokladek/pixi-particle-system.git
git cd pixi-particle-system
pnpm installBuild (production)
pnpm buildBuild & Watch (development)
pnpm devGenerate Documentation
pnpm docs:buildContribute
Contributions are welcome!
If you'd like to help:
- Fork the repo.
- Create a feature/bugfix branch.
- Submit a PR with your changes.
Contribution guidelines will be added soon.
Change Log
License
This content is released under the MIT License.