onCompleteParams

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

onCompleteParams: Array
传递给 onComplete 函数的参数数组。

new TimelineMax({onComplete: myFunction, onCompleteParams: ["param1", "param2"]}); 

如果想传递时间轴对象本身,可使用{self},如 onCompleteParams:["{self}", "param2"]
onCompleteParams适用于TimelineMaxTimelineLite

onCompleteParams的参数

onCompleteParams 示例


.box {
    width:50px;
    height:50px;
    border-radius:6px;
    margin-top:4px;
    display:inline-block
}
.green{
    background-color:#6fb936;
}
var tm= new TimelineMax({onComplete: myFunction, onCompleteParams: ["{self}", "param2"]})
tm.to('.box', 2, {x: 500});
panel = document.getElementById("panel");
function myFunction(param1, param2){
  panel.innerHTML = '传递的数值是'+param1 + param2;
  //param1是此时间轴对象,param2是传递的字符串
}

onCompleteParams返回值

onCompleteParams的补充说明