From f0e8b8af073bc7f20db4a37b3b427e061228c6dd Mon Sep 17 00:00:00 2001 From: "lixuefei.1313" Date: Wed, 17 Dec 2025 15:40:51 +0800 Subject: [PATCH 1/2] fix: fix issue of custom type --- .../src/executor/animate-executor.ts | 13 ++++--------- packages/vrender-animate/src/executor/utils.ts | 5 +++++ 2 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 packages/vrender-animate/src/executor/utils.ts diff --git a/packages/vrender-animate/src/executor/animate-executor.ts b/packages/vrender-animate/src/executor/animate-executor.ts index dce97e05a..e0797f57a 100644 --- a/packages/vrender-animate/src/executor/animate-executor.ts +++ b/packages/vrender-animate/src/executor/animate-executor.ts @@ -12,6 +12,7 @@ import type { IAnimationChannelInterpolator } from './executor'; import { cloneDeep, isArray, isFunction } from '@visactor/vutils'; +import { getCustomType } from './utils'; interface IAnimateExecutor { execute: (params: IAnimationConfig) => void; @@ -171,8 +172,7 @@ export class AnimateExecutor implements IAnimateExecutor { duration: (slice.duration as number) * scale, effects: effects.map(effect => { const custom = effect.custom ?? AnimateExecutor.builtInAnimateMap[(effect.type as any) ?? 'fromTo']; - const customType = - custom && isFunction(custom) ? (/^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2) : 0; + const customType = getCustomType(custom); return { ...effect, custom, @@ -198,12 +198,7 @@ export class AnimateExecutor implements IAnimateExecutor { (params as IAnimationTypeConfig).custom ?? AnimateExecutor.builtInAnimateMap[(params as IAnimationTypeConfig).type ?? 'fromTo']; - const customType = - parsedParams.custom && isFunction(parsedParams.custom) - ? /^class\s/.test(Function.prototype.toString.call(parsedParams.custom)) - ? 1 - : 2 - : 0; + const customType = getCustomType(parsedParams.custom); parsedParams.customType = customType; if (totalTime) { @@ -565,7 +560,7 @@ export class AnimateExecutor implements IAnimateExecutor { from = parsedFromProps.from; } const custom = effect.custom ?? AnimateExecutor.builtInAnimateMap[type]; - const customType = (effect as any).customType; + const customType = effect.custom ? (effect as any).customType : getCustomType(custom); this._handleRunAnimate( animate, custom, diff --git a/packages/vrender-animate/src/executor/utils.ts b/packages/vrender-animate/src/executor/utils.ts new file mode 100644 index 000000000..a34e9f523 --- /dev/null +++ b/packages/vrender-animate/src/executor/utils.ts @@ -0,0 +1,5 @@ +import { isFunction } from '@visactor/vutils'; + +export function getCustomType(custom: any): number { + return custom && isFunction(custom) ? (/^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2) : 0; +} From 2c2a6c90d69f4fb5ff3ce06b683f57731be8c78c Mon Sep 17 00:00:00 2001 From: "lixuefei.1313" Date: Wed, 17 Dec 2025 15:45:23 +0800 Subject: [PATCH 2/2] docs: update changlog of rush --- ...sue-of-animation-custom-type_2025-12-17-07-45.json | 11 +++++++++++ ...sue-of-animation-custom-type_2025-12-17-07-45.json | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 common/changes/@visactor/vrender-animate/feat-fix-issue-of-animation-custom-type_2025-12-17-07-45.json create mode 100644 common/changes/@visactor/vrender-components/feat-fix-issue-of-animation-custom-type_2025-12-17-07-45.json diff --git a/common/changes/@visactor/vrender-animate/feat-fix-issue-of-animation-custom-type_2025-12-17-07-45.json b/common/changes/@visactor/vrender-animate/feat-fix-issue-of-animation-custom-type_2025-12-17-07-45.json new file mode 100644 index 000000000..bc52f37cb --- /dev/null +++ b/common/changes/@visactor/vrender-animate/feat-fix-issue-of-animation-custom-type_2025-12-17-07-45.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix issue of custom type\n\n", + "type": "none", + "packageName": "@visactor/vrender-animate" + } + ], + "packageName": "@visactor/vrender-animate", + "email": "lixuef1313@163.com" +} \ No newline at end of file diff --git a/common/changes/@visactor/vrender-components/feat-fix-issue-of-animation-custom-type_2025-12-17-07-45.json b/common/changes/@visactor/vrender-components/feat-fix-issue-of-animation-custom-type_2025-12-17-07-45.json new file mode 100644 index 000000000..571895cb1 --- /dev/null +++ b/common/changes/@visactor/vrender-components/feat-fix-issue-of-animation-custom-type_2025-12-17-07-45.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fix issue of custom type\n\n", + "type": "none", + "packageName": "@visactor/vrender-components" + } + ], + "packageName": "@visactor/vrender-components", + "email": "lixuef1313@163.com" +} \ No newline at end of file