ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Control color value of Individual hold keyframes.

FAQ   •   VIEW ALL
 Control color value of Individual hold keyframes. on Dec 6, 2017 at 7:32:06 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.

Thanks.

 Re: Control color value of Individual hold keyframes.on Dec 7, 2017 at 12:20:29 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

 Re: Control color value of Individual hold keyframes.on Dec 7, 2017 at 5:44:10 pm

Worked perfectly, thank you so much!

Chris

 Re: Control color value of Individual hold keyframes.on Jul 26, 2019 at 6:08:36 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?

 Re: Control color value of Individual hold keyframes.on Jul 26, 2019 at 6:26:56 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)

 Re: Control color value of Individual hold keyframes.on Jul 26, 2019 at 6:30:11 pm

Great!

Thanks Dan

 Re: Control color value of Individual hold keyframes.on Jul 26, 2019 at 6:27:36 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); };```

 Re: Control color value of Individual hold keyframes.on Jul 26, 2019 at 6:49:55 pm

so what are you trying to do exactly?

Dan

 Re: Control color value of Individual hold keyframes.on Aug 20, 2019 at 3:49:33 pm

Sorry Dan.

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