PDA

View Full Version : Flash 5 : random colours with transition fade



Ultras
February 26th, 2003, 09:02 PM
ok im trying to create a clip of a dot that fades randomly between four pre defined colours whilst also randomly varying in the size range 0 - 100%. i am trying to create a smooth size tween also.
this is my attempt:


size = random(100);
setProperty ("purple", _xscale, size);
setProperty ("purple", _yscale, size);
myArray = ["0x399FB6", "0xCBC5D7", "0x5A3084", "0xffffff", "0x399FB6"];
myArray[0] = 0x399FB6;
myArray[1] = 0xCBC5D7;
myArray[2] = 0x5A3084;
myArray[3] = 0xffffff;
myArray[4] = 0x399FB6;
col = random(4);
myColor = new Color(purple);
purple._alpha=100;
myColor.setRGB(myArray[col]);


where purple is the next key frame instance of the dot with a tween between the two (ie purple and the one with the above script).

this script randomly changes both the size and colour in the desired way but for nothing can i get the dots to fade / change smoothly :hair:


some 1 help with this and i will perform anything you ask of me :P and be forever indebted..

here is the fla

pom
February 27th, 2003, 06:27 AM
Concerning the size transition, it could be something like this:
onClipEvent(load){
targSize=100;
}
onClipEvent(enterFrame){
var diff=_xscale-targSize;
if (Math.abs(diff)<1) targSize=random(100);
_xscale=_yscale+=diff/7;
}Look at the easing tutorial to ee what I mean.

And concerning the color transform, it's a lot harder to do. Look up the setTransform method and see what you can do with it.

pom :)

Ultras
February 27th, 2003, 09:58 AM
ok thanks i will .. was thinking in bed its gonna have to be some iterative thing... :run: