Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Instant color change on layer every few frames.

  • Instant color change on layer every few frames.

    Posted by Joey Harvey on February 6, 2014 at 10:21 am

    I am trying to get a layer to change colour instantly every few frames but stay within set range eg. different shades of green.

    I have had some success by adding the Fill effect to a layer,
    setting a suitable starting color, and then putting a wiggle expression on that color.

    This enables me to control the speed of change and limit the range of colours,
    but the colour changes smoothly and I want to create something that changes colour instantly.

    I have also tried using the random expression but can’t work out how to slow this down so it doesn’t change on every frame.

    Can anyone help?

    Thank you!

    wiggle (3,0.2) // causes colours to change gradually which I don't want

    and also tried

    random ([0,0.5,0,0.5]) // which causes erratic colour changes and I don't understand how to stop it changing on every frame

    Joey Harvey replied 12 years, 3 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    February 6, 2014 at 2:34 pm

    Something like this should slow things down:

    framesPerColor = 5;
    seg = Math.floor(timeToFrames(time)/framesPerColor);
    seedRandom(seg,true);
    value + [0,random(.5),0,0]

    Dan

  • Joey Harvey

    February 6, 2014 at 3:27 pm

    Lovely! That is great, thank you!

    In relation to this solution, would you be able to explain how the 4 digit color value is broken down? [0,0,0,0]

    My guess is that its something like [Red,Green,Blue,?] – is that right? If so, what is the value I have written as ‘?’

  • Dan Ebberts

    February 6, 2014 at 3:42 pm

    >what is the value I have written as ‘?’

    Alpha. Sometimes it isn’t used (as with the Fill effect), but it needs to be there.

    Dan

  • Joey Harvey

    February 6, 2014 at 4:26 pm

    Of course!

    That makes a lot of sense. Thank you very much for your time!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy