onCompleteParams
优质
小牛编辑
133浏览
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;
}