0

In After Effects, I want to animate an object from a position A = (960, 540), being the center of my 1920x1080 composition, to a position B = (960 - offset, 540) to the left, where offset is a positive number. My composition will be used as Motion Graphics template, so this offset needs to be adjustable with a Slider Control so that users can tweak the amount of movement.

In this question, a method is shown where a slider can be used to interpolate between two positions. However, I want to have the temporal interpolation to be predefined, and it is more complicated than the simple linear or ease interpolation that expressions allow for.

Thus, I want to be able to set the keyframe values with the slider, but I want the keyframe interpolation to be done with the graph editor. How can I make this work?

1 Answer 1

0

Use the values of the keyframes as the driver for a linear expression, and scale them with the slider:

const firstKF = thisProperty.key(1); //which KeyFrames to use as the driver
const lastKF = thisProperty.key(2); // NB you could use multiple keyframes with this expression
const initialValue = [960, 540]; // the start pos—could also use [thisComp.width, thisComp.height]/2
const offsetAmt = thisLayer.effect("offset slider")("Slider"); //pickwhip the slider control here
const finalValue = initialValue + [offsetAmt, 0];

linear(value, firstKF, lastKF, initialValue, finalValue)

This will scale the original motion as you've keyframed it to match the motion with the offset applied.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.