Jump to content
GreenSock

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

TweenLite.killTweensOf()

TweenLite.killTweensOf( target:Object, onlyActive:Boolean, vars:Object ) :

[static] Kills all the tweens (or specific tweening properties) of a particular object or delayedCalls to a particular function.

Parameters

target: Object

Object whose tweens should be killed immediately or selector text to feed the selector engine to find the target(s).

onlyActive: Boolean

(default = false) — If true, only tweens that are currently active will be killed (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).

vars: Object

(default = null) — To kill only specific properties, use a generic object containing enumerable properties corresponding to the ones that should be killed like {x:true, y:true}. The values assigned to each property of the object don’t matter – the sole purpose of the object is for iteration over the named properties (in this case, x and y). If no object (or null) is defined, all matched tweens will be killed in their entirety.

Details

Kills all the tweens (or specific tweening properties) of a particular object or delayedCalls to a particular function. If, for example, you want to kill all tweens of myObject, you'd do this:

TweenLite.killTweensOf(myObject);

To kill only active (currently animating) tweens of myObject, you'd do this:

TweenLite.killTweensOf(myObject, true);

To kill only particular tweening properties of the object, use the third parameter. For example, if you only want to kill all the tweens ofmyObject.opacity and myObject.x, you'd do this:

TweenLite.killTweensOf(myObject, false, {opacity:true, x:true});

To kill all the delayedCalls that were created like TweenLite.delayedCall(5, myFunction);, you can simply callTweenLite.killTweensOf(myFunction); because delayedCalls are simply tweens that have their target and onComplete set to the same function (as well as a delay of course).

As of version 1.8.0, you can also pass in a string that defines selector text, like "#myID" to kill the tweens of the element with an ID of "myID". If you load jQuery, you can do more complex things like ".myClass" or "tagname", etc.

killTweensOf() affects tweens that haven't begun yet too. If, for example, a tween of myObject has a delay of 5 seconds andTweenLite.killTweensOf(mc) is called 2 seconds after the tween was created, it will still be killed even though it hasn't started yet.

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