onCompleteParams

onCompleteParams: Array
传递给onComplete函数的参数数组,例如
TweenLite.to(element, 1, {
    left:"100px", 
    onComplete:myFunction, 
    onCompleteParams:[element, "param2"]
}); 
如果想传递动画对象本身,可以使用{self}
onCompleteParams:["{self}", "param2"]
onCompleteParams适用于TweenMaxTweenLite

onCompleteParams效果展示

  • HTML
  • CSS
  • JS
  • 展示
.box {
    width:50px;
    height:50px;
    border-radius:6px;
    margin-top:4px;
    display:inline-block
  }
.green{
    background-color:#6fb936;
  }
panel= document.getElementById("panel");
new TweenMax('.box', 3, {
    x: 500,
    onComplete:myFunction,
    onCompleteParams:["{self}", "param2 value"],
});
function myFunction(param1,param2){
    console.log(param1);
    panel.innerHTML=param2;
}
重播

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