Jump to content
GreenSock

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

TimelineMax

.getChildren()

.getChildren( nested:Boolean, tweens:Boolean, timelines:Boolean, ignoreBeforeTime:Number ) : Array

Returns an array containing all the tweens and/or timelines nested in this timeline.

Parameters

nested: Boolean

(default = true) — Determines whether or not tweens and/or timelines that are inside nested timelines should be returned. If you only want the “top level” tweens/timelines, set this to false.

tweens: Boolean

(default = true) — Determines whether or not tweens (TweenLite and TweenMax instances) should be included in the results

timelines: Boolean

(default = true) — Determines whether or not timelines (TimelineLite and TimelineMax instances) should be included in the results

ignoreBeforeTime: Number

Number (default = -9999999999) — All children with start times that are less than this value will be ignored.

Details

Returns an array containing all the tweens and/or timelines nested in this timeline. Callbacks (delayed calls) are considered zero-duration tweens.

Example

//first, let's set up a master timeline and nested timeline:
var master = new TimelineLite(),
nestedTimeline = new TimelineLite();
//drop 2 tweens into the nested timeline
nestedTimeline.to("#e1", 1, {x:100})
.to("#e2", 2, {y:200});
//drop 3 tweens into the master timeline
master.to("#e3", 1, {top:200})
.to("#e4", 1, {left:100})
.to("#e5", 1, {backgroundColor:"red"});
//nest the timeline:
master.add(nestedTimeline);

//now let's get only the direct children of the master timeline:
var children = master.getChildren(false, true, true, 0);
console.log(children.length); //"3" (2 tweens and 1 timeline)
//get all of the tweens/timelines (including nested ones) that occur AFTER 0.5 seconds
children = master.getChildren(true, true, true, 0.5);
console.log(children.length); //"5" (4 tweens and 1 timeline)
//get only tweens (not timelines) of master (including nested tweens):
children = master.getChildren(true, true, false, 0);
console.log(children.length); //"5" (5 tweens)
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.
×