An array of tweens
GreenSock Docs (HTML5/JS)
TweenLite.getTweensOf()
[static] Returns an array containing all the tweens of a particular target (or group of targets) that have not been released for garbage collection yet which typically happens within a few seconds after the tween completes.
Parameters
target: *
The target whose tweens should be returned, or an array of such targets
onlyActive: Boolean
(default = false
) — If
true
, only tweens that are currently active will be returned (a tween is considered “active” if the virtual playhead is actively moving across the tween and it is not paused, nor are any of its ancestor timelines paused).
Returns : Array

Details
Returns an array containing all the tweens of a particular target (or group of targets) that have not been released for garbage collection yet which typically happens within a few seconds after the tween completes. For example, TweenLite.getTweensOf(myObject)
returns an array of all tweens of myObject
, even tweens that haven't begun yet. TweenLite.getTweensOf([myObject1, myObject2]);
will return a condensed array of the tweens of myObject1
plus all the tweens of myObject2
combined into one array with duplicates removed.
Since the method only finds tweens that haven't been released for garbage collection, if you create a tween and then let it finish and then a while later try to find it with getTweensOf()
, it may not be found because it was released by the engine for garbage collection. Remember, one of the best parts of GSAP is that it saves you from the headache of managing gc. Otherwise, you'd need to manually dispose each tween you create, making things much more cumbersome.
TweenLite.to(myObject1, 1, {x:100});
TweenLite.to(myObject2, 1, {x:100});
TweenLite.to([myObject1, myObject2], 1, {alpha:0});
var a1 = TweenLite.getTweensOf(myObject1); //finds 2 tweens
var a2 = TweenLite.getTweensOf([myObject1, myObject2]); //finds 3 tweens