- TimelineMax 中文手册 / TimelineLite 中文手册
- TimelineMax()
- .add()
- .addCallback()
- .addLabel()
- .addPause()
- .remove()
- .removeCallBack()
- .removeLabel()
- .removePause()
- .to()
- .from()
- .fromTo()
- .staggerTo()
- .staggerFrom()
- .staggerFromTo()
- .set()
- delay
- paused
- useFrames
- tweens
- stagger
- align
- autoRemoveChildren
- smoothChildTiming
- repeat
- repeatDelay
- yoyo
- callbackScope
- onStart
- onStartParams
- onStartScope
- onComplete
- onCompleteParams
- onCompleteScope
- onReverseComplete
- onReverseCompleteParams
- onReverseCompleteScope
- onUpdate
- onUpdateParams
- onUpdateScope
- onRepeat
- onRepeatParams
- onRepeatScope
- .play()
- .pause()
- .paused()
- .restart()
- .resume()
- .reverse()
- .reversed()
- .seek()
- .timeScale()
- .tweenTo()
- .tweenFromTo()
- .delay()
- .repeat()
- .repeatDelay()
- .duration()
- .totalDuration()
- .progress()
- .totalProgress()
- .time()
- .totalTime()
- .endTime()
- .startTime()
- .yoyo()
- .autoRemoveChildren
- .data
- .smoothChildTiming
- .timeline
- .call()
- .clear()
- .currentLabel()
- .eventCallback()
- TimelineMax.exportRoot()
- .getActive()
- .getChildren()
- .getLabelAfter()
- .getLabelBefore()
- .getLabelsArray()
- .getLabelTime()
- .getTweensOf()
- .invalidate()
- .isActive()
- .kill()
- .recent()
- .shiftChildren()
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
.addCallback()
.addCallback( callback:Function, position:*, params:Array, scope:* ) : TimelineMax
在特定位置插入回调函数。
.addCallback()适用于TimelineMax
.addCallback()的参数
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
callback | Function | 是 | 要执行的函数 |
position | * | 否 | 插入回调函数的位置。秒或帧或标签,默认为"+=0" 。例如:
|
params | Array | 否 | 传递回调的参数数组。default = null |
scope | * | 否 | 回调调用的范围(基本上代表函数中"this"指的是什么),default = null |
.addCallback() 示例
.box {
width:50px;
height:50px;
border-radius:6px;
margin-top:4px;
}
.green{
background-color:#6fb936;
}
panel= document.getElementById("panel");
myFunction = function(){
panel.innerHTML='函数触发了!';
}
var tm = new TimelineMax();
tm.to(".box", 5, {x:500})
.addCallback(myFunction,"-=4");
console.log(tm.getChildren());
.addCallback()返回值
返回该时间轴以便链式调用。
.addCallback()的补充说明
回调函数可以被认为是一个持续时间为0的动画,因此如果你使用getChildren()
,将会为每个回调函数返回一个动画(tween),你可以通过这些动画的vars.onComplete
的内容并且duration
为零来识别出这些回调函数。
如果你想将回调追加到时间轴的末尾,那么使用call()
方法会更简洁 。此外,add()
方法也可以添加回调,但 add()
不接受参数。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论