Is there an easy way to reset a JavaScript TimelineMax object?

I'm having trouble re-initializing the TimelineMax sequence. When the window size changes, I need to return all teens to their default styles and reinitialize them based on the new window size. Is there a simple way to effectively destroy the timeline and start a new one without manually resetting all CSS properties?

+5
source share
1 answer

Depending on what you are trying to achieve, I can suggest two methods.

The first is exactly the same as you describe:

myTimeline.pause(0, true); //Go back to the start (true is to suppress events)
myTimeline.remove();

This returns everything to how they were at the beginning of the timeline. You can remove any initialization properties by calling as well .invalidate().

, , , , ...
, tweens/timeline, .invalidate() ( , , ) tweening .to(), .from(), , , .

, . , , .

API/: http://api.greensock.com/js/

+10

All Articles