zz85 / sparks.js

a lightweight 3d particle engine in javascript, compatible with THREE.js and TWEEN.js
435 stars 47 forks source link

Ability to kill the emitter and better update management #26

Open Baccanno opened 9 years ago

Baccanno commented 9 years ago

I will do a pull request soon on these two subjects.

First subject is already covered and used, it allows to call kill() on the emitter that will stop the counter from creating more particles. The emitter will actually die when the last particle still there dies. Thus it kills "softly" and triggers a killed event when it's really over so you can detach it, or do whatever you need with it (like putting it in a pool to reuse it only by changing the counter and starting it again)

Second is because right now there is very little control over how the engine updates itself (it is base on timeouts)

I'd rather switch to a manual updating system such as in https://github.com/tweenjs/tween.js so for instance you could flip-flop the updating or whatever related to performances, call it in requestAnimationFrame, and more important profile it easily.

Baccanno commented 9 years ago

Work is in progress here : https://github.com/Baccanno/sparks.js