Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
286 changes: 25 additions & 261 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion common/config/rush/version-policies.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"definitionName":"lockStepVersion","policyName":"vrenderMain","version":"1.0.10","nextBump":"patch"}]
[{"definitionName":"lockStepVersion","policyName":"vrenderMain","version":"1.0.11","nextBump":"patch"}]
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@visactor/vchart": "1.3.0",
"@visactor/vutils": "1.0.6",
"@visactor/vgrammar": "~0.5.7",
"@visactor/vrender": "workspace:1.0.10",
"@visactor/vrender": "workspace:1.0.11",
"markdown-it": "^13.0.0",
"highlight.js": "^11.8.0",
"axios": "^1.4.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/react-vrender-utils/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/react-vrender-utils",
"entries": [
{
"version": "1.0.11",
"tag": "@visactor/react-vrender-utils_v1.0.11",
"date": "Tue, 19 Aug 2025 06:31:41 GMT",
"comments": {}
},
{
"version": "1.0.10",
"tag": "@visactor/react-vrender-utils_v1.0.10",
Expand Down
7 changes: 6 additions & 1 deletion packages/react-vrender-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/react-vrender-utils

This log was last generated on Thu, 31 Jul 2025 09:44:33 GMT and should not be manually modified.
This log was last generated on Tue, 19 Aug 2025 06:31:41 GMT and should not be manually modified.

## 1.0.11
Tue, 19 Aug 2025 06:31:41 GMT

_Version update only_

## 1.0.10
Thu, 31 Jul 2025 09:44:33 GMT
Expand Down
6 changes: 3 additions & 3 deletions packages/react-vrender-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/react-vrender-utils",
"version": "1.0.10",
"version": "1.0.11",
"description": "",
"sideEffects": false,
"main": "cjs/index.js",
Expand All @@ -24,8 +24,8 @@
"react-dom": "^18.2.0"
},
"dependencies": {
"@visactor/vrender": "workspace:1.0.10",
"@visactor/react-vrender": "workspace:1.0.10",
"@visactor/vrender": "workspace:1.0.11",
"@visactor/react-vrender": "workspace:1.0.11",
"@visactor/vutils": "1.0.6",
"react-reconciler": "^0.29.0",
"tslib": "^2.3.1"
Expand Down
6 changes: 6 additions & 0 deletions packages/react-vrender/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/react-vrender",
"entries": [
{
"version": "1.0.11",
"tag": "@visactor/react-vrender_v1.0.11",
"date": "Tue, 19 Aug 2025 06:31:41 GMT",
"comments": {}
},
{
"version": "1.0.10",
"tag": "@visactor/react-vrender_v1.0.10",
Expand Down
7 changes: 6 additions & 1 deletion packages/react-vrender/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/react-vrender

This log was last generated on Thu, 31 Jul 2025 09:44:33 GMT and should not be manually modified.
This log was last generated on Tue, 19 Aug 2025 06:31:41 GMT and should not be manually modified.

## 1.0.11
Tue, 19 Aug 2025 06:31:41 GMT

_Version update only_

## 1.0.10
Thu, 31 Jul 2025 09:44:33 GMT
Expand Down
4 changes: 2 additions & 2 deletions packages/react-vrender/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/react-vrender",
"version": "1.0.10",
"version": "1.0.11",
"description": "",
"sideEffects": false,
"main": "cjs/index.js",
Expand All @@ -23,7 +23,7 @@
"react": "^18.2.0"
},
"dependencies": {
"@visactor/vrender": "workspace:1.0.10",
"@visactor/vrender": "workspace:1.0.11",
"@visactor/vutils": "1.0.6",
"react-reconciler": "^0.29.0",
"tslib": "^2.3.1"
Expand Down
18 changes: 18 additions & 0 deletions packages/vrender-animate/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
{
"name": "@visactor/vrender-animate",
"entries": [
{
"version": "1.0.11",
"tag": "@visactor/vrender-animate_v1.0.11",
"date": "Tue, 19 Aug 2025 06:31:41 GMT",
"comments": {
"none": [
{
"comment": "feat: support AStageAnimate"
},
{
"comment": "fix: fix issue with reApplyState when this state is not running yet"
},
{
"comment": "fix: fix issue with graphic run animate which unbind to scenegraph, closed #1914"
}
]
}
},
{
"version": "1.0.10",
"tag": "@visactor/vrender-animate_v1.0.10",
Expand Down
11 changes: 10 additions & 1 deletion packages/vrender-animate/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Change Log - @visactor/vrender-animate

This log was last generated on Thu, 31 Jul 2025 09:44:33 GMT and should not be manually modified.
This log was last generated on Tue, 19 Aug 2025 06:31:41 GMT and should not be manually modified.

## 1.0.11
Tue, 19 Aug 2025 06:31:41 GMT

### Updates

- feat: support AStageAnimate
- fix: fix issue with reApplyState when this state is not running yet
- fix: fix issue with graphic run animate which unbind to scenegraph, closed #1914

## 1.0.10
Thu, 31 Jul 2025 09:44:33 GMT
Expand Down
4 changes: 2 additions & 2 deletions packages/vrender-animate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vrender-animate",
"version": "1.0.10",
"version": "1.0.11",
"description": "",
"sideEffects": false,
"main": "cjs/index.js",
Expand All @@ -21,7 +21,7 @@
},
"dependencies": {
"@visactor/vutils": "1.0.6",
"@visactor/vrender-core": "workspace:1.0.10"
"@visactor/vrender-core": "workspace:1.0.11"
},
"devDependencies": {
"@internal/bundler": "workspace:*",
Expand Down
12 changes: 12 additions & 0 deletions packages/vrender-animate/src/animate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,10 @@ export class Animate implements IAnimate {
this._onFrame = [];
this._onEnd = [];
this._onRemove = [];

this.forEachStep(step => {
step.release();
});
}

/**
Expand Down Expand Up @@ -716,4 +720,12 @@ export class Animate implements IAnimate {
getLoop(): number {
return this._loopCount;
}

protected forEachStep(cb: (step: IStep) => void): void {
let step = this._firstStep;
while (step) {
cb(step);
step = step.next;
}
}
}
77 changes: 76 additions & 1 deletion packages/vrender-animate/src/custom/custom-animate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ComponentAnimator } from '../component';
import type { EasingType, IAnimateStepType, ICustomAnimate } from '@visactor/vrender-core';
import type { EasingType, IAnimateStepType, ICustomAnimate, Stage } from '@visactor/vrender-core';
import { Step } from '../step';

export abstract class ACustomAnimate<T> extends Step implements ICustomAnimate {
Expand Down Expand Up @@ -52,3 +52,78 @@ export abstract class AComponentAnimate<T> extends ACustomAnimate<T> {
this._animator && this._animator.stop();
}
}

export abstract class AStageAnimate<T> extends ACustomAnimate<T> {
willCallBeforeStageRender: boolean = true;
willCallAfterStageRender: boolean = true;
constructor(customFrom: T, customTo: T, duration: number, easing: EasingType, params?: any) {
super(customFrom, customTo, duration, easing, params);
this.props = {} as T;
}

// 用户重载
protected beforeStageRender(stage: Stage, canvas: HTMLCanvasElement): HTMLCanvasElement | void | null | false {
return false;
}

// 用户重载
protected afterStageRender(stage: Stage, canvas: HTMLCanvasElement): HTMLCanvasElement | void | null | false {
return false;
}

onFirstRun(): void {
super.onFirstRun();
this.target.stage.setBeforeRender(this._beforeStageRender);
this.target.stage.setAfterRender(this._afterStageRender);
// 禁用脏矩形,因为stage动画可能会批量修改整体画面
this.target.stage.disableDirtyBounds();
}

stop() {
super.stop();
this.target.stage.removeBeforeRender(this._beforeStageRender);
this.target.stage.removeAfterRender(this._afterStageRender);
}
onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {
super.onUpdate(end, ratio, out);
this.willCallBeforeStageRender = true;
this.willCallAfterStageRender = true;
}

protected _beforeStageRender = () => {
if (!this.willCallBeforeStageRender) {
return;
}
this.willCallBeforeStageRender = false;
const stage = this.target.stage as any;
const canvas = stage.window.getContext().canvas.nativeCanvas;
const outputCanvas = this.beforeStageRender(stage, canvas);
if (outputCanvas) {
this.renderToStage(stage, outputCanvas);
}
};

protected _afterStageRender = () => {
if (!this.willCallAfterStageRender) {
return;
}
this.willCallAfterStageRender = false;
const stage = this.target.stage as any;
const canvas = stage.window.getContext().canvas.nativeCanvas;
const outputCanvas = this.afterStageRender(stage, canvas);
if (outputCanvas) {
this.renderToStage(stage, outputCanvas);
}
};

protected renderToStage(stage: Stage, canvas: HTMLCanvasElement): HTMLCanvasElement | void | null | false {
const stageCanvas = stage.window.getContext().canvas.nativeCanvas;
const ctx = stageCanvas.getContext('2d');
if (!ctx) {
return false;
}
ctx.clearRect(0, 0, stageCanvas.width, stageCanvas.height);
ctx.drawImage(canvas, 0, 0);
return stageCanvas;
}
}
8 changes: 6 additions & 2 deletions packages/vrender-animate/src/executor/animate-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export class AnimateExecutor implements IAnimateExecutor {
this._target = target;
}

get started(): boolean {
return this._started;
}

/**
* 注册一个回调,当动画开始时调用
*/
Expand Down Expand Up @@ -421,8 +425,8 @@ export class AnimateExecutor implements IAnimateExecutor {
// 处理自定义动画
if (custom && customType) {
const customParams = {
width: graphic.stage.width,
height: graphic.stage.height,
width: graphic.stage?.width || 0,
height: graphic.stage?.height || 0,
group: this._target.parent,
...this.resolveValue(customParameters, graphic)
};
Expand Down
2 changes: 1 addition & 1 deletion packages/vrender-animate/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export { Step as AnimateStep } from './step';
export * from './utils/easing-func';
export * from './utils/easing';
export { registerAnimate } from './register';
export { ACustomAnimate, AComponentAnimate } from './custom/custom-animate';
export { ACustomAnimate, AComponentAnimate, AStageAnimate } from './custom/custom-animate';
export { ComponentAnimator } from './component/component-animator';
export { IncreaseCount } from './custom/number';
export { MorphingPath, MultiToOneMorphingPath, oneToMultiMorph, multiToOneMorph, morphPath } from './custom/morphing';
Expand Down
3 changes: 2 additions & 1 deletion packages/vrender-animate/src/state/animation-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ export class AnimationStateManager {

reApplyState(state: string): void {
const stateInfo = this.stateList?.find(stateInfo => stateInfo.state === state);
if (stateInfo) {
// 只有当状态存在且动画正在运行时才重新应用
if (stateInfo && stateInfo.executor.started) {
// stop状态会改变stateList,但因为是reapply,所以保留原始的stateList
const stateList = this.stateList.slice();
stateInfo.executor.stop();
Expand Down
4 changes: 4 additions & 0 deletions packages/vrender-animate/src/step.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ export class Step implements IStep {
stop(): void {
// ...
}

release(): void {
// ...
}
}

export class WaitStep extends Step {
Expand Down
6 changes: 6 additions & 0 deletions packages/vrender-components/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/vrender-components",
"entries": [
{
"version": "1.0.11",
"tag": "@visactor/vrender-components_v1.0.11",
"date": "Tue, 19 Aug 2025 06:31:41 GMT",
"comments": {}
},
{
"version": "1.0.10",
"tag": "@visactor/vrender-components_v1.0.10",
Expand Down
7 changes: 6 additions & 1 deletion packages/vrender-components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/vrender-components

This log was last generated on Thu, 31 Jul 2025 09:44:34 GMT and should not be manually modified.
This log was last generated on Tue, 19 Aug 2025 06:31:41 GMT and should not be manually modified.

## 1.0.11
Tue, 19 Aug 2025 06:31:41 GMT

_Version update only_

## 1.0.10
Thu, 31 Jul 2025 09:44:34 GMT
Expand Down
8 changes: 4 additions & 4 deletions packages/vrender-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vrender-components",
"version": "1.0.10",
"version": "1.0.11",
"description": "components library for dp visualization",
"sideEffects": false,
"main": "cjs/index.js",
Expand All @@ -27,9 +27,9 @@
"dependencies": {
"@visactor/vutils": "1.0.6",
"@visactor/vscale": "1.0.6",
"@visactor/vrender-core": "workspace:1.0.10",
"@visactor/vrender-kits": "workspace:1.0.10",
"@visactor/vrender-animate": "workspace:1.0.10"
"@visactor/vrender-core": "workspace:1.0.11",
"@visactor/vrender-kits": "workspace:1.0.11",
"@visactor/vrender-animate": "workspace:1.0.11"
},
"devDependencies": {
"@internal/bundler": "workspace:*",
Expand Down
12 changes: 12 additions & 0 deletions packages/vrender-core/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"name": "@visactor/vrender-core",
"entries": [
{
"version": "1.0.11",
"tag": "@visactor/vrender-core_v1.0.11",
"date": "Tue, 19 Aug 2025 06:31:41 GMT",
"comments": {
"none": [
{
"comment": "feat: support AStageAnimate"
}
]
}
},
{
"version": "1.0.10",
"tag": "@visactor/vrender-core_v1.0.10",
Expand Down
Loading
Loading