Adding multi-colors to canvas particles

label Programming
account_circle Unassigned
schedule 10 Days
account_balance_wallet $5

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

Studypool's Notebank makes it easy to buy and sell old notes, study guides, reviews, etc.
Click to visit
The Notebank
...
Aug 4th, 2013
...
Aug 4th, 2013
Oct 20th, 2017
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