@@ -6,16 +6,25 @@ import cloneDeep from 'lodash/cloneDeep';
66import { baseTransform } from '@/store/stageInterface' ;
77import { generateTimelineObj } from '@/Core/controller/stage/pixi/animations/timeline' ;
88import { 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