onCompleteParams

onCompleteParams: Array
传递给 onComplete 函数的参数数组。
new TimelineMax({onComplete: myFunction, onCompleteParams: ["param1", "param2"]}); 
如果想传递时间轴对象本身,可使用{self},如 onCompleteParams:["{self}", "param2"]
onCompleteParams适用于TimelineMaxTimelineLite

onCompleteParams效果展示

  • HTML
  • CSS
  • JS
  • 展示
.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是传递的字符串
}
重播

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