UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

59 lines (45 loc) 1.32 kB
"use strict"; var noop = require("../../core/utils/common").noop, Class = require("../../core/class"), abstract = Class.abstract, animationFrame = require("../../animation/frame"); var Animator = Class.inherit({ ctor: function ctor() { this._finished = true; this._stopped = false; this._proxiedStepCore = this._stepCore.bind(this); }, start: function start() { this._stopped = false; this._finished = false; this._stepCore(); }, stop: function stop() { this._stopped = true; animationFrame.cancelAnimationFrame(this._stepAnimationFrame); }, _stepCore: function _stepCore() { if (this._isStopped()) { this._stop(); return; } if (this._isFinished()) { this._finished = true; this._complete(); return; } this._step(); this._stepAnimationFrame = animationFrame.requestAnimationFrame(this._proxiedStepCore); }, _step: abstract, _isFinished: noop, _stop: noop, _complete: noop, _isStopped: function _isStopped() { return this._stopped; }, inProgress: function inProgress() { return !(this._stopped || this._finished); } }); module.exports = Animator;