Jump to content
Search Community

What's the cleanest way to kill a gsap.quickTo() ?

Michaël Garcia test
Moderator Tag

Go to solution Solved by Cassie,

Recommended Posts

I'm using a lot of quickTo methods on several pages of my website. Since I'm using AJAX, I'd love to kill every tween on each transition. 
I've been wondering how to properly kill a gsap.quickTo() ?

 

xTo = gsap.quickTo(object.position, "x", {duration: 0.6, ease: "power3"})

 

The following line doesn't work and create an error :

 

xTo.kill() // creates an error

 

Is my quickTo() method properly killed if I'm using instead this line (which doesn't return an error):

 

gsap.killTweensOf(xTo)

 

Thank you very much!

Link to comment
Share on other sites

  • Solution

Heya - I'd have to double check with @GreenSock - but I don't think you have to kill a quickTo. quickTo is a just a function that pipes values to a tween.

You can kill the associated tween, or as you suggested TweensOf, but I don't think you need to do anything more than that?
 

let xTo = gsap.quickTo("#id", "x", {duration: 0.8});

xTo(100); // animate to 100
xTo.tween.kill(); // kill the tween

 

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