qauMaWeb/node_modules/.cache/babel-loader/5c2b444e9e291079e52b570c0f3...

1 line
13 KiB
JSON
Raw Normal View History

2024-10-13 18:02:27 +08:00
{"ast":null,"code":"import { __extends } from \"tslib\";\nimport Eventful from '../core/Eventful.js';\nimport requestAnimationFrame from './requestAnimationFrame.js';\nimport Animator from './Animator.js';\nexport function getTime() {\n return new Date().getTime();\n}\n\nvar Animation = function (_super) {\n __extends(Animation, _super);\n\n function Animation(opts) {\n var _this = _super.call(this) || this;\n\n _this._running = false;\n _this._time = 0;\n _this._pausedTime = 0;\n _this._pauseStart = 0;\n _this._paused = false;\n opts = opts || {};\n _this.stage = opts.stage || {};\n return _this;\n }\n\n Animation.prototype.addClip = function (clip) {\n if (clip.animation) {\n this.removeClip(clip);\n }\n\n if (!this._head) {\n this._head = this._tail = clip;\n } else {\n this._tail.next = clip;\n clip.prev = this._tail;\n clip.next = null;\n this._tail = clip;\n }\n\n clip.animation = this;\n };\n\n Animation.prototype.addAnimator = function (animator) {\n animator.animation = this;\n var clip = animator.getClip();\n\n if (clip) {\n this.addClip(clip);\n }\n };\n\n Animation.prototype.removeClip = function (clip) {\n if (!clip.animation) {\n return;\n }\n\n var prev = clip.prev;\n var next = clip.next;\n\n if (prev) {\n prev.next = next;\n } else {\n this._head = next;\n }\n\n if (next) {\n next.prev = prev;\n } else {\n this._tail = prev;\n }\n\n clip.next = clip.prev = clip.animation = null;\n };\n\n Animation.prototype.removeAnimator = function (animator) {\n var clip = animator.getClip();\n\n if (clip) {\n this.removeClip(clip);\n }\n\n animator.animation = null;\n };\n\n Animation.prototype.update = function (notTriggerFrameAndStageUpdate) {\n var time = getTime() - this._pausedTime;\n\n var delta = time - this._time;\n var clip = this._head;\n\n while (clip) {\n var nextClip = clip.next;\n var finished = clip.step(time, delta);\n\n if (finished) {\n clip.ondestroy();\n this.removeClip(clip);\n clip = nextClip;\n } else {\n clip = nextClip;\n }\n }\n\n this._time = time;\n\n if (!notTriggerFrameAndStageUpdate) {\n this.trigger('frame', delta);\n this.stage.update && this.stage.update();\n }\n };\n\n Animation.prototype._startLoop = function () {\n var self = this;\n this._running = true;\n\n function step() {\n if (self._running) {\n requestAnimationFrame(step);\n !self._paused && self.update();\n }\n }\n\n requestAnimationFrame(step);\n };\n\n Animation.prototype.start = function () {\n if (this._running) {\n return;\n }\n\n this._time = getTime();\n this._pausedTime = 0;\n\n this._startLoop();\n };\n\n Animation.prototype.stop = function () {\n this._running = false;\n };\n\n Animation.prototype.pause = function () {\n if (!this._paused) {\n this._pauseStart = getTime();\n this._paused = true;\n }\n };\n\n Animation.prototype.resume = function () {\n if (this._paused) {\n this._pausedTime += getTime() - this._pauseStart;\n this._paused = false;\n }\n };\n\n Animation.prototype.clear = function () {\n var clip = this._head;\n\n while (clip) {\n var nextClip = clip.next;\n clip.prev = clip.next = clip.animation = null;\n clip = nextClip;\n }\n\n this._head = this._tail = null;\n };\n\n Animation.prototype.isFinished = function () {\n return this._head == null;\n };\n\n Animation.prototype.animate = function (target, options) {\n options = options || {};\n this.start();\n var animator = new Animator(target, options.loop);\n this.addAnimator(animator);\n return animator;\n };\n\n return Animation;\n}(Eventful);\n\nexport default Animation;","map":{"version":3,"sources":["D:/Work/WorkSpace/GitWorkSpace/TenShop/resource/ElectronicMall/src/ElectronicMallVue/node_modules/zrender/lib/animation/Animation.