Skip to content

Commit 19c3e72

Browse files
fix: enter and exit fig duration
1 parent 61c1ef6 commit 19c3e72

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

packages/webgal/src/Core/Modules/animationFunctions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { baseTransform } from '@/store/stageInterface';
77
import { generateTimelineObj } from '@/Core/controller/stage/pixi/animations/timeline';
88
import { WebGAL } from '@/Core/WebGAL';
99
import PixiStage, { IAnimationObject } from '@/Core/controller/stage/pixi/PixiController';
10+
import { DEFALUT_FIG_IN_DURATION, DEFALUT_FIG_OUT_DURATION } from '../constants';
1011

1112
// eslint-disable-next-line max-params
1213
export function getAnimationObject(animationName: string, target: string, duration: number, writeDefault: boolean) {
@@ -56,7 +57,7 @@ export function getEnterExitAnimation(
5657
animation: IAnimationObject | null;
5758
} {
5859
if (type === 'enter') {
59-
let duration = 500;
60+
let duration = DEFALUT_FIG_IN_DURATION;
6061
if (isBg) {
6162
duration = 1500;
6263
}
@@ -76,7 +77,8 @@ export function getEnterExitAnimation(
7677
}
7778
return { duration, animation };
7879
} else {
79-
let duration = 1000;
80+
// exit
81+
let duration = DEFALUT_FIG_OUT_DURATION;
8082
if (isBg) {
8183
duration = 1500;
8284
}

packages/webgal/src/Core/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ export const STAGE_KEYS = {
77
};
88

99
export const WEBGAL_NONE = 'none';
10+
export const DEFALUT_FIG_IN_DURATION = 300;
11+
export const DEFALUT_FIG_OUT_DURATION = 450;

packages/webgal/src/Core/gameScripts/changeFigure.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { logger } from '@/Core/util/logger';
1212
import { getAnimateDuration } from '@/Core/Modules/animationFunctions';
1313
import { WebGAL } from '@/Core/WebGAL';
1414
import { baseBlinkParam, baseFocusParam, BlinkParam, FocusParam } from '@/Core/live2DCore';
15-
import { WEBGAL_NONE } from '../constants';
15+
import { DEFALUT_FIG_IN_DURATION, WEBGAL_NONE } from '../constants';
1616
/**
1717
* 更改立绘
1818
* @param sentence 语句
@@ -87,7 +87,7 @@ export function changeFigure(sentence: ISentence): IPerform {
8787
// 其他参数
8888
const transformString = getStringArgByKey(sentence, 'transform');
8989
const ease = getStringArgByKey(sentence, 'ease') ?? '';
90-
let duration = getNumberArgByKey(sentence, 'duration') ?? 500;
90+
let duration = getNumberArgByKey(sentence, 'duration') ?? DEFALUT_FIG_IN_DURATION;
9191
const enterAnimation = getStringArgByKey(sentence, 'enter');
9292
const exitAnimation = getStringArgByKey(sentence, 'exit');
9393
let zIndex = getNumberArgByKey(sentence, 'zIndex') ?? -1;

0 commit comments

Comments
 (0)