onComplete

onComplete: Function
在动画结束时触发此回调函数。
TweenMax.to('.box', 2, {
    x: 500,
    onComplete:function(){
        ...
    }
});
onComplete适用于TweenMaxTweenLite

onComplete效果展示

  • HTML
  • CSS
  • JS
  • 展示
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='动画完成了';
    }
});
重播

转载原创文章请注明:文章转载自:TweenMax中文网 [https://www.tweenmax.com.cn]
本文地址:https://www.tweenmax.com.cn/api/tweenmax/onComplete