ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Change Keyframe Color Based on Expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
billy woodward
Change Keyframe Color Based on Expression
on Mar 2, 2020 at 9:27:28 pm

Hey all!

I've been scratching my head for too long now and I've decided to inquire for help. I basically have a comp containing several layers that have fill effects that are animating between two colors via holdframes.


What I'd like to do is have a master controller in the main comp that allows me to change what those two color values are - reason being I'm versioning and will need to have different color palettes for each comp.

Closest I've found in my searching is a chunk of code provided by DE that allows you to manipulate the color of certain keyframes using if/else. Doesn't work for my four keys.

I'm at a loss and any help would be greatly appreciated!

Best,
Billy

c1 = effect("Color Control")("Color");
c3 = effect("Color Control 2")("Color");
if (time &lt; key(2).time)
c1
else if (time &lt; key(3).time)
value
else
c3


Return to posts index

Dan Ebberts
Re: Change Keyframe Color Based on Expression
on Mar 2, 2020 at 9:42:41 pm

How about something like this:


c1 = effect("Color Control")("Color");
c2 = effect("Color Control 2")("Color");
val = value;
if (numKeys > 0){
n = nearestKey(time).index;
if (time < key(n).time)n--;
if (n > 0){
val = (n%2 > 0) ? c1 : c2;
}
}
val



Dan



Return to posts index

billy woodward
Re: Change Keyframe Color Based on Expression
on Mar 2, 2020 at 9:46:01 pm

Worked like a charm! You're an absolute legend, Dan. Thanks a ton!



Return to posts index

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