Skip to content

Commit bff1cdc

Browse files
Merge pull request #723 from OpenWebGAL/dev
Dev
2 parents 342886b + e051786 commit bff1cdc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1857
-878
lines changed

packages/webgal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webgal-engine",
3-
"version": "4.5.13",
3+
"version": "4.5.14",
44
"scripts": {
55
"dev": "vite --host --port 3000",
66
"build": "cross-env NODE_ENV=production tsc && vite build --base=./",
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
label: performs;
2+
choose: cherryBlossoms: cherryBlossoms | rain:rain | snow:snow | heavySnow:heavySnow;
3+
4+
label: cherryBlossoms;
5+
pixiInit;
6+
pixiPerform: cherryBlossoms;
7+
jumpLabel: performs;
8+
9+
label: rain;
10+
pixiInit;
11+
pixiPerform: rain;
12+
jumpLabel: performs;
13+
14+
label: snow;
15+
pixiInit;
16+
pixiPerform: snow;
17+
jumpLabel: performs;
18+
19+
label: heavySnow;
20+
pixiInit;
21+
pixiPerform: heavySnow;
22+
jumpLabel: performs;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
choose:Lip Sync Animation Test:demo_animation.txt | Variable interpolation test:demo_var.txt | Change Config:demo_changeConfig.txt;
1+
choose: Lip Sync Animation Test:demo_animation.txt | Variable interpolation test:demo_var.txt | Change Config:demo_changeConfig.txt | Performs:demo_performs.txt;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"name":"Default Template",
3-
"webgal-version":"4.5.13"
3+
"webgal-version":"4.5.14"
44
}
66.9 KB
Loading
36.5 KB
Loading
-823 Bytes
Binary file not shown.
26.5 KB
Loading
-22.8 KB
Binary file not shown.

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

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,25 @@ import cloneDeep from 'lodash/cloneDeep';
66
import { baseTransform } from '@/store/stageInterface';
77
import { generateTimelineObj } from '@/Core/controller/stage/pixi/animations/timeline';
88
import { WebGAL } from '@/Core/WebGAL';
9-
import PixiStage from '@/Core/controller/stage/pixi/PixiController';
9+
import PixiStage, { IAnimationObject } from '@/Core/controller/stage/pixi/PixiController';
1010

11-
export function getAnimationObject(animationName: string, target: string, duration: number) {
11+
// eslint-disable-next-line max-params
12+
export function getAnimationObject(animationName: string, target: string, duration: number, writeDefault: boolean) {
1213
const effect = WebGAL.animationManager.getAnimations().find((ani) => ani.name === animationName);
1314
if (effect) {
1415
const mappedEffects = effect.effects.map((effect) => {
1516
const targetSetEffect = webgalStore.getState().stage.effects.find((e) => e.target === target);
16-
const newEffect = cloneDeep({ ...(targetSetEffect?.transform ?? baseTransform), duration: 0 });
17+
let newEffect;
18+
19+
if (!writeDefault && targetSetEffect && targetSetEffect.transform) {
20+
newEffect = cloneDeep({ ...targetSetEffect.transform, duration: 0, ease: '' });
21+
} else {
22+
newEffect = cloneDeep({ ...baseTransform, duration: 0, ease: '' });
23+
}
24+
1725
PixiStage.assignTransform(newEffect, effect);
1826
newEffect.duration = effect.duration;
27+
newEffect.ease = effect.ease;
1928
return newEffect;
2029
});
2130
logger.debug('装载自定义动画', mappedEffects);
@@ -44,27 +53,19 @@ export function getEnterExitAnimation(
4453
realTarget?: string, // 用于立绘和背景移除时,以当前时间打上特殊标记
4554
): {
4655
duration: number;
47-
animation: {
48-
setStartState: () => void;
49-
tickerFunc: (delta: number) => void;
50-
setEndState: () => void;
51-
} | null;
56+
animation: IAnimationObject | null;
5257
} {
5358
if (type === 'enter') {
5459
let duration = 500;
5560
if (isBg) {
5661
duration = 1500;
5762
}
5863
// 走默认动画
59-
let animation: {
60-
setStartState: () => void;
61-
tickerFunc: (delta: number) => void;
62-
setEndState: () => void;
63-
} | null = generateUniversalSoftInAnimationObj(realTarget ?? target, duration);
64+
let animation: IAnimationObject | null = generateUniversalSoftInAnimationObj(realTarget ?? target, duration);
6465
const animarionName = WebGAL.animationManager.nextEnterAnimationName.get(target);
6566
if (animarionName) {
6667
logger.debug('取代默认进入动画', target);
67-
animation = getAnimationObject(animarionName, realTarget ?? target, getAnimateDuration(animarionName));
68+
animation = getAnimationObject(animarionName, realTarget ?? target, getAnimateDuration(animarionName), false);
6869
duration = getAnimateDuration(animarionName);
6970
// 用后重置
7071
WebGAL.animationManager.nextEnterAnimationName.delete(target);
@@ -76,15 +77,11 @@ export function getEnterExitAnimation(
7677
duration = 1500;
7778
}
7879
// 走默认动画
79-
let animation: {
80-
setStartState: () => void;
81-
tickerFunc: (delta: number) => void;
82-
setEndState: () => void;
83-
} | null = generateUniversalSoftOffAnimationObj(realTarget ?? target, duration);
80+
let animation: IAnimationObject | null = generateUniversalSoftOffAnimationObj(realTarget ?? target, duration);
8481
const animarionName = WebGAL.animationManager.nextExitAnimationName.get(target);
8582
if (animarionName) {
8683
logger.debug('取代默认退出动画', target);
87-
animation = getAnimationObject(animarionName, realTarget ?? target, getAnimateDuration(animarionName));
84+
animation = getAnimationObject(animarionName, realTarget ?? target, getAnimateDuration(animarionName), false);
8885
duration = getAnimateDuration(animarionName);
8986
// 用后重置
9087
WebGAL.animationManager.nextExitAnimationName.delete(target);

0 commit comments

Comments
 (0)