zz85 / sparks.js

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

Colour classes #14

Open renegademaster88 opened 12 years ago

renegademaster88 commented 12 years ago

Hi there, i have just finished writing a quick guide to sparks (please have a read there afew questions),which i have to say is an excellent highly flexible particle system.

The only bit that i dont understand, is you have not got any colour manipulation objects amongst your Initializers and Actions, and when i look at your examples, they all work by changing the particle colour in code outside of sparks callbacks etc. This seems a bit counter intuitive to me since you have such a comprehensive array of objects already. Couldn't we have define some colour behaviour classes instead?

SPARKS.SpriteInitializer () which takes a new THREE.texture () as a parameter

SPARKS.ColorBlender() Action which contains an array of colours and number between 0 an 1 to denote where the colour is.

just an idea!

zz85 commented 12 years ago

i was wondering where your guide was, and realized that its on the wiki. thanks @renegademaster88 ! interesting thought, let me think about it, it could get implemented in version 2 :)

renegademaster88 commented 12 years ago

Actually i have been playing with your code allot over the last 2 days - i will Fork a branch soon.

I wondered weather you decided to explicitly seperate your Sparks code from THREE.js so it could be used with any other 3D Api?

So far i have added - colorChange Attractor / repulosor http://www.nickfallon.net/3D/Attractors.html fadeOut Pulsator (sin wave)

I am trying to make some cool ray gun effects for my space game!

zz85 commented 12 years ago

It's looking good!

Yes, I'll glad to review the additions you've made.

So far, sparks.js have been tightly coupled with three.js, but I'm trying to make it engine dependent for version 2...

renegademaster88 commented 12 years ago

Maybe you should think about breaking your file up - Core Sparks , Sparks Initialisers, Sparcs Actors etc. (as the file is quite long already!) then you could have a THREE.Sparks file that had code that was THREE dependent - ie. all the shaders and colour manipulation stuff.

Before i started using THREE i looked at 5 other JS 3D engines, so there is an abundance of stuff going on that could use your code - C3dL , GLGE , CoperLicht, O3D, j3D

I am new to forking GitHub so it may take me a while to figure out how to Branch and re-submit , you can view source in the meantime!

zz85 commented 12 years ago

yes.. that's what I'm doing actually, but still a work in progress! im not going to get internet access tomorrow, maybe i'll trying push the new branch so you can work on that if you like :)

zz85 commented 12 years ago

I've now created a new branch for the new project structure. There's also a build script to concatenate the files.

https://github.com/zz85/sparks.js/tree/m2

"m2" would be the work in progress toward milestone 2. you can chose to work on the old branch or play around with the new branch. :)

renegademaster88 commented 12 years ago

Yeah would love to see!