Automatically-Calculated Keyframe

Scripting for After Effects

Automatically-Calculated Keyframe

Postby Minh on 07/7/2015, 9:09 am

Hi,
May I have a question:
Can we do some kinds of expressions which can directly affect the value of a keyframe
For example, I have may layer and their scales are depended to the value of a slider control. I want to animate them from 0% to the percentage which is linked previously to my control. Is there anyway that the value of the keyframes changes dynamcally relating to the one of the slider control.

Sorry if it sounds confusing, and I'd be glad to receive any answer.

Thank you
Minh
 
Posts: 9
Joined: 10/16/2014, 9:48 pm

Re: Automatically-Calculated Keyframe

Postby Michael_Szalapski on 07/9/2015, 1:11 pm

You can use value in your expression. That will reference the keyframe. So, if your expression says value*2 and your keyframes go from a value of 2 to 10, the result will go from 4 to 20.
______________
Michael Szalapski
Fast. Cheap. Good.
Pick two.
Michael_Szalapski
 
Posts: 8275
Joined: 02/2/2010, 1:06 pm
Location: Nashville, TN, USA
Twitter: thegreatszalam

Re: Automatically-Calculated Keyframe

Postby Minh on 07/9/2015, 9:33 pm

Hi Michael_Szalapski,
Thank you but that is not really what I meant. For example,
I want to link the opacity from several layers to the slider control on another one named "Control" valued 100, I'll type the expression:

thisComp.layer("Control").effect("Slider Control")("Slider")

But then how do I animated them seperately, for exmple, the Slider cotrol is at 100, and I wanna animte layer 1's opacity from 0 to 100, layer 2's opacity from 40 to 100, layer 3's opacity from 50 to 100, layer 4's opacity from 20 to 100, and so on...
How can I do that, so when I change the slider value to like 85, the opacities will animate from the former values (0, 40, 50, 20) to the latter which is 85.
Minh
 
Posts: 9
Joined: 10/16/2014, 9:48 pm

Re: Automatically-Calculated Keyframe

Postby star+circle on 07/11/2015, 12:51 am

To me it sounds like you need two sliders, one with the value that you want the keyframes to go to (if you are planning on having different values), and another slider that gives the balance between original keyframed values and the target value.

So slider "A" (target value) would be set to, say, 85.

Slider "B" (balance) would be animated from 0 to 100, and you would calculate the actual value from the balance:

((keyframed value) x (100-B) + (target value "A") x B)/100

Along those lines.
star+circle
 
Posts: 781
Joined: 12/6/2014, 3:07 pm
Location: Finland

Re: Automatically-Calculated Keyframe

Postby brurpo on 07/16/2015, 12:21 pm

I think this is what you want.

Assuming you have a layer named CONTROL, where you put your slider control

Code: Select all
ease(time, key(1).time, key(2).time, opacity.key(1), thisComp.layer("CONTROL").effect("Slider Control")("Slider"))


You can freely set key frame 1 and 2 position, and set keyframe 1 value, keyframe 2 value is set to slider control.

This is assuming you want an ease interpolation between keyframes, if not, change ease to linear on the code.
brurpo
 
Posts: 3
Joined: 07/15/2015, 12:39 pm
System Specs: i7 3930k
2x GTX680
32Gb RAM


Return to After Effects Expressions