Activity › Forums › Adobe After Effects Expressions › Changing color of a light randomly with expressions
-
Changing color of a light randomly with expressions
Posted by Helgi Johannsson on August 28, 2005 at 9:12 pmHi,
I’m somewhat familiar with expressions, but this leaves me with no clue. How can I randomly change color of a light with expressions. Change maybe every half a second or so. And I would certainly prefer only to use 5-6 colors.
Is this possible?
Elizabeth Yorick replied 5 years, 2 months ago 4 Members · 4 Replies -
4 Replies
-
Dan Ebberts
August 28, 2005 at 10:27 pmIn expressions, color is represented as an array of [red,green,blue,alpha] where the values have to be between 0 and 1. (Leave the alpha value set to 1 – it doesn’t do anything but it has to be there. So this would be one way to change the color at random every half second:
period = 0.5; // change color every .5 seconds colors = [[1,0,0,1], // red [0,1,0,1], // green [0,0,1,1], // blue [1,0,1,1], // magenta [1,1,0,1], // yellow [0,1,1,1]] // cyan seed = Math.floor(time/period); seedRandom(seed,true); idx = Math.floor(random(colors.length)); colors[idx]Dan
-
Steve Gerges
October 29, 2015 at 8:03 amHi i just searched for something like this and stumbled upon this old thread. It’s almost what i would like to achieve….but…. 😉
in this case the colors jumps straight from one color to another, as i am looking for a smooth transition between a given set of colors, and additionaly a little bit of random.
i’m using it on lights that drive a particular and would like to have some minor variations of the color (l’ets say i’m using some kind of green i don’t want to have the same green all the way)
is this possible ?
-
Elizabeth Yorick
February 5, 2021 at 10:50 pmThank you for posting this!! This is exactly what I needed!!
Reply to this Discussion! Login or Sign Up