Page 1 of 1

Offset last 2 keyframes by X seconds

PostPosted: 07/11/2018, 4:59 pm
by ivanparas
I'm making a text template and I need to adjust the last 2 keyframes using an expression so I can vary when the text animates out.

What I have:
A text layer with 4 position keyframes. The first to are the reveal animation, and the last 2 are the hide animation.

What I need:
I need to offset the last 2 keyframes by a number of seconds (or frames) using an expression and a slider.

Re: Offset last 2 keyframes by X seconds

PostPosted: 07/12/2018, 12:41 am
by star+circle
This should do it. The time between keyframes 2 and 3 is stretched to the new length. Slider named "End time offset" is directly on the text layer.

Code: Select all
offset = effect("End time offset")("Slider");
anim_time = time;
if(time>key(2).time) {
   if(time<key(3).time + offset){
   // stretch time
   anim_time = linear (time, key(2).time, key(3).time+offset, key(2).time, key(3).time);
   else {
   // offset time
   anim_time = time - offset;