From 06eeb9b59644971d93e6dd9207ac447864e527b9 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期二, 03 六月 2025 17:38:08 +0800 Subject: [PATCH] 动态溯源(待完成) --- src/model/FrameAnimation.js | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/model/FrameAnimation.js b/src/model/FrameAnimation.js index ad4dd8c..211fa0f 100644 --- a/src/model/FrameAnimation.js +++ b/src/model/FrameAnimation.js @@ -17,6 +17,7 @@ this.isPause = false; this.isRunning = false; + this.isStop = true; // 鏄惁寮�鍚姩鎬佺粯鍒堕�熷害 this.dynamicSpeed = false; // 姣忎釜浠诲姟鑰楁椂锛堢锛� @@ -27,12 +28,13 @@ FrameAnimation.prototype = { start: function () { - if (this.intervalFlag != undefined) { - this.isPause = false; - } else { - this.isRunning = true; + // 涓嶅瓨鍦ㄥ姩鐢讳换鍔℃椂閲嶆柊寮�濮嬶紝鍚﹀垯缁х画 + if (this.intervalFlag == undefined) { this._doTask(); } + this.isPause = false; + this.isStop = false; + this.isRunning = true; }, /** * 鍔ㄦ�佸姩鐢婚�熷害 @@ -65,8 +67,11 @@ }, pause: function () { this.isPause = true; + this.isRunning = false; }, stop: function () { + if (this.isStop) return; + if (this.intervalFlag != undefined) { clearInterval(this.intervalFlag); this.intervalFlag = undefined; @@ -85,7 +90,9 @@ this.isRunning = false; this.isPause = false; + this.isStop = true; this.lastestTime = undefined; + this.speed = 1; }, setOnStopCallback: function (callback) { this.onStopCallback = callback; @@ -118,14 +125,15 @@ if (this.isPause) { return; } - if (index >= t.count) { + // 缁樺埗3D鍥惧舰鏃讹紝鏈�灏戦渶瑕�2涓偣鎵嶅彲缁樺埗鍥惧舰 + // 鍥犳姝ゅ绱㈠紩鍙埌鍊掓暟绗簩涓偣灏辩粨鏉� + if (index >= t.count - 1) { this._endTask(this.intervalFlag); return; } t.task(t.data, index, t.count); index += this.speed; - // console.log("_doTask:" + index); }, this.timeout); } }, -- Gitblit v1.9.3