Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Control color value of Individual hold keyframes.

  • Control color value of Individual hold keyframes.

    Posted by Chris Jung on December 6, 2017 at 7:32 pm

    Hi,

    I was wondering if there was a way to control the color value of individual keyframes.

    I want to be able to control the first and last hold keyframes without changing the color value of the middle keyframe.

    Please let me know!
    Thanks.

    Chris Jung replied 7 years ago 2 Members · 8 Replies
  • 8 Replies
  • Dan Ebberts

    December 7, 2017 at 12:20 am

    Something like this maybe:


    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

    Dan

  • Chris Jung

    December 7, 2017 at 5:44 pm

    Worked perfectly, thank you so much!

    Chris

  • Chris Jung

    July 26, 2019 at 6:08 pm

    Hi,

    I can’t seem to get it to work when its 2 linear keyframes. How would you rewrite it for 2 linear keyframes where I want to only change the color value of the first keyframe?

  • Dan Ebberts

    July 26, 2019 at 6:26 pm

    Something like this:

    c1 = effect(“Color Control”)(“Color”);
    c2 = key(2).value;
    t1 = key(1).time;
    t2 = key(2).time;
    linear(time,t1,t2,c1,c2)

  • Chris Jung

    July 26, 2019 at 6:27 pm

    This seemed to work, but jumps back to the first color after it hits the 2nd keyframe, any solutions? or simplified code?

    if (numKeys&lt;1){
    value;
    }
    else{
    idx1 = nearestKey(time).index;
    if (key(idx1).time>time) idx1--;
    idx2 = idx1+1;
    if (idx1&lt;1) idx1=1 else if (numKeys<idx2) idx2=numKeys;
    val1 = thisComp.layer("COLOR").effect("color")("Color");
    val2 = thisComp.layer("COLOR").effect("color 2")("Color");

    linear(time, key(idx1).time, key(idx2).time, val1, val2);
    };

  • Chris Jung

    July 26, 2019 at 6:30 pm

    Great!

    Thanks Dan

  • Dan Ebberts

    July 26, 2019 at 6:49 pm

    so what are you trying to do exactly?

    Dan

  • Chris Jung

    August 20, 2019 at 3:49 pm

    Sorry Dan.

    Your original response worked out for me. I think we simultaneously posted responses and it overlapped.

    Really appreciate your quick responses.

    Best,
    Chris

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