Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

Timeline

.addLabel()

.addLabel( label:String, position:* ) : *

Adds a label to the timeline, making it easy to mark important positions/times.

Parameters

label: String

The name of the label

position: *

Controls the placement of the label in the timeline (by default, it’s the end of the timeline, like “+=0”). Use a number to indicate an absolute time in terms of seconds (or frames for frames-based timelines), or you can use a string with a “+=” or “-=” prefix to offset the insertion point relative to the END of the timeline. For example, "+=2" would place the label 2 seconds after the end, leaving a 2-second gap. "-=2" would create a 2-second overlap. You may also use a label like "myLabel" to have the label inserted exactly at the label or combine a label and a relative offset like "myLabel+=2" to insert the label 2 seconds after “myLabel” or "myLabel-=3" to insert it 3 seconds before “myLabel”. If you define a label that doesn’t exist yet, it will automatically be added to the end of the timeline before inserting the label there which can be quite convenient. Be sure to read our tutorial Understanding the Position Parameter which includes interactive timeline visualizations and a video.

Returns : *

self (makes chaining easier)

Details

Adds a label to the timeline, making it easy to mark important positions/times. You can then reference that label in other methods, like seek("myLabel") or add(myTween, "myLabel") or reverse("myLabel"). You could also use the timeline.add() method to insert a label.

Be sure to read our tutorial Understanding the Position Parameter which includes interactive timeline visualizations and a video.

Be sure to read our tutorial Understanding the Position Parameter which includes interactive timeline visualizations and a video.

Copyright 2017, GreenSock. All rights reserved. This work is subject to theterms of useor for Club GreenSock members, the software agreement that was issued with the membership.
×