Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 3 additions & 22 deletions packages/webgal/src/Core/controller/stage/pixi/PixiController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface IAnimationObject {
setStartState: Function;
setEndState: Function;
tickerFunc: PIXI.TickerCallback<number>;
getEndFilterEffect?: Function;
getEndStateEffect?: Function;
}

interface IStageAnimationObject {
Expand Down Expand Up @@ -291,33 +291,14 @@ export default class PixiStage {
const thisTickerFunc = this.stageAnimations[index];
this.currentApp?.ticker.remove(thisTickerFunc.animationObject.tickerFunc);
thisTickerFunc.animationObject.setEndState();
const webgalFilters = thisTickerFunc.animationObject.getEndFilterEffect?.() ?? {};
const endStateEffect = thisTickerFunc.animationObject.getEndStateEffect?.() ?? {};
this.unlockStageObject(thisTickerFunc.targetKey ?? 'default');
if (thisTickerFunc.targetKey) {
const target = this.getStageObjByKey(thisTickerFunc.targetKey);
if (target) {
const targetTransform = {
alpha: target.pixiContainer.alpha,
scale: {
x: target.pixiContainer.scale.x,
y: target.pixiContainer.scale.y,
},
// pivot: {
// x: target.pixiContainer.pivot.x,
// y: target.pixiContainer.pivot.y,
// },
position: {
x: target.pixiContainer.x,
y: target.pixiContainer.y,
},
rotation: target.pixiContainer.rotation,
// @ts-ignore
blur: target.pixiContainer.blur,
...webgalFilters,
};
let effect: IEffect = {
target: thisTickerFunc.targetKey,
transform: targetTransform,
transform: endStateEffect,
};
webgalStore.dispatch(stageActions.updateEffect(effect));
// if (!this.notUpdateBacklogEffects) updateCurrentBacklogEffects(webgalStore.getState().stage.effects);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,11 @@ export function generateTimelineObj(
return timeline[timeline.length - 1];
}

function getEndFilterEffect() {
const endSegment = timeline[timeline.length - 1];
const { alpha, rotation, blur, duration, scale, position, ...rest } = endSegment;
return rest;
}

return {
setStartState,
setEndState,
tickerFunc,
getEndFilterEffect,
getEndStateEffect,
Comment on lines 129 to +133
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The getEndStateEffect function is missing. This function is intended to return the final state of the animation as an ITransform object. The code currently references this function but it's not defined, which will cause a runtime error.

Here's a suggested implementation to be placed before the return statement.

  function getEndStateEffect() {
    const endSegment = timeline[timeline.length - 1];
    const { duration, ease, ...transform } = endSegment;
    return transform;
  }

};
}

Expand Down