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
13 changes: 7 additions & 6 deletions packages/webgal/src/Core/Modules/animationFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,19 @@ export function getEnterExitAnimation(
if (isBg) {
duration = DEFAULT_BG_OUT_DURATION;
}
duration =
webgalStore.getState().stage.animationSettings.find((setting) => setting.target === target)?.exitDuration ??
duration;
const animationSettings = webgalStore
.getState()
.stage.animationSettings.find((setting) => setting.target === target);
duration = animationSettings?.exitDuration ?? duration;
// 走默认动画
let animation: IAnimationObject | null = generateUniversalSoftOffAnimationObj(realTarget ?? target, duration);
const animationName = webgalStore
.getState()
.stage.animationSettings.find((setting) => setting.target === target)?.exitAnimationName;
const animationName = animationSettings?.exitAnimationName;
if (animationName) {
logger.debug('取代默认退出动画', target);
animation = getAnimationObject(animationName, realTarget ?? target, getAnimateDuration(animationName), false);
duration = getAnimateDuration(animationName);
}
if (animationSettings) {
// 退出动画拿完后,删了这个设定
webgalStore.dispatch(stageActions.removeAnimationSettingsByTargetOff(target));
logger.debug('删除退出动画设定', target);
Expand Down
2 changes: 1 addition & 1 deletion packages/webgal/src/store/stageReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const stageSlice = createSlice({
const prev = state.animationSettings[index];
state.animationSettings.splice(index, 1);

if (prev.exitAnimationName) {
if (prev.exitAnimationName || prev.exitDuration !== undefined) {
// 如果有退出动画设定,保留一个 -off 的设定
const prevTarget = `${action.payload}-off`;
const prevSetting = {
Expand Down