From 8a5cdab2dc7514ef2637433a8fa3b51bef0c4cfc Mon Sep 17 00:00:00 2001 From: "lixuefei.1313" Date: Mon, 5 Jan 2026 14:24:52 +0800 Subject: [PATCH 1/3] fix: fix issue about animation params support function --- .../src/executor/animate-executor.ts | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/vrender-animate/src/executor/animate-executor.ts b/packages/vrender-animate/src/executor/animate-executor.ts index 6bb5c9806..41811672d 100644 --- a/packages/vrender-animate/src/executor/animate-executor.ts +++ b/packages/vrender-animate/src/executor/animate-executor.ts @@ -11,7 +11,7 @@ import type { IAnimationCustomConstructor, IAnimationChannelInterpolator } from './executor'; -import { cloneDeep, isArray, isFunction } from '@visactor/vutils'; +import { cloneDeep, isArray, isFunction, isValidNumber } from '@visactor/vutils'; import { getCustomType } from './utils'; interface IAnimateExecutor { @@ -115,8 +115,8 @@ export class AnimateExecutor implements IAnimateExecutor { } parseParams(params: IAnimationConfig, isTimeline: boolean, child?: IGraphic): IAnimationConfig { - const totalTime = this.resolveValue(params.totalTime, undefined, undefined); - const startTime = this.resolveValue(params.startTime, undefined, 0); + const totalTime = this.resolveValue(params.totalTime, child, undefined); + const startTime = this.resolveValue(params.startTime, child, 0); // execute只在mark层面调用,所以性能影响可以忽略 // TODO 存在性能问题,如果后续调用频繁,需要重新修改 @@ -201,15 +201,14 @@ export class AnimateExecutor implements IAnimateExecutor { const customType = getCustomType(parsedParams.custom); parsedParams.customType = customType; - if (totalTime) { - const _totalTime = delay + delayAfter + duration + oneByOneDelay * (this._target.count - 2); - const scale = totalTime ? totalTime / _totalTime : 1; - parsedParams.delay = delay * scale; - parsedParams.delayAfter = delayAfter * scale; - parsedParams.duration = duration * scale; - parsedParams.oneByOneDelay = oneByOneDelay * scale; - (parsedParams as IAnimationTypeConfig).startTime = startTime; - } + const _totalTime = delay + delayAfter + duration + oneByOneDelay * (this._target.count - 2); + const scale = isValidNumber(totalTime) ? totalTime / _totalTime : 1; + + parsedParams.delay = delay * scale; + parsedParams.delayAfter = delayAfter * scale; + parsedParams.duration = duration * scale; + parsedParams.oneByOneDelay = oneByOneDelay * scale; + (parsedParams as IAnimationTypeConfig).startTime = startTime; } return parsedParams; From b0e996566b7928bd8ef87c34aa761de0742f5752 Mon Sep 17 00:00:00 2001 From: "lixuefei.1313" Date: Mon, 5 Jan 2026 14:30:19 +0800 Subject: [PATCH 2/3] docs: update changlog of rush --- .../fix-animate-params-function_2026-01-05-06-30.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@visactor/vrender-animate/fix-animate-params-function_2026-01-05-06-30.json diff --git a/common/changes/@visactor/vrender-animate/fix-animate-params-function_2026-01-05-06-30.json b/common/changes/@visactor/vrender-animate/fix-animate-params-function_2026-01-05-06-30.json new file mode 100644 index 000000000..3d68cb574 --- /dev/null +++ b/common/changes/@visactor/vrender-animate/fix-animate-params-function_2026-01-05-06-30.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix issue about animation params support function\n\n", + "type": "none", + "packageName": "@visactor/vrender-animate" + } + ], + "packageName": "@visactor/vrender-animate", + "email": "lixuef1313@163.com" +} \ No newline at end of file From d0def18c7cc4fb9cd793d56692d7d28c0315e2ce Mon Sep 17 00:00:00 2001 From: "lixuefei.1313" Date: Tue, 6 Jan 2026 17:49:53 +0800 Subject: [PATCH 3/3] feat: support stateSort in graphic --- packages/vrender-core/src/graphic/glyph.ts | 3 +++ packages/vrender-core/src/graphic/graphic.ts | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/packages/vrender-core/src/graphic/glyph.ts b/packages/vrender-core/src/graphic/glyph.ts index 48427220a..a70d567d4 100644 --- a/packages/vrender-core/src/graphic/glyph.ts +++ b/packages/vrender-core/src/graphic/glyph.ts @@ -205,6 +205,9 @@ export class Glyph extends Graphic implements IGlyph { this.stopStateAnimates(); + if (this.stateSort) { + states = states.sort(this.stateSort); + } const stateAttrs = {}; const subAttrs = this.subGraphic.map(() => ({})); states.forEach(stateName => { diff --git a/packages/vrender-core/src/graphic/graphic.ts b/packages/vrender-core/src/graphic/graphic.ts index 7a6377aa9..7283c99b4 100644 --- a/packages/vrender-core/src/graphic/graphic.ts +++ b/packages/vrender-core/src/graphic/graphic.ts @@ -320,6 +320,9 @@ export abstract class Graphic = Partial number; + constructor(params: T = {} as T) { super(); this._AABBBounds = new AABBBounds(); @@ -1177,7 +1180,11 @@ export abstract class Graphic = Partial { const attrs = this.stateProxy ? this.stateProxy(stateName, states) : this.states?.[stateName];