@@ -11,7 +11,7 @@ import type {
1111 IAnimationCustomConstructor ,
1212 IAnimationChannelInterpolator
1313} from './executor' ;
14- import { cloneDeep , isArray , isFunction } from '@visactor/vutils' ;
14+ import { cloneDeep , isArray , isFunction , isValidNumber } from '@visactor/vutils' ;
1515import { getCustomType } from './utils' ;
1616
1717interface IAnimateExecutor {
@@ -115,8 +115,8 @@ export class AnimateExecutor implements IAnimateExecutor {
115115 }
116116
117117 parseParams ( params : IAnimationConfig , isTimeline : boolean , child ?: IGraphic ) : IAnimationConfig {
118- const totalTime = this . resolveValue ( params . totalTime , undefined , undefined ) ;
119- const startTime = this . resolveValue ( params . startTime , undefined , 0 ) ;
118+ const totalTime = this . resolveValue ( params . totalTime , child , undefined ) ;
119+ const startTime = this . resolveValue ( params . startTime , child , 0 ) ;
120120
121121 // execute只在mark层面调用,所以性能影响可以忽略
122122 // TODO 存在性能问题,如果后续调用频繁,需要重新修改
@@ -201,15 +201,14 @@ export class AnimateExecutor implements IAnimateExecutor {
201201 const customType = getCustomType ( parsedParams . custom ) ;
202202 parsedParams . customType = customType ;
203203
204- if ( totalTime ) {
205- const _totalTime = delay + delayAfter + duration + oneByOneDelay * ( this . _target . count - 2 ) ;
206- const scale = totalTime ? totalTime / _totalTime : 1 ;
207- parsedParams . delay = delay * scale ;
208- parsedParams . delayAfter = delayAfter * scale ;
209- parsedParams . duration = duration * scale ;
210- parsedParams . oneByOneDelay = oneByOneDelay * scale ;
211- ( parsedParams as IAnimationTypeConfig ) . startTime = startTime ;
212- }
204+ const _totalTime = delay + delayAfter + duration + oneByOneDelay * ( this . _target . count - 2 ) ;
205+ const scale = isValidNumber ( totalTime ) ? totalTime / _totalTime : 1 ;
206+
207+ parsedParams . delay = delay * scale ;
208+ parsedParams . delayAfter = delayAfter * scale ;
209+ parsedParams . duration = duration * scale ;
210+ parsedParams . oneByOneDelay = oneByOneDelay * scale ;
211+ ( parsedParams as IAnimationTypeConfig ) . startTime = startTime ;
213212 }
214213
215214 return parsedParams ;
0 commit comments