mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-06 10:46:53 +08:00
Removed animation speed in favor or AnimationState.timeScale. Add expression to get its value.
This commit is contained in:
parent
0347e5f6ab
commit
a94b17292d
@ -266,12 +266,12 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "set-animation-speed",
|
||||
"scriptName": "SetAnimationSpeed",
|
||||
"id": "set-time-scale",
|
||||
"scriptName": "SetTimeScale",
|
||||
"highlight": false,
|
||||
"params": [
|
||||
{
|
||||
"id": "speed",
|
||||
"id": "time-scale",
|
||||
"type": "number"
|
||||
}
|
||||
]
|
||||
@ -719,6 +719,12 @@
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "time-scale",
|
||||
"expressionName": "TimeScale",
|
||||
"highlight": false,
|
||||
"returnType": "number"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -85,8 +85,8 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Acts =
|
||||
this.setCustomSkin(skinName);
|
||||
},
|
||||
|
||||
SetAnimationSpeed (this: SDKInstanceClass, speed: number) {
|
||||
this.setAnimationSpeed(speed);
|
||||
SetTimeScale (this: SDKInstanceClass, timeScale: number) {
|
||||
this.setAnimationSpeed(timeScale);
|
||||
},
|
||||
|
||||
SetAnimationTime (this: SDKInstanceClass, track: number, time: number, units: 0 | 1) {
|
||||
|
||||
@ -79,5 +79,9 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Exps =
|
||||
if (field === "animation") return this.triggeredEventData?.animation ?? 0;
|
||||
if (field === "track") return this.triggeredEventData?.track ?? -1;
|
||||
return "";
|
||||
},
|
||||
|
||||
TimeScale (this: SpineC3Instance) {
|
||||
return this.state?.timeScale ?? 1;
|
||||
}
|
||||
};
|
||||
|
||||
@ -57,7 +57,6 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
|
||||
collisionSpriteInstance?: IWorldInstance;
|
||||
collisionSpriteClassName = "";
|
||||
isPlaying = true;
|
||||
animationSpeed = 1.0;
|
||||
physicsMode = spine.Physics.update;
|
||||
customSkins: Record<string, Skin> = {};
|
||||
|
||||
@ -176,13 +175,12 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
|
||||
}
|
||||
|
||||
private update (delta: number) {
|
||||
const { state, skeleton, animationSpeed, physicsMode, matrix } = this;
|
||||
const { state, skeleton, physicsMode, matrix } = this;
|
||||
|
||||
if (!skeleton || !state) return;
|
||||
|
||||
const adjustedDelta = delta * animationSpeed;
|
||||
state.update(adjustedDelta);
|
||||
skeleton.update(adjustedDelta);
|
||||
state.update(delta);
|
||||
skeleton.update(delta);
|
||||
state.apply(skeleton);
|
||||
|
||||
this.updateHandles(skeleton, matrix);
|
||||
@ -580,7 +578,8 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
|
||||
}
|
||||
|
||||
public setAnimationSpeed (speed: number) {
|
||||
this.animationSpeed = speed;
|
||||
if (!this.state) return;
|
||||
this.state.timeScale = speed;
|
||||
}
|
||||
|
||||
public setAnimationTime (units: 0 | 1, time: number, track: number) {
|
||||
|
||||
@ -345,14 +345,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"set-animation-speed": {
|
||||
"list-name": "Set animation speed",
|
||||
"display-text": "Set animation speed to {0}",
|
||||
"description": "Set the playback speed of animations (1.0 = normal, 2.0 = double speed, 0.5 = half speed)",
|
||||
"set-time-scale": {
|
||||
"list-name": "Set time scale",
|
||||
"display-text": "Set time scale to {0}",
|
||||
"description": "Set the time scale of animations (1.0 = normal, 2.0 = double speed, 0.5 = half speed)",
|
||||
"params": {
|
||||
"speed": {
|
||||
"name": "Speed",
|
||||
"desc": "Animation speed multiplier (1.0 is normal speed)"
|
||||
"time-scale": {
|
||||
"name": "Time scale",
|
||||
"desc": "Time scale multiplier (1.0 is normal speed)"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -807,6 +807,10 @@
|
||||
"desc": "The event data field to retrieve"
|
||||
}
|
||||
}
|
||||
},
|
||||
"time-scale": {
|
||||
"description": "Get the current animation time scale (speed multiplier).",
|
||||
"translated-name": "TimeScale"
|
||||
}
|
||||
},
|
||||
"custom_ui": {
|
||||
|
||||
@ -345,14 +345,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"set-animation-speed": {
|
||||
"list-name": "设置动画速度",
|
||||
"display-text": "将动画速度设置为{0}",
|
||||
"description": "设置动画播放速度(1.0 = 正常,2.0 = 两倍速,0.5 = 半速)",
|
||||
"set-time-scale": {
|
||||
"list-name": "设置时间缩放",
|
||||
"display-text": "将时间缩放设置为{0}",
|
||||
"description": "设置动画时间缩放(1.0 = 正常,2.0 = 两倍速,0.5 = 半速)",
|
||||
"params": {
|
||||
"speed": {
|
||||
"name": "速度",
|
||||
"desc": "动画速度倍数(1.0为正常速度)"
|
||||
"time-scale": {
|
||||
"name": "时间缩放",
|
||||
"desc": "时间缩放倍数(1.0为正常速度)"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -807,6 +807,10 @@
|
||||
"desc": "要检索的事件数据字段"
|
||||
}
|
||||
}
|
||||
},
|
||||
"time-scale": {
|
||||
"description": "获取当前动画时间缩放(速度倍数)。",
|
||||
"translated-name": "TimeScale"
|
||||
}
|
||||
},
|
||||
"custom_ui": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user