mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Add set-animation-time.
This commit is contained in:
parent
10edf10dce
commit
e90d5d5d82
@ -198,6 +198,29 @@
|
|||||||
"type": "number"
|
"type": "number"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "set-animation-time",
|
||||||
|
"scriptName": "SetAnimationTime",
|
||||||
|
"highlight": false,
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"id": "units",
|
||||||
|
"type": "combo",
|
||||||
|
"items": [
|
||||||
|
"seconds",
|
||||||
|
"ratio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "time",
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "track",
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"expressions": [
|
"expressions": [
|
||||||
|
|||||||
@ -55,6 +55,10 @@ C3.Plugins.EsotericSoftware_SpineConstruct3.Acts =
|
|||||||
|
|
||||||
SetAnimationSpeed (this: SDKInstanceClass, speed: number) {
|
SetAnimationSpeed (this: SDKInstanceClass, speed: number) {
|
||||||
this.setAnimationSpeed(speed);
|
this.setAnimationSpeed(speed);
|
||||||
|
},
|
||||||
|
|
||||||
|
SetAnimationTime (this: SDKInstanceClass, units: 0 | 1, time: number, track: number) {
|
||||||
|
this.setAnimationTime(units, time, track);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -228,6 +228,27 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
|
|||||||
this.animationSpeed = speed;
|
this.animationSpeed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setAnimationTime (units: 0 | 1, time: number, track: number) {
|
||||||
|
if (!this.state) return;
|
||||||
|
|
||||||
|
const trackEntry = this.state.tracks[track];
|
||||||
|
if (!trackEntry) return;
|
||||||
|
|
||||||
|
if (units === 0) {
|
||||||
|
if (time < trackEntry.animationStart || time > trackEntry.animationEnd) {
|
||||||
|
console.warn(`[Spine] Animation time ${time} is out of bounds [${trackEntry.animationStart}, ${trackEntry.animationEnd}]`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
trackEntry.trackTime = time;
|
||||||
|
} else {
|
||||||
|
if (time < 0 || time > 1) {
|
||||||
|
console.warn(`[Spine] Animation time ratio ${time} is out of bounds [0, 1]`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
trackEntry.trackTime = time * (trackEntry.animationEnd - trackEntry.animationStart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private _setSkin () {
|
private _setSkin () {
|
||||||
const { skeleton } = this;
|
const { skeleton } = this;
|
||||||
if (!skeleton) return;
|
if (!skeleton) return;
|
||||||
|
|||||||
@ -272,6 +272,29 @@
|
|||||||
"desc": "Animation speed multiplier (1.0 is normal speed)"
|
"desc": "Animation speed multiplier (1.0 is normal speed)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"set-animation-time": {
|
||||||
|
"list-name": "Set animation time",
|
||||||
|
"display-text": "Set track {2} animation time to {1} ({0})",
|
||||||
|
"description": "Set the current time of an animation on a track",
|
||||||
|
"params": {
|
||||||
|
"units": {
|
||||||
|
"name": "Units",
|
||||||
|
"desc": "Time units",
|
||||||
|
"items": {
|
||||||
|
"seconds": "Seconds (absolute time)",
|
||||||
|
"ratio": "Ratio (0.0 to 1.0)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"name": "Time",
|
||||||
|
"desc": "Time value (in seconds or as a ratio 0.0-1.0)"
|
||||||
|
},
|
||||||
|
"track": {
|
||||||
|
"name": "Track",
|
||||||
|
"desc": "Track index"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"expressions": {
|
"expressions": {
|
||||||
|
|||||||
@ -274,6 +274,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"set-animation-time": {
|
||||||
|
"list-name": "设置动画时间",
|
||||||
|
"display-text": "将轨道{2}的动画时间设置为{1}({0})",
|
||||||
|
"description": "设置轨道上动画的当前时间",
|
||||||
|
"params": {
|
||||||
|
"units": {
|
||||||
|
"name": "单位",
|
||||||
|
"desc": "时间单位",
|
||||||
|
"items": {
|
||||||
|
"seconds": "秒(绝对时间)",
|
||||||
|
"ratio": "比例(0.0到1.0)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"time": {
|
||||||
|
"name": "时间",
|
||||||
|
"desc": "时间值(秒或0.0-1.0的比例)"
|
||||||
|
},
|
||||||
|
"track": {
|
||||||
|
"name": "轨道",
|
||||||
|
"desc": "轨道索引"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"expressions": {
|
"expressions": {
|
||||||
"double": {
|
"double": {
|
||||||
"description": "将数字翻倍。",
|
"description": "将数字翻倍。",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user