Jump to content
Search Community

what is the difference between using clear() versus one of the kill methods and/or clearProps?

Jonathan test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hello all... i had a couple questions about clear and kill methods:

 

  1. What is the difference between using clear(), versus one of the kill methods and/or clearProps?
  2. Is the clear() method faster, and just clears a timeline? ...versus using one of the kill methods, or clearProps on a individual basis?
  3. Also is clear() better than using killAll()?

 

thanks ahead of time for any clarification? :)

Link to comment
Share on other sites

clear() empties a timeline of all of its child tweens, timelines and delayedCalls. After a timeline is cleared, the timeline still exists and you can still add tweens to it.

 

Once a timeline or tween is killed, it is immediately stopped and will be available for garbage collection after which point you will no longer be able to modify, control or access that tween. 

 

Individual tweens do not have a clear() method, only timelines. 

 

clearProps is just a flag that tells a specific tween to remove any or all inline styles that have been set on a DOM element by a tween. It doesn't really relate or compare to the clear() and kill() methods in any way.

 

Hope this helps clear things up.

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...