Jump to content
GreenSock

TimelineMax

.getLabelsArray()

.getLabelsArray( ) : Array

Returns an Array of label objects, each with a "time" and "name" property, in the order that they occur in the timeline.

Returns : Array

An array of generic objects (one for each label) with a “name” property and a “time” property in the order they occur in the TimelineMax.

Details

Returns an Array of label objects, each with a "time" and "name" property, in the order that they occur in the timeline. For example, to loop through all the labels in order and console.log() them to the screen:

var labels = myTimeline.getLabelsArray();
for (var i = 0; i < labels.length; i++) {
console.log("label name: " + labels[i].name + ", time: " + labels[i].time);
}

Note: changing the values in this array will have no effect on the actual labels inside the TimelineMax. To add/remove labels, use the corresponding methods (addLabel(), removeLabel()).

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.
×