onRepeat: Function
在每次动画重复时(repeat
)执行此事件函数。
TweenMax.to('.box', 2, {
x: 500,
repeat:1,
onRepeat:function(){
...
}
});
重复次数0
body {
background: #f8f8f8;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0 10px;
padding: 0;
}
.box {
width:50px;
height:50px;
border-radius:6px;
margin-top:4px;
display:inline-block
}
.green{
background-color:#6fb936;
}
TweenMax.killAll();
var num = document.getElementById("num");
count = 1;
var tween = new TweenMax('.box', 3, {
x: 500,
repeat: -1,
yoyo: true,
onRepeat: function(){
num.innerHTML=count;
count++;
},
});
转载原创文章请注明:文章转载自:TweenMax中文网 [https://www.tweenmax.com.cn]
本文地址:https://www.tweenmax.com.cn/api/tweenmax/onRepeat