Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Array with color values changing by time

  • Array with color values changing by time

  • Regina Weber

    May 1, 2020 at 7:49 pm

    Hello,

    I have a simple solid layer with a fill effect.
    I want to change the color over time with fix color values, for example every second a new color.
    I found a solution by changing the colors randomly but not in a specific order.
    color1, color2, color3, color4, color5, color6, color5, color4, color3, color2 -> and loop again

    can anyone help me, maybe with a clever array solution for the colors?

    thanks so far and all the best

    regi

  • Dan Ebberts

    May 1, 2020 at 8:49 pm

    Try this:

    c1 = [1,0,0,1]; // red
    c2 = [1,.5,0,1]; // orange
    c3 = [1,1,0,1]; // yellow
    c4 = [0,1,0,1]; // green
    c5 = [0,1,1,1]; // cyan
    c6 = [0,0,1,1]; // blue
    colors = [c1,c2,c3,c4,c5,c6,c5,c4,c3,c2];
    secondsPerColor = 1;
    idx = Math.floor((time – inPoint)/secondsPerColor)%colors.length;
    colors[idx]

    Dan

  • Regina Weber

    May 1, 2020 at 9:06 pm

    Dan, brilliant, thank you soo much, thats exactly what i am looking for ☺

    cheers regi

Viewing 1 - 3 of 3 posts

Log in to reply.

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