Skip to content

Commit

Permalink
fix: fix the order of layerState when AnimatorStatePlayState.Finished (
Browse files Browse the repository at this point in the history
…galacean#774)

* fix: the order of layerState when AnimatorStatePlayState.Finished galacean#774
  • Loading branch information
luzhuang authored Apr 29, 2022
1 parent 38f77aa commit 375face
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/core/src/animation/Animator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,15 +473,6 @@ export class Animator extends Component {

eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);

if (lastPlayState === AnimatorStatePlayState.UnStarted) {
this._callAnimatorScriptOnEnter(state, layerIndex);
}
if (playState === AnimatorStatePlayState.Finished) {
this._callAnimatorScriptOnExit(state, layerIndex);
} else {
this._callAnimatorScriptOnUpdate(state, layerIndex);
}

for (let i = curves.length - 1; i >= 0; i--) {
const owner = curveOwners[i];
const value = this._evaluateCurve(owner.property, curves[i].curve, clipTime, additive);
Expand All @@ -496,6 +487,15 @@ export class Animator extends Component {
if (playState === AnimatorStatePlayState.Finished) {
layerData.layerState = LayerState.Standby;
}

if (lastPlayState === AnimatorStatePlayState.UnStarted) {
this._callAnimatorScriptOnEnter(state, layerIndex);
}
if (playState === AnimatorStatePlayState.Finished) {
this._callAnimatorScriptOnExit(state, layerIndex);
} else {
this._callAnimatorScriptOnUpdate(state, layerIndex);
}
}

private _updateCrossFade(
Expand Down

0 comments on commit 375face

Please sign in to comment.