Skip to content

Commit

Permalink
[ts][pixi-v8] Fixed _updateAndApplyState name
Browse files Browse the repository at this point in the history
  • Loading branch information
davidetan committed Nov 13, 2024
1 parent fbadd25 commit 886f842
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions spine-ts/spine-pixi-v8/example/slot-objects.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
// from one animation to the next.
spineboy.state.data.defaultMix = 0.2;

// Set animation "run" on track 0, looped.
spineboy.state.setAnimation(0, "walk", true);

// Center the spine object on screen.
spineboy.x = window.innerWidth / 2;
spineboy.y = window.innerHeight / 2 + spineboy.getBounds().height / 2;

// Set animation "run" on track 0, looped.
spineboy.state.setAnimation(0, "walk", true);

// Add the display object to the stage.
app.stage.addChild(spineboy);

Expand Down Expand Up @@ -126,6 +126,7 @@
// for clipping attachments having slot objects
setTimeout(() => {
spineboy.state.setAnimation(0, "portal", true)
spineboy.update(0)
const tooth3 = PIXI.Sprite.from('raptor_jaw');
tooth3.scale.set(2);
tooth3.x = -60;
Expand Down
6 changes: 3 additions & 3 deletions spine-ts/spine-pixi-v8/src/Spine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export class Spine extends ViewContainer {
protected internalUpdate (_deltaFrame: any, deltaSeconds?: number): void {
// Because reasons, pixi uses deltaFrames at 60fps.
// We ignore the default deltaFrames and use the deltaSeconds from pixi ticker.
this._updateAndApplySpine(deltaSeconds ?? Ticker.shared.deltaMS / 1000);
this._updateAndApplyState(deltaSeconds ?? Ticker.shared.deltaMS / 1000);
}

get bounds () {
Expand Down Expand Up @@ -347,7 +347,7 @@ export class Spine extends ViewContainer {
*
* @param time the time at which to set the state
*/
private _updateAndApplySpine (time: number) {
private _updateAndApplyState (time: number) {
this.hasNeverUpdated = false;

this.state.update(time);
Expand Down Expand Up @@ -799,7 +799,7 @@ export class Spine extends ViewContainer {

if (skeletonBounds.minX === Infinity) {
if (this.hasNeverUpdated) {
this._updateAndApplySpine(0);
this._updateAndApplyState(0);
this._boundsDirty = false;
}
this._validateAndTransformAttachments();
Expand Down

0 comments on commit 886f842

Please sign in to comment.