How to tween an integer variable using TweenMax?

Ashkan Ghodrat picture Ashkan Ghodrat · Jul 21, 2013 · Viewed 12.5k times · Source

How to tween an integer variable using Greensock:TweenMax,TweenLite in javascript?

Answer

Ashkan Ghodrat picture Ashkan Ghodrat · Jul 21, 2013
 var counter = { var: 0 };
 TweenMax.to(counter, 5, {
      var: 100, 
      onUpdate: function () {
          console.log(Math.ceil(counter.var));
      },
      ease:Circ.easeOut
  });

it starts from 0 to 100 in 5 seconds.

sample code