diff --git a/spine-ts/spine-construct3/src/aces.json b/spine-ts/spine-construct3/src/aces.json index 81ac3b657..54fbb3bcd 100644 --- a/spine-ts/spine-construct3/src/aces.json +++ b/spine-ts/spine-construct3/src/aces.json @@ -207,10 +207,7 @@ { "id": "units", "type": "combo", - "items": [ - "seconds", - "ratio" - ] + "items": ["seconds", "ratio"] }, { "id": "time", @@ -221,6 +218,25 @@ "type": "number" } ] + }, + { + "id": "set-animation-mix", + "scriptName": "SetAnimationMix", + "highlight": false, + "params": [ + { + "id": "from-name", + "type": "string" + }, + { + "id": "to-name", + "type": "string" + }, + { + "id": "duration", + "type": "number" + } + ] } ], "expressions": [ diff --git a/spine-ts/spine-construct3/src/c3runtime/actions.ts b/spine-ts/spine-construct3/src/c3runtime/actions.ts index cf65d94ce..f69d77d3c 100644 --- a/spine-ts/spine-construct3/src/c3runtime/actions.ts +++ b/spine-ts/spine-construct3/src/c3runtime/actions.ts @@ -59,6 +59,10 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Acts = SetAnimationTime (this: SDKInstanceClass, units: 0 | 1, time: number, track: number) { this.setAnimationTime(units, time, track); + }, + + SetAnimationMix (this: SDKInstanceClass, fromName: string, toName: string, duration: number) { + this.setAnimationMix(fromName, toName, duration); } }; diff --git a/spine-ts/spine-construct3/src/c3runtime/instance.ts b/spine-ts/spine-construct3/src/c3runtime/instance.ts index 120aa6a61..ae924301d 100644 --- a/spine-ts/spine-construct3/src/c3runtime/instance.ts +++ b/spine-ts/spine-construct3/src/c3runtime/instance.ts @@ -249,6 +249,17 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase { } } + public setAnimationMix (fromName: string, toName: string, duration: number) { + const stateData = this.state?.data; + if (!stateData) return; + + try { + stateData.setMix(fromName, toName, duration); + } catch (error) { + console.error('[Spine] setAnimationMix error:', error); + } + } + private _setSkin () { const { skeleton } = this; if (!skeleton) return; diff --git a/spine-ts/spine-construct3/src/lang/en-US.json b/spine-ts/spine-construct3/src/lang/en-US.json index 8c648f524..bfab7acf7 100644 --- a/spine-ts/spine-construct3/src/lang/en-US.json +++ b/spine-ts/spine-construct3/src/lang/en-US.json @@ -295,6 +295,25 @@ "desc": "Track index" } } + }, + "set-animation-mix": { + "list-name": "Set animation mix", + "display-text": "Set animation mix from {0} to {1} duration {2}", + "description": "Set the blend/crossfade duration when transitioning from one animation to another", + "params": { + "from-name": { + "name": "From animation", + "desc": "Name of the animation to transition from" + }, + "to-name": { + "name": "To animation", + "desc": "Name of the animation to transition to" + }, + "duration": { + "name": "Duration", + "desc": "Blend duration in seconds" + } + } } }, "expressions": { diff --git a/spine-ts/spine-construct3/src/lang/zh-CN.json b/spine-ts/spine-construct3/src/lang/zh-CN.json index eb025683e..9d8666aa7 100644 --- a/spine-ts/spine-construct3/src/lang/zh-CN.json +++ b/spine-ts/spine-construct3/src/lang/zh-CN.json @@ -297,6 +297,25 @@ } } }, + "set-animation-mix": { + "list-name": "设置动画混合", + "display-text": "设置从动画{0}到{1}的混合时长为{2}", + "description": "设置从一个动画过渡到另一个动画时的混合/淡入淡出时长", + "params": { + "from-name": { + "name": "起始动画", + "desc": "过渡起始的动画名称" + }, + "to-name": { + "name": "目标动画", + "desc": "过渡目标的动画名称" + }, + "duration": { + "name": "时长", + "desc": "混合时长(秒)" + } + } + }, "expressions": { "double": { "description": "将数字翻倍。",