Activity › Forums › Adobe After Effects Expressions › Randomize color
-
Randomize color
Posted by Julio Crespo on October 27, 2007 at 11:35 pmI need a expression to ramdomize and hold the color property on the fill effect. I need to aplly this expression to one solid and every time I duplicate it the fill effect take diferent color and hold it
Daniel Sánchez de miguel replied 11 years, 3 months ago 4 Members · 8 Replies -
8 Replies
-
Dan Ebberts
October 28, 2007 at 1:39 amThis should work:
seedRandom(index,true);
random([1,1,1,1])Dan
-
Jason Jantzen
December 10, 2012 at 9:13 pmThis is great, Dan. Is there a way to keep the random seed range within a color hue?
Jason Jantzen
vimeo.com/jasonj -
Dan Ebberts
December 10, 2012 at 9:27 pmYou can limit the range by passing two arrays to random. For example, this will give you different variations of red:
seedRandom(index,true);
random([.25,0,0,1],[1,0,0,1])Dan
-
Jason Jantzen
December 10, 2012 at 9:38 pmok, this is pretty awesome 🙂 I’m trying to understand the color system though. Are those 32 bit values?
Jason Jantzen
vimeo.com/jasonj -
Dan Ebberts
December 10, 2012 at 10:39 pmThey’re floating point, with individual channel values between 0.0 and 1.0.
Dan
-
Daniel Sánchez de miguel
January 13, 2015 at 5:41 pmwould there be a way to call for say, four specific colors? then have it so, each time you duplicate the solid it creates another one with one of the 4 defined colors?
Also, to define such colors in floating point mode… would I have to divide RGBA values by 255 in order to get the floating point color values?
Thanks,
Dani -
Dan Ebberts
January 13, 2015 at 6:07 pmThis should give you the idea:
color0 = [255,0,0,255]/255; // red
color1 = [0,255,0,255]/255; // green
color2 = [0,0,255,255]/255; // blue
color3 = [255,255,0,255]/255; // yellowcolors = [color0,color1,color2,color3];
seedRandom(index,true);
colors[Math.floor(random(colors.length))];Dan
Reply to this Discussion! Login or Sign Up