mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-17 20:41:38 +08:00
[ts] Player, if config.success set an animation but not a viewport, set a viewport.
This commit is contained in:
parent
99f8cba35f
commit
cae8b6036e
@ -454,7 +454,8 @@ module spine {
|
|||||||
|
|
||||||
if (config.success) config.success(this);
|
if (config.success) config.success(this);
|
||||||
|
|
||||||
if (!this.animationState.getCurrent(0)) {
|
let entry = this.animationState.getCurrent(0);
|
||||||
|
if (!entry) {
|
||||||
if (this.config.animation)
|
if (this.config.animation)
|
||||||
this.setAnimation(this.config.animation);
|
this.setAnimation(this.config.animation);
|
||||||
else {
|
else {
|
||||||
@ -462,7 +463,8 @@ module spine {
|
|||||||
entry.trackEnd = 100000000;
|
entry.trackEnd = 100000000;
|
||||||
this.setViewport(entry.animation);
|
this.setViewport(entry.animation);
|
||||||
}
|
}
|
||||||
}
|
} else if (!this.currentViewport)
|
||||||
|
this.setViewport(entry.animation);
|
||||||
}
|
}
|
||||||
|
|
||||||
private setupInput () {
|
private setupInput () {
|
||||||
@ -728,20 +730,22 @@ module spine {
|
|||||||
height: this.currentViewport.height + (this.currentViewport.padBottom as number) + (this.currentViewport.padTop as number)
|
height: this.currentViewport.height + (this.currentViewport.padBottom as number) + (this.currentViewport.padTop as number)
|
||||||
};
|
};
|
||||||
|
|
||||||
let transitionAlpha = ((performance.now() - this.viewportTransitionStart) / 1000) / config.viewport.transitionTime;
|
if (this.previousViewport) {
|
||||||
if (this.previousViewport && transitionAlpha < 1) {
|
let transitionAlpha = ((performance.now() - this.viewportTransitionStart) / 1000) / config.viewport.transitionTime;
|
||||||
let oldViewport = {
|
if (transitionAlpha < 1) {
|
||||||
x: this.previousViewport.x - (this.previousViewport.padLeft as number),
|
let oldViewport = {
|
||||||
y: this.previousViewport.y - (this.previousViewport.padBottom as number),
|
x: this.previousViewport.x - (this.previousViewport.padLeft as number),
|
||||||
width: this.previousViewport.width + (this.previousViewport.padLeft as number) + (this.previousViewport.padRight as number),
|
y: this.previousViewport.y - (this.previousViewport.padBottom as number),
|
||||||
height: this.previousViewport.height + (this.previousViewport.padBottom as number) + (this.previousViewport.padTop as number)
|
width: this.previousViewport.width + (this.previousViewport.padLeft as number) + (this.previousViewport.padRight as number),
|
||||||
};
|
height: this.previousViewport.height + (this.previousViewport.padBottom as number) + (this.previousViewport.padTop as number)
|
||||||
viewport = {
|
};
|
||||||
x: oldViewport.x + (viewport.x - oldViewport.x) * transitionAlpha,
|
viewport = {
|
||||||
y: oldViewport.y + (viewport.y - oldViewport.y) * transitionAlpha,
|
x: oldViewport.x + (viewport.x - oldViewport.x) * transitionAlpha,
|
||||||
width: oldViewport.width + (viewport.width - oldViewport.width) * transitionAlpha,
|
y: oldViewport.y + (viewport.y - oldViewport.y) * transitionAlpha,
|
||||||
height: oldViewport.height + (viewport.height - oldViewport.height) * transitionAlpha
|
width: oldViewport.width + (viewport.width - oldViewport.width) * transitionAlpha,
|
||||||
};
|
height: oldViewport.height + (viewport.height - oldViewport.height) * transitionAlpha
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let viewportSize = this.scale(viewport.width, viewport.height, this.canvas.width, this.canvas.height);
|
let viewportSize = this.scale(viewport.width, viewport.height, this.canvas.width, this.canvas.height);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user