%PDF- %PDF-
Direktori : /var/www/html/shaban/laviva/wp-content/themes/levelup/assets/js/app/tools/ |
Current File : /var/www/html/shaban/laviva/wp-content/themes/levelup/assets/js/app/tools/ticker.class.js |
(function() { "use strict"; APP.TOOLS.Ticker = APP.CORE.Event_Emitter.extend({ staticInstantiate: function () { if (APP.TOOLS.Ticker.prototype.instance === null) return null; else return APP.TOOLS.Ticker.prototype.instance; }, init: function (options) { this._super(options); this.started = false; this.running = false; this.start_time = 0; this.time = 0; this.elapsed_time = 0; APP.TOOLS.Ticker.prototype.instance = this; }, start: function (run) { var that = this; this.started = true; this.start_time = +( new Date() ); this.time = 0; this.elapsed_time = 0; if (run) this.run(); }, run: function () { var that = this; this.running = true; var loop = function () { if (that.running) window.requestAnimationFrame(loop); that.tick(); }; loop(); }, stop: function () { this.running = false; }, tick: function () { if (!this.started) this.start(); this.time = +( new Date() ); this.delta = this.time - this.start_time - this.elapsed_time; this.elapsed_time = this.time - this.start_time; this.trigger('tick', [this.elapsed_time, this.time, this.start_time]); } }); })();