Home

Awesome

Sparkler

A modular 2d particle system.

Features

Sample Usage


var emitter = new ParticleEmitter<
	ColorListOverLifetimeModule,
	InitialVelocityModule,
	KhaSpriteRendererModule
>({
	cacheSize: 512,
	lifetime: 2,
	emitterLifetime: 5,
	emitRate: 50,
	colorListOverLifetime: {
		ease: null,
		list: [
			{
				time: 0,
				value: 0xFFFF0000
			},
			{
				time: 0.5,
				value: 0xFFFF00FF
			},
			{
				time: 1,
				value: 0x00FF00FF
			}
		]
	},
	initialVelocity: {x: 0, y: -200},
	khaSpriteRenderer: {
		image: kha.Assets.images.particle
	},
	sortFunc: function(a, b) {
		return a.age < b.age ? 1 : -1;
	}
});

emitter.start();