Jump to content
Search Community

Change tween duration while its tweening

Michael71 test
Moderator Tag

Go to solution Solved by PointC,

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

Yes exactly something like this.

Can I also get the current speed? so I can gradually decrease it? 

 

This is for a loader which I'm not sure when it will finish, so I want to keep making it go slower so it doesn't end, and when it is complete to bump it to the end.

Link to comment
Share on other sites

Oh, this is for a loader. I thought there was some user interaction that was causing the change.

 

I don't have much loader knowledge, but I think you'd probably want to link the percentage of page load to the progress of the timeline in that case. 

 

Maybe someone else will jump in here with some solid advice.

 

Happy tweening.

:)

Link to comment
Share on other sites

timeScale works as a getter or setter. You could also use progress or time which also work as getters or setters.

var t = yourTween.progress(); // gets current progress
var t = yourTween.timeScale(); // gets current timeScale
var t = yourTween.time(); //gets current time

Happy tweening.

:)

  • Like 2
Link to comment
Share on other sites

FYI, duration() works as a getter or setter as well:

t.duration(newDuration); //sets
var d = t.duration(); //gets

Also, yes, you can literally tween the timeScale() using another tween:

var t = TweenLite.to(...); //your original tween
TweenLite.to(t, 1, {timeScale:0.2}); //animates the timeScale to 0.2 over the course of 1 second (slowing it down)

Making things appear to slow down can also be achieved with easing, like Power4.easeOut would start out fast and then slow to a crawl. See http://greensock.com/ease-visualizer

 

Does that help? 

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