m4chei Posted March 22, 2021 Share Posted March 22, 2021 I tried implementing state-transitions with Vue.js 3 and gsap, like in the example of the Vue.js 3 documentation: https://v3.vuejs.org/guide/transitions-state.html#organizing-transitions-into-components This example rounds to fullNumbers. In my little project, I don't want the numbers to be rounded, but gsap.to() seems to round to a floating point precision of 4 (e.g. 0.00049 is rounded to 0.0005). Is there a way, I can increase the precision of gsap.to() so that my small numbers are not always rounded to 0? gsap.to is used like this: tween(newValue, oldValue) { gsap.to(this.$data, { duration: 0.5, tweeningValue: newValue, ease: 'sine' }); } Thanks! See the Pen oNBvZMj by lmachegger (@lmachegger) on CodePen Link to comment Share on other sites More sharing options...
Solution akapowl Posted March 22, 2021 Solution Share Posted March 22, 2021 Hey @m4chei I am not entirely sure, but maybe this thread can help Welcome to the forums. Link to comment Share on other sites More sharing options...
m4chei Posted March 22, 2021 Author Share Posted March 22, 2021 Hi @akapowl This did indeed get me a step further, I updated my codepen to use this plugin. Sadly I don't really understand whats happening in this plugin. Is there a way I can set the number of decimals to a specific value (in my case I would need 8)? Ideally it would be great, if the animation would consider the number of decimals of the target value. But I could work with a solution where I can specify the number of decimals to a fixed value, since in my case I always need 8 decimals Thanks Link to comment Share on other sites More sharing options...
m4chei Posted March 22, 2021 Author Share Posted March 22, 2021 Ok I actually found a solution. When gsap provides the full precision, I can do the rounding by myself with a computed property. updated the Codepen Thanks for the help! 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now