Activity › Forums › Adobe After Effects Expressions › Changing colours of a few circles at random
-
Changing colours of a few circles at random
Emil Stefanow replied 7 years, 11 months ago 5 Members · 13 Replies
-
Dan Ebberts
October 5, 2014 at 5:03 pmMaybe like this:
dur = 1; //duration of each color (seconds)
fadeDur = .2; // duration of fade
seed = Math.floor((time-inPoint)/dur)+1113;
t = (time-inPoint)%dur;
mySaturation = .5
myLlightness = .5
var myAlpha = 1;
seedRandom(seed,true);
curColor = hslToRgb([random(1), mySaturation, myLlightness , myAlpha ]);
seedRandom(seed+1,true);
nextColor = hslToRgb([random(1), mySaturation, myLlightness , myAlpha ]);
ease(t,dur-fadeDur,dur,curColor,nextColor);Dan
-
Adam Walker
October 8, 2014 at 4:45 amThanks Dan
that worked great.
i have another effect that im trying to create that i would be keen to get your advice on.
basically what i have is a background comp similar to the example at the start of this topic (round circles, but i have 60 of them) i want to start with all circles black (off) and then randomly select them and turn them “on” (to a random colour) one at a time, they then stay at their random colour until all 60 have turned on, then they do the reverse (turn off to black one at a time)
any ideas how i can achieve this with an expression?, or at least an idea of where i should start?
-
Emil Stefanow
August 29, 2018 at 10:42 amHi Sander!
The script is amazing! Thank you!
By the way, is it possible to prevent it from randomly have same colors at any given frame?Let’s say I have 3 layers (L1, L2, L3) that get 10 random colors (C1, C2, C3, C4,…, C9,C10)
First change delivers L1->C4, L2->C8, L3->C10
Second change delivers L1->C2, L2->C4, L3->C9
Third change delivers L1->C5, L2->C5, L3->C7 (<—- here I would like to prevent the script from randomly giving out the same color twice (or even 3 times). Is it posible?)Thank you!
Best regards
Emil
Reply to this Discussion! Login or Sign Up