G’day.
How would I go about making the snow flakes in the Falling Snow tutorial random colours? I read the random colour generator tutorial but I don’t know how to make it happen autiomatically.
What would I add to the script to do this?
G’day.
How would I go about making the snow flakes in the Falling Snow tutorial random colours? I read the random colour generator tutorial but I don’t know how to make it happen autiomatically.
What would I add to the script to do this?
Change this line [AS]for (k=0; k<50; k++) {
duplicateMovieClip(_root.snow, “snow”+k, k);
}[/AS] to this [AS]for (k=0; k<50; k++) {
mc = duplicateMovieClip(_root.snow, “snow”+k, k);
c = new Color(mc);
c.setRGB(Math.round(Math.random()*0xFFFFFF));
}[/AS]
That sets an ID (“mc”) to the duplicated clip, uses the Color() object to target the newly duplicated clip, and then sets the RGB color of that clip to a random color (the code was taking from another random color tutorial at kirupa.com, I believe in the AS Tricks section)
Or add this to your snow clip:[AS]onClipEvent (load) {
myColor = new Color(this);
myColorTransform = new Object();
myColorTransform.ra = (Math.random()<.5) ? Math.random()100 : -1Math.random()*100;
myColorTransform.rb = (Math.random()<.5) ? Math.random()255 : -1Math.random()*255;
myColorTransform.ga = (Math.random()<.5) ? Math.random()100 : -1Math.random()*100;
myColorTransform.gb = (Math.random()<.5) ? Math.random()255 : -1Math.random()*255;
myColorTransform.ba = (Math.random()<.5) ? Math.random()100 : -1Math.random()*100;
myColorTransform.bb = (Math.random()<.5) ? Math.random()255 : -1Math.random()*255;
myColorTransform.aa = (Math.random()<.5) ? Math.random()100 : -1Math.random()*100;
myColorTransform.ab = (Math.random()<.5) ? Math.random()255 : -1Math.random()*255;
myColor.setTransform(myColorTransform);
}[/AS]
Thankyou very much guys!
welcome :thumb:
:: Copyright KIRUPA 2024 //--