时间轴 API
RinneTimeline 用于创建复杂的动画序列,支持嵌套、标签和双向跳转。你可以通过 rinne.timeline() 创建一个时间轴实例。
tl.to(target, values, config, position?)
Section titled “tl.to(target, values, config, position?)”向时间轴添加一个动画。
target/values/config: 与rinne.to()相同。position: 动画在时间轴上的开始位置(可选)。支持:- 绝对时间:
1000(毫秒)。 - 相对当前末尾:
"+=500","-=500"。 - 相对于上一个动画:
"<"(开始时),">"(结束时)。 - 标签引用:
"labelName","labelName+=200"。
- 绝对时间:
tl.set(target, values, position?)
Section titled “tl.set(target, values, position?)”在特定时间点立即设置属性。等同于 duration: 0 的 to 动画。
tl.call(callback, position?)
Section titled “tl.call(callback, position?)”在指定时间点触发一个回调函数。
tl.add(childTimeline, position?)
Section titled “tl.add(childTimeline, position?)”嵌套另一个时间轴。被嵌套的时间轴将跟随父级的时间轴磁头步进。
tl.addLabel(name, position?)
Section titled “tl.addLabel(name, position?)”在时间轴上定义一个标签,方便后续通过名称引用该时间点。
tl.seek(time, autoUpdate?)
Section titled “tl.seek(time, autoUpdate?)”跳转到指定的时间点(局部时间)。
autoUpdate: 默认为true,跳转后立即触发一次引擎渲染。
tl.play() / tl.pause()
Section titled “tl.play() / tl.pause()”播放或暂停当前时间轴。
tl.timeScale(scale)
Section titled “tl.timeScale(scale)”设置该时间轴的局部播放倍速。
tl.duration
Section titled “tl.duration”获取当前时间轴的总物理时长。
tl.currentTime
Section titled “tl.currentTime”获取或设置当前时间轴的局部播放时间。