onComplete
优质
小牛编辑
131浏览
2023-12-01
onComplete: Function
在动画结束时触发此回调函数。
TweenMax.to('.box', 2, {
x: 500,
onComplete:function(){
...
}
});
onComplete适用于TweenMaxTweenLite
onComplete的参数
onComplete 示例
body {
background: #f8f8f8;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0 10px;
padding: 0;
}
.box {
width:50px;
height:50px;
border-radius:6px;
margin-top:4px;
display:inline-block
}
.green{
background-color:#6fb936;
}
panel= document.getElementById("panel");
TweenMax.to('.box', 2, {
x: 500,
repeat: 1,
yoyo:true,
onComplete:function(){
panel.innerHTML='动画完成了';
}
});