跳过主要内容

endTime

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

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

参数

  • includeRepeats:布尔值

    (默认值 =true) - 默认情况下,计算结束时间时会包含重复次数,但你可以传入参数false来阻止此操作。

返回值:[数字 | 自身实例]

时间轴根据其父时间轴的结束时间。

细节

返回动画根据父时间轴的本地时间完成的时间点。这会考虑到timeScale。例如:

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
无噪 Logo
无噪文档
中文文档 · 复刻官网
查看所有 ↗