I have the following simple function which is supposed to produce a simple flame effect, I build the actual display part of the code from here:
http://jeromeetienne.github.io/sparkseditor/
Whenever I run the function it seems to exhaust the pool (max particles) and then die, with no visible trace of it on the screen. I'm using r53, whereas many if not all of the sparks.js examples use r47, not sure if this is relevant.
You can find the actual file producing the error over here:
http://jeromeetienne.github.io/threex/docs/threex.sparks.html
And the code for my flame below:
var position = data.status.position;
var group = new Object3D();
scene.add(group);
var sparks = new THREEx.Sparks({
maxParticles : 10,
counter : new SPARKS.SteadyCounter(300)
});
var emitter = sparks.emitter();
var color = function() {
this.initialize = function(emitter, particle) {
particle.target.color().setHSV(0.4, 0.8, 0.4);
particle.target.size(100);
};
};
emitter.addInitializer(new color());
emitter.addInitializer(new SPARKS.Position(new SPARKS.PointZone(new THREE.Vector3(
position.x, position.y, position.z
))));
emitter.addInitializer(new SPARKS.Lifetime(0, 0.8));
emitter.addInitializer(new SPARKS.Velocity(new SPARKS.PointZone(new THREE.Vector3(
position.x, position.y-100, position.z
))));
emitter.addAction(new SPARKS.Age());
emitter.addAction(new SPARKS.Move());
emitter.addAction(new SPARKS.RandomDrift(1000,0,1000));
emitter.addAction(new SPARKS.Accelerate(0,-200,0));
emitter.addCallback('created', function(particle) {
group.add(particle);
});
emitter.addCallback('dead', function(particle) {
particle.target.visible = false;
group.remove(particle);
});
emitter.start();
Thanks in advance, any help is much appreciated :)