onReverseCompleteParams

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

onReverseCompleteParams: Array
传递给onReverseComplete函数的参数数组。

new TimelineMax({onReverseComplete: myFunction, onReverseCompleteParams: ["param1", "param2"]}); 

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

onReverseCompleteParams的参数

onReverseCompleteParams 示例



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

onReverseCompleteParams返回值

onReverseCompleteParams的补充说明