ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Array with color values changing by time

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Regina Weber
Array with color values changing by time
on May 1, 2020 at 7:49:21 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


Return to posts index

Dan Ebberts
Re: Array with color values changing by time
on May 1, 2020 at 8:49:40 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



Return to posts index

Regina Weber
Re: Array with color values changing by time
on May 1, 2020 at 9:06:39 pm

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

cheers regi


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]