Share Posted June 29, 2012 Hello I'm trying to tween a value of an object like this: var _obj = {v:0}; TweenMax.to(_obj, 1, {v:100, ease: Linear.easeNone, onUpdate:onTweenUpdate}) } function onTweenUpdate () { console.log(_obj.v) } This works fine but what it actually needs are rounded values. I thought "roundProps" would come in handy but the following change causes an error in TweenMax.js: TweenMax.to(_obj, 1, {v:100, roundProps:"v", ease: Linear.easeNone, onUpdate:onTweenUpdate}) Is this code wrong or does "roundProps" not work that way? What I actually would like to do with it is tweening the "currentAnimationFrame" of an EaselJS BitmapAnimation. I used the "onTweenUpdate" function from the example above together with Math.round() as a workaround. But it would be much nicer to tween the currentAnimationFrame directly. Any ideas anyone? Cheers Henry Link to post Share on other sites
Share Posted June 30, 2012 It sounds like maybe you forgot to load the RoundPropsPlugin JavaScript file. Right? Link to post Share on other sites
Author Share Posted July 1, 2012 Hello and thanks for your quick reply. I used TweenMax.js. According to the documentation the plugin would be included. I just run a test with RoundPropsPlugin.js loaded as well. But it makes no difference. Well - a small difference: The error comes from RoundPropsPlugin.js now. ( Uncaught ReferenceError: _tween is not defined, line:56, Tested in Firefox and Chrome ) Your answer sounds like it should work? I reduced my code to the following copy/paste example. Perhaps it helps to find out what I'm doing wrong: <!doctype html> <html> <head> <title>RoundProps Test</title> <meta charset="utf-8" /> <script type="text/javascript" src="http://www.greensock.com/js/src/TweenMax.min.js"></script> <script type="text/javascript"> //<![CDATA[ var _obj = {v:0}; TweenMax.to(_obj, 1, {v:100, roundProps:"v", ease: Linear.easeNone, onUpdate:onTweenUpdate}) function onTweenUpdate () { console.log(_obj.v) } //]]> </script> </head> <body> </body> </html> Greetings Henry Link to post Share on other sites
Share Posted July 3, 2012 Ah yes, the code was missing a "this." - good catch. Sorry about that - it should be fixed in the latest version. Link to post Share on other sites
Author Share Posted July 3, 2012 Hello Jack It perfectly works now. Thanks for fixing this so quickly. Henry Link to post Share on other sites