gabwebdesign
10/12/2017 - 3:17 PM

Counter

Counter

var _foo = {_bar:15};
var _currentBar = _foo._bar;

function counter(){
	TweenMax.to(_foo, _foo._bar, { _bar: 0, roundProps: "_bar", ease:Linear.easeNone, onUpdate: function() {
		// console.log("update") //fires 60 times per second
		if(_currentBar != this.target._bar) {
		// $('#container').text(this.target._bar);
		console.log("seconds left " + this.target._bar) // fires once per second. 
		_currentBar = this.target._bar
		}
		if(_currentBar<=0)_tl.pause();
	}});
}