Jump to content
GreenSock

martis

Update end value of tween while its tweening?

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

Is there a way to use onUpdate or pass a function to an end value to update the end value of a tween?

 

Thanks!

Link to comment
Share on other sites

Hi martis :)

 

yep , pls try like this :

var tween = TweenMax.to(".blue",2,{x:500});

$("#btn").on("click", function() {
var time = tween.time();
tween.vars.css.x = 100;
tween.seek(0).invalidate().seek(time);
});

See the Pen PPoyor by MAW (@MAW) on CodePen

Link to comment
Share on other sites

Thanks Diaco, this is awesome!

 

Now for the hard question  :-P

 

What if I have a tween within a long timeline that I want to change on the fly?

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