loading

Javascript Particle Engine

That's right. I've went and written something many would consider, probably rightly, to be quite bizarre: a particle engine in Javascript. I haven't as much experience in Javascript as I'd like, so don't expect great quality code, but it does have a few hacked-up optimisations and it runs at a fairly imressive speed considering the platform. I've slapped a GPL license notice in there, so muck about with it all you want, if you can read my god-awful code..

Using it's simple business. The instructions are right there on the sparkz page. Just include sparkz.js <script type='text/javascript' src='sparkz.js'>
// courtesy of defproc.co.uk [optional ;)]
</script>

then to create a particle, just call makespark(x, y, xspeed, yspeed, colour, alpha);.

<button onclick='makespark(84 ,92, (Math.random()*19)-9.5, (Math.random()*6)-3.0, "#ffa000", 100);'>
spark!@#!
</button>

There're a few variables you can set at the top of sparkz.js to customise its behaviour. Enjoy!
(unrated) | by defproc on February 23rd, 2008

An account is required to post comments

tf2.flyingllamaandpandasquad.net

COMMENTS

Gotta say I was well impressed with that. Told you JS is easy.

(1) | by madkat on February 23rd, 2008
warmonkey's website | Powered by: Apache / PHP / MySQL | Made in Ninjapad NX | © defproc.co.uk, 2007_