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

onReverseCompleteParams

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

onReverseCompleteParams: Array
传递给onReverseComplete函数的参数数组,例如

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

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

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

onReverseCompleteParams适用于TweenMaxTweenLite

onReverseCompleteParams的参数

onReverseCompleteParams 示例


.box {
    width:50px;
    height:50px;
    border-radius:6px;
    margin-top:4px;
    display:inline-block
  }
.green{
    background-color:#6fb936;
  }
panel= document.getElementById("panel");
var tween = new TweenMax('.box', 3, {
    x: 500,
    onReverseComplete:myFunction,
    onReverseCompleteParams:["{self}", "param2 value"],
});
function myFunction(param1,param2){
    console.log(param1);
    panel.innerHTML=param2;
}
reverseBtn = document.getElementById("reverseBtn");
reverseBtn.onclick = function() {
    tween.reverse();
}

onReverseCompleteParams返回值

onReverseCompleteParams的补充说明