.isActive( ) : Boolean
只有在非进行状态下才可以转换动画方向,我们使用isActive()来确保补间在激活时不能改变其方向。
body, html {
font-family: Signika Negative, sans-serif;
background: #111;
color:#efefef;
height:100%;
}
.wrapper {
width:400px;
height:100px;
background:#444;
margin-bottom:10px;
}
.box {
width:100px;
height:100px;
background:#88ce02;
}
button {
margin:10px 0;
padding:10px;
}
var endX = 300;
var tween = TweenMax.to('.box', 2, {x:endX, ease:Linear.easeNone}).reverse();
tweenBox=document.getElementById("tweenBox")
tweenBox.onclick=function(){
if(!tween.isActive()){
//only reverse the direction if the tween is not active
tween.reversed(!tween.reversed())
}
}
转载原创文章请注明:文章转载自:TweenMax中文网 [https://www.tweenmax.com.cn]
本文地址:https://www.tweenmax.com.cn/api/tweenmax/isActive()