ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Offset timing of 3rd and 4th Keyframe via slider

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
James Ronan
Offset timing of 3rd and 4th Keyframe via slider
on Jan 22, 2018 at 1:58:07 pm

Hi there

What I would like to do is to control what time the 3rd and 4th keyframes (one second apart) begin via a slider.

e.g. If the slider value is 4, then the 3rd keyframe will start at 4 seconds and the 4th keyframe is at 5 seconds.
If the slider value is 10, then the 3rd keyframe will start at 10 seconds, and the 4th keyframe will be at 11 seconds.

etc. etc.

I want to keep all the easing I already have between the two if that is possible.

So far I've been messsing around with:

if (numKeys > 2){
dur = (effect(Slider Control")("Slider"))
t = time - dur
valueAtTime(t)
} else
value


This is sort of doing it but not quite...

Any suggestions would be awesome!

Thanks

James


Return to posts index

James Ronan
Re: Offset timing of 3rd and 4th Keyframe via slider
on Jan 22, 2018 at 3:08:03 pm

SOLVED!

After more searching I've found an old post with something that will work:

Instead, this uses a slider to hold the values between 2nd and 3rd keyframes...


holdTime = effect("Slider Control")("Slider");
k1 = 2; // 1st hold keyframe
k2 = 3; // 2nd hold keyframe
p = transform.position;
t1 = p.key(k1).time;
t2 = t1 + holdTime;
if (time < t1)
t = time
else if (time < t2)
t = linear(time,t1,t2,t1,p.key(k2).time)
else
t = p.key(k2).time + (time - t2);
valueAtTime(t)


The old post for reference:
https://forums.creativecow.net/thread/227/18402


Return to posts index

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