Jump to content
GreenSock

TweenLite.onOverwrite

TweenLite.onOverwrite : Function

[static] A function that should be called when any tween gets overwritten by another tween (great for debugging).

Details

[static] A function that should be called when any tween gets overwritten by another tween (great for debugging). The following parameters will be passed to that function:

  1. overwrittenTween : Animation - the tween that was just overwritten
  2. overwritingTween : Animation - the tween did the overwriting
  3. target : Object [only passed if the overwrite mode was "auto" because that's the only case when portions of a tween can be overwritten rather than the entire thing] - the target object whose properties were overwritten. This is usually the same as overwrittenTween.target unless that's an array and the overwriting targeted a sub-element of that array. For example, TweenLite.to([obj1, obj2], 1, {x:100}) and then TweenLite.to(obj2, 1, {x:50}), the target would be obj2.
  4. overwrittenProperties : Array [only passed if the overwrite mode was "auto" because that's the only case when portions of a tween can be overwritten rather than the entire thing] - an array of property names that were overwritten, like ["x","y","opacity"].

Note: there is also an onOverwrite special property that you can apply on a tween-by-tween basis like TweenLite.to(... {x:100, onOverwrite:yourFunction}).

See it in action

Run this TweenLite.onOverwrite demo with the browser console open to see the info that gets reported when an overwrite occurs.

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