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

How to use a keyframe instead when you have an expression?

Explorer ,
Aug 08, 2022 Aug 08, 2022

Greetings,

 

I have a property that is using a matth expression for the bulk of it's values, based on an input value from another layer, but I actually need to use some manual values that do not follow the expression calculation, so I was wondering how I could add keyframes with those manual values and have the expression, use the keyframe value instead, whenever there is a keyframe value present? Thanks for any help on this 🙂

TOPICS
Expressions , How to
673
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 , Aug 09, 2022 Aug 09, 2022

I have no idea if this will affect your motion blur in the way you're hoping for, but on any frame where a keyframe exists, it should give the value of the keyframe, rather than the calculation:

x= effect("PanZoom")("Anchor A")[0]-effect("xOffset")("Slider")+effect("shakeDelta")("Point")[0]*effect("x,y movement factor")("Slider")/100-effect("panDelta")("Point")[0]/2;
y= effect("PanZoom")("Anchor A")[1]-effect("yOffset")("Slider")+effect("shakeDelta")("Point")[1]*effect("x,y movement factor")("Sl
...
Translate
Community Expert ,
Aug 08, 2022 Aug 08, 2022

You can call up a keyframe number and a keyframe value. You'll probably also need to add an if/else statement and maybe even an interpolation method to ease in and out of the keyframe value over time. 

 

You could also set up animations based on markers or layer in and out points, then add an if statement that looked for the nearest keyframe and turned off the expression if there were any keyframes in the property.

 

To be more specific, I would have to see exactly what you are trying to do. 

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 ,
Aug 08, 2022 Aug 08, 2022

As you want to change the expression value when it reaches a keyframe so I think you want to use (valueAtTime(t)) expression, so try to search for that and you will find a lot of example on how to use this expression 

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 ,
Aug 09, 2022 Aug 09, 2022

Not a problem. Yopu simply use a slider that blends between your slider and your keyframed values as represented by the default "value" keyword. Since the slider itself then can be keyframed, it's easy enough to go back and forth using simple linear() functions or whatever you have in mind. All the same, you could of course fully offshore either the keyframe data or the expression to their own sliders and blend between those as well. Really depends on what you want to do.

 

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
Explorer ,
Aug 09, 2022 Aug 09, 2022

Hi Mylenium, this "linear" slider function sounds interesting to try. I have not used it before, do you have a reference for either how I might use it, or how to use it in general? Thanks for any additional info.

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 ,
Aug 09, 2022 Aug 09, 2022

What does the "math expression" look like?

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
Explorer ,
Aug 09, 2022 Aug 09, 2022

It's combining different x,y movements to generate a composite camera panning movement, but since I have my Motion Blur turned ON for the foreground and background layers, the blur gets screwed up on the last frame of each panning section because the very next value starts in a completely different x,y location and AE just smears the blur on the last frame since I can't tell AE that I'm "restarting" my panning motion, so I need to make my last keyframe value just use the same x,y value on the second to last frame of each panning section along the timeline. 

 

var x= effect("PanZoom")("Anchor A")[0]-effect("xOffset")("Slider")+effect("shakeDelta")("Point")[0]*effect("x,y movement factor")("Slider")/100-effect("panDelta")("Point")[0]/2;
var y= effect("PanZoom")("Anchor A")[1]-effect("yOffset")("Slider")+effect("shakeDelta")("Point")[1]*effect("x,y movement factor")("Slider")/100-effect("panDelta")("Point")[1]/2;

[x, y]

 

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 ,
Aug 09, 2022 Aug 09, 2022

I have no idea if this will affect your motion blur in the way you're hoping for, but on any frame where a keyframe exists, it should give the value of the keyframe, rather than the calculation:

x= effect("PanZoom")("Anchor A")[0]-effect("xOffset")("Slider")+effect("shakeDelta")("Point")[0]*effect("x,y movement factor")("Slider")/100-effect("panDelta")("Point")[0]/2;
y= effect("PanZoom")("Anchor A")[1]-effect("yOffset")("Slider")+effect("shakeDelta")("Point")[1]*effect("x,y movement factor")("Slider")/100-effect("panDelta")("Point")[1]/2;
val =[x, y]

if (numKeys > 0){
  f = timeToFrames(nearestKey(time).time);
  if (f == timeToFrames(time)) val = value; 
}
val

 

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
Explorer ,
Aug 09, 2022 Aug 09, 2022
LATEST

Thanks for this one Dan, it did the trick!!! It eliminated the extreme blur at the last frame frame of each panning frame range.

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