Adding multi-colors to canvas particles

Programming
Tutor: None Selected Time limit: 10 Days

Hello.

This is a particle system made using Javascript (CoffeeScript) http://cssdeck.com/labs/53gonama3x

How do I add more colors to the particles? Like Rainbow colors or RGB?

Thanks.


Aug 4th, 2013
Try the below code snippet. (i+j)% number of colors will give value from 0 to number of colors-1. Each time you push a new particle value of i+j%5 will increase by 1. Use this fact to change the value of colors to one of your choice of color. In below I have chosen 5 values of colors at random which gives nice pattern. By the way, it's pretty cool code.

switch ((i+j)%5)
when 0 then colors = ['#FF2233']
when 1 then colors = ['#002233']
when 2 then colors = ['#FF33FF']
when 3 then colors = ['#0033FF']
when 4 then colors = ['#00FF00']
display_list.push new Particle(i)
Aug 4th, 2013

Hi, I am new to this website, so I will be very pleased if you could give me a good rating to get started. Thanks.

Aug 5th, 2013

Hi, so did it work?

Aug 5th, 2013

Did you know? You can earn $20 for every friend you invite to Studypool!
Click here to
Refer a Friend
...
Aug 4th, 2013
...
Aug 4th, 2013
Dec 9th, 2016
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer