Skip to main content
brandonb96942845
Inspiring
June 15, 2023
Question

Link Two Keyframes to Different Values?

  • June 15, 2023
  • 1 reply
  • 1044 views

So I've got another "cool if we can do it" scenario. Basically, I have a graphic where a couple of different parts of it show up in different colors, and then there's a part where I want to have one color fade into another.

My question is: since this project makes extensive use of parented color values, is there a way I can link one keyframe to one color, and the next keyframe to another? (I know I can keyframe the color value itself, so that part is easy; what I'm looking for is to be able to link the changing colors to the parent values, so if I have to change the parent colors I won't have to change every animation too)

This topic has been closed for replies.

1 reply

Community Expert
June 15, 2023

You can use key(key number) to capture the time of any keyframe property. Combine that with a simple linear method, and you could use the position keyframes of any layer to trigger a color change over time. For example, this expression will change the color value of any color property from its original color to yellow ("DCE30A") in the time it takes the layer to move from position 1 to position 2:

t = time;
st = transform.position.key(1).time;
et = transform.position.key(2).time;
strtClr = value;
newClr = hexToRgb("DCE30A");
linear(t, st, et, strtClr, newClr);

You can also take the time of a keyframe and add to that to cause colors to change when a specific keyframe is passed. This expression will change the color from its original color to the same yellow in a half second when the time gets to the second keyframe.

t = time;
st = transform.position.key(3).time;
et = transform.position.key(3).time + .5;
strtClr = hexToRgb("DCE30A");
newClr = value;
linear(t, st, et, strtClr, newClr);

You can use any kind of color conversion or a simple array to define a color with an expression. For example: [.5, .5, .5, 1] will give you black. If you set your color picker to decimal, you can observe the individual color values for r, g, b, but I find it easier to use the hexToRgb value because it can be copied directly from the color panel or from a client's design guidelines.

brandonb96942845
Inspiring
June 16, 2023

So if I were to translate this answer into what I was looking for, I might apply th following to the Color property:

 

st = FillColor.key(1).time;
et = FillColor.key(2).time;
strtClr = LinkedColorValue1;
newClr = LinkedColorValue2;
linear(t, st, et, strtClr, newClr);

 

Community Expert
June 16, 2023

You need to apply that expression to another layer and point to the original one. Two keyframes for color on a color control will create the fade. If you linked to another color control on a different layer or a different property, like a shape layer stroke color using the strtClr and newClr using something like strtClr = thisComp.layer("Controls").effect("Color Control")("Color") it would work. 

 

To get specific I need to see a timeline with the effects you want to link and a little more detailed description of your design goal.