@visactor/vrender-kits 0.22.0 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/canvas/contributions/modules.js +1 -2
- package/cjs/env/contributions/browser-contribution.js +2 -1
- package/cjs/env/contributions/taro-contribution.js +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/tools/dynamicTexture/effect.d.ts +21 -0
- package/cjs/tools/dynamicTexture/effect.js +121 -0
- package/cjs/tools/dynamicTexture/effect.js.map +1 -0
- package/cjs/tools/dynamicTexture.d.ts +1 -0
- package/cjs/tools/dynamicTexture.js +1 -0
- package/cjs/tools/dynamicTexture.js.map +1 -0
- package/cjs/window/contributions/node-contribution.js +5 -4
- package/cjs/window/contributions/node-contribution.js.map +1 -1
- package/dist/index.es.js +166 -4
- package/es/canvas/contributions/modules.js +1 -2
- package/es/env/contributions/browser-contribution.js +2 -1
- package/es/env/contributions/taro-contribution.js +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -0
- package/es/index.js.map +1 -1
- package/es/tools/dynamicTexture/effect.d.ts +21 -0
- package/es/tools/dynamicTexture/effect.js +106 -0
- package/es/tools/dynamicTexture/effect.js.map +1 -0
- package/es/tools/dynamicTexture.d.ts +1 -0
- package/es/tools/dynamicTexture.js +1 -0
- package/es/tools/dynamicTexture.js.map +1 -0
- package/es/window/contributions/node-contribution.js +5 -4
- package/es/window/contributions/node-contribution.js.map +1 -1
- package/package.json +2 -2
|
@@ -44,5 +44,4 @@ function loadWxCanvas(container) {
|
|
|
44
44
|
exports.loadAllCavnvas = loadAllCavnvas, exports.loadBrowserCanvas = loadBrowserCanvas,
|
|
45
45
|
exports.loadFeishuCanvas = loadFeishuCanvas, exports.loadLynxCanvas = loadLynxCanvas,
|
|
46
46
|
exports.loadNodeCanvas = loadNodeCanvas, exports.loadTaroCanvas = loadTaroCanvas,
|
|
47
|
-
exports.loadTTCanvas = loadTTCanvas, exports.loadWxCanvas = loadWxCanvas;
|
|
48
|
-
//# sourceMappingURL=modules.js.map
|
|
47
|
+
exports.loadTTCanvas = loadTTCanvas, exports.loadWxCanvas = loadWxCanvas;
|
|
@@ -253,4 +253,5 @@ let BrowserEnvContribution = class extends vrender_core_1.BaseEnvContribution {
|
|
|
253
253
|
};
|
|
254
254
|
|
|
255
255
|
BrowserEnvContribution = __decorate([ (0, vrender_core_1.injectable)(), __metadata("design:paramtypes", []) ], BrowserEnvContribution),
|
|
256
|
-
exports.BrowserEnvContribution = BrowserEnvContribution;
|
|
256
|
+
exports.BrowserEnvContribution = BrowserEnvContribution;
|
|
257
|
+
//# sourceMappingURL=browser-contribution.js.map
|
|
@@ -112,4 +112,4 @@ let TaroEnvContribution = class extends vrender_core_1.BaseEnvContribution {
|
|
|
112
112
|
|
|
113
113
|
TaroEnvContribution = __decorate([ (0, vrender_core_1.injectable)(), __metadata("design:paramtypes", []) ], TaroEnvContribution),
|
|
114
114
|
exports.TaroEnvContribution = TaroEnvContribution;
|
|
115
|
-
//# sourceMappingURL=taro-contribution.js.map
|
|
115
|
+
//# sourceMappingURL=taro-contribution.js.map
|
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -67,5 +67,5 @@ __exportStar(require("./register/register-polygon"), exports), __exportStar(requ
|
|
|
67
67
|
__exportStar(require("./register/register-rect"), exports), __exportStar(require("./register/register-rect3d"), exports),
|
|
68
68
|
__exportStar(require("./register/register-richtext"), exports), __exportStar(require("./register/register-shadowRoot"), exports),
|
|
69
69
|
__exportStar(require("./register/register-symbol"), exports), __exportStar(require("./register/register-text"), exports),
|
|
70
|
-
__exportStar(require("./register/register-wraptext"), exports);
|
|
70
|
+
__exportStar(require("./register/register-wraptext"), exports), __exportStar(require("./tools/dynamicTexture/effect"), exports);
|
|
71
71
|
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,iFAA+D;AAGlD,QAAA,WAAW,GAAG,gBAAY,CAAC;AACxC,mEAAiD;AAEjD,wCAAsB;AACtB,+CAA6B;AAC7B,oDAAkC;AAElC,wCAAsB;AACtB,kFAAgE;AAChE,gFAA8D;AAE9D,mFAAiE;AACjE,iFAA+D;AAE/D,mFAAiE;AACjE,iFAA+D;AAE/D,mFAAiE;AACjE,iFAA+D;AAE/D,qFAAmE;AACnE,mFAAiE;AAEjE,qFAAmE;AACnE,mFAAiE;AAEjE,mFAAiE;AACjE,iFAA+D;AAE/D,mFAAiE;AACjE,iFAA+D;AAE/D,sFAAoE;AACpE,oFAAkE;AAElE,oFAAkE;AAClE,kFAAgE;AAEhE,uFAAqE;AACrE,qFAAmE;AAEnE,oFAAkE;AAClE,kFAAgE;AAEhE,qFAAmE;AAEnE,oFAAkE;AAElE,wFAAsE;AAEtE,sDAAoC;AACpC,wFAAsE;AACtE,iFAA+D;AAE/D,mDAAiC;AACjC,qFAAmE;AACnE,8EAA4D;AAE5D,0DAAwC;AACxC,4DAA0C;AAC1C,2DAAyC;AACzC,6DAA2C;AAC3C,4DAA0C;AAC1C,4DAA0C;AAC1C,4DAA0C;AAC1C,2DAAyC;AACzC,2DAAyC;AACzC,8DAA4C;AAC5C,gEAA8C;AAC9C,2DAAyC;AACzC,6DAA2C;AAC3C,+DAA6C;AAC7C,iEAA+C;AAC/C,6DAA2C;AAC3C,2DAAyC;AACzC,+DAA6C","file":"index.js","sourcesContent":["import _roughModule from './render/contributions/rough/module';\n// import _canvasModuleLoader from './canvas/contributions/canvas-module';\n\nexport const roughModule = _roughModule;\nexport * from './picker/contributions/constants';\n\nexport * from './jsx';\nexport * from './react-tree';\nexport * from './event/extension';\n// export * from './env/browser';\nexport * from './env';\nexport * from './picker/contributions/canvas-picker/arc-module';\nexport * from './picker/contributions/math-picker/arc-module';\n\nexport * from './picker/contributions/canvas-picker/rect-module';\nexport * from './picker/contributions/math-picker/rect-module';\n\nexport * from './picker/contributions/canvas-picker/line-module';\nexport * from './picker/contributions/math-picker/line-module';\n\nexport * from './picker/contributions/canvas-picker/area-module';\nexport * from './picker/contributions/math-picker/area-module';\n\nexport * from './picker/contributions/canvas-picker/symbol-module';\nexport * from './picker/contributions/math-picker/symbol-module';\n\nexport * from './picker/contributions/canvas-picker/circle-module';\nexport * from './picker/contributions/math-picker/circle-module';\n\nexport * from './picker/contributions/canvas-picker/text-module';\nexport * from './picker/contributions/math-picker/text-module';\n\nexport * from './picker/contributions/canvas-picker/path-module';\nexport * from './picker/contributions/math-picker/path-module';\n\nexport * from './picker/contributions/canvas-picker/polygon-module';\nexport * from './picker/contributions/math-picker/polygon-module';\n\nexport * from './picker/contributions/canvas-picker/glyph-module';\nexport * from './picker/contributions/math-picker/glyph-module';\n\nexport * from './picker/contributions/canvas-picker/richtext-module';\nexport * from './picker/contributions/math-picker/richtext-module';\n\nexport * from './picker/contributions/canvas-picker/image-module';\nexport * from './picker/contributions/math-picker/image-module';\n\nexport * from './picker/contributions/canvas-picker/rect3d-module';\n\nexport * from './picker/contributions/canvas-picker/arc3d-module';\n\nexport * from './picker/contributions/canvas-picker/pyramid3d-module';\n\nexport * from './graphic/gif-image';\nexport * from './picker/contributions/canvas-picker/gif-image-module';\nexport * from './render/contributions/canvas/gif-image-module';\n\nexport * from './graphic/Lottie';\nexport * from './picker/contributions/canvas-picker/lottie-module';\nexport * from './render/contributions/canvas/lottie-module';\n\nexport * from './register/register-arc';\nexport * from './register/register-arc3d';\nexport * from './register/register-area';\nexport * from './register/register-circle';\nexport * from './register/register-glyph';\nexport * from './register/register-group';\nexport * from './register/register-image';\nexport * from './register/register-line';\nexport * from './register/register-path';\nexport * from './register/register-polygon';\nexport * from './register/register-pyramid3d';\nexport * from './register/register-rect';\nexport * from './register/register-rect3d';\nexport * from './register/register-richtext';\nexport * from './register/register-shadowRoot';\nexport * from './register/register-symbol';\nexport * from './register/register-text';\nexport * from './register/register-wraptext';\n// export const canvasModuleLoader = _canvasModuleLoader;\n// export { nodeLoader } from './node-bind'; // nodeLoader只在node入口暴露\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,iFAA+D;AAGlD,QAAA,WAAW,GAAG,gBAAY,CAAC;AACxC,mEAAiD;AAEjD,wCAAsB;AACtB,+CAA6B;AAC7B,oDAAkC;AAElC,wCAAsB;AACtB,kFAAgE;AAChE,gFAA8D;AAE9D,mFAAiE;AACjE,iFAA+D;AAE/D,mFAAiE;AACjE,iFAA+D;AAE/D,mFAAiE;AACjE,iFAA+D;AAE/D,qFAAmE;AACnE,mFAAiE;AAEjE,qFAAmE;AACnE,mFAAiE;AAEjE,mFAAiE;AACjE,iFAA+D;AAE/D,mFAAiE;AACjE,iFAA+D;AAE/D,sFAAoE;AACpE,oFAAkE;AAElE,oFAAkE;AAClE,kFAAgE;AAEhE,uFAAqE;AACrE,qFAAmE;AAEnE,oFAAkE;AAClE,kFAAgE;AAEhE,qFAAmE;AAEnE,oFAAkE;AAElE,wFAAsE;AAEtE,sDAAoC;AACpC,wFAAsE;AACtE,iFAA+D;AAE/D,mDAAiC;AACjC,qFAAmE;AACnE,8EAA4D;AAE5D,0DAAwC;AACxC,4DAA0C;AAC1C,2DAAyC;AACzC,6DAA2C;AAC3C,4DAA0C;AAC1C,4DAA0C;AAC1C,4DAA0C;AAC1C,2DAAyC;AACzC,2DAAyC;AACzC,8DAA4C;AAC5C,gEAA8C;AAC9C,2DAAyC;AACzC,6DAA2C;AAC3C,+DAA6C;AAC7C,iEAA+C;AAC/C,6DAA2C;AAC3C,2DAAyC;AACzC,+DAA6C;AAC7C,gEAA8C","file":"index.js","sourcesContent":["import _roughModule from './render/contributions/rough/module';\n// import _canvasModuleLoader from './canvas/contributions/canvas-module';\n\nexport const roughModule = _roughModule;\nexport * from './picker/contributions/constants';\n\nexport * from './jsx';\nexport * from './react-tree';\nexport * from './event/extension';\n// export * from './env/browser';\nexport * from './env';\nexport * from './picker/contributions/canvas-picker/arc-module';\nexport * from './picker/contributions/math-picker/arc-module';\n\nexport * from './picker/contributions/canvas-picker/rect-module';\nexport * from './picker/contributions/math-picker/rect-module';\n\nexport * from './picker/contributions/canvas-picker/line-module';\nexport * from './picker/contributions/math-picker/line-module';\n\nexport * from './picker/contributions/canvas-picker/area-module';\nexport * from './picker/contributions/math-picker/area-module';\n\nexport * from './picker/contributions/canvas-picker/symbol-module';\nexport * from './picker/contributions/math-picker/symbol-module';\n\nexport * from './picker/contributions/canvas-picker/circle-module';\nexport * from './picker/contributions/math-picker/circle-module';\n\nexport * from './picker/contributions/canvas-picker/text-module';\nexport * from './picker/contributions/math-picker/text-module';\n\nexport * from './picker/contributions/canvas-picker/path-module';\nexport * from './picker/contributions/math-picker/path-module';\n\nexport * from './picker/contributions/canvas-picker/polygon-module';\nexport * from './picker/contributions/math-picker/polygon-module';\n\nexport * from './picker/contributions/canvas-picker/glyph-module';\nexport * from './picker/contributions/math-picker/glyph-module';\n\nexport * from './picker/contributions/canvas-picker/richtext-module';\nexport * from './picker/contributions/math-picker/richtext-module';\n\nexport * from './picker/contributions/canvas-picker/image-module';\nexport * from './picker/contributions/math-picker/image-module';\n\nexport * from './picker/contributions/canvas-picker/rect3d-module';\n\nexport * from './picker/contributions/canvas-picker/arc3d-module';\n\nexport * from './picker/contributions/canvas-picker/pyramid3d-module';\n\nexport * from './graphic/gif-image';\nexport * from './picker/contributions/canvas-picker/gif-image-module';\nexport * from './render/contributions/canvas/gif-image-module';\n\nexport * from './graphic/Lottie';\nexport * from './picker/contributions/canvas-picker/lottie-module';\nexport * from './render/contributions/canvas/lottie-module';\n\nexport * from './register/register-arc';\nexport * from './register/register-arc3d';\nexport * from './register/register-area';\nexport * from './register/register-circle';\nexport * from './register/register-glyph';\nexport * from './register/register-group';\nexport * from './register/register-image';\nexport * from './register/register-line';\nexport * from './register/register-path';\nexport * from './register/register-polygon';\nexport * from './register/register-pyramid3d';\nexport * from './register/register-rect';\nexport * from './register/register-rect3d';\nexport * from './register/register-richtext';\nexport * from './register/register-shadowRoot';\nexport * from './register/register-symbol';\nexport * from './register/register-text';\nexport * from './register/register-wraptext';\nexport * from './tools/dynamicTexture/effect';\n// export const canvasModuleLoader = _canvasModuleLoader;\n// export { nodeLoader } from './node-bind'; // nodeLoader只在node入口暴露\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IContext2d, IGraphic } from '@visactor/vrender-core';
|
|
2
|
+
export declare function randomOpacity(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
3
|
+
export declare function columnLeftToRight(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
4
|
+
export declare function columnRightToLeft(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
5
|
+
export declare function rowTopToBottom(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
6
|
+
export declare function rowBottomToTop(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
7
|
+
export declare function diagonalCenterToEdge(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
8
|
+
export declare function diagonalTopLeftToBottomRight(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
9
|
+
export declare function rotationScan(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
10
|
+
export declare function rippleEffect(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
11
|
+
export declare function snakeWave(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
12
|
+
export declare function alternatingWave(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
13
|
+
export declare function spiralEffect(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
14
|
+
export declare function columnCenterToEdge(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
15
|
+
export declare function columnEdgeToCenter(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
16
|
+
export declare function rowCenterToEdge(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
17
|
+
export declare function rowEdgeToCenter(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
18
|
+
export declare function cornerToCenter(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
19
|
+
export declare function centerToCorner(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
20
|
+
export declare function pulseWave(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
21
|
+
export declare function particleEffect(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function randomOpacity(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
4
|
+
graphic.dynamicTextureCache || (graphic.dynamicTextureCache = new Array(rowCount * columnCount).fill(0).map((item => 2 * Math.random() * Math.PI)));
|
|
5
|
+
const targetRandomValue = graphic.dynamicTextureCache[row * columnCount + column], _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI + targetRandomValue) + 1) / 2;
|
|
6
|
+
return Math.min(1, Math.max(0, _r));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function columnLeftToRight(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10
|
+
const delay = column / columnCount, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * delay * Math.PI) + 1) / 2;
|
|
11
|
+
return Math.min(1, Math.max(0, _r));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function columnRightToLeft(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
15
|
+
const delay = (columnCount - 1 - column) / columnCount, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * delay * Math.PI) + 1) / 2;
|
|
16
|
+
return Math.min(1, Math.max(0, _r));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function rowTopToBottom(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
20
|
+
const delay = row / rowCount, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * delay * Math.PI) + 1) / 2;
|
|
21
|
+
return Math.min(1, Math.max(0, _r));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function rowBottomToTop(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
25
|
+
const delay = (rowCount - 1 - row) / rowCount, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * delay * Math.PI) + 1) / 2;
|
|
26
|
+
return Math.min(1, Math.max(0, _r));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function diagonalCenterToEdge(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
30
|
+
const centerRow = rowCount / 2, centerCol = columnCount / 2, distance = Math.sqrt(Math.pow((row - centerRow) / rowCount, 2) + Math.pow((column - centerCol) / columnCount, 2)), _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * distance * Math.PI) + 1) / 2;
|
|
31
|
+
return Math.min(1, Math.max(0, _r));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function diagonalTopLeftToBottomRight(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
35
|
+
const delay = (row / rowCount + column / columnCount) / 2, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * delay * Math.PI) + 1) / 2;
|
|
36
|
+
return Math.min(1, Math.max(0, _r));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function rotationScan(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
40
|
+
const centerRow = rowCount / 2, centerCol = columnCount / 2, angle = Math.atan2(row - centerRow, column - centerCol), delay = (angle < 0 ? angle + 2 * Math.PI : angle) / (2 * Math.PI), _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * delay * Math.PI) + 1) / 2;
|
|
41
|
+
return Math.min(1, Math.max(0, _r));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function rippleEffect(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
45
|
+
const centerRow = rowCount / 2, centerCol = columnCount / 2, normalizedDistance = Math.sqrt(Math.pow(row - centerRow, 2) + Math.pow(column - centerCol, 2)) / Math.sqrt(Math.pow(rowCount / 2, 2) + Math.pow(columnCount / 2, 2)), _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI * 3 - 2 * normalizedDistance * Math.PI) + 1) / 2;
|
|
46
|
+
return Math.min(1, Math.max(0, _r));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function snakeWave(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
50
|
+
const delay = (row + column) % (rowCount + columnCount) / (rowCount + columnCount), _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 4 * delay * Math.PI) + 1) / 2;
|
|
51
|
+
return Math.min(1, Math.max(0, _r));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function alternatingWave(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
55
|
+
const rowPhase = row / rowCount, colPhase = column / columnCount, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * rowPhase * Math.PI) * Math.sin(2 * ratio * Math.PI - 2 * colPhase * Math.PI) + 1) / 2;
|
|
56
|
+
return Math.min(1, Math.max(0, _r));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function spiralEffect(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
60
|
+
const centerRow = rowCount / 2, centerCol = columnCount / 2, distance = Math.sqrt(Math.pow(row - centerRow, 2) + Math.pow(column - centerCol, 2)), angle = Math.atan2(row - centerRow, column - centerCol), delay = (distance / Math.sqrt(Math.pow(rowCount / 2, 2) + Math.pow(columnCount / 2, 2)) + angle / (2 * Math.PI)) / 2, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 4 * delay * Math.PI) + 1) / 2;
|
|
61
|
+
return Math.min(1, Math.max(0, _r));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function columnCenterToEdge(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
65
|
+
const centerCol = columnCount / 2, distance = Math.abs(column - centerCol) / centerCol, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * distance * Math.PI) + 1) / 2;
|
|
66
|
+
return Math.min(1, Math.max(0, _r));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function columnEdgeToCenter(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
70
|
+
const centerCol = columnCount / 2, distance = 1 - Math.abs(column - centerCol) / centerCol, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * distance * Math.PI) + 1) / 2;
|
|
71
|
+
return Math.min(1, Math.max(0, _r));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function rowCenterToEdge(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
75
|
+
const centerRow = rowCount / 2, distance = Math.abs(row - centerRow) / centerRow, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * distance * Math.PI) + 1) / 2;
|
|
76
|
+
return Math.min(1, Math.max(0, _r));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function rowEdgeToCenter(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
80
|
+
const centerRow = rowCount / 2, distance = 1 - Math.abs(row - centerRow) / centerRow, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * distance * Math.PI) + 1) / 2;
|
|
81
|
+
return Math.min(1, Math.max(0, _r));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function cornerToCenter(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
85
|
+
const centerRow = rowCount / 2, centerCol = columnCount / 2, distance = Math.sqrt(Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)), normalizedDistance = Math.min(distance, 1), _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * normalizedDistance * Math.PI) + 1) / 2;
|
|
86
|
+
return Math.min(1, Math.max(0, _r));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function centerToCorner(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
90
|
+
const centerRow = rowCount / 2, centerCol = columnCount / 2, distance = Math.sqrt(Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)), normalizedDistance = 1 - Math.min(distance, 1), _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * normalizedDistance * Math.PI) + 1) / 2;
|
|
91
|
+
return Math.min(1, Math.max(0, _r));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function pulseWave(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
95
|
+
const centerRow = rowCount / 2, centerCol = columnCount / 2, distance = Math.sqrt(Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)), normalizedDistance = Math.min(distance, 1), wavePhase = 2 * ratio * Math.PI * 3, decay = Math.max(0, 1 - normalizedDistance), _r = minRatio + amplitude * ((Math.sin(wavePhase - 4 * normalizedDistance * Math.PI) + 1) / 2) * (.7 * decay + .3);
|
|
96
|
+
return Math.min(1, Math.max(0, _r));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function particleEffect(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
100
|
+
graphic.dynamicTextureCache || (graphic.dynamicTextureCache = {
|
|
101
|
+
phases: new Array(rowCount * columnCount).fill(0).map((() => 2 * Math.random() * Math.PI)),
|
|
102
|
+
speeds: new Array(rowCount * columnCount).fill(0).map((() => .5 + .5 * Math.random())),
|
|
103
|
+
directions: new Array(rowCount * columnCount).fill(0).map((() => 2 * Math.random() * Math.PI))
|
|
104
|
+
});
|
|
105
|
+
const index = row * columnCount + column, phase = graphic.dynamicTextureCache.phases[index], speed = graphic.dynamicTextureCache.speeds[index], direction = graphic.dynamicTextureCache.directions[index], centerRow = rowCount / 2, centerCol = columnCount / 2, distance = Math.sqrt(Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)), normalizedDistance = Math.min(distance, 1), scatterRatio = (ratio - .4) / .6, movement = Math.sin(scatterRatio * speed * 8 * Math.PI + phase + direction * scatterRatio), distanceEffect = Math.cos(normalizedDistance * Math.PI + scatterRatio * Math.PI), _r = minRatio + amplitude * ((movement + 1) / 2 * Math.max(0, 1 - 1.2 * scatterRatio) * (.3 + .7 * distanceEffect));
|
|
106
|
+
return Math.min(1, Math.max(0, _r));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
Object.defineProperty(exports, "__esModule", {
|
|
110
|
+
value: !0
|
|
111
|
+
}), exports.particleEffect = exports.pulseWave = exports.centerToCorner = exports.cornerToCenter = exports.rowEdgeToCenter = exports.rowCenterToEdge = exports.columnEdgeToCenter = exports.columnCenterToEdge = exports.spiralEffect = exports.alternatingWave = exports.snakeWave = exports.rippleEffect = exports.rotationScan = exports.diagonalTopLeftToBottomRight = exports.diagonalCenterToEdge = exports.rowBottomToTop = exports.rowTopToBottom = exports.columnRightToLeft = exports.columnLeftToRight = exports.randomOpacity = void 0,
|
|
112
|
+
exports.randomOpacity = randomOpacity, exports.columnLeftToRight = columnLeftToRight,
|
|
113
|
+
exports.columnRightToLeft = columnRightToLeft, exports.rowTopToBottom = rowTopToBottom,
|
|
114
|
+
exports.rowBottomToTop = rowBottomToTop, exports.diagonalCenterToEdge = diagonalCenterToEdge,
|
|
115
|
+
exports.diagonalTopLeftToBottomRight = diagonalTopLeftToBottomRight, exports.rotationScan = rotationScan,
|
|
116
|
+
exports.rippleEffect = rippleEffect, exports.snakeWave = snakeWave, exports.alternatingWave = alternatingWave,
|
|
117
|
+
exports.spiralEffect = spiralEffect, exports.columnCenterToEdge = columnCenterToEdge,
|
|
118
|
+
exports.columnEdgeToCenter = columnEdgeToCenter, exports.rowCenterToEdge = rowCenterToEdge,
|
|
119
|
+
exports.rowEdgeToCenter = rowEdgeToCenter, exports.cornerToCenter = cornerToCenter,
|
|
120
|
+
exports.centerToCorner = centerToCorner, exports.pulseWave = pulseWave, exports.particleEffect = particleEffect;
|
|
121
|
+
//# sourceMappingURL=effect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tools/dynamicTexture/effect.ts"],"names":[],"mappings":";;;AAEA,SAAgB,aAAa,CAC3B,GAAe,EACf,GAAW,EACX,MAAc,EACd,QAAgB,EAChB,WAAmB,EACnB,KAAa,EACb,OAAiB,EACjB,WAAmB,CAAC,EACpB,YAAoB,CAAC;IAErB,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE;QAChC,OAAO,CAAC,mBAAmB,GAAG,IAAI,KAAK,CAAC,QAAQ,GAAG,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;KAClH;IACD,MAAM,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,GAAG,GAAG,WAAW,GAAG,MAAM,CAAC,CAAC;IAElF,MAAM,EAAE,GAAG,QAAQ,GAAG,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAChG,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACtC,CAAC;AAlBD,sCAkBC;AAGD,SAAgB,iBAAiB,CAC/B,GAAe,EACf,GAAW,EACX,MAAc,EACd,QAAgB,EAChB,WAAmB,EACnB,KAAa,EACb,OAAiB,EACjB,WAAmB,CAAC,E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G,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACtC,CAAC;AA9CD,wCA8CC","file":"effect.js","sourcesContent":["import type { IContext2d, IGraphic } from '@visactor/vrender-core';\n\nexport function randomOpacity(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0, // 最小ratio值,默认为0\n amplitude: number = 1 // 变化幅度,默认为1\n): number {\n if (!graphic.dynamicTextureCache) {\n graphic.dynamicTextureCache = new Array(rowCount * columnCount).fill(0).map(item => Math.random() * 2 * Math.PI);\n }\n const targetRandomValue = graphic.dynamicTextureCache[row * columnCount + column];\n // 调整sin函数的振幅,并将结果映射到[minRatio, minRatio + amplitude]范围\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI + targetRandomValue) + 1)) / 2;\n return Math.min(1, Math.max(0, _r)); // 确保返回值在[0,1]范围内\n}\n\n// 从左到右的列式渐变\nexport function columnLeftToRight(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const delay = column / columnCount;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从右到左的列式渐变\nexport function columnRightToLeft(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const delay = (columnCount - 1 - column) / columnCount;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从上到下的行式渐变\nexport function rowTopToBottom(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const delay = row / rowCount;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从下到上的行式渐变\nexport function rowBottomToTop(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const delay = (rowCount - 1 - row) / rowCount;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从中心向两边的对角线渐变\nexport function diagonalCenterToEdge(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n const distance = Math.sqrt(\n Math.pow((row - centerRow) / rowCount, 2) + Math.pow((column - centerCol) / columnCount, 2)\n );\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从左上角到右下角的对角线渐变\nexport function diagonalTopLeftToBottomRight(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const delay = (row / rowCount + column / columnCount) / 2;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 旋转扫描效果\nexport function rotationScan(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n // 计算当前点相对于中心点的角度\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n const angle = Math.atan2(row - centerRow, column - centerCol);\n // 将角度归一化到 [0, 2π]\n const normalizedAngle = angle < 0 ? angle + 2 * Math.PI : angle;\n // 计算扫描延迟\n const delay = normalizedAngle / (2 * Math.PI);\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 波纹扩散效果\nexport function rippleEffect(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n // 计算到中心的距离\n const distance = Math.sqrt(Math.pow(row - centerRow, 2) + Math.pow(column - centerCol, 2));\n // 归一化距离\n const normalizedDistance = distance / Math.sqrt(Math.pow(rowCount / 2, 2) + Math.pow(columnCount / 2, 2));\n // 创建多个波纹\n const waves = 3;\n const _r =\n minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI * waves - normalizedDistance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 蛇形波动效果\nexport function snakeWave(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n // 使用行和列的位置创建蛇形路径\n const delay = ((row + column) % (rowCount + columnCount)) / (rowCount + columnCount);\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 4 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 交错波纹效果\nexport function alternatingWave(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n // 行和列的交错波纹\n const rowPhase = row / rowCount;\n const colPhase = column / columnCount;\n const _r =\n minRatio +\n (amplitude *\n (Math.sin(ratio * 2 * Math.PI - rowPhase * 2 * Math.PI) * Math.sin(ratio * 2 * Math.PI - colPhase * 2 * Math.PI) +\n 1)) /\n 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 螺旋效果\nexport function spiralEffect(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n // 计算到中心的距离和角度\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n const distance = Math.sqrt(Math.pow(row - centerRow, 2) + Math.pow(column - centerCol, 2));\n const angle = Math.atan2(row - centerRow, column - centerCol);\n // 归一化距离\n const normalizedDistance = distance / Math.sqrt(Math.pow(rowCount / 2, 2) + Math.pow(columnCount / 2, 2));\n // 组合距离和角度创建螺旋效果\n const delay = (normalizedDistance + angle / (2 * Math.PI)) / 2;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 4 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从两边向中间的列式渐变\nexport function columnCenterToEdge(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerCol = columnCount / 2;\n // 计算到中心的距离,并归一化到[0,1]区间\n const distance = Math.abs(column - centerCol) / centerCol;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从中间向两边的列式渐变\nexport function columnEdgeToCenter(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerCol = columnCount / 2;\n // 计算到中心的距离,并归一化到[0,1]区间,然后用1减去它来反转延迟\n const distance = 1 - Math.abs(column - centerCol) / centerCol;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从上下向中间的行式渐变\nexport function rowCenterToEdge(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerRow = rowCount / 2;\n // 计算到中心的距离,并归一化到[0,1]区间\n const distance = Math.abs(row - centerRow) / centerRow;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从中间向上下的行式渐变\nexport function rowEdgeToCenter(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerRow = rowCount / 2;\n // 计算到中心的距离,并归一化到[0,1]区间,然后用1减去它来反转延迟\n const distance = 1 - Math.abs(row - centerRow) / centerRow;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从四个角向中心的渐变\nexport function cornerToCenter(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n // 计算到中心的距离,使用欧几里得距离\n const distance = Math.sqrt(\n Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)\n );\n // 归一化到[0,1]区间\n const normalizedDistance = Math.min(distance, 1);\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - normalizedDistance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从中心向四个角的渐变\nexport function centerToCorner(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n // 计算到中心的距离,使用欧几里得距离\n const distance = Math.sqrt(\n Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)\n );\n // 归一化到[0,1]区间并反转\n const normalizedDistance = 1 - Math.min(distance, 1);\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - normalizedDistance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 脉冲波纹效果\nexport function pulseWave(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n // 计算到中心的距离\n const distance = Math.sqrt(\n Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)\n );\n const normalizedDistance = Math.min(distance, 1);\n // 创建多个波纹\n const waves = 3;\n const wavePhase = ratio * 2 * Math.PI * waves;\n // 添加距离衰减\n const decay = Math.max(0, 1 - normalizedDistance);\n // 组合波纹和衰减效果\n const wave = Math.sin(wavePhase - normalizedDistance * 4 * Math.PI);\n const _r = minRatio + amplitude * ((wave + 1) / 2) * (decay * 0.7 + 0.3);\n return Math.min(1, Math.max(0, _r));\n}\n\n// 粒子动画效果\nexport function particleEffect(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n // 初始化随机种子\n if (!graphic.dynamicTextureCache) {\n graphic.dynamicTextureCache = {\n phases: new Array(rowCount * columnCount).fill(0).map(() => Math.random() * 2 * Math.PI),\n speeds: new Array(rowCount * columnCount).fill(0).map(() => 0.5 + Math.random() * 0.5),\n directions: new Array(rowCount * columnCount).fill(0).map(() => Math.random() * 2 * Math.PI)\n };\n }\n\n const index = row * columnCount + column;\n const phase = graphic.dynamicTextureCache.phases[index];\n const speed = graphic.dynamicTextureCache.speeds[index];\n const direction = graphic.dynamicTextureCache.directions[index];\n\n // 计算到中心的距离\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n const distance = Math.sqrt(\n Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)\n );\n const normalizedDistance = Math.min(distance, 1);\n\n // 扩散阶段:粒子随机运动\n const scatterRatio = (ratio - 0.4) / 0.6;\n // 使用相位和方向创建随机运动\n const movement = Math.sin(scatterRatio * speed * 8 * Math.PI + phase + direction * scatterRatio);\n // 添加距离影响\n const distanceEffect = Math.cos(normalizedDistance * Math.PI + scatterRatio * Math.PI);\n // 添加衰减效果\n const decay = Math.max(0, 1 - scatterRatio * 1.2);\n\n // 组合所有效果\n const baseEffect = ((movement + 1) / 2) * decay * (0.3 + 0.7 * distanceEffect);\n const _r = minRatio + amplitude * baseEffect;\n return Math.min(1, Math.max(0, _r));\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=dynamicTexture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tools/dynamicTexture.ts"],"names":[],"mappings":"","file":"dynamicTexture.js","sourcesContent":["// import type { IContext2d, IGraphic } from '@visactor/vrender-core';\n\n// export function randomOpacity(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// if (!graphic.dynamicTextureCache) {\n// graphic.dynamicTextureCache = new Array(rowCount * columnCount).fill(0).map(item => Math.random() * 2 * Math.PI);\n// }\n// const targetRandomValue = graphic.dynamicTextureCache[row * columnCount + column];\n// const _r = (Math.sin(ratio * 2 * Math.PI + targetRandomValue) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 从左到右的列式渐变\n// export function columnLeftToRight(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// // 根据列号计算延迟\n// const delay = column / columnCount;\n// // 使用连续的sin函数,不需要max(0,ratio-delay)的截断\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 从右到左的列式渐变\n// export function columnRightToLeft(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// const delay = (columnCount - 1 - column) / columnCount;\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 从上到下的行式渐变\n// export function rowTopToBottom(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// const delay = row / rowCount;\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 从下到上的行式渐变\n// export function rowBottomToTop(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// const delay = (rowCount - 1 - row) / rowCount;\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 从中心向两边的对角线渐变\n// export function diagonalCenterToEdge(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// const centerRow = rowCount / 2;\n// const centerCol = columnCount / 2;\n// const distance = Math.sqrt(\n// Math.pow((row - centerRow) / rowCount, 2) + Math.pow((column - centerCol) / columnCount, 2)\n// );\n// const _r = (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 从左上角到右下角的对角线渐变\n// export function diagonalTopLeftToBottomRight(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// const delay = (row / rowCount + column / columnCount) / 2;\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 旋转扫描效果\n// export function rotationScan(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// // 计算当前点相对于中心点的角度\n// const centerRow = rowCount / 2;\n// const centerCol = columnCount / 2;\n// const angle = Math.atan2(row - centerRow, column - centerCol);\n// // 将角度归一化到 [0, 2π]\n// const normalizedAngle = angle < 0 ? angle + 2 * Math.PI : angle;\n// // 计算扫描延迟\n// const delay = normalizedAngle / (2 * Math.PI);\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 波纹扩散效果\n// export function rippleEffect(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// const centerRow = rowCount / 2;\n// const centerCol = columnCount / 2;\n// // 计算到中心的距离\n// const distance = Math.sqrt(Math.pow(row - centerRow, 2) + Math.pow(column - centerCol, 2));\n// // 归一化距离\n// const normalizedDistance = distance / Math.sqrt(Math.pow(rowCount / 2, 2) + Math.pow(columnCount / 2, 2));\n// // 创建多个波纹\n// const waves = 3;\n// const _r = (Math.sin(ratio * 2 * Math.PI * waves - normalizedDistance * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 蛇形波动效果\n// export function snakeWave(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// // 使用行和列的位置创建蛇形路径\n// const delay = ((row + column) % (rowCount + columnCount)) / (rowCount + columnCount);\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 4 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 交错波纹效果\n// export function alternatingWave(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// // 行和列的交错波纹\n// const rowPhase = row / rowCount;\n// const colPhase = column / columnCount;\n// const _r =\n// (Math.sin(ratio * 2 * Math.PI - rowPhase * 2 * Math.PI) * Math.sin(ratio * 2 * Math.PI - colPhase * 2 * Math.PI) +\n// 1) /\n// 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 螺旋效果\n// export function spiralEffect(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// const centerRow = rowCount / 2;\n// const centerCol = columnCount / 2;\n// // 计算到中心的距离和角度\n// const distance = Math.sqrt(Math.pow(row - centerRow, 2) + Math.pow(column - centerCol, 2));\n// const angle = Math.atan2(row - centerRow, column - centerCol);\n// // 归一化距离\n// const normalizedDistance = distance / Math.sqrt(Math.pow(rowCount / 2, 2) + Math.pow(columnCount / 2, 2));\n// // 组合距离和角度创建螺旋效果\n// const delay = (normalizedDistance + angle / (2 * Math.PI)) / 2;\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 4 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n"]}
|
|
@@ -58,13 +58,14 @@ let NodeWindowHandlerContribution = class extends vrender_core_1.BaseWindowHandl
|
|
|
58
58
|
this.canvas = new node_1.NodeCanvas(options);
|
|
59
59
|
}
|
|
60
60
|
createWindowByCanvas(params) {
|
|
61
|
-
|
|
61
|
+
var _a;
|
|
62
|
+
const canvas = params.canvas, dpr = null !== (_a = params.dpr) && void 0 !== _a ? _a : 1;
|
|
62
63
|
let width = params.width, height = params.height;
|
|
63
|
-
null != width && null != height && params.canvasControled || (width = canvas.width,
|
|
64
|
-
height = canvas.height), this.canvas = new node_1.NodeCanvas({
|
|
64
|
+
null != width && null != height && params.canvasControled || (width = canvas.width / dpr,
|
|
65
|
+
height = canvas.height / dpr), this.canvas = new node_1.NodeCanvas({
|
|
65
66
|
width: width,
|
|
66
67
|
height: height,
|
|
67
|
-
dpr:
|
|
68
|
+
dpr: dpr,
|
|
68
69
|
nativeCanvas: canvas,
|
|
69
70
|
canvasControled: params.canvasControled
|
|
70
71
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/window/contributions/node-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yDAQgC;AAWhC,0DAA6D;AAGtD,IAAM,6BAA6B,GAAnC,MAAM,6BAA8B,SAAQ,4CAA6B;IAK9E,IAAI,SAAS;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAA8C,MAAe;QAC3D,KAAK,EAAE,CAAC;QADoC,WAAM,GAAN,MAAM,CAAS;QAP7D,SAAI,GAAY,MAAM,CAAC;IASvB,CAAC;IAED,QAAQ;QACN,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK;QACH,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;YAC/B,MAA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AAO;IACT,CAAC;IAED,QAAQ;QACN,OAAO;IACT,CAAC;IACD,QAAQ,CAAC,KAAgD;QACvD,OAAO;IACT,CAAC;IAED,qBAAqB;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY,CAAC,KAAc;QACzB,OAAO;IACT,CAAC;;AA5IM,iCAAG,GAAY,MAAM,CAAC;AADlB,6BAA6B;IADzC,IAAA,yBAAU,GAAE;IAUE,WAAA,IAAA,qBAAM,EAAC,sBAAO,CAAC,CAAA;;GATjB,6BAA6B,CA8IzC;AA9IY,sEAA6B;AAgJ7B,QAAA,gBAAgB,GAAG,IAAI,8BAAe,CAAC,IAAI,CAAC,EAAE;IAEzD,IAAI,CAAC,6BAA6B,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7C,IAAI,CAAC,wCAAyB,CAAC;SAC5B,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;SACvE,eAAe,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC","file":"node-contribution.js","sourcesContent":["import {\n inject,\n injectable,\n Generator,\n BaseWindowHandlerContribution,\n VGlobal,\n ContainerModule,\n WindowHandlerContribution\n} from '@visactor/vrender-core';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport type {\n EnvType,\n IGlobal,\n IContext2d,\n ICanvas,\n IDomRectLike,\n IWindowHandlerContribution,\n IWindowParams\n} from '@visactor/vrender-core';\nimport { NodeCanvas } from '../../canvas/contributions/node';\n\n@injectable()\nexport class NodeWindowHandlerContribution extends BaseWindowHandlerContribution implements IWindowHandlerContribution {\n static env: EnvType = 'node';\n type: EnvType = 'node';\n\n canvas: ICanvas;\n get container(): HTMLElement | null {\n return null;\n }\n\n constructor(@inject(VGlobal) private readonly global: IGlobal) {\n super();\n }\n\n getTitle(): string {\n return '';\n }\n\n getWH(): { width: number; height: number } {\n return {\n width: this.canvas.displayWidth,\n height: this.canvas.displayHeight\n };\n }\n\n getXY(): { x: number; y: number } {\n return { x: 0, y: 0 };\n }\n\n createWindow(params: IWindowParams): void {\n // 如果没有传入canvas,那么就创建一个canvas\n if (!params.canvas) {\n this.createWindowByConfig(params);\n } else {\n this.createWindowByCanvas(params);\n }\n }\n private createWindowByConfig(params: IWindowParams) {\n // 创建canvas\n const nativeCanvas = this.global.createCanvas({ width: params.width, height: params.height });\n\n // 绑定\n const options = {\n width: params.width,\n height: params.height,\n dpr: params.dpr,\n nativeCanvas,\n id: Generator.GenAutoIncrementId().toString(),\n canvasControled: true\n };\n this.canvas = new NodeCanvas(options);\n }\n private createWindowByCanvas(params: IWindowParams) {\n // 获取canvas\n const canvas = params!.canvas as HTMLCanvasElement | null;\n const dpr = params.dpr ?? 1;\n // 如果没有传入wh,或者是不受控制的canvas,那就用canvas的原始wh\n let width = params.width;\n let height = params.height;\n if (width == null || height == null || !params.canvasControled) {\n width = canvas.width / dpr;\n height = canvas.height / dpr;\n }\n\n this.canvas = new NodeCanvas({\n width: width,\n height: height,\n dpr: dpr,\n nativeCanvas: canvas,\n canvasControled: params.canvasControled\n });\n }\n releaseWindow(): void {\n this.canvas.release();\n }\n resizeWindow(width: number, height: number): void {\n this.canvas.resize(width, height);\n }\n setDpr(dpr: number): void {\n this.canvas.dpr = dpr;\n }\n\n getContext(): IContext2d {\n return this.canvas.getContext();\n }\n getNativeHandler(): ICanvas {\n return this.canvas;\n }\n getDpr(): number {\n return this.canvas.dpr;\n }\n\n getImageBuffer(type: string = 'image/png'): any {\n const canvas = this.canvas.nativeCanvas;\n return canvas.toBuffer(type);\n }\n\n addEventListener<K extends keyof DocumentEventMap>(\n type: K,\n listener: (this: Document, ev: DocumentEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n ): void;\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n ): void;\n addEventListener(type: unknown, listener: unknown, options?: unknown): void {\n return;\n }\n\n dispatchEvent(event: any): boolean {\n return true;\n }\n\n removeEventListener<K extends keyof DocumentEventMap>(\n type: K,\n listener: (this: Document, ev: DocumentEventMap[K]) => any,\n options?: boolean | EventListenerOptions\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions\n ): void;\n removeEventListener(type: unknown, listener: unknown, options?: unknown): void {\n return;\n }\n\n getStyle(): CSSStyleDeclaration | Record<string, any> {\n return;\n }\n setStyle(style: CSSStyleDeclaration | Record<string, any>): void {\n return;\n }\n\n getBoundingClientRect(): IDomRectLike {\n return null;\n }\n\n clearViewBox(color?: string): void {\n return;\n }\n}\n\nexport const nodeWindowModule = new ContainerModule(bind => {\n // node\n bind(NodeWindowHandlerContribution).toSelf();\n bind(WindowHandlerContribution)\n .toDynamicValue(ctx => ctx.container.get(NodeWindowHandlerContribution))\n .whenTargetNamed(NodeWindowHandlerContribution.env);\n});\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -5904,17 +5904,19 @@ let NodeWindowHandlerContribution = class NodeWindowHandlerContribution extends
|
|
|
5904
5904
|
this.canvas = new NodeCanvas(options);
|
|
5905
5905
|
}
|
|
5906
5906
|
createWindowByCanvas(params) {
|
|
5907
|
+
var _a;
|
|
5907
5908
|
const canvas = params.canvas;
|
|
5909
|
+
const dpr = (_a = params.dpr) !== null && _a !== void 0 ? _a : 1;
|
|
5908
5910
|
let width = params.width;
|
|
5909
5911
|
let height = params.height;
|
|
5910
5912
|
if (width == null || height == null || !params.canvasControled) {
|
|
5911
|
-
width = canvas.width;
|
|
5912
|
-
height = canvas.height;
|
|
5913
|
+
width = canvas.width / dpr;
|
|
5914
|
+
height = canvas.height / dpr;
|
|
5913
5915
|
}
|
|
5914
5916
|
this.canvas = new NodeCanvas({
|
|
5915
5917
|
width: width,
|
|
5916
5918
|
height: height,
|
|
5917
|
-
dpr:
|
|
5919
|
+
dpr: dpr,
|
|
5918
5920
|
nativeCanvas: canvas,
|
|
5919
5921
|
canvasControled: params.canvasControled
|
|
5920
5922
|
});
|
|
@@ -10264,6 +10266,166 @@ function _registerWrapText() {
|
|
|
10264
10266
|
_registerWrapText.__loaded = false;
|
|
10265
10267
|
const registerWrapText = _registerWrapText;
|
|
10266
10268
|
|
|
10269
|
+
function randomOpacity(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10270
|
+
if (!graphic.dynamicTextureCache) {
|
|
10271
|
+
graphic.dynamicTextureCache = new Array(rowCount * columnCount).fill(0).map(item => Math.random() * 2 * Math.PI);
|
|
10272
|
+
}
|
|
10273
|
+
const targetRandomValue = graphic.dynamicTextureCache[row * columnCount + column];
|
|
10274
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI + targetRandomValue) + 1)) / 2;
|
|
10275
|
+
return Math.min(1, Math.max(0, _r));
|
|
10276
|
+
}
|
|
10277
|
+
function columnLeftToRight(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10278
|
+
const delay = column / columnCount;
|
|
10279
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;
|
|
10280
|
+
return Math.min(1, Math.max(0, _r));
|
|
10281
|
+
}
|
|
10282
|
+
function columnRightToLeft(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10283
|
+
const delay = (columnCount - 1 - column) / columnCount;
|
|
10284
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;
|
|
10285
|
+
return Math.min(1, Math.max(0, _r));
|
|
10286
|
+
}
|
|
10287
|
+
function rowTopToBottom(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10288
|
+
const delay = row / rowCount;
|
|
10289
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;
|
|
10290
|
+
return Math.min(1, Math.max(0, _r));
|
|
10291
|
+
}
|
|
10292
|
+
function rowBottomToTop(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10293
|
+
const delay = (rowCount - 1 - row) / rowCount;
|
|
10294
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;
|
|
10295
|
+
return Math.min(1, Math.max(0, _r));
|
|
10296
|
+
}
|
|
10297
|
+
function diagonalCenterToEdge(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10298
|
+
const centerRow = rowCount / 2;
|
|
10299
|
+
const centerCol = columnCount / 2;
|
|
10300
|
+
const distance = Math.sqrt(Math.pow((row - centerRow) / rowCount, 2) + Math.pow((column - centerCol) / columnCount, 2));
|
|
10301
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;
|
|
10302
|
+
return Math.min(1, Math.max(0, _r));
|
|
10303
|
+
}
|
|
10304
|
+
function diagonalTopLeftToBottomRight(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10305
|
+
const delay = (row / rowCount + column / columnCount) / 2;
|
|
10306
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;
|
|
10307
|
+
return Math.min(1, Math.max(0, _r));
|
|
10308
|
+
}
|
|
10309
|
+
function rotationScan(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10310
|
+
const centerRow = rowCount / 2;
|
|
10311
|
+
const centerCol = columnCount / 2;
|
|
10312
|
+
const angle = Math.atan2(row - centerRow, column - centerCol);
|
|
10313
|
+
const normalizedAngle = angle < 0 ? angle + 2 * Math.PI : angle;
|
|
10314
|
+
const delay = normalizedAngle / (2 * Math.PI);
|
|
10315
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;
|
|
10316
|
+
return Math.min(1, Math.max(0, _r));
|
|
10317
|
+
}
|
|
10318
|
+
function rippleEffect(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10319
|
+
const centerRow = rowCount / 2;
|
|
10320
|
+
const centerCol = columnCount / 2;
|
|
10321
|
+
const distance = Math.sqrt(Math.pow(row - centerRow, 2) + Math.pow(column - centerCol, 2));
|
|
10322
|
+
const normalizedDistance = distance / Math.sqrt(Math.pow(rowCount / 2, 2) + Math.pow(columnCount / 2, 2));
|
|
10323
|
+
const waves = 3;
|
|
10324
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI * waves - normalizedDistance * 2 * Math.PI) + 1)) / 2;
|
|
10325
|
+
return Math.min(1, Math.max(0, _r));
|
|
10326
|
+
}
|
|
10327
|
+
function snakeWave(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10328
|
+
const delay = ((row + column) % (rowCount + columnCount)) / (rowCount + columnCount);
|
|
10329
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 4 * Math.PI) + 1)) / 2;
|
|
10330
|
+
return Math.min(1, Math.max(0, _r));
|
|
10331
|
+
}
|
|
10332
|
+
function alternatingWave(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10333
|
+
const rowPhase = row / rowCount;
|
|
10334
|
+
const colPhase = column / columnCount;
|
|
10335
|
+
const _r = minRatio +
|
|
10336
|
+
(amplitude *
|
|
10337
|
+
(Math.sin(ratio * 2 * Math.PI - rowPhase * 2 * Math.PI) * Math.sin(ratio * 2 * Math.PI - colPhase * 2 * Math.PI) +
|
|
10338
|
+
1)) /
|
|
10339
|
+
2;
|
|
10340
|
+
return Math.min(1, Math.max(0, _r));
|
|
10341
|
+
}
|
|
10342
|
+
function spiralEffect(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10343
|
+
const centerRow = rowCount / 2;
|
|
10344
|
+
const centerCol = columnCount / 2;
|
|
10345
|
+
const distance = Math.sqrt(Math.pow(row - centerRow, 2) + Math.pow(column - centerCol, 2));
|
|
10346
|
+
const angle = Math.atan2(row - centerRow, column - centerCol);
|
|
10347
|
+
const normalizedDistance = distance / Math.sqrt(Math.pow(rowCount / 2, 2) + Math.pow(columnCount / 2, 2));
|
|
10348
|
+
const delay = (normalizedDistance + angle / (2 * Math.PI)) / 2;
|
|
10349
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 4 * Math.PI) + 1)) / 2;
|
|
10350
|
+
return Math.min(1, Math.max(0, _r));
|
|
10351
|
+
}
|
|
10352
|
+
function columnCenterToEdge(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10353
|
+
const centerCol = columnCount / 2;
|
|
10354
|
+
const distance = Math.abs(column - centerCol) / centerCol;
|
|
10355
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;
|
|
10356
|
+
return Math.min(1, Math.max(0, _r));
|
|
10357
|
+
}
|
|
10358
|
+
function columnEdgeToCenter(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10359
|
+
const centerCol = columnCount / 2;
|
|
10360
|
+
const distance = 1 - Math.abs(column - centerCol) / centerCol;
|
|
10361
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;
|
|
10362
|
+
return Math.min(1, Math.max(0, _r));
|
|
10363
|
+
}
|
|
10364
|
+
function rowCenterToEdge(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10365
|
+
const centerRow = rowCount / 2;
|
|
10366
|
+
const distance = Math.abs(row - centerRow) / centerRow;
|
|
10367
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;
|
|
10368
|
+
return Math.min(1, Math.max(0, _r));
|
|
10369
|
+
}
|
|
10370
|
+
function rowEdgeToCenter(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10371
|
+
const centerRow = rowCount / 2;
|
|
10372
|
+
const distance = 1 - Math.abs(row - centerRow) / centerRow;
|
|
10373
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;
|
|
10374
|
+
return Math.min(1, Math.max(0, _r));
|
|
10375
|
+
}
|
|
10376
|
+
function cornerToCenter(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10377
|
+
const centerRow = rowCount / 2;
|
|
10378
|
+
const centerCol = columnCount / 2;
|
|
10379
|
+
const distance = Math.sqrt(Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2));
|
|
10380
|
+
const normalizedDistance = Math.min(distance, 1);
|
|
10381
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - normalizedDistance * 2 * Math.PI) + 1)) / 2;
|
|
10382
|
+
return Math.min(1, Math.max(0, _r));
|
|
10383
|
+
}
|
|
10384
|
+
function centerToCorner(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10385
|
+
const centerRow = rowCount / 2;
|
|
10386
|
+
const centerCol = columnCount / 2;
|
|
10387
|
+
const distance = Math.sqrt(Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2));
|
|
10388
|
+
const normalizedDistance = 1 - Math.min(distance, 1);
|
|
10389
|
+
const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - normalizedDistance * 2 * Math.PI) + 1)) / 2;
|
|
10390
|
+
return Math.min(1, Math.max(0, _r));
|
|
10391
|
+
}
|
|
10392
|
+
function pulseWave(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10393
|
+
const centerRow = rowCount / 2;
|
|
10394
|
+
const centerCol = columnCount / 2;
|
|
10395
|
+
const distance = Math.sqrt(Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2));
|
|
10396
|
+
const normalizedDistance = Math.min(distance, 1);
|
|
10397
|
+
const waves = 3;
|
|
10398
|
+
const wavePhase = ratio * 2 * Math.PI * waves;
|
|
10399
|
+
const decay = Math.max(0, 1 - normalizedDistance);
|
|
10400
|
+
const wave = Math.sin(wavePhase - normalizedDistance * 4 * Math.PI);
|
|
10401
|
+
const _r = minRatio + amplitude * ((wave + 1) / 2) * (decay * 0.7 + 0.3);
|
|
10402
|
+
return Math.min(1, Math.max(0, _r));
|
|
10403
|
+
}
|
|
10404
|
+
function particleEffect(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
10405
|
+
if (!graphic.dynamicTextureCache) {
|
|
10406
|
+
graphic.dynamicTextureCache = {
|
|
10407
|
+
phases: new Array(rowCount * columnCount).fill(0).map(() => Math.random() * 2 * Math.PI),
|
|
10408
|
+
speeds: new Array(rowCount * columnCount).fill(0).map(() => 0.5 + Math.random() * 0.5),
|
|
10409
|
+
directions: new Array(rowCount * columnCount).fill(0).map(() => Math.random() * 2 * Math.PI)
|
|
10410
|
+
};
|
|
10411
|
+
}
|
|
10412
|
+
const index = row * columnCount + column;
|
|
10413
|
+
const phase = graphic.dynamicTextureCache.phases[index];
|
|
10414
|
+
const speed = graphic.dynamicTextureCache.speeds[index];
|
|
10415
|
+
const direction = graphic.dynamicTextureCache.directions[index];
|
|
10416
|
+
const centerRow = rowCount / 2;
|
|
10417
|
+
const centerCol = columnCount / 2;
|
|
10418
|
+
const distance = Math.sqrt(Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2));
|
|
10419
|
+
const normalizedDistance = Math.min(distance, 1);
|
|
10420
|
+
const scatterRatio = (ratio - 0.4) / 0.6;
|
|
10421
|
+
const movement = Math.sin(scatterRatio * speed * 8 * Math.PI + phase + direction * scatterRatio);
|
|
10422
|
+
const distanceEffect = Math.cos(normalizedDistance * Math.PI + scatterRatio * Math.PI);
|
|
10423
|
+
const decay = Math.max(0, 1 - scatterRatio * 1.2);
|
|
10424
|
+
const baseEffect = ((movement + 1) / 2) * decay * (0.3 + 0.7 * distanceEffect);
|
|
10425
|
+
const _r = minRatio + amplitude * baseEffect;
|
|
10426
|
+
return Math.min(1, Math.max(0, _r));
|
|
10427
|
+
}
|
|
10428
|
+
|
|
10267
10429
|
const roughModule = _roughModule;
|
|
10268
10430
|
|
|
10269
|
-
export { BrowserEnvContribution, CanvasArc3dPicker, CanvasArcPicker, CanvasAreaPicker, CanvasCirclePicker, CanvasGifImagePicker, CanvasGlyphPicker, CanvasGroupPicker, CanvasImagePicker, CanvasLinePicker, CanvasLottiePicker, CanvasPathPicker, CanvasPickerContribution, CanvasPolygonPicker, CanvasPyramid3dPicker, CanvasRect3dPicker, CanvasRectPicker, CanvasRichTextPicker, CanvasSymbolPicker, CanvasTextPicker, DragNDrop, Fragment, Gesture, GifImage, Lottie, MathArcPicker, MathAreaPicker, MathCirclePicker, MathGlyphPicker, MathImagePicker, MathLinePicker, MathPathPicker, MathPickerContribution, MathPolygonPicker, MathRectPicker, MathSymbolPicker, MathTextPicker, REACT_TO_CANOPUS_EVENTS, REACT_TO_CANOPUS_EVENTS_LIST, VArc, VArc3d, VArea, VCircle, VGlyph, VGroup, VImage, VLine, VPath, VPolygon, VPyramid3d, VRect, VRect3d, VRichText, VSymbol, VText, _registerArc, arc3dCanvasPickModule, arcCanvasPickModule, arcMathPickModule, areaCanvasPickModule, areaMathPickModule, browserEnvModule, circleCanvasPickModule, circleMathPickModule, createGifImage, createImageElement$1 as createImageElement, createLottie, decodeReactDom, feishuEnvModule, gifImageCanvasPickModule, gifImageModule, glyphCanvasPickModule, glyphMathPickModule, harmonyEnvModule, imageCanvasPickModule, imageMathPickModule, initAllEnv, initBrowserEnv, initFeishuEnv, initHarmonyEnv, initLynxEnv, initNodeEnv, initTTEnv, initTaroEnv, initWxEnv, jsx, lineCanvasPickModule, lineMathPickModule, loadAllEnv, loadAllModule, loadBrowserEnv, loadFeishuEnv, loadHarmonyEnv, loadLynxEnv, loadNodeEnv, loadTTEnv, loadTaroEnv, loadWxEnv, lottieCanvasPickModule, lottieModule, lynxEnvModule, nodeEnvModule, pathCanvasPickModule, pathMathPickModule, polygonCanvasPickModule, polygonMathPickModule, pyramid3dCanvasPickModule, rect3dCanvasPickModule, rectCanvasPickModule, rectMathPickModule, registerArc, registerArc3d, registerArea, registerCircle, registerGlyph, registerGroup, registerImage, registerLine, registerPath, registerPolygon, registerPyramid3d, registerRect, registerRect3d, registerRichtext, registerShadowRoot, registerSymbol, registerText, registerWrapText, richTextMathPickModule, richtextCanvasPickModule, roughModule, symbolCanvasPickModule, symbolMathPickModule, taroEnvModule, textCanvasPickModule, textMathPickModule, ttEnvModule, wxEnvModule };
|
|
10431
|
+
export { BrowserEnvContribution, CanvasArc3dPicker, CanvasArcPicker, CanvasAreaPicker, CanvasCirclePicker, CanvasGifImagePicker, CanvasGlyphPicker, CanvasGroupPicker, CanvasImagePicker, CanvasLinePicker, CanvasLottiePicker, CanvasPathPicker, CanvasPickerContribution, CanvasPolygonPicker, CanvasPyramid3dPicker, CanvasRect3dPicker, CanvasRectPicker, CanvasRichTextPicker, CanvasSymbolPicker, CanvasTextPicker, DragNDrop, Fragment, Gesture, GifImage, Lottie, MathArcPicker, MathAreaPicker, MathCirclePicker, MathGlyphPicker, MathImagePicker, MathLinePicker, MathPathPicker, MathPickerContribution, MathPolygonPicker, MathRectPicker, MathSymbolPicker, MathTextPicker, REACT_TO_CANOPUS_EVENTS, REACT_TO_CANOPUS_EVENTS_LIST, VArc, VArc3d, VArea, VCircle, VGlyph, VGroup, VImage, VLine, VPath, VPolygon, VPyramid3d, VRect, VRect3d, VRichText, VSymbol, VText, _registerArc, alternatingWave, arc3dCanvasPickModule, arcCanvasPickModule, arcMathPickModule, areaCanvasPickModule, areaMathPickModule, browserEnvModule, centerToCorner, circleCanvasPickModule, circleMathPickModule, columnCenterToEdge, columnEdgeToCenter, columnLeftToRight, columnRightToLeft, cornerToCenter, createGifImage, createImageElement$1 as createImageElement, createLottie, decodeReactDom, diagonalCenterToEdge, diagonalTopLeftToBottomRight, feishuEnvModule, gifImageCanvasPickModule, gifImageModule, glyphCanvasPickModule, glyphMathPickModule, harmonyEnvModule, imageCanvasPickModule, imageMathPickModule, initAllEnv, initBrowserEnv, initFeishuEnv, initHarmonyEnv, initLynxEnv, initNodeEnv, initTTEnv, initTaroEnv, initWxEnv, jsx, lineCanvasPickModule, lineMathPickModule, loadAllEnv, loadAllModule, loadBrowserEnv, loadFeishuEnv, loadHarmonyEnv, loadLynxEnv, loadNodeEnv, loadTTEnv, loadTaroEnv, loadWxEnv, lottieCanvasPickModule, lottieModule, lynxEnvModule, nodeEnvModule, particleEffect, pathCanvasPickModule, pathMathPickModule, polygonCanvasPickModule, polygonMathPickModule, pulseWave, pyramid3dCanvasPickModule, randomOpacity, rect3dCanvasPickModule, rectCanvasPickModule, rectMathPickModule, registerArc, registerArc3d, registerArea, registerCircle, registerGlyph, registerGroup, registerImage, registerLine, registerPath, registerPolygon, registerPyramid3d, registerRect, registerRect3d, registerRichtext, registerShadowRoot, registerSymbol, registerText, registerWrapText, richTextMathPickModule, richtextCanvasPickModule, rippleEffect, rotationScan, roughModule, rowBottomToTop, rowCenterToEdge, rowEdgeToCenter, rowTopToBottom, snakeWave, spiralEffect, symbolCanvasPickModule, symbolMathPickModule, taroEnvModule, textCanvasPickModule, textMathPickModule, ttEnvModule, wxEnvModule };
|
|
@@ -247,4 +247,5 @@ let BrowserEnvContribution = class extends BaseEnvContribution {
|
|
|
247
247
|
|
|
248
248
|
BrowserEnvContribution = __decorate([ injectable(), __metadata("design:paramtypes", []) ], BrowserEnvContribution);
|
|
249
249
|
|
|
250
|
-
export { BrowserEnvContribution };
|
|
250
|
+
export { BrowserEnvContribution };
|
|
251
|
+
//# sourceMappingURL=browser-contribution.js.map
|
|
@@ -109,4 +109,4 @@ let TaroEnvContribution = class extends BaseEnvContribution {
|
|
|
109
109
|
TaroEnvContribution = __decorate([ injectable(), __metadata("design:paramtypes", []) ], TaroEnvContribution);
|
|
110
110
|
|
|
111
111
|
export { TaroEnvContribution };
|
|
112
|
-
//# sourceMappingURL=taro-contribution.js.map
|
|
112
|
+
//# sourceMappingURL=taro-contribution.js.map
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,qCAAqC,CAAC;AAG/D,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AACxC,cAAc,kCAAkC,CAAC;AAEjD,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAElC,cAAc,OAAO,CAAC;AACtB,cAAc,iDAAiD,CAAC;AAChE,cAAc,+CAA+C,CAAC;AAE9D,cAAc,kDAAkD,CAAC;AACjE,cAAc,gDAAgD,CAAC;AAE/D,cAAc,kDAAkD,CAAC;AACjE,cAAc,gDAAgD,CAAC;AAE/D,cAAc,kDAAkD,CAAC;AACjE,cAAc,gDAAgD,CAAC;AAE/D,cAAc,oDAAoD,CAAC;AACnE,cAAc,kDAAkD,CAAC;AAEjE,cAAc,oDAAoD,CAAC;AACnE,cAAc,kDAAkD,CAAC;AAEjE,cAAc,kDAAkD,CAAC;AACjE,cAAc,gDAAgD,CAAC;AAE/D,cAAc,kDAAkD,CAAC;AACjE,cAAc,gDAAgD,CAAC;AAE/D,cAAc,qDAAqD,CAAC;AACpE,cAAc,mDAAmD,CAAC;AAElE,cAAc,mDAAmD,CAAC;AAClE,cAAc,iDAAiD,CAAC;AAEhE,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AAEnE,cAAc,mDAAmD,CAAC;AAClE,cAAc,iDAAiD,CAAC;AAEhE,cAAc,oDAAoD,CAAC;AAEnE,cAAc,mDAAmD,CAAC;AAElE,cAAc,uDAAuD,CAAC;AAEtE,cAAc,qBAAqB,CAAC;AACpC,cAAc,uDAAuD,CAAC;AACtE,cAAc,gDAAgD,CAAC;AAE/D,cAAc,kBAAkB,CAAC;AACjC,cAAc,oDAAoD,CAAC;AACnE,cAAc,6CAA6C,CAAC;AAE5D,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC","file":"index.js","sourcesContent":["import _roughModule from './render/contributions/rough/module';\n// import _canvasModuleLoader from './canvas/contributions/canvas-module';\n\nexport const roughModule = _roughModule;\nexport * from './picker/contributions/constants';\n\nexport * from './jsx';\nexport * from './react-tree';\nexport * from './event/extension';\n// export * from './env/browser';\nexport * from './env';\nexport * from './picker/contributions/canvas-picker/arc-module';\nexport * from './picker/contributions/math-picker/arc-module';\n\nexport * from './picker/contributions/canvas-picker/rect-module';\nexport * from './picker/contributions/math-picker/rect-module';\n\nexport * from './picker/contributions/canvas-picker/line-module';\nexport * from './picker/contributions/math-picker/line-module';\n\nexport * from './picker/contributions/canvas-picker/area-module';\nexport * from './picker/contributions/math-picker/area-module';\n\nexport * from './picker/contributions/canvas-picker/symbol-module';\nexport * from './picker/contributions/math-picker/symbol-module';\n\nexport * from './picker/contributions/canvas-picker/circle-module';\nexport * from './picker/contributions/math-picker/circle-module';\n\nexport * from './picker/contributions/canvas-picker/text-module';\nexport * from './picker/contributions/math-picker/text-module';\n\nexport * from './picker/contributions/canvas-picker/path-module';\nexport * from './picker/contributions/math-picker/path-module';\n\nexport * from './picker/contributions/canvas-picker/polygon-module';\nexport * from './picker/contributions/math-picker/polygon-module';\n\nexport * from './picker/contributions/canvas-picker/glyph-module';\nexport * from './picker/contributions/math-picker/glyph-module';\n\nexport * from './picker/contributions/canvas-picker/richtext-module';\nexport * from './picker/contributions/math-picker/richtext-module';\n\nexport * from './picker/contributions/canvas-picker/image-module';\nexport * from './picker/contributions/math-picker/image-module';\n\nexport * from './picker/contributions/canvas-picker/rect3d-module';\n\nexport * from './picker/contributions/canvas-picker/arc3d-module';\n\nexport * from './picker/contributions/canvas-picker/pyramid3d-module';\n\nexport * from './graphic/gif-image';\nexport * from './picker/contributions/canvas-picker/gif-image-module';\nexport * from './render/contributions/canvas/gif-image-module';\n\nexport * from './graphic/Lottie';\nexport * from './picker/contributions/canvas-picker/lottie-module';\nexport * from './render/contributions/canvas/lottie-module';\n\nexport * from './register/register-arc';\nexport * from './register/register-arc3d';\nexport * from './register/register-area';\nexport * from './register/register-circle';\nexport * from './register/register-glyph';\nexport * from './register/register-group';\nexport * from './register/register-image';\nexport * from './register/register-line';\nexport * from './register/register-path';\nexport * from './register/register-polygon';\nexport * from './register/register-pyramid3d';\nexport * from './register/register-rect';\nexport * from './register/register-rect3d';\nexport * from './register/register-richtext';\nexport * from './register/register-shadowRoot';\nexport * from './register/register-symbol';\nexport * from './register/register-text';\nexport * from './register/register-wraptext';\n// export const canvasModuleLoader = _canvasModuleLoader;\n// export { nodeLoader }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AA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC","file":"index.js","sourcesContent":["import _roughModule from './render/contributions/rough/module';\n// import _canvasModuleLoader from './canvas/contributions/canvas-module';\n\nexport const roughModule = _roughModule;\nexport * from './picker/contributions/constants';\n\nexport * from './jsx';\nexport * from './react-tree';\nexport * from './event/extension';\n// export * from './env/browser';\nexport * from './env';\nexport * from './picker/contributions/canvas-picker/arc-module';\nexport * from './picker/contributions/math-picker/arc-module';\n\nexport * from './picker/contributions/canvas-picker/rect-module';\nexport * from './picker/contributions/math-picker/rect-module';\n\nexport * from './picker/contributions/canvas-picker/line-module';\nexport * from './picker/contributions/math-picker/line-module';\n\nexport * from './picker/contributions/canvas-picker/area-module';\nexport * from './picker/contributions/math-picker/area-module';\n\nexport * from './picker/contributions/canvas-picker/symbol-module';\nexport * from './picker/contributions/math-picker/symbol-module';\n\nexport * from './picker/contributions/canvas-picker/circle-module';\nexport * from './picker/contributions/math-picker/circle-module';\n\nexport * from './picker/contributions/canvas-picker/text-module';\nexport * from './picker/contributions/math-picker/text-module';\n\nexport * from './picker/contributions/canvas-picker/path-module';\nexport * from './picker/contributions/math-picker/path-module';\n\nexport * from './picker/contributions/canvas-picker/polygon-module';\nexport * from './picker/contributions/math-picker/polygon-module';\n\nexport * from './picker/contributions/canvas-picker/glyph-module';\nexport * from './picker/contributions/math-picker/glyph-module';\n\nexport * from './picker/contributions/canvas-picker/richtext-module';\nexport * from './picker/contributions/math-picker/richtext-module';\n\nexport * from './picker/contributions/canvas-picker/image-module';\nexport * from './picker/contributions/math-picker/image-module';\n\nexport * from './picker/contributions/canvas-picker/rect3d-module';\n\nexport * from './picker/contributions/canvas-picker/arc3d-module';\n\nexport * from './picker/contributions/canvas-picker/pyramid3d-module';\n\nexport * from './graphic/gif-image';\nexport * from './picker/contributions/canvas-picker/gif-image-module';\nexport * from './render/contributions/canvas/gif-image-module';\n\nexport * from './graphic/Lottie';\nexport * from './picker/contributions/canvas-picker/lottie-module';\nexport * from './render/contributions/canvas/lottie-module';\n\nexport * from './register/register-arc';\nexport * from './register/register-arc3d';\nexport * from './register/register-area';\nexport * from './register/register-circle';\nexport * from './register/register-glyph';\nexport * from './register/register-group';\nexport * from './register/register-image';\nexport * from './register/register-line';\nexport * from './register/register-path';\nexport * from './register/register-polygon';\nexport * from './register/register-pyramid3d';\nexport * from './register/register-rect';\nexport * from './register/register-rect3d';\nexport * from './register/register-richtext';\nexport * from './register/register-shadowRoot';\nexport * from './register/register-symbol';\nexport * from './register/register-text';\nexport * from './register/register-wraptext';\nexport * from './tools/dynamicTexture/effect';\n// export const canvasModuleLoader = _canvasModuleLoader;\n// export { nodeLoader } from './node-bind'; // nodeLoader只在node入口暴露\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IContext2d, IGraphic } from '@visactor/vrender-core';
|
|
2
|
+
export declare function randomOpacity(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
3
|
+
export declare function columnLeftToRight(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
4
|
+
export declare function columnRightToLeft(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
5
|
+
export declare function rowTopToBottom(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
6
|
+
export declare function rowBottomToTop(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
7
|
+
export declare function diagonalCenterToEdge(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
8
|
+
export declare function diagonalTopLeftToBottomRight(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
9
|
+
export declare function rotationScan(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
10
|
+
export declare function rippleEffect(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
11
|
+
export declare function snakeWave(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
12
|
+
export declare function alternatingWave(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
13
|
+
export declare function spiralEffect(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
14
|
+
export declare function columnCenterToEdge(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
15
|
+
export declare function columnEdgeToCenter(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
16
|
+
export declare function rowCenterToEdge(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
17
|
+
export declare function rowEdgeToCenter(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
18
|
+
export declare function cornerToCenter(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
19
|
+
export declare function centerToCorner(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
20
|
+
export declare function pulseWave(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
21
|
+
export declare function particleEffect(ctx: IContext2d, row: number, column: number, rowCount: number, columnCount: number, ratio: number, graphic: IGraphic, minRatio?: number, amplitude?: number): number;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
export function randomOpacity(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
2
|
+
graphic.dynamicTextureCache || (graphic.dynamicTextureCache = new Array(rowCount * columnCount).fill(0).map((item => 2 * Math.random() * Math.PI)));
|
|
3
|
+
const targetRandomValue = graphic.dynamicTextureCache[row * columnCount + column], _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI + targetRandomValue) + 1) / 2;
|
|
4
|
+
return Math.min(1, Math.max(0, _r));
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function columnLeftToRight(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
8
|
+
const delay = column / columnCount, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * delay * Math.PI) + 1) / 2;
|
|
9
|
+
return Math.min(1, Math.max(0, _r));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function columnRightToLeft(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
13
|
+
const delay = (columnCount - 1 - column) / columnCount, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * delay * Math.PI) + 1) / 2;
|
|
14
|
+
return Math.min(1, Math.max(0, _r));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function rowTopToBottom(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
18
|
+
const delay = row / rowCount, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * delay * Math.PI) + 1) / 2;
|
|
19
|
+
return Math.min(1, Math.max(0, _r));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function rowBottomToTop(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
23
|
+
const delay = (rowCount - 1 - row) / rowCount, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * delay * Math.PI) + 1) / 2;
|
|
24
|
+
return Math.min(1, Math.max(0, _r));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function diagonalCenterToEdge(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
28
|
+
const centerRow = rowCount / 2, centerCol = columnCount / 2, distance = Math.sqrt(Math.pow((row - centerRow) / rowCount, 2) + Math.pow((column - centerCol) / columnCount, 2)), _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * distance * Math.PI) + 1) / 2;
|
|
29
|
+
return Math.min(1, Math.max(0, _r));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function diagonalTopLeftToBottomRight(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
33
|
+
const delay = (row / rowCount + column / columnCount) / 2, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * delay * Math.PI) + 1) / 2;
|
|
34
|
+
return Math.min(1, Math.max(0, _r));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function rotationScan(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
38
|
+
const centerRow = rowCount / 2, centerCol = columnCount / 2, angle = Math.atan2(row - centerRow, column - centerCol), delay = (angle < 0 ? angle + 2 * Math.PI : angle) / (2 * Math.PI), _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * delay * Math.PI) + 1) / 2;
|
|
39
|
+
return Math.min(1, Math.max(0, _r));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function rippleEffect(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
43
|
+
const centerRow = rowCount / 2, centerCol = columnCount / 2, normalizedDistance = Math.sqrt(Math.pow(row - centerRow, 2) + Math.pow(column - centerCol, 2)) / Math.sqrt(Math.pow(rowCount / 2, 2) + Math.pow(columnCount / 2, 2)), _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI * 3 - 2 * normalizedDistance * Math.PI) + 1) / 2;
|
|
44
|
+
return Math.min(1, Math.max(0, _r));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function snakeWave(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
48
|
+
const delay = (row + column) % (rowCount + columnCount) / (rowCount + columnCount), _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 4 * delay * Math.PI) + 1) / 2;
|
|
49
|
+
return Math.min(1, Math.max(0, _r));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function alternatingWave(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
53
|
+
const rowPhase = row / rowCount, colPhase = column / columnCount, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * rowPhase * Math.PI) * Math.sin(2 * ratio * Math.PI - 2 * colPhase * Math.PI) + 1) / 2;
|
|
54
|
+
return Math.min(1, Math.max(0, _r));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function spiralEffect(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
58
|
+
const centerRow = rowCount / 2, centerCol = columnCount / 2, distance = Math.sqrt(Math.pow(row - centerRow, 2) + Math.pow(column - centerCol, 2)), angle = Math.atan2(row - centerRow, column - centerCol), delay = (distance / Math.sqrt(Math.pow(rowCount / 2, 2) + Math.pow(columnCount / 2, 2)) + angle / (2 * Math.PI)) / 2, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 4 * delay * Math.PI) + 1) / 2;
|
|
59
|
+
return Math.min(1, Math.max(0, _r));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function columnCenterToEdge(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
63
|
+
const centerCol = columnCount / 2, distance = Math.abs(column - centerCol) / centerCol, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * distance * Math.PI) + 1) / 2;
|
|
64
|
+
return Math.min(1, Math.max(0, _r));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function columnEdgeToCenter(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
68
|
+
const centerCol = columnCount / 2, distance = 1 - Math.abs(column - centerCol) / centerCol, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * distance * Math.PI) + 1) / 2;
|
|
69
|
+
return Math.min(1, Math.max(0, _r));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function rowCenterToEdge(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
73
|
+
const centerRow = rowCount / 2, distance = Math.abs(row - centerRow) / centerRow, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * distance * Math.PI) + 1) / 2;
|
|
74
|
+
return Math.min(1, Math.max(0, _r));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function rowEdgeToCenter(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
78
|
+
const centerRow = rowCount / 2, distance = 1 - Math.abs(row - centerRow) / centerRow, _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * distance * Math.PI) + 1) / 2;
|
|
79
|
+
return Math.min(1, Math.max(0, _r));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function cornerToCenter(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
83
|
+
const centerRow = rowCount / 2, centerCol = columnCount / 2, distance = Math.sqrt(Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)), normalizedDistance = Math.min(distance, 1), _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * normalizedDistance * Math.PI) + 1) / 2;
|
|
84
|
+
return Math.min(1, Math.max(0, _r));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function centerToCorner(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
88
|
+
const centerRow = rowCount / 2, centerCol = columnCount / 2, distance = Math.sqrt(Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)), normalizedDistance = 1 - Math.min(distance, 1), _r = minRatio + amplitude * (Math.sin(2 * ratio * Math.PI - 2 * normalizedDistance * Math.PI) + 1) / 2;
|
|
89
|
+
return Math.min(1, Math.max(0, _r));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function pulseWave(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
93
|
+
const centerRow = rowCount / 2, centerCol = columnCount / 2, distance = Math.sqrt(Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)), normalizedDistance = Math.min(distance, 1), wavePhase = 2 * ratio * Math.PI * 3, decay = Math.max(0, 1 - normalizedDistance), _r = minRatio + amplitude * ((Math.sin(wavePhase - 4 * normalizedDistance * Math.PI) + 1) / 2) * (.7 * decay + .3);
|
|
94
|
+
return Math.min(1, Math.max(0, _r));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function particleEffect(ctx, row, column, rowCount, columnCount, ratio, graphic, minRatio = 0, amplitude = 1) {
|
|
98
|
+
graphic.dynamicTextureCache || (graphic.dynamicTextureCache = {
|
|
99
|
+
phases: new Array(rowCount * columnCount).fill(0).map((() => 2 * Math.random() * Math.PI)),
|
|
100
|
+
speeds: new Array(rowCount * columnCount).fill(0).map((() => .5 + .5 * Math.random())),
|
|
101
|
+
directions: new Array(rowCount * columnCount).fill(0).map((() => 2 * Math.random() * Math.PI))
|
|
102
|
+
});
|
|
103
|
+
const index = row * columnCount + column, phase = graphic.dynamicTextureCache.phases[index], speed = graphic.dynamicTextureCache.speeds[index], direction = graphic.dynamicTextureCache.directions[index], centerRow = rowCount / 2, centerCol = columnCount / 2, distance = Math.sqrt(Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)), normalizedDistance = Math.min(distance, 1), scatterRatio = (ratio - .4) / .6, movement = Math.sin(scatterRatio * speed * 8 * Math.PI + phase + direction * scatterRatio), distanceEffect = Math.cos(normalizedDistance * Math.PI + scatterRatio * Math.PI), _r = minRatio + amplitude * ((movement + 1) / 2 * Math.max(0, 1 - 1.2 * scatterRatio) * (.3 + .7 * distanceEffect));
|
|
104
|
+
return Math.min(1, Math.max(0, _r));
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=effect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tools/dynamicTexture/effect.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAC3B,GAAe,EACf,GAAW,EACX,MAAc,EACd,QAAgB,EAChB,WAAmB,EACnB,KA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YAAY,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IAEzC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,KAAK,GAAG,SAAS,GAAG,YAAY,CAAC,CAAC;IAEjG,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,kBAAkB,GAAG,IAAI,CAAC,EAAE,GAAG,YAAY,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;IAEvF,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,YAAY,GAAG,GAAG,CAAC,CAAC;IAGlD,MAAM,UAAU,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,cAAc,CAAC,CAAC;IAC/E,MAAM,EAAE,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;IAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACtC,CAAC","file":"effect.js","sourcesContent":["import type { IContext2d, IGraphic } from '@visactor/vrender-core';\n\nexport function randomOpacity(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0, // 最小ratio值,默认为0\n amplitude: number = 1 // 变化幅度,默认为1\n): number {\n if (!graphic.dynamicTextureCache) {\n graphic.dynamicTextureCache = new Array(rowCount * columnCount).fill(0).map(item => Math.random() * 2 * Math.PI);\n }\n const targetRandomValue = graphic.dynamicTextureCache[row * columnCount + column];\n // 调整sin函数的振幅,并将结果映射到[minRatio, minRatio + amplitude]范围\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI + targetRandomValue) + 1)) / 2;\n return Math.min(1, Math.max(0, _r)); // 确保返回值在[0,1]范围内\n}\n\n// 从左到右的列式渐变\nexport function columnLeftToRight(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const delay = column / columnCount;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从右到左的列式渐变\nexport function columnRightToLeft(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const delay = (columnCount - 1 - column) / columnCount;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从上到下的行式渐变\nexport function rowTopToBottom(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const delay = row / rowCount;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从下到上的行式渐变\nexport function rowBottomToTop(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const delay = (rowCount - 1 - row) / rowCount;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从中心向两边的对角线渐变\nexport function diagonalCenterToEdge(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n const distance = Math.sqrt(\n Math.pow((row - centerRow) / rowCount, 2) + Math.pow((column - centerCol) / columnCount, 2)\n );\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从左上角到右下角的对角线渐变\nexport function diagonalTopLeftToBottomRight(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const delay = (row / rowCount + column / columnCount) / 2;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 旋转扫描效果\nexport function rotationScan(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n // 计算当前点相对于中心点的角度\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n const angle = Math.atan2(row - centerRow, column - centerCol);\n // 将角度归一化到 [0, 2π]\n const normalizedAngle = angle < 0 ? angle + 2 * Math.PI : angle;\n // 计算扫描延迟\n const delay = normalizedAngle / (2 * Math.PI);\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 波纹扩散效果\nexport function rippleEffect(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n // 计算到中心的距离\n const distance = Math.sqrt(Math.pow(row - centerRow, 2) + Math.pow(column - centerCol, 2));\n // 归一化距离\n const normalizedDistance = distance / Math.sqrt(Math.pow(rowCount / 2, 2) + Math.pow(columnCount / 2, 2));\n // 创建多个波纹\n const waves = 3;\n const _r =\n minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI * waves - normalizedDistance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 蛇形波动效果\nexport function snakeWave(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n // 使用行和列的位置创建蛇形路径\n const delay = ((row + column) % (rowCount + columnCount)) / (rowCount + columnCount);\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 4 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 交错波纹效果\nexport function alternatingWave(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n // 行和列的交错波纹\n const rowPhase = row / rowCount;\n const colPhase = column / columnCount;\n const _r =\n minRatio +\n (amplitude *\n (Math.sin(ratio * 2 * Math.PI - rowPhase * 2 * Math.PI) * Math.sin(ratio * 2 * Math.PI - colPhase * 2 * Math.PI) +\n 1)) /\n 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 螺旋效果\nexport function spiralEffect(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n // 计算到中心的距离和角度\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n const distance = Math.sqrt(Math.pow(row - centerRow, 2) + Math.pow(column - centerCol, 2));\n const angle = Math.atan2(row - centerRow, column - centerCol);\n // 归一化距离\n const normalizedDistance = distance / Math.sqrt(Math.pow(rowCount / 2, 2) + Math.pow(columnCount / 2, 2));\n // 组合距离和角度创建螺旋效果\n const delay = (normalizedDistance + angle / (2 * Math.PI)) / 2;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - delay * 4 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从两边向中间的列式渐变\nexport function columnCenterToEdge(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerCol = columnCount / 2;\n // 计算到中心的距离,并归一化到[0,1]区间\n const distance = Math.abs(column - centerCol) / centerCol;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从中间向两边的列式渐变\nexport function columnEdgeToCenter(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerCol = columnCount / 2;\n // 计算到中心的距离,并归一化到[0,1]区间,然后用1减去它来反转延迟\n const distance = 1 - Math.abs(column - centerCol) / centerCol;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从上下向中间的行式渐变\nexport function rowCenterToEdge(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerRow = rowCount / 2;\n // 计算到中心的距离,并归一化到[0,1]区间\n const distance = Math.abs(row - centerRow) / centerRow;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从中间向上下的行式渐变\nexport function rowEdgeToCenter(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerRow = rowCount / 2;\n // 计算到中心的距离,并归一化到[0,1]区间,然后用1减去它来反转延迟\n const distance = 1 - Math.abs(row - centerRow) / centerRow;\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从四个角向中心的渐变\nexport function cornerToCenter(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n // 计算到中心的距离,使用欧几里得距离\n const distance = Math.sqrt(\n Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)\n );\n // 归一化到[0,1]区间\n const normalizedDistance = Math.min(distance, 1);\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - normalizedDistance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 从中心向四个角的渐变\nexport function centerToCorner(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n // 计算到中心的距离,使用欧几里得距离\n const distance = Math.sqrt(\n Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)\n );\n // 归一化到[0,1]区间并反转\n const normalizedDistance = 1 - Math.min(distance, 1);\n const _r = minRatio + (amplitude * (Math.sin(ratio * 2 * Math.PI - normalizedDistance * 2 * Math.PI) + 1)) / 2;\n return Math.min(1, Math.max(0, _r));\n}\n\n// 脉冲波纹效果\nexport function pulseWave(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n // 计算到中心的距离\n const distance = Math.sqrt(\n Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)\n );\n const normalizedDistance = Math.min(distance, 1);\n // 创建多个波纹\n const waves = 3;\n const wavePhase = ratio * 2 * Math.PI * waves;\n // 添加距离衰减\n const decay = Math.max(0, 1 - normalizedDistance);\n // 组合波纹和衰减效果\n const wave = Math.sin(wavePhase - normalizedDistance * 4 * Math.PI);\n const _r = minRatio + amplitude * ((wave + 1) / 2) * (decay * 0.7 + 0.3);\n return Math.min(1, Math.max(0, _r));\n}\n\n// 粒子动画效果\nexport function particleEffect(\n ctx: IContext2d,\n row: number,\n column: number,\n rowCount: number,\n columnCount: number,\n ratio: number,\n graphic: IGraphic,\n minRatio: number = 0,\n amplitude: number = 1\n): number {\n // 初始化随机种子\n if (!graphic.dynamicTextureCache) {\n graphic.dynamicTextureCache = {\n phases: new Array(rowCount * columnCount).fill(0).map(() => Math.random() * 2 * Math.PI),\n speeds: new Array(rowCount * columnCount).fill(0).map(() => 0.5 + Math.random() * 0.5),\n directions: new Array(rowCount * columnCount).fill(0).map(() => Math.random() * 2 * Math.PI)\n };\n }\n\n const index = row * columnCount + column;\n const phase = graphic.dynamicTextureCache.phases[index];\n const speed = graphic.dynamicTextureCache.speeds[index];\n const direction = graphic.dynamicTextureCache.directions[index];\n\n // 计算到中心的距离\n const centerRow = rowCount / 2;\n const centerCol = columnCount / 2;\n const distance = Math.sqrt(\n Math.pow((row - centerRow) / centerRow, 2) + Math.pow((column - centerCol) / centerCol, 2)\n );\n const normalizedDistance = Math.min(distance, 1);\n\n // 扩散阶段:粒子随机运动\n const scatterRatio = (ratio - 0.4) / 0.6;\n // 使用相位和方向创建随机运动\n const movement = Math.sin(scatterRatio * speed * 8 * Math.PI + phase + direction * scatterRatio);\n // 添加距离影响\n const distanceEffect = Math.cos(normalizedDistance * Math.PI + scatterRatio * Math.PI);\n // 添加衰减效果\n const decay = Math.max(0, 1 - scatterRatio * 1.2);\n\n // 组合所有效果\n const baseEffect = ((movement + 1) / 2) * decay * (0.3 + 0.7 * distanceEffect);\n const _r = minRatio + amplitude * baseEffect;\n return Math.min(1, Math.max(0, _r));\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=dynamicTexture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tools/dynamicTexture.ts"],"names":[],"mappings":"","file":"dynamicTexture.js","sourcesContent":["// import type { IContext2d, IGraphic } from '@visactor/vrender-core';\n\n// export function randomOpacity(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// if (!graphic.dynamicTextureCache) {\n// graphic.dynamicTextureCache = new Array(rowCount * columnCount).fill(0).map(item => Math.random() * 2 * Math.PI);\n// }\n// const targetRandomValue = graphic.dynamicTextureCache[row * columnCount + column];\n// const _r = (Math.sin(ratio * 2 * Math.PI + targetRandomValue) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 从左到右的列式渐变\n// export function columnLeftToRight(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// // 根据列号计算延迟\n// const delay = column / columnCount;\n// // 使用连续的sin函数,不需要max(0,ratio-delay)的截断\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 从右到左的列式渐变\n// export function columnRightToLeft(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// const delay = (columnCount - 1 - column) / columnCount;\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 从上到下的行式渐变\n// export function rowTopToBottom(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// const delay = row / rowCount;\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 从下到上的行式渐变\n// export function rowBottomToTop(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// const delay = (rowCount - 1 - row) / rowCount;\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 从中心向两边的对角线渐变\n// export function diagonalCenterToEdge(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// const centerRow = rowCount / 2;\n// const centerCol = columnCount / 2;\n// const distance = Math.sqrt(\n// Math.pow((row - centerRow) / rowCount, 2) + Math.pow((column - centerCol) / columnCount, 2)\n// );\n// const _r = (Math.sin(ratio * 2 * Math.PI - distance * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 从左上角到右下角的对角线渐变\n// export function diagonalTopLeftToBottomRight(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// const delay = (row / rowCount + column / columnCount) / 2;\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 旋转扫描效果\n// export function rotationScan(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// // 计算当前点相对于中心点的角度\n// const centerRow = rowCount / 2;\n// const centerCol = columnCount / 2;\n// const angle = Math.atan2(row - centerRow, column - centerCol);\n// // 将角度归一化到 [0, 2π]\n// const normalizedAngle = angle < 0 ? angle + 2 * Math.PI : angle;\n// // 计算扫描延迟\n// const delay = normalizedAngle / (2 * Math.PI);\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 波纹扩散效果\n// export function rippleEffect(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// const centerRow = rowCount / 2;\n// const centerCol = columnCount / 2;\n// // 计算到中心的距离\n// const distance = Math.sqrt(Math.pow(row - centerRow, 2) + Math.pow(column - centerCol, 2));\n// // 归一化距离\n// const normalizedDistance = distance / Math.sqrt(Math.pow(rowCount / 2, 2) + Math.pow(columnCount / 2, 2));\n// // 创建多个波纹\n// const waves = 3;\n// const _r = (Math.sin(ratio * 2 * Math.PI * waves - normalizedDistance * 2 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 蛇形波动效果\n// export function snakeWave(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// // 使用行和列的位置创建蛇形路径\n// const delay = ((row + column) % (rowCount + columnCount)) / (rowCount + columnCount);\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 4 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 交错波纹效果\n// export function alternatingWave(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// // 行和列的交错波纹\n// const rowPhase = row / rowCount;\n// const colPhase = column / columnCount;\n// const _r =\n// (Math.sin(ratio * 2 * Math.PI - rowPhase * 2 * Math.PI) * Math.sin(ratio * 2 * Math.PI - colPhase * 2 * Math.PI) +\n// 1) /\n// 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n\n// // 螺旋效果\n// export function spiralEffect(\n// ctx: IContext2d,\n// row: number,\n// column: number,\n// rowCount: number,\n// columnCount: number,\n// ratio: number,\n// graphic: IGraphic\n// ) {\n// const centerRow = rowCount / 2;\n// const centerCol = columnCount / 2;\n// // 计算到中心的距离和角度\n// const distance = Math.sqrt(Math.pow(row - centerRow, 2) + Math.pow(column - centerCol, 2));\n// const angle = Math.atan2(row - centerRow, column - centerCol);\n// // 归一化距离\n// const normalizedDistance = distance / Math.sqrt(Math.pow(rowCount / 2, 2) + Math.pow(columnCount / 2, 2));\n// // 组合距离和角度创建螺旋效果\n// const delay = (normalizedDistance + angle / (2 * Math.PI)) / 2;\n// const _r = (Math.sin(ratio * 2 * Math.PI - delay * 4 * Math.PI) + 1) / 2;\n// ctx.globalAlpha = _r;\n// ctx.fill();\n// }\n"]}
|
|
@@ -54,13 +54,14 @@ let NodeWindowHandlerContribution = class extends BaseWindowHandlerContribution
|
|
|
54
54
|
this.canvas = new NodeCanvas(options);
|
|
55
55
|
}
|
|
56
56
|
createWindowByCanvas(params) {
|
|
57
|
-
|
|
57
|
+
var _a;
|
|
58
|
+
const canvas = params.canvas, dpr = null !== (_a = params.dpr) && void 0 !== _a ? _a : 1;
|
|
58
59
|
let width = params.width, height = params.height;
|
|
59
|
-
null != width && null != height && params.canvasControled || (width = canvas.width,
|
|
60
|
-
height = canvas.height), this.canvas = new NodeCanvas({
|
|
60
|
+
null != width && null != height && params.canvasControled || (width = canvas.width / dpr,
|
|
61
|
+
height = canvas.height / dpr), this.canvas = new NodeCanvas({
|
|
61
62
|
width: width,
|
|
62
63
|
height: height,
|
|
63
|
-
dpr:
|
|
64
|
+
dpr: dpr,
|
|
64
65
|
nativeCanvas: canvas,
|
|
65
66
|
canvasControled: params.canvasControled
|
|
66
67
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/window/contributions/node-contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,SAAS,EACT,6BAA6B,EAC7B,OAAO,EACP,eAAe,EACf,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAWhC,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAGtD,IAAM,6BAA6B,GAAnC,MAAM,6BAA8B,SAAQ,6BAA6B;IAK9E,IAAI,SAAS;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAA8C,MAAe;QAC3D,KAAK,EAAE,CAAC;QADoC,WAAM,GAAN,MAAM,CAAS;QAP7D,SAAI,GAAY,MAAM,CAAC;IASvB,CAAC;IAED,QAAQ;QACN,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK;QACH,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;YAC/B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa;SAClC,CAAC;IACJ,CAAC;IAED,KAAK;QACH,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,MAAqB;QAEhC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;SACnC;aAAM;YACL,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;SACnC;IACH,CAAC;IACO,oBAAoB,CAAC,MAAqB;QAEhD,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,E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6BAA6B,CA8IzC;SA9IY,6BAA6B;AAgJ1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;IAEzD,IAAI,CAAC,6BAA6B,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7C,IAAI,CAAC,yBAAyB,CAAC;SAC5B,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;SACvE,eAAe,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC","file":"node-contribution.js","sourcesContent":["import {\n inject,\n injectable,\n Generator,\n BaseWindowHandlerContribution,\n VGlobal,\n ContainerModule,\n WindowHandlerContribution\n} from '@visactor/vrender-core';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport type {\n EnvType,\n IGlobal,\n IContext2d,\n ICanvas,\n IDomRectLike,\n IWindowHandlerContribution,\n IWindowParams\n} from '@visactor/vrender-core';\nimport { NodeCanvas } from '../../canvas/contributions/node';\n\n@injectable()\nexport class NodeWindowHandlerContribution extends BaseWindowHandlerContribution implements IWindowHandlerContribution {\n static env: EnvType = 'node';\n type: EnvType = 'node';\n\n canvas: ICanvas;\n get container(): HTMLElement | null {\n return null;\n }\n\n constructor(@inject(VGlobal) private readonly global: IGlobal) {\n super();\n }\n\n getTitle(): string {\n return '';\n }\n\n getWH(): { width: number; height: number } {\n return {\n width: this.canvas.displayWidth,\n height: this.canvas.displayHeight\n };\n }\n\n getXY(): { x: number; y: number } {\n return { x: 0, y: 0 };\n }\n\n createWindow(params: IWindowParams): void {\n // 如果没有传入canvas,那么就创建一个canvas\n if (!params.canvas) {\n this.createWindowByConfig(params);\n } else {\n this.createWindowByCanvas(params);\n }\n }\n private createWindowByConfig(params: IWindowParams) {\n // 创建canvas\n const nativeCanvas = this.global.createCanvas({ width: params.width, height: params.height });\n\n // 绑定\n const options = {\n width: params.width,\n height: params.height,\n dpr: params.dpr,\n nativeCanvas,\n id: Generator.GenAutoIncrementId().toString(),\n canvasControled: true\n };\n this.canvas = new NodeCanvas(options);\n }\n private createWindowByCanvas(params: IWindowParams) {\n // 获取canvas\n const canvas = params!.canvas as HTMLCanvasElement | null;\n const dpr = params.dpr ?? 1;\n // 如果没有传入wh,或者是不受控制的canvas,那就用canvas的原始wh\n let width = params.width;\n let height = params.height;\n if (width == null || height == null || !params.canvasControled) {\n width = canvas.width / dpr;\n height = canvas.height / dpr;\n }\n\n this.canvas = new NodeCanvas({\n width: width,\n height: height,\n dpr: dpr,\n nativeCanvas: canvas,\n canvasControled: params.canvasControled\n });\n }\n releaseWindow(): void {\n this.canvas.release();\n }\n resizeWindow(width: number, height: number): void {\n this.canvas.resize(width, height);\n }\n setDpr(dpr: number): void {\n this.canvas.dpr = dpr;\n }\n\n getContext(): IContext2d {\n return this.canvas.getContext();\n }\n getNativeHandler(): ICanvas {\n return this.canvas;\n }\n getDpr(): number {\n return this.canvas.dpr;\n }\n\n getImageBuffer(type: string = 'image/png'): any {\n const canvas = this.canvas.nativeCanvas;\n return canvas.toBuffer(type);\n }\n\n addEventListener<K extends keyof DocumentEventMap>(\n type: K,\n listener: (this: Document, ev: DocumentEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n ): void;\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions\n ): void;\n addEventListener(type: unknown, listener: unknown, options?: unknown): void {\n return;\n }\n\n dispatchEvent(event: any): boolean {\n return true;\n }\n\n removeEventListener<K extends keyof DocumentEventMap>(\n type: K,\n listener: (this: Document, ev: DocumentEventMap[K]) => any,\n options?: boolean | EventListenerOptions\n ): void;\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | EventListenerOptions\n ): void;\n removeEventListener(type: unknown, listener: unknown, options?: unknown): void {\n return;\n }\n\n getStyle(): CSSStyleDeclaration | Record<string, any> {\n return;\n }\n setStyle(style: CSSStyleDeclaration | Record<string, any>): void {\n return;\n }\n\n getBoundingClientRect(): IDomRectLike {\n return null;\n }\n\n clearViewBox(color?: string): void {\n return;\n }\n}\n\nexport const nodeWindowModule = new ContainerModule(bind => {\n // node\n bind(NodeWindowHandlerContribution).toSelf();\n bind(WindowHandlerContribution)\n .toDynamicValue(ctx => ctx.container.get(NodeWindowHandlerContribution))\n .whenTargetNamed(NodeWindowHandlerContribution.env);\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vrender-kits",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "cjs/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@visactor/vutils": "~0.19.4",
|
|
16
|
-
"@visactor/vrender-core": "0.22.
|
|
16
|
+
"@visactor/vrender-core": "0.22.1",
|
|
17
17
|
"@resvg/resvg-js": "2.4.1",
|
|
18
18
|
"roughjs": "4.5.2",
|
|
19
19
|
"gifuct-js": "2.1.2",
|