Jump to content
Search Community

Round props fromTo tween

Wiplash test
Moderator Tag

Go to solution Solved by Carl,

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

Hi there,

 

Does anyone know how I would apply roundprops to the following tween?, I can't figure it out.

 

tl.tweenFromTo(tl.time(), tl.getLabelBefore(), {onComplete: function(){allowScroll = true;}});

 

Thanks

  • Like 1
Link to comment
Share on other sites

Interesting question, and probably the first time its come up. I was initially doubtful it would work, but it does and it should  :-P  

 

The most important thing to note is that tweenFromTo() creates a tween that tween's the time() of a timeline.

So the trick is to tell roundProps to round the "time" like so

tl.tweenFromTo(0, 10, {roundProps:"time"});

So that will advance the timeline and round time to 1-second intervals

 

demo:  http://codepen.io/GreenSock/pen/yNXvzR

 

Is that what you wanted?

  • Like 1
Link to comment
Share on other sites

Thanks, thats perfect. It's actually for a video scroll and scrub website. Might be having performance issues as it's trying to target frames of the video or times that essentially don't exist. This should help, thanks.

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