当前位置: 首页 > 文档资料 > TweenMax 中文文档 >

onCompleteParams

优质
小牛编辑
135浏览
2023-12-01

onCompleteParams: Array
传递给onComplete函数的参数数组,例如

TweenLite.to(element, 1, {
    left:"100px", 
    onComplete:myFunction, 
    onCompleteParams:[element, "param2"]
}); 

如果想传递动画对象本身,可以使用{self}

onCompleteParams:["{self}", "param2"]

onCompleteParams适用于TweenMaxTweenLite

onCompleteParams的参数

onCompleteParams 示例


.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;
}

onCompleteParams返回值

onCompleteParams的补充说明