.removeLabel()

.removeLabel( label:String ) : *
从时间轴中删除标记。你也可以使用remove()方法来移除。
.removeLabel()适用于TimelineMaxTimelineLite

.removeLabel()的参数

参数 类型 必填 说明
label String 标记的名称

.removeLabel()效果展示

  • HTML
  • CSS
  • JS
  • 展示
.box {
    width:50px;
    height:50px;
    border-radius:6px;
    margin-top:4px;
  }
.green{
    background-color:#6fb936;
  }
panel= document.getElementById("panel");
myFunction = function(param){
  panel.innerHTML='移除了标签(时间点'+param+')';
}

var tm = new TimelineMax();
tm.to(".box", 5, {x:500});
tm.addLabel("mylabel", "-=1")
labelTime = tm.getLabelTime("mylabel")
tm.removeLabel("mylabel");

tm.addCallback(myFunction, "+=0", [labelTime]);
重播

.removeLabel()返回值

*返回该时间轴以便链式调用(注意版本区别)。

转载原创文章请注明:文章转载自:TweenMax中文网 [https://www.tweenmax.com.cn]
本文地址:https://www.tweenmax.com.cn/api/timelinemax/removeLabel()