Skip to main content

endTime

endTime( includeRepeats:Boolean ) : [Number | self]

Returns the time at which the animation will finish according to the parent timeline's local time.

Parameters

  • includeRepeats: Boolean

    (default = true) - by default, repeats are included when calculating the end time but you can pass false to prevent that.

Returns : [Number | self]​

The end time of the timeline according to its parent timeline.

Details​

Returns the time at which the animation will finish according to the parent timeline's local time. This does factor in the timeScale. For example:

var tl = gsap.timeline();

//create a 1-second tween
var tween = gsap.to(e, { duration: 1, x: 100 });

//insert the tween at 0.5 seconds into the timeline
tl.add(tween, 0.5);

console.log(tween.endTime()); //1.5

//double the speed of the tween, thus it'll finish in half the normal time
tween.timeScale(2);

console.log(tween.endTime()); //1