恢复动画速度为三档
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
// 根据路径长度精确计算小球位置
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
},
|
||||
"ConnectionAnimation_speed": {
|
||||
"name": "动画速度",
|
||||
"tooltip": "设置连线动画的速度(0.5-3,数值越大越快)。"
|
||||
"tooltip": "设置连线动画的速度(1-3,数值越大越快)。"
|
||||
},
|
||||
"ConnectionAnimation_samplingLevel": {
|
||||
"name": "采样强度",
|
||||
|
||||
Reference in New Issue
Block a user