From 949f009e15fe320ffb686a4f38e81fea82ea918f Mon Sep 17 00:00:00 2001 From: Dontdrunk <1761696257@qq.com> Date: Thu, 11 Jun 2026 15:41:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=8A=A8=E7=94=BB=E9=80=9F?= =?UTF-8?q?=E5=BA=A6=E4=B8=BA=E4=B8=89=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extensions/Online_Animation/ConnectionAnimationCore.js | 5 ++--- extensions/Online_Animation/ConnectionAnimationExt.js | 4 ++-- extensions/Online_Animation/effects/FlowEffect.js | 2 +- extensions/Online_Animation/effects/PulseEffect.js | 2 +- extensions/Online_Animation/effects/RhythmEffect.js | 4 ++-- extensions/Online_Animation/effects/WaveEffect.js | 2 +- locales/en/settings.json | 2 +- locales/zh/settings.json | 2 +- 8 files changed, 11 insertions(+), 12 deletions(-) diff --git a/extensions/Online_Animation/ConnectionAnimationCore.js b/extensions/Online_Animation/ConnectionAnimationCore.js index 0f57655..31c02e8 100644 --- a/extensions/Online_Animation/ConnectionAnimationCore.js +++ b/extensions/Online_Animation/ConnectionAnimationCore.js @@ -49,7 +49,7 @@ export class ConnectionAnimation { this._phase = 0; this._originalDrawConnections = null; this._animating = false; - this.speed = 2; // 0.5~3 + this.speed = 2; // 1~3 this.effectExtra = true; this.renderStyle = normalizeRenderStyleValue(DEFAULT_CONFIG.renderStyle); this.useGradient = true; this.circuitBoardMap = null; this.displayMode = normalizeDisplayModeValue(DEFAULT_CONFIG.displayMode); @@ -220,8 +220,7 @@ export class ConnectionAnimation { } setSpeed(speed) { - const raw = clampNumber(speed, 0.5, 3); - this.speed = clampNumber(Math.round(raw * 2) / 2, 0.5, 3); + this.speed = Math.max(1, Math.min(3, Math.round(Number(speed)))); } setEffectExtra(flag) { diff --git a/extensions/Online_Animation/ConnectionAnimationExt.js b/extensions/Online_Animation/ConnectionAnimationExt.js index 678fd16..5923217 100644 --- a/extensions/Online_Animation/ConnectionAnimationExt.js +++ b/extensions/Online_Animation/ConnectionAnimationExt.js @@ -318,8 +318,8 @@ app.registerExtension({ name: "Speed", type: "slider", defaultValue: 2, - attrs: { min: 0.5, max: 3, step: 0.5 }, - tooltip: "Adjust the animation speed (0.5-3). Higher is faster.", + attrs: { min: 1, max: 3, step: 1 }, + tooltip: "Adjust the animation speed (1-3). Higher is faster.", category: ["DD_CONNECTION_ANIMATION", "3_SETTINGS", "ANIMATION_SPEED"], onChange(value) { const connectionAnim = app.canvas?._connectionAnimation; diff --git a/extensions/Online_Animation/effects/FlowEffect.js b/extensions/Online_Animation/effects/FlowEffect.js index 3c2da19..b53b3ee 100644 --- a/extensions/Online_Animation/effects/FlowEffect.js +++ b/extensions/Online_Animation/effects/FlowEffect.js @@ -21,7 +21,7 @@ export class FlowEffect extends BaseEffect { // 虚线动画设置 const dashLen = 24, gapLen = 18; const dashCycleLen = dashLen + gapLen; - const speed = Math.max(0.5, Math.min(3, Number(this.animationManager.speed ?? 2))); + const speed = Math.max(1, Math.min(3, Number(this.animationManager.speed ?? 2))); const exponent = speed - 1; const period = 5000 / Math.pow(2, exponent); const t = ((now % period) / period); diff --git a/extensions/Online_Animation/effects/PulseEffect.js b/extensions/Online_Animation/effects/PulseEffect.js index e09035c..3670b27 100644 --- a/extensions/Online_Animation/effects/PulseEffect.js +++ b/extensions/Online_Animation/effects/PulseEffect.js @@ -15,7 +15,7 @@ export class PulseEffect extends BaseEffect { const strokeStyle = this.getPathColor(ctx, pathData); // 脉冲周期 - const speed = Math.max(0.5, Math.min(3, Number(this.animationManager.speed ?? 2))); + const speed = Math.max(1, Math.min(3, Number(this.animationManager.speed ?? 2))); const exponent = speed - 1; const period = 5000 / Math.pow(2, exponent); diff --git a/extensions/Online_Animation/effects/RhythmEffect.js b/extensions/Online_Animation/effects/RhythmEffect.js index 461ff05..21b1a2d 100644 --- a/extensions/Online_Animation/effects/RhythmEffect.js +++ b/extensions/Online_Animation/effects/RhythmEffect.js @@ -37,7 +37,7 @@ export class RhythmEffect extends BaseEffect { ctx.stroke(); // 周期时间(毫秒),不同速度有不同的周期 - const speed = Math.max(0.5, Math.min(3, Number(this.animationManager.speed ?? 2))); + const speed = Math.max(1, Math.min(3, Number(this.animationManager.speed ?? 2))); const exponent = speed - 1; const period = 7500 / Math.pow(2, exponent); @@ -58,7 +58,7 @@ export class RhythmEffect extends BaseEffect { // 应用缓动函数,使运动更加平滑流畅 // 低速度使用更强的缓动效果 - const easingType = speed <= 1.5 ? 'easeInOutCubic' : (speed <= 2.5 ? 'easeInOutQuad' : 'easeInOutSine'); + const easingType = speed <= 1 ? 'easeInOutCubic' : (speed <= 2 ? 'easeInOutQuad' : 'easeInOutSine'); t = this.applyEasing(t, easingType); // 根据路径长度精确计算小球位置 diff --git a/extensions/Online_Animation/effects/WaveEffect.js b/extensions/Online_Animation/effects/WaveEffect.js index 8884fcf..6ef221d 100644 --- a/extensions/Online_Animation/effects/WaveEffect.js +++ b/extensions/Online_Animation/effects/WaveEffect.js @@ -23,7 +23,7 @@ export class WaveEffect extends BaseEffect { // 波浪参数 const amplitude = 8 * this.animationManager.lineWidth / 3; const freq = 1 + this.animationManager.lineWidth / 8; - const speed = Math.max(0.5, Math.min(3, Number(this.animationManager.speed ?? 2))); + const speed = Math.max(1, Math.min(3, Number(this.animationManager.speed ?? 2))); const exponent = speed - 1; const period = 5000 / Math.pow(2, exponent); const baseT = ((now % period) / period); diff --git a/locales/en/settings.json b/locales/en/settings.json index 232beac..63d0055 100644 --- a/locales/en/settings.json +++ b/locales/en/settings.json @@ -74,7 +74,7 @@ }, "ConnectionAnimation_speed": { "name": "Speed", - "tooltip": "Adjust the animation speed (0.5-3). Higher is faster." + "tooltip": "Adjust the animation speed (1-3). Higher is faster." }, "ConnectionAnimation_samplingLevel": { "name": "Sampling", diff --git a/locales/zh/settings.json b/locales/zh/settings.json index 201ce71..3f6329b 100644 --- a/locales/zh/settings.json +++ b/locales/zh/settings.json @@ -74,7 +74,7 @@ }, "ConnectionAnimation_speed": { "name": "动画速度", - "tooltip": "设置连线动画的速度(0.5-3,数值越大越快)。" + "tooltip": "设置连线动画的速度(1-3,数值越大越快)。" }, "ConnectionAnimation_samplingLevel": { "name": "采样强度",