Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change Keyframe Color Based on Expression

  • Change Keyframe Color Based on Expression

    Posted by Billy Woodward on March 2, 2020 at 9:27 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 < key(2).time)
    c1
    else if (time < key(3).time)
    value
    else
    c3

    Billy Woodward replied 6 years, 2 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    March 2, 2020 at 9:42 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

  • Billy Woodward

    March 2, 2020 at 9:46 pm

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

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