ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Control value of two keyframes with one slider.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Fabian Bosman
Control value of two keyframes with one slider.
on Nov 5, 2019 at 2:19:07 pm

Hello After Effects masters,

I'm creating a template in which the end user would be able to adjust a lowerthird to the length of a name he/she wants to use.

I've made a simple in-animation and out animation.
So this is my setup:
Keyframe 1: 00:00 (value is 0)
Keyframe 2: 02:00 (value is defined by the slider)
Keyframe 3: 04:00 (value is defined by the slider)
Keyframe 4: 06:00 (value is 0)

What I want is one slider to control the value of keyframe 2 and 3.
But it should not create a new keyframe if you adjust the slider, it will only adjust the value of those two keyframes.

2019-11-0515_16_26-nvidiageforceoverlay.png

What should be the expression for this?
I've found this expression online but it is not working for my animation.

I hope someone can help me.
Thanks

if (numKeys > 1){
t1 = key(1).time;
t2 = key(2).time;
v1 = [95, 95]; //or if it's 3d [95, 95, 95]
slider = comp("INPUT").layer("CONTROL").effect("Zoom intensity")("Slider");
v2 = [slider, slider]; // or [slider,slider,slider] if 3D
linear((time, t1, t2, v1, v2);
} else {
value
}


Return to posts index

Dan Ebberts
Re: Control value of two keyframes with one slider.
on Nov 5, 2019 at 3:05:20 pm

I think it will be something like this:


s = thisComp.layer("Control").effect("Your Slider")("Slider");
t1 = key(1).time;
t2 = key(2).time;
t4 = key(4).time;
if (time > t1 && time < t4)
value*s/valueAtTime(t2)
else
value;



Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]