Jump to content
GreenSock

y_nk

about onUpdate and RoundPropsPlugin

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,

 

I'm fairly good user of the lib, which i find awesome. thanks ;)

I'm having this case right now where i tween a plain numeric value, which i round with the roundProps plugin, and to which i react whenever there's an update with the onUpdate() hook. As the tween runs, the onUpdate() function is fired for every single step on the way, ignoring the fact that the value is rounded in post treatment by the plugin, firing unnecessary onUpdates on the way. Is there a way to prevent that ?

 

Quite simple example :

 

let wrapper = { index: 0, length : 0 };

TweenMax.killAll();

TweenMax.to(wrapper, 2, {
  length: 10
, roundProps: 'length'
, onUpdate: value => {
    console.log(wrapper.length)
  }
})

 

Thanks for the help,

J.

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