-
Merging two expressions together: changing start and duration
Hi there,
So recently with the announced features from AE 2018 I was curious in creating a perfect template to increase the proficiency some of the more mundane tasks take to complete, especially lower thirds / call outs. So I have manged to stitch together two different expressions
firstly, one which extends the time between 2 key frames
holdTime =effect(“Slider Control”)(“Slider”);
k1 = 1; // 1st hold keyframe
k2 = 2; // 2nd hold keyframe
p = thisProperty;
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)secondly, one which changes the time in which the animation starts
s =effect(“Slider Control2”)(“Slider”);
t = time + s;
valueAtTime(t)However, for the life of me I can’t seem to get them to work together, I’ve tried all sorts of things but to no avail.
Anyway the situation is,
I have a call out which has a short animation allowing it to pop onto the screen. After 10 seconds it then plays its outro animation in which its gone. Thats fantastic… if every single call out could be read or needed to last 10 seconds. However, I want this to be as dynamic as possible.
I’ve connected it to a controll null with a slider, but for ease of use i’ve just added the slider to the actual object.
All I want to do is be able to have 2 sliders, 1 which changes the duration that the animation between 2 key frames takes ( extending or decreasing my 10 second animation ) and a second slider which controls when this animation is played, increasing or decreasing the time in which the animation will start
IE:
time slider: 10
delay slider: 30animation plays at 00:30:00 and lasts 10 seconds
time slider: 20
delay slider: 100animation plays at 01:40:00 and lasts 20 seconds
holdTime =effect("Slider Control")("Slider");
k1 = 1; // 1st hold keyframe
k2 = 2; // 2nd hold keyframe
p = thisProperty;
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)s =effect("Slider Control2")("Slider");
t = time + s;
valueAtTime(t)