.removeLabel()

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

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

.removeLabel()的参数

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

.removeLabel() 示例


.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()返回值

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

.removeLabel()的补充说明