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

.time()

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

.time( value:Number ) : *
获取或设置当前动画时间。

var currentTime = myTween.time(); //gets current time
myTween.time(2);
//sets time, jumping to new value just like seek().

.time()适用于TweenMaxTweenLite

.time()的参数

.time() 示例


动画进行时间: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;
  }
var timeView = document.getElementById("time");
new TweenMax('.box', 3, {
    x: 500,
    onUpdate:function(){
        timeView.innerHTML=this.time().toFixed(2);
    }
});

.time()返回值

.time()的补充说明