Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Link a single keyframe to point control expression in After Effects

Community Beginner ,
Dec 13, 2022 Dec 13, 2022

I want to adjust the value of a single keyframe by changing the values in a point controller. 

The expression that I came up with doesn't quite work because it changes to values of all the keyframes of that layer. 

 

transform.position.key(4).value = effect("Point Control")("Point")

82c2f57d-a06a-4690-813c-68737049cddf.png

 

I tried to find a solution but I can't wrap my head around this problem.

TOPICS
Expressions , How to
756
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 13, 2022 Dec 13, 2022

This might work for you:

p = toComp(effect("Point Control")("Point"));
v3 = key(3).value;
t3 = key(3).time;
v4 = key(4).value;
if (time >= t3){
  x = linear(value[0],v3[0],v4[0],v3[0],p[0]);
  y = linear(value[1],v3[1],v4[1],v3[1],p[1]);
  [x,y]
}else
  value
Translate
LEGEND ,
Dec 13, 2022 Dec 13, 2022

You cannot link keyframes directly. That's where functions like

 

valueAtTime(key(4).time)

 

would come into play. But even that apparently would require to interpolate from the previous keyframe in some form, so it's really not quite clear what you are even trying to do here. You need to explain in more detail what you are actually trying to achieve. Chnaces are it doesn't even require expressions, just layered animation by ways of using a Null and parenting.

 

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2022 Dec 13, 2022

This might work for you:

p = toComp(effect("Point Control")("Point"));
v3 = key(3).value;
t3 = key(3).time;
v4 = key(4).value;
if (time >= t3){
  x = linear(value[0],v3[0],v4[0],v3[0],p[0]);
  y = linear(value[1],v3[1],v4[1],v3[1],p[1]);
  [x,y]
}else
  value
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 14, 2022 Dec 14, 2022

This worked perfectly. Thank you so much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 14, 2022 Dec 14, 2022

Okay now I ran into another issue. I tried to copy the expression to a layer with just 2 keyframes and adjusted the expression accordingly. Now it is change the values of the first keyframe.

Adobe Expression Problem.PNG

 

The first expression works perfectly but the second one isn't.

What am I doing wrong?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 14, 2022 Dec 14, 2022

Is it possible there are one or more hidden keyframes to the left of time = 0?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 14, 2022 Dec 14, 2022

I thought of that too, but there are no other keyframes except these two.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 14, 2022 Dec 14, 2022

That code actually won't work in all situations. It attempts to preserve the easing that exists in the original keyframes, but if you can accept the standard expression easing, this would be much better:

p = toComp(effect("Point Control")("Point"));
v1 = key(1).value;
t1 = key(1).time;
t2 = key(2).time;
ease(time,t1,t2,v1,p)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 15, 2022 Dec 15, 2022
LATEST

Thank you, this worked perfectly!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 14, 2022 Dec 14, 2022

Toggle the graph editor and the icon for the expression graph to see if it does anything at all. Just staring at your code I can't see why this isn't working. It really should. Perhaps it just acts weird because the layer is trimmed or the layers above cover up the layer even though the expression correctly does its thing.

 

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 14, 2022 Dec 14, 2022

I tried to a new layer with just to keyframes on top of all the other layers, still the same problem. Even when I add 4 keyframes to the layer it makes the 3rd keyframe some kind of hold keyframe.

 

 

First I am playing the animation without the expression applied, second time with the expression enabled. It should change the values of the 4th keyframe but it doesn't.

 

Is this some kind of bug inside of After Effects?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines