@visactor/vchart 2.0.4-alpha.7 → 2.0.4-alpha.8
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/build/es5/index.js +1 -1
- package/build/index.es.js +66 -1469
- package/build/index.js +66 -1469
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/base/base-chart.js +1 -2
- package/cjs/chart/base/base-chart.js.map +1 -1
- package/cjs/chart/range-area/range-area-transformer.js +1 -2
- package/cjs/chart/range-area/range-area-transformer.js.map +1 -1
- package/cjs/compile/compiler.js +4 -6
- package/cjs/compile/compiler.js.map +1 -1
- package/cjs/component/base/base-component.js.map +1 -1
- package/cjs/component/custom-mark/custom-mark.js +2 -1
- package/cjs/component/custom-mark/custom-mark.js.map +1 -1
- package/cjs/component/data-zoom/data-filter-base-component.d.ts +0 -2
- package/cjs/component/data-zoom/data-filter-base-component.js +5 -15
- package/cjs/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/cjs/component/data-zoom/interface.d.ts +0 -1
- package/cjs/component/data-zoom/interface.js.map +1 -1
- package/cjs/component/marker/mark-point/cartesian-mark-point.js +2 -2
- package/cjs/component/marker/mark-point/cartesian-mark-point.js.map +1 -1
- package/cjs/constant/event.d.ts +1 -2
- package/cjs/constant/event.js +1 -1
- package/cjs/constant/event.js.map +1 -1
- package/cjs/core/factory.d.ts +0 -4
- package/cjs/core/factory.js +2 -8
- package/cjs/core/factory.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/interface.d.ts +0 -2
- package/cjs/core/interface.js.map +1 -1
- package/cjs/core/vchart.d.ts +1 -3
- package/cjs/core/vchart.js +1 -7
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/event/event-dispatcher.d.ts +1 -0
- package/cjs/event/event-dispatcher.js +12 -1
- package/cjs/event/event-dispatcher.js.map +1 -1
- package/cjs/model/interface.d.ts +0 -1
- package/cjs/model/interface.js.map +1 -1
- package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.d.ts +1 -1
- package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js +17 -17
- package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -1
- package/cjs/series/treemap/treemap.js +2 -2
- package/cjs/series/treemap/treemap.js.map +1 -1
- package/cjs/series/word-cloud/base.js +1 -15
- package/cjs/series/word-cloud/base.js.map +1 -1
- package/cjs/typings/spec/common.d.ts +0 -1
- package/cjs/typings/spec/common.js.map +1 -1
- package/cjs/util/style.js +2 -3
- package/cjs/util/style.js.map +1 -1
- package/esm/chart/base/base-chart.js +1 -2
- package/esm/chart/base/base-chart.js.map +1 -1
- package/esm/chart/range-area/range-area-transformer.js +1 -2
- package/esm/chart/range-area/range-area-transformer.js.map +1 -1
- package/esm/compile/compiler.js +4 -6
- package/esm/compile/compiler.js.map +1 -1
- package/esm/component/base/base-component.js.map +1 -1
- package/esm/component/custom-mark/custom-mark.js +2 -1
- package/esm/component/custom-mark/custom-mark.js.map +1 -1
- package/esm/component/data-zoom/data-filter-base-component.d.ts +0 -2
- package/esm/component/data-zoom/data-filter-base-component.js +6 -16
- package/esm/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/esm/component/data-zoom/interface.d.ts +0 -1
- package/esm/component/data-zoom/interface.js.map +1 -1
- package/esm/component/marker/mark-point/cartesian-mark-point.js +2 -2
- package/esm/component/marker/mark-point/cartesian-mark-point.js.map +1 -1
- package/esm/constant/event.d.ts +1 -2
- package/esm/constant/event.js +1 -1
- package/esm/constant/event.js.map +1 -1
- package/esm/core/factory.d.ts +0 -4
- package/esm/core/factory.js +1 -8
- package/esm/core/factory.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/core/interface.d.ts +0 -2
- package/esm/core/interface.js.map +1 -1
- package/esm/core/vchart.d.ts +1 -3
- package/esm/core/vchart.js +0 -8
- package/esm/core/vchart.js.map +1 -1
- package/esm/event/event-dispatcher.d.ts +1 -0
- package/esm/event/event-dispatcher.js +12 -1
- package/esm/event/event-dispatcher.js.map +1 -1
- package/esm/model/interface.d.ts +0 -1
- package/esm/model/interface.js.map +1 -1
- package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.d.ts +1 -1
- package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js +17 -17
- package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -1
- package/esm/series/treemap/treemap.js +2 -2
- package/esm/series/treemap/treemap.js.map +1 -1
- package/esm/series/word-cloud/base.js +0 -16
- package/esm/series/word-cloud/base.js.map +1 -1
- package/esm/typings/spec/common.d.ts +0 -1
- package/esm/typings/spec/common.js.map +1 -1
- package/esm/util/style.js +2 -3
- package/esm/util/style.js.map +1 -1
- package/package.json +8 -8
- package/cjs/plugin/vchart/index.d.ts +0 -2
- package/cjs/plugin/vchart/index.js +0 -21
- package/cjs/plugin/vchart/index.js.map +0 -1
- package/cjs/plugin/vchart/interface.d.ts +0 -16
- package/cjs/plugin/vchart/interface.js +0 -6
- package/cjs/plugin/vchart/interface.js.map +0 -1
- package/cjs/plugin/vchart/plugin-service.d.ts +0 -9
- package/cjs/plugin/vchart/plugin-service.js +0 -24
- package/cjs/plugin/vchart/plugin-service.js.map +0 -1
- package/cjs/plugin/vchart/register.d.ts +0 -2
- package/cjs/plugin/vchart/register.js +0 -12
- package/cjs/plugin/vchart/register.js.map +0 -1
- package/cjs/plugin/vchart/rotate/index.d.ts +0 -1
- package/cjs/plugin/vchart/rotate/index.js +0 -21
- package/cjs/plugin/vchart/rotate/index.js.map +0 -1
- package/cjs/plugin/vchart/rotate/rotate.d.ts +0 -18
- package/cjs/plugin/vchart/rotate/rotate.js +0 -67
- package/cjs/plugin/vchart/rotate/rotate.js.map +0 -1
- package/esm/plugin/vchart/index.d.ts +0 -2
- package/esm/plugin/vchart/index.js +0 -4
- package/esm/plugin/vchart/index.js.map +0 -1
- package/esm/plugin/vchart/interface.d.ts +0 -16
- package/esm/plugin/vchart/interface.js +0 -2
- package/esm/plugin/vchart/interface.js.map +0 -1
- package/esm/plugin/vchart/plugin-service.d.ts +0 -9
- package/esm/plugin/vchart/plugin-service.js +0 -16
- package/esm/plugin/vchart/plugin-service.js.map +0 -1
- package/esm/plugin/vchart/register.d.ts +0 -2
- package/esm/plugin/vchart/register.js +0 -6
- package/esm/plugin/vchart/register.js.map +0 -1
- package/esm/plugin/vchart/rotate/index.d.ts +0 -1
- package/esm/plugin/vchart/rotate/index.js +0 -2
- package/esm/plugin/vchart/rotate/index.js.map +0 -1
- package/esm/plugin/vchart/rotate/rotate.d.ts +0 -18
- package/esm/plugin/vchart/rotate/rotate.js +0 -62
- package/esm/plugin/vchart/rotate/rotate.js.map +0 -1
package/build/index.es.js
CHANGED
|
@@ -9731,34 +9731,6 @@ class GradientParser {
|
|
|
9731
9731
|
}
|
|
9732
9732
|
return c;
|
|
9733
9733
|
}
|
|
9734
|
-
static processColorStops(colorStops) {
|
|
9735
|
-
if (!colorStops || 0 === colorStops.length) return [];
|
|
9736
|
-
if (colorStops.some(item => item.length)) {
|
|
9737
|
-
const stops = colorStops.map(item => ({
|
|
9738
|
-
color: item.value,
|
|
9739
|
-
offset: item.length ? parseFloat(item.length.value) / 100 : -1
|
|
9740
|
-
}));
|
|
9741
|
-
stops[0].offset < 0 && (stops[0].offset = 0), stops[stops.length - 1].offset < 0 && (stops[stops.length - 1].offset = 1);
|
|
9742
|
-
for (let i = 1; i < stops.length - 1; i++) if (stops[i].offset < 0) {
|
|
9743
|
-
const prevWithOffsetIdx = i - 1;
|
|
9744
|
-
let nextWithOffsetIdx = i + 1;
|
|
9745
|
-
for (; nextWithOffsetIdx < stops.length && stops[nextWithOffsetIdx].offset < 0;) nextWithOffsetIdx++;
|
|
9746
|
-
const startOffset = stops[prevWithOffsetIdx].offset,
|
|
9747
|
-
endOffset = stops[nextWithOffsetIdx].offset,
|
|
9748
|
-
unspecCount = nextWithOffsetIdx - prevWithOffsetIdx;
|
|
9749
|
-
for (let j = 1; j < unspecCount; j++) stops[prevWithOffsetIdx + j].offset = startOffset + (endOffset - startOffset) * j / unspecCount;
|
|
9750
|
-
i = nextWithOffsetIdx - 1;
|
|
9751
|
-
}
|
|
9752
|
-
return stops;
|
|
9753
|
-
}
|
|
9754
|
-
return colorStops.map((item, index) => {
|
|
9755
|
-
const offset = colorStops.length > 1 ? index / (colorStops.length - 1) : 0;
|
|
9756
|
-
return {
|
|
9757
|
-
color: item.value,
|
|
9758
|
-
offset: offset
|
|
9759
|
-
};
|
|
9760
|
-
});
|
|
9761
|
-
}
|
|
9762
9734
|
static ParseConic(datum) {
|
|
9763
9735
|
const {
|
|
9764
9736
|
orientation: orientation,
|
|
@@ -9772,7 +9744,10 @@ class GradientParser {
|
|
|
9772
9744
|
y: .5,
|
|
9773
9745
|
startAngle: sa,
|
|
9774
9746
|
endAngle: sa + pi2,
|
|
9775
|
-
stops:
|
|
9747
|
+
stops: colorStops.map(item => ({
|
|
9748
|
+
color: item.value,
|
|
9749
|
+
offset: parseFloat(item.length.value) / 100
|
|
9750
|
+
}))
|
|
9776
9751
|
};
|
|
9777
9752
|
}
|
|
9778
9753
|
static ParseRadial(datum) {
|
|
@@ -9787,7 +9762,10 @@ class GradientParser {
|
|
|
9787
9762
|
y1: .5,
|
|
9788
9763
|
r0: 0,
|
|
9789
9764
|
r1: 1,
|
|
9790
|
-
stops:
|
|
9765
|
+
stops: colorStops.map(item => ({
|
|
9766
|
+
color: item.value,
|
|
9767
|
+
offset: parseFloat(item.length.value) / 100
|
|
9768
|
+
}))
|
|
9791
9769
|
};
|
|
9792
9770
|
}
|
|
9793
9771
|
static ParseLinear(datum) {
|
|
@@ -9809,7 +9787,10 @@ class GradientParser {
|
|
|
9809
9787
|
y0: y0,
|
|
9810
9788
|
x1: x1,
|
|
9811
9789
|
y1: y1,
|
|
9812
|
-
stops:
|
|
9790
|
+
stops: colorStops.map(item => ({
|
|
9791
|
+
color: item.value,
|
|
9792
|
+
offset: parseFloat(item.length.value) / 100
|
|
9793
|
+
}))
|
|
9813
9794
|
};
|
|
9814
9795
|
}
|
|
9815
9796
|
}
|
|
@@ -17154,7 +17135,7 @@ class RichText extends Graphic {
|
|
|
17154
17135
|
case "right":
|
|
17155
17136
|
deltaX = -aabbBounds.width();
|
|
17156
17137
|
}
|
|
17157
|
-
return
|
|
17138
|
+
return aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
|
|
17158
17139
|
}
|
|
17159
17140
|
needUpdateTags(keys) {
|
|
17160
17141
|
return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);
|
|
@@ -31745,6 +31726,8 @@ class WaitStep extends Step {
|
|
|
31745
31726
|
}
|
|
31746
31727
|
onStart() {
|
|
31747
31728
|
super.onStart();
|
|
31729
|
+
}
|
|
31730
|
+
onFirstRun() {
|
|
31748
31731
|
const fromProps = this.getFromProps();
|
|
31749
31732
|
this.target.setAttributes(fromProps);
|
|
31750
31733
|
}
|
|
@@ -32825,45 +32808,6 @@ class AComponentAnimate extends ACustomAnimate {
|
|
|
32825
32808
|
this._animator && this._animator.stop();
|
|
32826
32809
|
}
|
|
32827
32810
|
}
|
|
32828
|
-
class AStageAnimate extends ACustomAnimate {
|
|
32829
|
-
constructor(customFrom, customTo, duration, easing, params) {
|
|
32830
|
-
super(customFrom, customTo, duration, easing, params), this.willCallBeforeStageRender = !0, this.willCallAfterStageRender = !0, this._beforeStageRender = () => {
|
|
32831
|
-
if (!this.willCallBeforeStageRender) return;
|
|
32832
|
-
this.willCallBeforeStageRender = !1;
|
|
32833
|
-
const stage = this.target.stage,
|
|
32834
|
-
canvas = stage.window.getContext().canvas.nativeCanvas,
|
|
32835
|
-
outputCanvas = this.beforeStageRender(stage, canvas);
|
|
32836
|
-
outputCanvas && this.renderToStage(stage, outputCanvas);
|
|
32837
|
-
}, this._afterStageRender = () => {
|
|
32838
|
-
if (!this.willCallAfterStageRender) return;
|
|
32839
|
-
this.willCallAfterStageRender = !1;
|
|
32840
|
-
const stage = this.target.stage,
|
|
32841
|
-
canvas = stage.window.getContext().canvas.nativeCanvas,
|
|
32842
|
-
outputCanvas = this.afterStageRender(stage, canvas);
|
|
32843
|
-
outputCanvas && this.renderToStage(stage, outputCanvas);
|
|
32844
|
-
}, this.props = {};
|
|
32845
|
-
}
|
|
32846
|
-
beforeStageRender(stage, canvas) {
|
|
32847
|
-
return !1;
|
|
32848
|
-
}
|
|
32849
|
-
afterStageRender(stage, canvas) {
|
|
32850
|
-
return !1;
|
|
32851
|
-
}
|
|
32852
|
-
onFirstRun() {
|
|
32853
|
-
super.onFirstRun(), this.target.stage.setBeforeRender(this._beforeStageRender), this.target.stage.setAfterRender(this._afterStageRender), this.target.stage.disableDirtyBounds();
|
|
32854
|
-
}
|
|
32855
|
-
stop() {
|
|
32856
|
-
super.stop(), this.target.stage.removeBeforeRender(this._beforeStageRender), this.target.stage.removeAfterRender(this._afterStageRender);
|
|
32857
|
-
}
|
|
32858
|
-
onUpdate(end, ratio, out) {
|
|
32859
|
-
super.onUpdate(end, ratio, out), this.willCallBeforeStageRender = !0, this.willCallAfterStageRender = !0;
|
|
32860
|
-
}
|
|
32861
|
-
renderToStage(stage, canvas) {
|
|
32862
|
-
const stageCanvas = stage.window.getContext().canvas.nativeCanvas,
|
|
32863
|
-
ctx = stageCanvas.getContext("2d");
|
|
32864
|
-
return !!ctx && (ctx.clearRect(0, 0, stageCanvas.width, stageCanvas.height), ctx.drawImage(canvas, 0, 0), stageCanvas);
|
|
32865
|
-
}
|
|
32866
|
-
}
|
|
32867
32811
|
|
|
32868
32812
|
class ComponentAnimator {
|
|
32869
32813
|
constructor(component) {
|
|
@@ -36299,1277 +36243,8 @@ class StreamLight extends ACustomAnimate {
|
|
|
36299
36243
|
}
|
|
36300
36244
|
}
|
|
36301
36245
|
|
|
36302
|
-
class DisappearAnimateBase extends AStageAnimate {
|
|
36303
|
-
constructor(from, to, duration, easing, params) {
|
|
36304
|
-
super(from, to, duration, easing, params), this.webglCanvas = null, this.gl = null, this.program = null, this.currentAnimationRatio = 0, this.animationTime = 0;
|
|
36305
|
-
}
|
|
36306
|
-
onUpdate(end, ratio, out) {
|
|
36307
|
-
super.onUpdate(end, ratio, out), this.currentAnimationRatio = ratio, this.animationTime = ratio * Math.PI * 2;
|
|
36308
|
-
}
|
|
36309
|
-
getAnimationTime() {
|
|
36310
|
-
return this.currentAnimationRatio > 0 ? this.animationTime : Date.now() / 1e3;
|
|
36311
|
-
}
|
|
36312
|
-
getDurationFromParent() {
|
|
36313
|
-
return this.duration || 1e3;
|
|
36314
|
-
}
|
|
36315
|
-
initWebGL(canvas) {
|
|
36316
|
-
try {
|
|
36317
|
-
if (this.webglCanvas = vglobal.createCanvas({
|
|
36318
|
-
width: canvas.width,
|
|
36319
|
-
height: canvas.height,
|
|
36320
|
-
dpr: vglobal.devicePixelRatio
|
|
36321
|
-
}), !this.webglCanvas) return console.warn("WebGL canvas creation failed"), !1;
|
|
36322
|
-
this.webglCanvas.style.width = canvas.style.width || `${canvas.width}px`, this.webglCanvas.style.height = canvas.style.height || `${canvas.height}px`;
|
|
36323
|
-
let glContext = null;
|
|
36324
|
-
try {
|
|
36325
|
-
glContext = this.webglCanvas.getContext("webgl"), glContext || (glContext = this.webglCanvas.getContext("experimental-webgl"));
|
|
36326
|
-
} catch (e) {
|
|
36327
|
-
console.warn("Failed to get WebGL context:", e);
|
|
36328
|
-
}
|
|
36329
|
-
if (this.gl = glContext, !this.gl) return console.warn("WebGL not supported"), !1;
|
|
36330
|
-
const shaders = this.getShaderSources();
|
|
36331
|
-
return this.program = this.createShaderProgram(shaders.vertex, shaders.fragment), null !== this.program;
|
|
36332
|
-
} catch (error) {
|
|
36333
|
-
return console.warn("Failed to initialize WebGL:", error), !1;
|
|
36334
|
-
}
|
|
36335
|
-
}
|
|
36336
|
-
createShaderProgram(vertexSource, fragmentSource) {
|
|
36337
|
-
if (!this.gl) return null;
|
|
36338
|
-
const vertexShader = this.createShader(this.gl.VERTEX_SHADER, vertexSource),
|
|
36339
|
-
fragmentShader = this.createShader(this.gl.FRAGMENT_SHADER, fragmentSource);
|
|
36340
|
-
if (!vertexShader || !fragmentShader) return null;
|
|
36341
|
-
const program = this.gl.createProgram();
|
|
36342
|
-
return program ? (this.gl.attachShader(program, vertexShader), this.gl.attachShader(program, fragmentShader), this.gl.linkProgram(program), this.gl.getProgramParameter(program, this.gl.LINK_STATUS) ? program : (console.error("Shader program link error:", this.gl.getProgramInfoLog(program)), null)) : null;
|
|
36343
|
-
}
|
|
36344
|
-
createShader(type, source) {
|
|
36345
|
-
if (!this.gl) return null;
|
|
36346
|
-
const shader = this.gl.createShader(type);
|
|
36347
|
-
return shader ? (this.gl.shaderSource(shader, source), this.gl.compileShader(shader), this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS) ? shader : (console.error("Shader compile error:", this.gl.getShaderInfoLog(shader)), this.gl.deleteShader(shader), null)) : null;
|
|
36348
|
-
}
|
|
36349
|
-
setupWebGLState(canvas) {
|
|
36350
|
-
this.gl && this.webglCanvas && (this.webglCanvas.width === canvas.width && this.webglCanvas.height === canvas.height || (this.webglCanvas.width = canvas.width, this.webglCanvas.height = canvas.height), this.gl.viewport(0, 0, this.webglCanvas.width, this.webglCanvas.height), this.gl.clearColor(0, 0, 0, 0), this.gl.clear(this.gl.COLOR_BUFFER_BIT));
|
|
36351
|
-
}
|
|
36352
|
-
createFullScreenQuad() {
|
|
36353
|
-
if (!this.gl) return null;
|
|
36354
|
-
const vertices = new Float32Array([-1, -1, 0, 1, 1, -1, 1, 1, -1, 1, 0, 0, 1, 1, 1, 0]),
|
|
36355
|
-
vertexBuffer = this.gl.createBuffer();
|
|
36356
|
-
return this.gl.bindBuffer(this.gl.ARRAY_BUFFER, vertexBuffer), this.gl.bufferData(this.gl.ARRAY_BUFFER, vertices, this.gl.STATIC_DRAW), vertexBuffer;
|
|
36357
|
-
}
|
|
36358
|
-
createTextureFromCanvas(canvas) {
|
|
36359
|
-
if (!this.gl) return null;
|
|
36360
|
-
const texture = this.gl.createTexture();
|
|
36361
|
-
return this.gl.activeTexture(this.gl.TEXTURE0), this.gl.bindTexture(this.gl.TEXTURE_2D, texture), this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, this.gl.RGBA, this.gl.UNSIGNED_BYTE, canvas), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR), texture;
|
|
36362
|
-
}
|
|
36363
|
-
setupVertexAttributes() {
|
|
36364
|
-
if (!this.gl || !this.program) return;
|
|
36365
|
-
const positionLocation = this.gl.getAttribLocation(this.program, "a_position"),
|
|
36366
|
-
texCoordLocation = this.gl.getAttribLocation(this.program, "a_texCoord");
|
|
36367
|
-
this.gl.enableVertexAttribArray(positionLocation), this.gl.vertexAttribPointer(positionLocation, 2, this.gl.FLOAT, !1, 16, 0), this.gl.enableVertexAttribArray(texCoordLocation), this.gl.vertexAttribPointer(texCoordLocation, 2, this.gl.FLOAT, !1, 16, 8);
|
|
36368
|
-
}
|
|
36369
|
-
createOutputCanvas(canvas) {
|
|
36370
|
-
const outputCanvas = vglobal.createCanvas({
|
|
36371
|
-
width: canvas.width,
|
|
36372
|
-
height: canvas.height,
|
|
36373
|
-
dpr: vglobal.devicePixelRatio
|
|
36374
|
-
}),
|
|
36375
|
-
ctx = outputCanvas.getContext("2d");
|
|
36376
|
-
return ctx ? (ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.drawImage(canvas, 0, 0), {
|
|
36377
|
-
canvas: outputCanvas,
|
|
36378
|
-
ctx: ctx
|
|
36379
|
-
}) : null;
|
|
36380
|
-
}
|
|
36381
|
-
getShaderSources() {
|
|
36382
|
-
return null;
|
|
36383
|
-
}
|
|
36384
|
-
applyWebGLEffect(canvas) {
|
|
36385
|
-
return null;
|
|
36386
|
-
}
|
|
36387
|
-
applyCanvas2DEffect(canvas) {
|
|
36388
|
-
return null;
|
|
36389
|
-
}
|
|
36390
|
-
supportsWebGL() {
|
|
36391
|
-
return null !== this.getShaderSources();
|
|
36392
|
-
}
|
|
36393
|
-
supportsCanvas2D() {
|
|
36394
|
-
return this.applyCanvas2DEffect !== DisappearAnimateBase.prototype.applyCanvas2DEffect;
|
|
36395
|
-
}
|
|
36396
|
-
release() {
|
|
36397
|
-
super.release(), this.gl && (this.program && (this.gl.deleteProgram(this.program), this.program = null), this.gl = null), this.webglCanvas && (this.webglCanvas = null), this.currentAnimationRatio = 0, this.animationTime = 0;
|
|
36398
|
-
}
|
|
36399
|
-
afterStageRender(stage, canvas) {
|
|
36400
|
-
let result = null;
|
|
36401
|
-
if (this.supportsWebGL() && (this.gl || this.initWebGL(canvas) || console.warn("WebGL初始化失败,尝试Canvas 2D回退"), this.gl)) {
|
|
36402
|
-
if (result = this.applyWebGLEffect(canvas), result) return result;
|
|
36403
|
-
console.warn("WebGL特效执行失败,尝试Canvas 2D回退");
|
|
36404
|
-
}
|
|
36405
|
-
if (this.supportsCanvas2D()) {
|
|
36406
|
-
if (result = this.applyCanvas2DEffect(canvas), result) return result;
|
|
36407
|
-
console.warn("Canvas 2D特效执行失败");
|
|
36408
|
-
}
|
|
36409
|
-
return this.supportsWebGL() || this.supportsCanvas2D() || console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`), canvas;
|
|
36410
|
-
}
|
|
36411
|
-
}
|
|
36412
|
-
|
|
36413
|
-
class Canvas2DEffectBase extends DisappearAnimateBase {
|
|
36414
|
-
constructor(from, to, duration, easing, params) {
|
|
36415
|
-
super(from, to, duration, easing, params);
|
|
36416
|
-
}
|
|
36417
|
-
getShaderSources() {
|
|
36418
|
-
return null;
|
|
36419
|
-
}
|
|
36420
|
-
applyWebGLEffect(canvas) {
|
|
36421
|
-
return null;
|
|
36422
|
-
}
|
|
36423
|
-
}
|
|
36424
|
-
class HybridEffectBase extends DisappearAnimateBase {
|
|
36425
|
-
constructor(from, to, duration, easing, params) {
|
|
36426
|
-
super(from, to, duration, easing, params);
|
|
36427
|
-
}
|
|
36428
|
-
getShaderSources() {
|
|
36429
|
-
return null;
|
|
36430
|
-
}
|
|
36431
|
-
applyWebGLEffect(canvas) {
|
|
36432
|
-
return null;
|
|
36433
|
-
}
|
|
36434
|
-
applyCanvas2DEffect(canvas) {
|
|
36435
|
-
return null;
|
|
36436
|
-
}
|
|
36437
|
-
supportsWebGL() {
|
|
36438
|
-
return this.getShaderSources !== HybridEffectBase.prototype.getShaderSources && null !== this.getShaderSources();
|
|
36439
|
-
}
|
|
36440
|
-
supportsCanvas2D() {
|
|
36441
|
-
return this.applyCanvas2DEffect !== HybridEffectBase.prototype.applyCanvas2DEffect;
|
|
36442
|
-
}
|
|
36443
|
-
afterStageRender(stage, canvas) {
|
|
36444
|
-
var _a, _b;
|
|
36445
|
-
let result = null;
|
|
36446
|
-
if (!1 !== (null === (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.options) || void 0 === _b ? void 0 : _b.useWebGL)) {
|
|
36447
|
-
if (this.supportsWebGL() && (this.gl || this.initWebGL(canvas) || console.warn("WebGL初始化失败,尝试Canvas 2D回退"), this.gl)) {
|
|
36448
|
-
if (result = this.applyWebGLEffect(canvas), result) return result;
|
|
36449
|
-
console.warn("WebGL特效执行失败,尝试Canvas 2D回退");
|
|
36450
|
-
}
|
|
36451
|
-
if (this.supportsCanvas2D()) {
|
|
36452
|
-
if (result = this.applyCanvas2DEffect(canvas), result) return result;
|
|
36453
|
-
console.warn("Canvas 2D特效执行失败");
|
|
36454
|
-
}
|
|
36455
|
-
} else if (this.supportsCanvas2D()) {
|
|
36456
|
-
if (result = this.applyCanvas2DEffect(canvas), result) return result;
|
|
36457
|
-
console.warn("Canvas 2D特效执行失败");
|
|
36458
|
-
} else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);
|
|
36459
|
-
return this.supportsWebGL() || this.supportsCanvas2D() || console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`), canvas;
|
|
36460
|
-
}
|
|
36461
|
-
}
|
|
36462
|
-
|
|
36463
|
-
class ImageProcessUtils {
|
|
36464
|
-
static createTempCanvas(width, height, dpr) {
|
|
36465
|
-
return vglobal.createCanvas({
|
|
36466
|
-
width: width,
|
|
36467
|
-
height: height,
|
|
36468
|
-
dpr: dpr || vglobal.devicePixelRatio
|
|
36469
|
-
});
|
|
36470
|
-
}
|
|
36471
|
-
static cloneImageData(imageData) {
|
|
36472
|
-
const clonedData = new Uint8ClampedArray(imageData.data);
|
|
36473
|
-
return new ImageData(clonedData, imageData.width, imageData.height);
|
|
36474
|
-
}
|
|
36475
|
-
static lerp(start, end, t) {
|
|
36476
|
-
return start * (1 - t) + end * t;
|
|
36477
|
-
}
|
|
36478
|
-
static smoothstep(edge0, edge1, x) {
|
|
36479
|
-
const t = Math.max(0, Math.min(1, (x - edge0) / (edge1 - edge0)));
|
|
36480
|
-
return t * t * (3 - 2 * t);
|
|
36481
|
-
}
|
|
36482
|
-
static distance(x1, y1, x2, y2) {
|
|
36483
|
-
const dx = x2 - x1,
|
|
36484
|
-
dy = y2 - y1;
|
|
36485
|
-
return Math.sqrt(dx * dx + dy * dy);
|
|
36486
|
-
}
|
|
36487
|
-
static normalizeAngle(angle) {
|
|
36488
|
-
return (angle + Math.PI) / (2 * Math.PI);
|
|
36489
|
-
}
|
|
36490
|
-
static pixelNoise(x, y, pixelSize) {
|
|
36491
|
-
if (pixelSize <= 0) return 0;
|
|
36492
|
-
const gridX = Math.floor(x / pixelSize) * pixelSize,
|
|
36493
|
-
gridY = Math.floor(y / pixelSize) * pixelSize,
|
|
36494
|
-
n = 43758.5453 * Math.sin(12.9898 * gridX + 78.233 * gridY);
|
|
36495
|
-
return n - Math.floor(n);
|
|
36496
|
-
}
|
|
36497
|
-
static generateNoiseTexture(width, height) {
|
|
36498
|
-
const data = new Uint8Array(width * height);
|
|
36499
|
-
for (let i = 0; i < data.length; i++) data[i] = Math.floor(256 * Math.random());
|
|
36500
|
-
return data;
|
|
36501
|
-
}
|
|
36502
|
-
static applyCSSFilter(canvas, filter) {
|
|
36503
|
-
const outputCanvas = this.createTempCanvas(canvas.width, canvas.height),
|
|
36504
|
-
ctx = outputCanvas.getContext("2d");
|
|
36505
|
-
return ctx ? (ctx.filter = filter, ctx.drawImage(canvas, 0, 0), ctx.filter = "none", outputCanvas) : canvas;
|
|
36506
|
-
}
|
|
36507
|
-
static extractChannel(imageData, channelIndex) {
|
|
36508
|
-
const {
|
|
36509
|
-
data: data,
|
|
36510
|
-
width: width,
|
|
36511
|
-
height: height
|
|
36512
|
-
} = imageData,
|
|
36513
|
-
channelData = new Uint8ClampedArray(data.length);
|
|
36514
|
-
for (let i = 0; i < data.length; i += 4) channelData[i] = 0, channelData[i + 1] = 0, channelData[i + 2] = 0, channelData[i + 3] = data[i + 3], channelIndex >= 0 && channelIndex <= 2 && (channelData[i + channelIndex] = data[i + channelIndex]);
|
|
36515
|
-
return new ImageData(channelData, width, height);
|
|
36516
|
-
}
|
|
36517
|
-
static blendImageData(imageData1, imageData2, ratio) {
|
|
36518
|
-
const {
|
|
36519
|
-
data: data1,
|
|
36520
|
-
width: width,
|
|
36521
|
-
height: height
|
|
36522
|
-
} = imageData1,
|
|
36523
|
-
{
|
|
36524
|
-
data: data2
|
|
36525
|
-
} = imageData2,
|
|
36526
|
-
result = new Uint8ClampedArray(data1.length);
|
|
36527
|
-
for (let i = 0; i < data1.length; i += 4) result[i] = Math.round(this.lerp(data1[i], data2[i], ratio)), result[i + 1] = Math.round(this.lerp(data1[i + 1], data2[i + 1], ratio)), result[i + 2] = Math.round(this.lerp(data1[i + 2], data2[i + 2], ratio)), result[i + 3] = Math.round(this.lerp(data1[i + 3], data2[i + 3], ratio));
|
|
36528
|
-
return new ImageData(result, width, height);
|
|
36529
|
-
}
|
|
36530
|
-
static getLuminance(r, g, b) {
|
|
36531
|
-
return .299 * r + .587 * g + .114 * b;
|
|
36532
|
-
}
|
|
36533
|
-
static applySepiaToPixel(r, g, b) {
|
|
36534
|
-
return [Math.min(255, .393 * r + .769 * g + .189 * b), Math.min(255, .349 * r + .686 * g + .168 * b), Math.min(255, .272 * r + .534 * g + .131 * b)];
|
|
36535
|
-
}
|
|
36536
|
-
static calculateDynamicStrength(baseStrength, animationTime) {
|
|
36537
|
-
return baseStrength * (animationTime / (2 * Math.PI));
|
|
36538
|
-
}
|
|
36539
|
-
}
|
|
36540
|
-
class ShaderLibrary {}
|
|
36541
|
-
ShaderLibrary.STANDARD_VERTEX_SHADER = "\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ", ShaderLibrary.SHADER_FUNCTIONS = "\n // 亮度计算函数\n float luminance(vec3 color) {\n return dot(color, vec3(0.299, 0.587, 0.114));\n }\n\n // 褐色调函数\n vec3 sepia(vec3 color) {\n float r = color.r * 0.393 + color.g * 0.769 + color.b * 0.189;\n float g = color.r * 0.349 + color.g * 0.686 + color.b * 0.168;\n float b = color.r * 0.272 + color.g * 0.534 + color.b * 0.131;\n return vec3(r, g, b);\n }\n\n // 线性插值函数\n float lerp(float a, float b, float t) {\n return a * (1.0 - t) + b * t;\n }\n\n\n // 简单噪声函数\n float pixelNoise(vec2 coord, float pixelSize) {\n vec2 gridCoord = floor(coord / pixelSize) * pixelSize;\n return fract(sin(dot(gridCoord, vec2(12.9898, 78.233))) * 43758.5453123);\n }\n\n // 动态强度计算\n float calculateDynamicStrength(float baseStrength, float time) {\n return baseStrength * (time / 6.28318531); // 2π\n }\n ";
|
|
36542
|
-
|
|
36543
|
-
class Dissolve extends HybridEffectBase {
|
|
36544
|
-
constructor(from, to, duration, easing, params) {
|
|
36545
|
-
var _a, _b, _c, _d;
|
|
36546
|
-
super(from, to, duration, easing, params), this.noiseData = null;
|
|
36547
|
-
const rawNoiseScale = null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.noiseScale,
|
|
36548
|
-
clampedNoiseScale = void 0 !== rawNoiseScale ? Math.max(0, Math.floor(rawNoiseScale)) : 8;
|
|
36549
|
-
this.dissolveConfig = {
|
|
36550
|
-
dissolveType: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.dissolveType) || "outward",
|
|
36551
|
-
useWebGL: void 0 === (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.useWebGL) || params.options.useWebGL,
|
|
36552
|
-
noiseScale: clampedNoiseScale,
|
|
36553
|
-
fadeEdge: void 0 === (null === (_d = null == params ? void 0 : params.options) || void 0 === _d ? void 0 : _d.fadeEdge) || params.options.fadeEdge
|
|
36554
|
-
};
|
|
36555
|
-
}
|
|
36556
|
-
getShaderSources() {
|
|
36557
|
-
return {
|
|
36558
|
-
vertex: ShaderLibrary.STANDARD_VERTEX_SHADER,
|
|
36559
|
-
fragment: `\n precision mediump float;\n uniform sampler2D u_texture;\n uniform sampler2D u_noiseTexture;\n uniform float u_time;\n uniform int u_dissolveType;\n uniform vec2 u_resolution;\n uniform float u_noiseScale;\n uniform bool u_fadeEdge;\n varying vec2 v_texCoord;\n\n ${ShaderLibrary.SHADER_FUNCTIONS}\n\n // 向外溶解函数\n float outwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n // 归一化距离 (0为中心,1为边缘)\n float normalizedDist = distFromCenter / maxDist;\n\n // 向外溶解:从边缘开始溶解,time控制溶解进度\n // 增加安全边距,确保动画结束时完全溶解\n float edgeThreshold = 1.2 - time * 1.5;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n // 添加基于像素大小的噪声,让边缘呈现颗粒状\n vec2 pixelCoord = uv * resolution; // 转换为像素坐标\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4; // 增强噪声影响\n edgeThreshold += noiseInfluence;\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return 1.0 - smoothstep(edgeThreshold - fadeWidth, edgeThreshold, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist > edgeThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 向内溶解函数\n float inwardDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float distFromCenter = length(uv - center);\n float maxDist = length(vec2(0.5, 0.5));\n\n float normalizedDist = distFromCenter / maxDist;\n\n // 向内溶解:从中心开始溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float centerThreshold = time * 1.4;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.4;\n centerThreshold += noiseInfluence;\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.15; // 渐变宽度\n return smoothstep(centerThreshold, centerThreshold + fadeWidth, normalizedDist);\n } else {\n // 硬边缘:返回0或1\n return normalizedDist < centerThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 径向溶解函数\n float radialDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n vec2 center = vec2(0.5, 0.5);\n float angle = atan(uv.y - center.y, uv.x - center.x);\n float normalizedAngle = (angle + 3.14159) / (2.0 * 3.14159);\n\n // 径向溶解:按角度顺序溶解,time控制溶解进度\n // 增加系数,确保动画结束时完全溶解\n float angleThreshold = time * 1.2;\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n angleThreshold += noiseInfluence;\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(angleThreshold, angleThreshold + fadeWidth, normalizedAngle);\n } else {\n // 硬边缘:返回0或1\n return normalizedAngle < angleThreshold ? 0.0 : 1.0;\n }\n }\n }\n\n // 从左到右溶解函数\n float leftToRightDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 左到右溶解:从x=0开始向x=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从右到左溶解函数\n float rightToLeftDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 右到左溶解:从x=1开始向x=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.x);\n } else {\n // 硬边缘:返回0或1\n return uv.x > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从上到下溶解函数\n float topToBottomDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 上到下溶解:从y=0开始向y=1溶解\n float dissolvePosition = time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition, dissolvePosition + fadeWidth, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y < dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n // 从下到上溶解函数\n float bottomToTopDissolve(vec2 uv, float time, float pixelSize, vec2 resolution) {\n // 下到上溶解:从y=1开始向y=0溶解\n float dissolvePosition = 1.0 - time * 1.2; // 增加系数确保完全溶解\n\n // 当pixelSize > 0时添加颗粒效果\n if (pixelSize > 0.0) {\n vec2 pixelCoord = uv * resolution;\n float noiseValue = pixelNoise(pixelCoord, pixelSize);\n float noiseInfluence = (noiseValue - 0.5) * 0.3;\n dissolvePosition += noiseInfluence;\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n } else {\n // 平滑溶解:根据fadeEdge决定是否使用渐变\n if (u_fadeEdge) {\n // 柔和边缘:返回渐变值\n float fadeWidth = 0.08; // 渐变宽度\n return smoothstep(dissolvePosition - fadeWidth, dissolvePosition, uv.y);\n } else {\n // 硬边缘:返回0或1\n return uv.y > dissolvePosition ? 0.0 : 1.0;\n }\n }\n }\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 texColor = texture2D(u_texture, uv);\n\n float alpha = 1.0;\n\n // 根据溶解类型选择对应的溶解函数\n if (u_dissolveType == 0) {\n alpha = outwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 1) {\n alpha = inwardDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 2) {\n alpha = radialDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 3) {\n alpha = leftToRightDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 4) {\n alpha = rightToLeftDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 5) {\n alpha = topToBottomDissolve(uv, u_time, u_noiseScale, u_resolution);\n } else if (u_dissolveType == 6) {\n alpha = bottomToTopDissolve(uv, u_time, u_noiseScale, u_resolution);\n }\n\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n }\n `
|
|
36560
|
-
};
|
|
36561
|
-
}
|
|
36562
|
-
applyWebGLEffect(canvas) {
|
|
36563
|
-
if (!this.gl || !this.program || !this.webglCanvas) return canvas;
|
|
36564
|
-
this.setupWebGLState(canvas);
|
|
36565
|
-
const texture = this.createTextureFromCanvas(canvas);
|
|
36566
|
-
if (!texture) return canvas;
|
|
36567
|
-
this.noiseData || (this.noiseData = ImageProcessUtils.generateNoiseTexture(256, 256));
|
|
36568
|
-
const noiseTexture = this.gl.createTexture();
|
|
36569
|
-
this.gl.activeTexture(this.gl.TEXTURE1), this.gl.bindTexture(this.gl.TEXTURE_2D, noiseTexture), this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.LUMINANCE, 256, 256, 0, this.gl.LUMINANCE, this.gl.UNSIGNED_BYTE, this.noiseData), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.REPEAT), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.REPEAT), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR), this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR);
|
|
36570
|
-
const vertexBuffer = this.createFullScreenQuad();
|
|
36571
|
-
return vertexBuffer ? (this.gl.useProgram(this.program), this.setupVertexAttributes(), this.setUniforms(), this.gl.enable(this.gl.BLEND), this.gl.blendFunc(this.gl.SRC_ALPHA, this.gl.ONE_MINUS_SRC_ALPHA), this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4), this.gl.deleteTexture(texture), this.gl.deleteTexture(noiseTexture), this.gl.deleteBuffer(vertexBuffer), this.webglCanvas) : canvas;
|
|
36572
|
-
}
|
|
36573
|
-
setUniforms() {
|
|
36574
|
-
if (!this.gl || !this.program || !this.webglCanvas) return;
|
|
36575
|
-
const textureLocation = this.gl.getUniformLocation(this.program, "u_texture"),
|
|
36576
|
-
noiseTextureLocation = this.gl.getUniformLocation(this.program, "u_noiseTexture"),
|
|
36577
|
-
timeLocation = this.gl.getUniformLocation(this.program, "u_time"),
|
|
36578
|
-
dissolveTypeLocation = this.gl.getUniformLocation(this.program, "u_dissolveType"),
|
|
36579
|
-
resolutionLocation = this.gl.getUniformLocation(this.program, "u_resolution"),
|
|
36580
|
-
noiseScaleLocation = this.gl.getUniformLocation(this.program, "u_noiseScale"),
|
|
36581
|
-
fadeEdgeLocation = this.gl.getUniformLocation(this.program, "u_fadeEdge");
|
|
36582
|
-
this.gl.uniform1i(textureLocation, 0), this.gl.uniform1i(noiseTextureLocation, 1), this.gl.uniform1f(timeLocation, this.currentAnimationRatio), this.gl.uniform2f(resolutionLocation, this.webglCanvas.width, this.webglCanvas.height), this.gl.uniform1f(noiseScaleLocation, this.dissolveConfig.noiseScale), this.gl.uniform1i(fadeEdgeLocation, this.dissolveConfig.fadeEdge ? 1 : 0);
|
|
36583
|
-
this.gl.uniform1i(dissolveTypeLocation, {
|
|
36584
|
-
outward: 0,
|
|
36585
|
-
inward: 1,
|
|
36586
|
-
radial: 2,
|
|
36587
|
-
leftToRight: 3,
|
|
36588
|
-
rightToLeft: 4,
|
|
36589
|
-
topToBottom: 5,
|
|
36590
|
-
bottomToTop: 6
|
|
36591
|
-
}[this.dissolveConfig.dissolveType] || 0);
|
|
36592
|
-
}
|
|
36593
|
-
applyCanvas2DEffect(canvas) {
|
|
36594
|
-
const outputCanvas = this.createOutputCanvas(canvas);
|
|
36595
|
-
if (!outputCanvas) return canvas;
|
|
36596
|
-
const {
|
|
36597
|
-
canvas: outputCanvasElement,
|
|
36598
|
-
ctx: ctx
|
|
36599
|
-
} = outputCanvas,
|
|
36600
|
-
imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
|
|
36601
|
-
progress = this.currentAnimationRatio;
|
|
36602
|
-
let dissolvedImageData;
|
|
36603
|
-
switch (this.dissolveConfig.dissolveType) {
|
|
36604
|
-
case "outward":
|
|
36605
|
-
dissolvedImageData = this.applyOutwardDissolve(imageData, progress);
|
|
36606
|
-
break;
|
|
36607
|
-
case "inward":
|
|
36608
|
-
dissolvedImageData = this.applyInwardDissolve(imageData, progress);
|
|
36609
|
-
break;
|
|
36610
|
-
case "radial":
|
|
36611
|
-
dissolvedImageData = this.applyRadialDissolve(imageData, progress);
|
|
36612
|
-
break;
|
|
36613
|
-
case "leftToRight":
|
|
36614
|
-
dissolvedImageData = this.applyLeftToRightDissolve(imageData, progress);
|
|
36615
|
-
break;
|
|
36616
|
-
case "rightToLeft":
|
|
36617
|
-
dissolvedImageData = this.applyRightToLeftDissolve(imageData, progress);
|
|
36618
|
-
break;
|
|
36619
|
-
case "topToBottom":
|
|
36620
|
-
dissolvedImageData = this.applyTopToBottomDissolve(imageData, progress);
|
|
36621
|
-
break;
|
|
36622
|
-
case "bottomToTop":
|
|
36623
|
-
dissolvedImageData = this.applyBottomToTopDissolve(imageData, progress);
|
|
36624
|
-
break;
|
|
36625
|
-
default:
|
|
36626
|
-
dissolvedImageData = imageData;
|
|
36627
|
-
}
|
|
36628
|
-
return ctx.putImageData(dissolvedImageData, 0, 0), outputCanvasElement;
|
|
36629
|
-
}
|
|
36630
|
-
applyOutwardDissolve(imageData, progress) {
|
|
36631
|
-
const {
|
|
36632
|
-
data: data,
|
|
36633
|
-
width: width,
|
|
36634
|
-
height: height
|
|
36635
|
-
} = imageData,
|
|
36636
|
-
result = new Uint8ClampedArray(data.length);
|
|
36637
|
-
result.set(data);
|
|
36638
|
-
const centerX = width / 2,
|
|
36639
|
-
centerY = height / 2,
|
|
36640
|
-
maxDist = Math.sqrt(centerX * centerX + centerY * centerY),
|
|
36641
|
-
pixelSize = this.dissolveConfig.noiseScale;
|
|
36642
|
-
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
36643
|
-
const dx = x - centerX,
|
|
36644
|
-
dy = y - centerY,
|
|
36645
|
-
normalizedDist = Math.sqrt(dx * dx + dy * dy) / maxDist;
|
|
36646
|
-
let dissolveThreshold = 1.2 - 1.4 * progress,
|
|
36647
|
-
alpha = 1;
|
|
36648
|
-
if (pixelSize > 0) {
|
|
36649
|
-
dissolveThreshold += .4 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedDist > dissolveThreshold ? 0 : 1;
|
|
36650
|
-
} else if (this.dissolveConfig.fadeEdge) {
|
|
36651
|
-
const fadeStart = dissolveThreshold - .15;
|
|
36652
|
-
alpha = normalizedDist < fadeStart ? 1 : normalizedDist > dissolveThreshold ? 0 : 1 - (normalizedDist - fadeStart) / (dissolveThreshold - fadeStart);
|
|
36653
|
-
} else alpha = normalizedDist > dissolveThreshold ? 0 : 1;
|
|
36654
|
-
const index = 4 * (y * width + x);
|
|
36655
|
-
result[index + 3] = Math.floor(result[index + 3] * alpha);
|
|
36656
|
-
}
|
|
36657
|
-
return new ImageData(result, width, height);
|
|
36658
|
-
}
|
|
36659
|
-
applyInwardDissolve(imageData, progress) {
|
|
36660
|
-
const {
|
|
36661
|
-
data: data,
|
|
36662
|
-
width: width,
|
|
36663
|
-
height: height
|
|
36664
|
-
} = imageData,
|
|
36665
|
-
result = new Uint8ClampedArray(data.length);
|
|
36666
|
-
result.set(data);
|
|
36667
|
-
const centerX = width / 2,
|
|
36668
|
-
centerY = height / 2,
|
|
36669
|
-
maxDist = Math.sqrt(centerX * centerX + centerY * centerY),
|
|
36670
|
-
pixelSize = this.dissolveConfig.noiseScale;
|
|
36671
|
-
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
36672
|
-
const dx = x - centerX,
|
|
36673
|
-
dy = y - centerY,
|
|
36674
|
-
normalizedDist = Math.sqrt(dx * dx + dy * dy) / maxDist;
|
|
36675
|
-
let dissolveThreshold = 1.4 * progress,
|
|
36676
|
-
alpha = 1;
|
|
36677
|
-
if (pixelSize > 0) {
|
|
36678
|
-
dissolveThreshold += .4 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedDist < dissolveThreshold ? 0 : 1;
|
|
36679
|
-
} else if (this.dissolveConfig.fadeEdge) {
|
|
36680
|
-
const fadeEnd = dissolveThreshold + .15;
|
|
36681
|
-
alpha = normalizedDist < dissolveThreshold ? 0 : normalizedDist > fadeEnd ? 1 : (normalizedDist - dissolveThreshold) / (fadeEnd - dissolveThreshold);
|
|
36682
|
-
} else alpha = normalizedDist < dissolveThreshold ? 0 : 1;
|
|
36683
|
-
const index = 4 * (y * width + x);
|
|
36684
|
-
result[index + 3] = Math.floor(result[index + 3] * alpha);
|
|
36685
|
-
}
|
|
36686
|
-
return new ImageData(result, width, height);
|
|
36687
|
-
}
|
|
36688
|
-
applyRadialDissolve(imageData, progress) {
|
|
36689
|
-
const {
|
|
36690
|
-
data: data,
|
|
36691
|
-
width: width,
|
|
36692
|
-
height: height
|
|
36693
|
-
} = imageData,
|
|
36694
|
-
result = new Uint8ClampedArray(data.length);
|
|
36695
|
-
result.set(data);
|
|
36696
|
-
const centerX = width / 2,
|
|
36697
|
-
centerY = height / 2,
|
|
36698
|
-
pixelSize = this.dissolveConfig.noiseScale;
|
|
36699
|
-
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
36700
|
-
const dx = x - centerX,
|
|
36701
|
-
dy = y - centerY,
|
|
36702
|
-
normalizedAngle = (Math.atan2(dy, dx) + Math.PI) / (2 * Math.PI);
|
|
36703
|
-
let dissolveThreshold = 1.2 * progress,
|
|
36704
|
-
alpha = 1;
|
|
36705
|
-
if (pixelSize > 0) {
|
|
36706
|
-
dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedAngle < dissolveThreshold ? 0 : 1;
|
|
36707
|
-
} else if (this.dissolveConfig.fadeEdge) {
|
|
36708
|
-
const fadeEnd = dissolveThreshold + .08;
|
|
36709
|
-
alpha = normalizedAngle < dissolveThreshold ? 0 : normalizedAngle > fadeEnd ? 1 : (normalizedAngle - dissolveThreshold) / (fadeEnd - dissolveThreshold);
|
|
36710
|
-
} else alpha = normalizedAngle < dissolveThreshold ? 0 : 1;
|
|
36711
|
-
const index = 4 * (y * width + x);
|
|
36712
|
-
result[index + 3] = Math.floor(result[index + 3] * alpha);
|
|
36713
|
-
}
|
|
36714
|
-
return new ImageData(result, width, height);
|
|
36715
|
-
}
|
|
36716
|
-
applyLeftToRightDissolve(imageData, progress) {
|
|
36717
|
-
const {
|
|
36718
|
-
data: data,
|
|
36719
|
-
width: width,
|
|
36720
|
-
height: height
|
|
36721
|
-
} = imageData,
|
|
36722
|
-
result = new Uint8ClampedArray(data.length);
|
|
36723
|
-
result.set(data);
|
|
36724
|
-
const pixelSize = this.dissolveConfig.noiseScale;
|
|
36725
|
-
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
36726
|
-
const normalizedX = x / width;
|
|
36727
|
-
let dissolveThreshold = 1.2 * progress,
|
|
36728
|
-
alpha = 1;
|
|
36729
|
-
if (pixelSize > 0) {
|
|
36730
|
-
dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedX < dissolveThreshold ? 0 : 1;
|
|
36731
|
-
} else if (this.dissolveConfig.fadeEdge) {
|
|
36732
|
-
const fadeEnd = dissolveThreshold + .08;
|
|
36733
|
-
alpha = normalizedX < dissolveThreshold ? 0 : normalizedX > fadeEnd ? 1 : (normalizedX - dissolveThreshold) / (fadeEnd - dissolveThreshold);
|
|
36734
|
-
} else alpha = normalizedX < dissolveThreshold ? 0 : 1;
|
|
36735
|
-
const index = 4 * (y * width + x);
|
|
36736
|
-
result[index + 3] = Math.floor(result[index + 3] * alpha);
|
|
36737
|
-
}
|
|
36738
|
-
return new ImageData(result, width, height);
|
|
36739
|
-
}
|
|
36740
|
-
applyRightToLeftDissolve(imageData, progress) {
|
|
36741
|
-
const {
|
|
36742
|
-
data: data,
|
|
36743
|
-
width: width,
|
|
36744
|
-
height: height
|
|
36745
|
-
} = imageData,
|
|
36746
|
-
result = new Uint8ClampedArray(data.length);
|
|
36747
|
-
result.set(data);
|
|
36748
|
-
const pixelSize = this.dissolveConfig.noiseScale;
|
|
36749
|
-
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
36750
|
-
const normalizedX = x / width;
|
|
36751
|
-
let dissolveThreshold = 1 - 1.2 * progress,
|
|
36752
|
-
alpha = 1;
|
|
36753
|
-
if (pixelSize > 0) {
|
|
36754
|
-
dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedX > dissolveThreshold ? 0 : 1;
|
|
36755
|
-
} else if (this.dissolveConfig.fadeEdge) {
|
|
36756
|
-
const fadeStart = dissolveThreshold - .08;
|
|
36757
|
-
alpha = normalizedX < fadeStart ? 1 : normalizedX > dissolveThreshold ? 0 : 1 - (normalizedX - fadeStart) / (dissolveThreshold - fadeStart);
|
|
36758
|
-
} else alpha = normalizedX > dissolveThreshold ? 0 : 1;
|
|
36759
|
-
const index = 4 * (y * width + x);
|
|
36760
|
-
result[index + 3] = Math.floor(result[index + 3] * alpha);
|
|
36761
|
-
}
|
|
36762
|
-
return new ImageData(result, width, height);
|
|
36763
|
-
}
|
|
36764
|
-
applyTopToBottomDissolve(imageData, progress) {
|
|
36765
|
-
const {
|
|
36766
|
-
data: data,
|
|
36767
|
-
width: width,
|
|
36768
|
-
height: height
|
|
36769
|
-
} = imageData,
|
|
36770
|
-
result = new Uint8ClampedArray(data.length);
|
|
36771
|
-
result.set(data);
|
|
36772
|
-
const pixelSize = this.dissolveConfig.noiseScale;
|
|
36773
|
-
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
36774
|
-
const normalizedY = y / height;
|
|
36775
|
-
let dissolveThreshold = 1.2 * progress,
|
|
36776
|
-
alpha = 1;
|
|
36777
|
-
if (pixelSize > 0) {
|
|
36778
|
-
dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedY < dissolveThreshold ? 0 : 1;
|
|
36779
|
-
} else if (this.dissolveConfig.fadeEdge) {
|
|
36780
|
-
const fadeEnd = dissolveThreshold + .08;
|
|
36781
|
-
alpha = normalizedY < dissolveThreshold ? 0 : normalizedY > fadeEnd ? 1 : (normalizedY - dissolveThreshold) / (fadeEnd - dissolveThreshold);
|
|
36782
|
-
} else alpha = normalizedY < dissolveThreshold ? 0 : 1;
|
|
36783
|
-
const index = 4 * (y * width + x);
|
|
36784
|
-
result[index + 3] = Math.floor(result[index + 3] * alpha);
|
|
36785
|
-
}
|
|
36786
|
-
return new ImageData(result, width, height);
|
|
36787
|
-
}
|
|
36788
|
-
applyBottomToTopDissolve(imageData, progress) {
|
|
36789
|
-
const {
|
|
36790
|
-
data: data,
|
|
36791
|
-
width: width,
|
|
36792
|
-
height: height
|
|
36793
|
-
} = imageData,
|
|
36794
|
-
result = new Uint8ClampedArray(data.length);
|
|
36795
|
-
result.set(data);
|
|
36796
|
-
const pixelSize = this.dissolveConfig.noiseScale;
|
|
36797
|
-
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
36798
|
-
const normalizedY = y / height;
|
|
36799
|
-
let dissolveThreshold = 1 - 1.2 * progress,
|
|
36800
|
-
alpha = 1;
|
|
36801
|
-
if (pixelSize > 0) {
|
|
36802
|
-
dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedY > dissolveThreshold ? 0 : 1;
|
|
36803
|
-
} else if (this.dissolveConfig.fadeEdge) {
|
|
36804
|
-
const fadeStart = dissolveThreshold - .08;
|
|
36805
|
-
alpha = normalizedY < fadeStart ? 1 : normalizedY > dissolveThreshold ? 0 : 1 - (normalizedY - fadeStart) / (dissolveThreshold - fadeStart);
|
|
36806
|
-
} else alpha = normalizedY > dissolveThreshold ? 0 : 1;
|
|
36807
|
-
const index = 4 * (y * width + x);
|
|
36808
|
-
result[index + 3] = Math.floor(result[index + 3] * alpha);
|
|
36809
|
-
}
|
|
36810
|
-
return new ImageData(result, width, height);
|
|
36811
|
-
}
|
|
36812
|
-
}
|
|
36813
|
-
|
|
36814
|
-
class Grayscale extends HybridEffectBase {
|
|
36815
|
-
constructor(from, to, duration, easing, params) {
|
|
36816
|
-
var _a, _b, _c;
|
|
36817
|
-
super(from, to, duration, easing, params);
|
|
36818
|
-
const rawStrength = void 0 !== (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.strength) ? params.options.strength : 1,
|
|
36819
|
-
clampedStrength = Math.max(0, Math.min(1, rawStrength));
|
|
36820
|
-
this.colorConfig = {
|
|
36821
|
-
effectType: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.effectType) || "grayscale",
|
|
36822
|
-
strength: clampedStrength,
|
|
36823
|
-
useWebGL: void 0 === (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.useWebGL) || params.options.useWebGL
|
|
36824
|
-
};
|
|
36825
|
-
}
|
|
36826
|
-
getShaderSources() {
|
|
36827
|
-
return {
|
|
36828
|
-
vertex: ShaderLibrary.STANDARD_VERTEX_SHADER,
|
|
36829
|
-
fragment: `\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_effectType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n ${ShaderLibrary.SHADER_FUNCTIONS}\n\n void main() {\n vec2 uv = v_texCoord;\n vec4 originalColor = texture2D(u_texture, uv);\n vec3 color = originalColor.rgb;\n\n // 计算动态强度\n float dynamicStrength = calculateDynamicStrength(u_strength, u_time);\n\n if (u_effectType == 0) {\n // 灰度效果\n float gray = luminance(color);\n vec3 grayColor = vec3(gray);\n color = mix(color, grayColor, dynamicStrength);\n } else if (u_effectType == 1) {\n // 褐色调效果\n vec3 sepiaColor = sepia(color);\n color = mix(color, sepiaColor, dynamicStrength);\n }\n\n gl_FragColor = vec4(color, originalColor.a);\n }\n `
|
|
36830
|
-
};
|
|
36831
|
-
}
|
|
36832
|
-
applyWebGLEffect(canvas) {
|
|
36833
|
-
if (!this.gl || !this.program || !this.webglCanvas) return null;
|
|
36834
|
-
this.setupWebGLState(canvas);
|
|
36835
|
-
const texture = this.createTextureFromCanvas(canvas);
|
|
36836
|
-
if (!texture) return null;
|
|
36837
|
-
const vertexBuffer = this.createFullScreenQuad();
|
|
36838
|
-
if (!vertexBuffer) return this.gl.deleteTexture(texture), null;
|
|
36839
|
-
try {
|
|
36840
|
-
return this.gl.useProgram(this.program), this.setupVertexAttributes(), this.setColorUniforms(), this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4), this.webglCanvas;
|
|
36841
|
-
} finally {
|
|
36842
|
-
this.gl.deleteTexture(texture), this.gl.deleteBuffer(vertexBuffer);
|
|
36843
|
-
}
|
|
36844
|
-
}
|
|
36845
|
-
setColorUniforms() {
|
|
36846
|
-
if (!this.gl || !this.program) return;
|
|
36847
|
-
const currentTime = this.getAnimationTime(),
|
|
36848
|
-
timeLocation = this.gl.getUniformLocation(this.program, "u_time"),
|
|
36849
|
-
strengthLocation = this.gl.getUniformLocation(this.program, "u_strength"),
|
|
36850
|
-
effectTypeLocation = this.gl.getUniformLocation(this.program, "u_effectType"),
|
|
36851
|
-
resolutionLocation = this.gl.getUniformLocation(this.program, "u_resolution");
|
|
36852
|
-
this.gl.uniform1f(timeLocation, currentTime), this.gl.uniform1f(strengthLocation, this.colorConfig.strength), this.gl.uniform2f(resolutionLocation, this.webglCanvas.width, this.webglCanvas.height);
|
|
36853
|
-
this.gl.uniform1i(effectTypeLocation, {
|
|
36854
|
-
grayscale: 0,
|
|
36855
|
-
sepia: 1
|
|
36856
|
-
}[this.colorConfig.effectType] || 0);
|
|
36857
|
-
}
|
|
36858
|
-
applyCanvas2DEffect(canvas) {
|
|
36859
|
-
if (this.colorConfig.strength <= 0) {
|
|
36860
|
-
const outputCanvas = this.createOutputCanvas(canvas);
|
|
36861
|
-
return outputCanvas ? outputCanvas.canvas : null;
|
|
36862
|
-
}
|
|
36863
|
-
if (this.canUseCSSFilter()) return this.applyCSSFilter(canvas);
|
|
36864
|
-
const outputCanvas = this.createOutputCanvas(canvas);
|
|
36865
|
-
if (!outputCanvas) return null;
|
|
36866
|
-
const {
|
|
36867
|
-
ctx: ctx
|
|
36868
|
-
} = outputCanvas;
|
|
36869
|
-
try {
|
|
36870
|
-
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
|
|
36871
|
-
currentTime = this.getAnimationTime();
|
|
36872
|
-
let processedImageData;
|
|
36873
|
-
switch (this.colorConfig.effectType) {
|
|
36874
|
-
case "grayscale":
|
|
36875
|
-
default:
|
|
36876
|
-
processedImageData = this.applyGrayscaleEffect(imageData, this.colorConfig.strength, currentTime);
|
|
36877
|
-
break;
|
|
36878
|
-
case "sepia":
|
|
36879
|
-
processedImageData = this.applySepiaEffect(imageData, this.colorConfig.strength, currentTime);
|
|
36880
|
-
}
|
|
36881
|
-
return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(processedImageData, 0, 0), outputCanvas.canvas;
|
|
36882
|
-
} catch (error) {
|
|
36883
|
-
return console.warn("Canvas 2D color effect failed:", error), null;
|
|
36884
|
-
}
|
|
36885
|
-
}
|
|
36886
|
-
canUseCSSFilter() {
|
|
36887
|
-
var _a;
|
|
36888
|
-
return !!window.useFilterAPI && "undefined" != typeof CSS && (null === (_a = CSS.supports) || void 0 === _a ? void 0 : _a.call(CSS, "filter", "grayscale(1)"));
|
|
36889
|
-
}
|
|
36890
|
-
applyCSSFilter(canvas) {
|
|
36891
|
-
try {
|
|
36892
|
-
const outputCanvas = ImageProcessUtils.createTempCanvas(canvas.width, canvas.height),
|
|
36893
|
-
ctx = outputCanvas.getContext("2d");
|
|
36894
|
-
if (!ctx) return null;
|
|
36895
|
-
const currentTime = this.getAnimationTime(),
|
|
36896
|
-
dynamicStrength = ImageProcessUtils.calculateDynamicStrength(this.colorConfig.strength, currentTime);
|
|
36897
|
-
let filterValue = "";
|
|
36898
|
-
return "grayscale" === this.colorConfig.effectType ? filterValue = `grayscale(${Math.min(1, dynamicStrength)})` : "sepia" === this.colorConfig.effectType && (filterValue = `sepia(${Math.min(1, dynamicStrength)})`), ctx.filter = filterValue, ctx.drawImage(canvas, 0, 0), ctx.filter = "none", outputCanvas;
|
|
36899
|
-
} catch (error) {
|
|
36900
|
-
return console.warn("CSS Filter API failed, falling back to pixel processing:", error), null;
|
|
36901
|
-
}
|
|
36902
|
-
}
|
|
36903
|
-
applyGrayscaleEffect(imageData, strength, time) {
|
|
36904
|
-
const {
|
|
36905
|
-
data: data,
|
|
36906
|
-
width: width,
|
|
36907
|
-
height: height
|
|
36908
|
-
} = imageData,
|
|
36909
|
-
result = new Uint8ClampedArray(data.length),
|
|
36910
|
-
dynamicStrength = ImageProcessUtils.calculateDynamicStrength(strength, time);
|
|
36911
|
-
for (let i = 0; i < data.length; i += 4) {
|
|
36912
|
-
const r = data[i],
|
|
36913
|
-
g = data[i + 1],
|
|
36914
|
-
b = data[i + 2],
|
|
36915
|
-
a = data[i + 3],
|
|
36916
|
-
gray = ImageProcessUtils.getLuminance(r, g, b);
|
|
36917
|
-
result[i] = Math.round(ImageProcessUtils.lerp(r, gray, dynamicStrength)), result[i + 1] = Math.round(ImageProcessUtils.lerp(g, gray, dynamicStrength)), result[i + 2] = Math.round(ImageProcessUtils.lerp(b, gray, dynamicStrength)), result[i + 3] = a;
|
|
36918
|
-
}
|
|
36919
|
-
return new ImageData(result, width, height);
|
|
36920
|
-
}
|
|
36921
|
-
applySepiaEffect(imageData, strength, time) {
|
|
36922
|
-
const {
|
|
36923
|
-
data: data,
|
|
36924
|
-
width: width,
|
|
36925
|
-
height: height
|
|
36926
|
-
} = imageData,
|
|
36927
|
-
result = new Uint8ClampedArray(data.length),
|
|
36928
|
-
dynamicStrength = ImageProcessUtils.calculateDynamicStrength(strength, time);
|
|
36929
|
-
for (let i = 0; i < data.length; i += 4) {
|
|
36930
|
-
const r = data[i],
|
|
36931
|
-
g = data[i + 1],
|
|
36932
|
-
b = data[i + 2],
|
|
36933
|
-
a = data[i + 3],
|
|
36934
|
-
[sepiaR, sepiaG, sepiaB] = ImageProcessUtils.applySepiaToPixel(r, g, b);
|
|
36935
|
-
result[i] = Math.round(ImageProcessUtils.lerp(r, sepiaR, dynamicStrength)), result[i + 1] = Math.round(ImageProcessUtils.lerp(g, sepiaG, dynamicStrength)), result[i + 2] = Math.round(ImageProcessUtils.lerp(b, sepiaB, dynamicStrength)), result[i + 3] = a;
|
|
36936
|
-
}
|
|
36937
|
-
return new ImageData(result, width, height);
|
|
36938
|
-
}
|
|
36939
|
-
afterStageRender(stage, canvas) {
|
|
36940
|
-
if (this.canUseCSSFilter() && this.colorConfig.strength > 0) {
|
|
36941
|
-
const cssResult = this.applyCSSFilter(canvas);
|
|
36942
|
-
if (cssResult) return cssResult;
|
|
36943
|
-
}
|
|
36944
|
-
return super.afterStageRender(stage, canvas);
|
|
36945
|
-
}
|
|
36946
|
-
}
|
|
36947
|
-
|
|
36948
|
-
class Distortion extends HybridEffectBase {
|
|
36949
|
-
constructor(from, to, duration, easing, params) {
|
|
36950
|
-
var _a, _b, _c;
|
|
36951
|
-
super(from, to, duration, easing, params), this.distortionConfig = {
|
|
36952
|
-
distortionType: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.distortionType) || "wave",
|
|
36953
|
-
strength: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.strength) || .3,
|
|
36954
|
-
useWebGL: void 0 === (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.useWebGL) || params.options.useWebGL
|
|
36955
|
-
};
|
|
36956
|
-
}
|
|
36957
|
-
getShaderSources() {
|
|
36958
|
-
return {
|
|
36959
|
-
vertex: "\n attribute vec2 a_position;\n attribute vec2 a_texCoord;\n varying vec2 v_texCoord;\n\n void main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n v_texCoord = a_texCoord;\n }\n ",
|
|
36960
|
-
fragment: "\n precision mediump float;\n uniform sampler2D u_texture;\n uniform float u_time;\n uniform float u_strength;\n uniform int u_distortionType;\n uniform vec2 u_resolution;\n varying vec2 v_texCoord;\n\n // 波浪扭曲函数\n vec2 wave(vec2 uv, float time, float strength) {\n float waveX = sin(uv.y * 10.0 + time * 3.0) * strength * 0.1;\n float waveY = sin(uv.x * 10.0 + time * 2.0) * strength * 0.1;\n return uv + vec2(waveX, waveY);\n }\n\n // 涟漪扭曲函数\n vec2 ripple(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n float distance = length(uv - center);\n float ripple = sin(distance * 20.0 - time * 5.0) * strength * 0.1;\n vec2 direction = normalize(uv - center);\n return uv + direction * ripple;\n }\n\n // 漩涡扭曲函数\n vec2 swirl(vec2 uv, float time, float strength) {\n vec2 center = vec2(0.5, 0.5);\n vec2 delta = uv - center;\n float dist = length(delta);\n float originalAngle = atan(delta.y, delta.x);\n float rotationAngle = dist * strength * time * 2.0;\n float finalAngle = originalAngle + rotationAngle;\n return center + dist * vec2(cos(finalAngle), sin(finalAngle));\n }\n\n void main() {\n vec2 uv = v_texCoord;\n\n // 根据扭曲类型应用相应变换\n if (u_distortionType == 0) {\n uv = wave(uv, u_time, u_strength);\n } else if (u_distortionType == 1) {\n uv = ripple(uv, u_time, u_strength);\n } else if (u_distortionType == 2) {\n uv = swirl(uv, u_time, u_strength);\n }\n\n // 边界检查\n if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n } else {\n gl_FragColor = texture2D(u_texture, uv);\n }\n }\n "
|
|
36961
|
-
};
|
|
36962
|
-
}
|
|
36963
|
-
applyWebGLEffect(canvas) {
|
|
36964
|
-
if (!this.gl || !this.program || !this.webglCanvas) return null;
|
|
36965
|
-
this.setupWebGLState(canvas);
|
|
36966
|
-
const texture = this.createTextureFromCanvas(canvas);
|
|
36967
|
-
if (!texture) return null;
|
|
36968
|
-
const vertexBuffer = this.createFullScreenQuad();
|
|
36969
|
-
if (!vertexBuffer) return this.gl.deleteTexture(texture), null;
|
|
36970
|
-
try {
|
|
36971
|
-
return this.gl.useProgram(this.program), this.setupVertexAttributes(), this.setDistortionUniforms(), this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4), this.webglCanvas;
|
|
36972
|
-
} finally {
|
|
36973
|
-
this.gl.deleteTexture(texture), this.gl.deleteBuffer(vertexBuffer);
|
|
36974
|
-
}
|
|
36975
|
-
}
|
|
36976
|
-
setDistortionUniforms() {
|
|
36977
|
-
if (!this.gl || !this.program) return;
|
|
36978
|
-
const currentTime = this.getAnimationTime(),
|
|
36979
|
-
timeLocation = this.gl.getUniformLocation(this.program, "u_time"),
|
|
36980
|
-
strengthLocation = this.gl.getUniformLocation(this.program, "u_strength"),
|
|
36981
|
-
distortionTypeLocation = this.gl.getUniformLocation(this.program, "u_distortionType"),
|
|
36982
|
-
resolutionLocation = this.gl.getUniformLocation(this.program, "u_resolution");
|
|
36983
|
-
this.gl.uniform1f(timeLocation, currentTime), this.gl.uniform1f(strengthLocation, this.distortionConfig.strength), this.gl.uniform2f(resolutionLocation, this.webglCanvas.width, this.webglCanvas.height);
|
|
36984
|
-
this.gl.uniform1i(distortionTypeLocation, {
|
|
36985
|
-
wave: 0,
|
|
36986
|
-
ripple: 1,
|
|
36987
|
-
swirl: 2
|
|
36988
|
-
}[this.distortionConfig.distortionType] || 0);
|
|
36989
|
-
}
|
|
36990
|
-
applyCanvas2DEffect(canvas) {
|
|
36991
|
-
const outputCanvas = this.createOutputCanvas(canvas);
|
|
36992
|
-
if (!outputCanvas) return null;
|
|
36993
|
-
const {
|
|
36994
|
-
ctx: ctx
|
|
36995
|
-
} = outputCanvas;
|
|
36996
|
-
try {
|
|
36997
|
-
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
|
|
36998
|
-
currentTime = this.getAnimationTime();
|
|
36999
|
-
let distortedImageData;
|
|
37000
|
-
switch (this.distortionConfig.distortionType) {
|
|
37001
|
-
case "wave":
|
|
37002
|
-
distortedImageData = this.applyWaveDistortion(imageData, this.distortionConfig.strength, currentTime);
|
|
37003
|
-
break;
|
|
37004
|
-
case "ripple":
|
|
37005
|
-
distortedImageData = this.applyRippleDistortion(imageData, this.distortionConfig.strength, currentTime);
|
|
37006
|
-
break;
|
|
37007
|
-
case "swirl":
|
|
37008
|
-
distortedImageData = this.applySwirlDistortion(imageData, this.distortionConfig.strength, currentTime);
|
|
37009
|
-
break;
|
|
37010
|
-
default:
|
|
37011
|
-
distortedImageData = imageData;
|
|
37012
|
-
}
|
|
37013
|
-
return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(distortedImageData, 0, 0), outputCanvas.canvas;
|
|
37014
|
-
} catch (error) {
|
|
37015
|
-
return console.warn("Canvas 2D distortion effect failed:", error), null;
|
|
37016
|
-
}
|
|
37017
|
-
}
|
|
37018
|
-
applyWaveDistortion(imageData, strength, time) {
|
|
37019
|
-
const {
|
|
37020
|
-
data: data,
|
|
37021
|
-
width: width,
|
|
37022
|
-
height: height
|
|
37023
|
-
} = imageData,
|
|
37024
|
-
result = new Uint8ClampedArray(data.length);
|
|
37025
|
-
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
37026
|
-
const waveX = Math.sin(.1 * y + 3 * time) * strength * 20,
|
|
37027
|
-
waveY = Math.sin(.1 * x + 2 * time) * strength * 20,
|
|
37028
|
-
sourceX = Math.round(x - waveX),
|
|
37029
|
-
sourceY = Math.round(y - waveY),
|
|
37030
|
-
targetIndex = 4 * (y * width + x);
|
|
37031
|
-
if (sourceX >= 0 && sourceX < width && sourceY >= 0 && sourceY < height) {
|
|
37032
|
-
const sourceIndex = 4 * (sourceY * width + sourceX);
|
|
37033
|
-
result[targetIndex] = data[sourceIndex], result[targetIndex + 1] = data[sourceIndex + 1], result[targetIndex + 2] = data[sourceIndex + 2], result[targetIndex + 3] = data[sourceIndex + 3];
|
|
37034
|
-
} else result[targetIndex + 3] = 0;
|
|
37035
|
-
}
|
|
37036
|
-
return new ImageData(result, width, height);
|
|
37037
|
-
}
|
|
37038
|
-
applyRippleDistortion(imageData, strength, time) {
|
|
37039
|
-
const {
|
|
37040
|
-
data: data,
|
|
37041
|
-
width: width,
|
|
37042
|
-
height: height
|
|
37043
|
-
} = imageData,
|
|
37044
|
-
result = new Uint8ClampedArray(data.length),
|
|
37045
|
-
centerX = width / 2,
|
|
37046
|
-
centerY = height / 2;
|
|
37047
|
-
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
37048
|
-
const dx = x - centerX,
|
|
37049
|
-
dy = y - centerY,
|
|
37050
|
-
distance = Math.sqrt(dx * dx + dy * dy),
|
|
37051
|
-
ripple = Math.sin(.2 * distance - 5 * time) * strength * 10,
|
|
37052
|
-
angle = Math.atan2(dy, dx),
|
|
37053
|
-
sourceX = Math.round(x - Math.cos(angle) * ripple),
|
|
37054
|
-
sourceY = Math.round(y - Math.sin(angle) * ripple),
|
|
37055
|
-
targetIndex = 4 * (y * width + x);
|
|
37056
|
-
if (sourceX >= 0 && sourceX < width && sourceY >= 0 && sourceY < height) {
|
|
37057
|
-
const sourceIndex = 4 * (sourceY * width + sourceX);
|
|
37058
|
-
result[targetIndex] = data[sourceIndex], result[targetIndex + 1] = data[sourceIndex + 1], result[targetIndex + 2] = data[sourceIndex + 2], result[targetIndex + 3] = data[sourceIndex + 3];
|
|
37059
|
-
} else result[targetIndex + 3] = 0;
|
|
37060
|
-
}
|
|
37061
|
-
return new ImageData(result, width, height);
|
|
37062
|
-
}
|
|
37063
|
-
applySwirlDistortion(imageData, strength, time) {
|
|
37064
|
-
const {
|
|
37065
|
-
data: data,
|
|
37066
|
-
width: width,
|
|
37067
|
-
height: height
|
|
37068
|
-
} = imageData,
|
|
37069
|
-
result = new Uint8ClampedArray(data.length),
|
|
37070
|
-
centerX = width / 2,
|
|
37071
|
-
centerY = height / 2;
|
|
37072
|
-
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
37073
|
-
const dx = x - centerX,
|
|
37074
|
-
dy = y - centerY,
|
|
37075
|
-
distance = Math.sqrt(dx * dx + dy * dy),
|
|
37076
|
-
finalAngle = Math.atan2(dy, dx) + distance * strength * time * .02,
|
|
37077
|
-
sourceX = Math.round(centerX + distance * Math.cos(finalAngle)),
|
|
37078
|
-
sourceY = Math.round(centerY + distance * Math.sin(finalAngle)),
|
|
37079
|
-
targetIndex = 4 * (y * width + x);
|
|
37080
|
-
if (sourceX >= 0 && sourceX < width && sourceY >= 0 && sourceY < height) {
|
|
37081
|
-
const sourceIndex = 4 * (sourceY * width + sourceX);
|
|
37082
|
-
result[targetIndex] = data[sourceIndex], result[targetIndex + 1] = data[sourceIndex + 1], result[targetIndex + 2] = data[sourceIndex + 2], result[targetIndex + 3] = data[sourceIndex + 3];
|
|
37083
|
-
} else result[targetIndex + 3] = 0;
|
|
37084
|
-
}
|
|
37085
|
-
return new ImageData(result, width, height);
|
|
37086
|
-
}
|
|
37087
|
-
afterStageRender(stage, canvas) {
|
|
37088
|
-
return this.distortionConfig.strength <= 0 ? canvas : super.afterStageRender(stage, canvas);
|
|
37089
|
-
}
|
|
37090
|
-
}
|
|
37091
|
-
|
|
37092
|
-
class Particle extends HybridEffectBase {
|
|
37093
|
-
constructor(from, to, duration, easing, params) {
|
|
37094
|
-
var _a, _b, _c, _d, _e;
|
|
37095
|
-
super(from, to, duration, easing, params), this.particles = [], this.positionBuffer = null, this.colorBuffer = null, this.particleConfig = {
|
|
37096
|
-
effectType: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.effectType) || "gravity",
|
|
37097
|
-
count: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.count) || 4e3,
|
|
37098
|
-
size: (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.size) || 20,
|
|
37099
|
-
strength: (null === (_d = null == params ? void 0 : params.options) || void 0 === _d ? void 0 : _d.strength) || 1.5,
|
|
37100
|
-
useWebGL: void 0 === (null === (_e = null == params ? void 0 : params.options) || void 0 === _e ? void 0 : _e.useWebGL) || params.options.useWebGL
|
|
37101
|
-
};
|
|
37102
|
-
}
|
|
37103
|
-
getShaderSources() {
|
|
37104
|
-
return {
|
|
37105
|
-
vertex: "\n attribute vec2 a_position;\n attribute vec4 a_color;\n attribute float a_size;\n\n uniform vec2 u_resolution;\n uniform float u_time;\n uniform float u_forceStrength;\n uniform int u_effectType;\n\n varying vec4 v_color;\n\n void main() {\n // 将像素坐标转换为剪辑空间坐标\n vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0;\n clipSpace.y = -clipSpace.y; // 翻转Y轴\n\n gl_Position = vec4(clipSpace, 0.0, 1.0);\n gl_PointSize = a_size;\n v_color = a_color;\n }\n ",
|
|
37106
|
-
fragment: "\n precision mediump float;\n varying vec4 v_color;\n\n void main() {\n // 创建圆形粒子\n vec2 coord = gl_PointCoord - vec2(0.5);\n float distance = length(coord);\n\n if (distance > 0.5) {\n discard;\n }\n\n // 保持原始颜色,只调整透明度渐变\n gl_FragColor = vec4(v_color.rgb, v_color.a);\n }\n "
|
|
37107
|
-
};
|
|
37108
|
-
}
|
|
37109
|
-
applyWebGLEffect(canvas) {
|
|
37110
|
-
if (!this.gl || !this.program || !this.webglCanvas) return null;
|
|
37111
|
-
this.setupWebGLState(canvas), 0 === this.particles.length && this.extractParticles(canvas), this.updateParticles(canvas);
|
|
37112
|
-
const gl = this.gl;
|
|
37113
|
-
return gl.enable(gl.BLEND), gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA), gl.useProgram(this.program), this.prepareAndDrawParticles(gl), this.webglCanvas;
|
|
37114
|
-
}
|
|
37115
|
-
applyCanvas2DEffect(canvas) {
|
|
37116
|
-
const output = this.createOutputCanvas(canvas);
|
|
37117
|
-
if (!output) return null;
|
|
37118
|
-
const {
|
|
37119
|
-
canvas: outputCanvas,
|
|
37120
|
-
ctx: ctx
|
|
37121
|
-
} = output,
|
|
37122
|
-
progress = this.currentAnimationRatio;
|
|
37123
|
-
switch (this.particleConfig.effectType) {
|
|
37124
|
-
case "explode":
|
|
37125
|
-
this.applyCanvas2DExplode(ctx, canvas, progress);
|
|
37126
|
-
break;
|
|
37127
|
-
case "gravity":
|
|
37128
|
-
this.applyCanvas2DGravity(ctx, canvas, progress);
|
|
37129
|
-
break;
|
|
37130
|
-
case "vortex":
|
|
37131
|
-
this.applyCanvas2DVortex(ctx, canvas, progress);
|
|
37132
|
-
break;
|
|
37133
|
-
default:
|
|
37134
|
-
ctx.globalAlpha = Math.max(0, 1 - progress), ctx.drawImage(canvas, 0, 0);
|
|
37135
|
-
}
|
|
37136
|
-
return outputCanvas;
|
|
37137
|
-
}
|
|
37138
|
-
extractParticles(canvas) {
|
|
37139
|
-
const tempCanvas = ImageProcessUtils.createTempCanvas(canvas.width, canvas.height, 1),
|
|
37140
|
-
tempCtx = tempCanvas.getContext("2d");
|
|
37141
|
-
if (!tempCtx) return;
|
|
37142
|
-
tempCtx.drawImage(canvas, 0, 0, tempCanvas.width, tempCanvas.height);
|
|
37143
|
-
const data = tempCtx.getImageData(0, 0, tempCanvas.width, tempCanvas.height).data;
|
|
37144
|
-
this.particles = [];
|
|
37145
|
-
const step = Math.max(1, Math.floor(Math.sqrt(tempCanvas.width * tempCanvas.height / (1.5 * this.particleConfig.count))));
|
|
37146
|
-
for (let y = 0; y < tempCanvas.height; y += step) for (let x = 0; x < tempCanvas.width; x += step) {
|
|
37147
|
-
const index = 4 * (y * tempCanvas.width + x),
|
|
37148
|
-
r = data[index],
|
|
37149
|
-
g = data[index + 1],
|
|
37150
|
-
b = data[index + 2],
|
|
37151
|
-
a = data[index + 3];
|
|
37152
|
-
if (a > 5) {
|
|
37153
|
-
const realX = x / tempCanvas.width * canvas.width,
|
|
37154
|
-
realY = y / tempCanvas.height * canvas.height,
|
|
37155
|
-
particle = {
|
|
37156
|
-
x: realX,
|
|
37157
|
-
y: realY,
|
|
37158
|
-
originX: realX,
|
|
37159
|
-
originY: realY,
|
|
37160
|
-
vx: 0,
|
|
37161
|
-
vy: 0,
|
|
37162
|
-
r: r / 255,
|
|
37163
|
-
g: g / 255,
|
|
37164
|
-
b: b / 255,
|
|
37165
|
-
a: Math.max(.6, a / 255),
|
|
37166
|
-
life: 1,
|
|
37167
|
-
size: this.particleConfig.size * (1 + .5 * Math.random())
|
|
37168
|
-
};
|
|
37169
|
-
this.particles.push(particle);
|
|
37170
|
-
}
|
|
37171
|
-
}
|
|
37172
|
-
}
|
|
37173
|
-
updateParticles(canvas) {
|
|
37174
|
-
const centerX = canvas.width / 2,
|
|
37175
|
-
centerY = canvas.height / 2,
|
|
37176
|
-
progress = this.currentAnimationRatio,
|
|
37177
|
-
duration = this.getDurationFromParent(),
|
|
37178
|
-
isShortAnimation = duration < 2e3,
|
|
37179
|
-
timeMultiplier = isShortAnimation ? Math.max(1.5, 3e3 / duration) : 1,
|
|
37180
|
-
intensityBoost = isShortAnimation ? Math.min(2, 2e3 / duration) : 1;
|
|
37181
|
-
this.particles.forEach(particle => {
|
|
37182
|
-
const dx = particle.x - centerX,
|
|
37183
|
-
dy = particle.y - centerY,
|
|
37184
|
-
distance = Math.sqrt(dx * dx + dy * dy),
|
|
37185
|
-
angle = Math.atan2(dy, dx);
|
|
37186
|
-
this.applyParticleForces(particle, angle, distance, progress, intensityBoost, canvas), this.updateParticleProperties(particle, progress, isShortAnimation, timeMultiplier, intensityBoost);
|
|
37187
|
-
});
|
|
37188
|
-
}
|
|
37189
|
-
applyParticleForces(particle, angle, distance, progress, intensityBoost, canvas) {
|
|
37190
|
-
const time = this.getAnimationTime();
|
|
37191
|
-
switch (this.particleConfig.effectType) {
|
|
37192
|
-
case "explode":
|
|
37193
|
-
const explodeIntensity = progress * this.particleConfig.strength * intensityBoost * 5;
|
|
37194
|
-
particle.vx += Math.cos(angle) * explodeIntensity, particle.vy += Math.sin(angle) * explodeIntensity;
|
|
37195
|
-
break;
|
|
37196
|
-
case "gravity":
|
|
37197
|
-
this.applyGravityEffect(particle, progress, intensityBoost, canvas, time);
|
|
37198
|
-
break;
|
|
37199
|
-
case "vortex":
|
|
37200
|
-
this.applyVortexEffect(particle, progress, intensityBoost, canvas, angle, distance);
|
|
37201
|
-
}
|
|
37202
|
-
}
|
|
37203
|
-
applyGravityEffect(particle, progress, intensityBoost, canvas, time) {
|
|
37204
|
-
const gravityThreshold = (particle.originX + .7 * particle.originY) / (canvas.width + canvas.height) * .8;
|
|
37205
|
-
if (progress > gravityThreshold) {
|
|
37206
|
-
const gravityProgress = (progress - gravityThreshold) / (1 - gravityThreshold),
|
|
37207
|
-
gravityForce = this.particleConfig.strength * gravityProgress * gravityProgress * 12 * intensityBoost;
|
|
37208
|
-
particle.vy += gravityForce;
|
|
37209
|
-
const turbulence = Math.sin(3 * time + .02 * particle.originX) * Math.cos(2 * time + .015 * particle.originY);
|
|
37210
|
-
particle.vx += turbulence * this.particleConfig.strength * 2 * intensityBoost;
|
|
37211
|
-
}
|
|
37212
|
-
}
|
|
37213
|
-
applyVortexEffect(particle, progress, intensityBoost, canvas, angle, distance) {
|
|
37214
|
-
const centerX = canvas.width / 2,
|
|
37215
|
-
centerY = canvas.height / 2,
|
|
37216
|
-
spiralAngle = angle + progress * Math.PI * .8,
|
|
37217
|
-
targetRadius = distance + progress * Math.max(canvas.width, canvas.height) * .7 * 1.8,
|
|
37218
|
-
targetX = centerX + Math.cos(spiralAngle) * targetRadius,
|
|
37219
|
-
targetY = centerY + Math.sin(spiralAngle) * targetRadius,
|
|
37220
|
-
baseForce = progress * this.particleConfig.strength * .08 * intensityBoost;
|
|
37221
|
-
particle.vx += (targetX - particle.x) * baseForce, particle.vy += (targetY - particle.y) * baseForce;
|
|
37222
|
-
}
|
|
37223
|
-
updateParticleProperties(particle, progress, isShortAnimation, timeMultiplier, intensityBoost) {
|
|
37224
|
-
const dragCoeff = isShortAnimation ? .99 : .98;
|
|
37225
|
-
if (particle.vx *= dragCoeff, particle.vy *= dragCoeff, particle.x += particle.vx, particle.y += particle.vy, isShortAnimation) {
|
|
37226
|
-
const lifeDecayRate = Math.max(.1, .5 / timeMultiplier);
|
|
37227
|
-
particle.life = Math.max(0, 1 - progress * lifeDecayRate), particle.a = Math.max(.2, particle.life * Math.min(1, 1.2 * particle.a)), particle.size = Math.max(.7 * this.particleConfig.size, this.particleConfig.size * (.5 + .5 * particle.life));
|
|
37228
|
-
} else particle.life = Math.max(0, 1 - .2 * progress), particle.a = Math.max(.1, particle.life * Math.min(1, 1.5 * particle.a)), particle.size = Math.max(.5 * this.particleConfig.size, this.particleConfig.size * (.3 + .7 * particle.life));
|
|
37229
|
-
}
|
|
37230
|
-
prepareAndDrawParticles(gl) {
|
|
37231
|
-
const positions = new Float32Array(2 * this.particles.length),
|
|
37232
|
-
colors = new Float32Array(4 * this.particles.length),
|
|
37233
|
-
sizes = new Float32Array(this.particles.length);
|
|
37234
|
-
this.particles.forEach((particle, i) => {
|
|
37235
|
-
positions[2 * i] = particle.x, positions[2 * i + 1] = particle.y, colors[4 * i] = particle.r, colors[4 * i + 1] = particle.g, colors[4 * i + 2] = particle.b, colors[4 * i + 3] = Math.max(.1, particle.a), sizes[i] = Math.max(6, 1.5 * particle.size);
|
|
37236
|
-
}), this.updateParticleBuffers(gl, positions, colors, sizes), this.setParticleUniforms(gl), gl.drawArrays(gl.POINTS, 0, this.particles.length), this.cleanupTempBuffers(gl);
|
|
37237
|
-
}
|
|
37238
|
-
updateParticleBuffers(gl, positions, colors, sizes) {
|
|
37239
|
-
this.positionBuffer || (this.positionBuffer = gl.createBuffer()), gl.bindBuffer(gl.ARRAY_BUFFER, this.positionBuffer), gl.bufferData(gl.ARRAY_BUFFER, positions, gl.DYNAMIC_DRAW);
|
|
37240
|
-
const positionLocation = gl.getAttribLocation(this.program, "a_position");
|
|
37241
|
-
gl.enableVertexAttribArray(positionLocation), gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, !1, 0, 0), this.colorBuffer || (this.colorBuffer = gl.createBuffer()), gl.bindBuffer(gl.ARRAY_BUFFER, this.colorBuffer), gl.bufferData(gl.ARRAY_BUFFER, colors, gl.DYNAMIC_DRAW);
|
|
37242
|
-
const colorLocation = gl.getAttribLocation(this.program, "a_color");
|
|
37243
|
-
gl.enableVertexAttribArray(colorLocation), gl.vertexAttribPointer(colorLocation, 4, gl.FLOAT, !1, 0, 0);
|
|
37244
|
-
const sizeBuffer = gl.createBuffer();
|
|
37245
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, sizeBuffer), gl.bufferData(gl.ARRAY_BUFFER, sizes, gl.DYNAMIC_DRAW);
|
|
37246
|
-
const sizeLocation = gl.getAttribLocation(this.program, "a_size");
|
|
37247
|
-
gl.enableVertexAttribArray(sizeLocation), gl.vertexAttribPointer(sizeLocation, 1, gl.FLOAT, !1, 0, 0), this._tempSizeBuffer = sizeBuffer;
|
|
37248
|
-
}
|
|
37249
|
-
setParticleUniforms(gl) {
|
|
37250
|
-
const resolutionLocation = gl.getUniformLocation(this.program, "u_resolution"),
|
|
37251
|
-
timeLocation = gl.getUniformLocation(this.program, "u_time"),
|
|
37252
|
-
forceStrengthLocation = gl.getUniformLocation(this.program, "u_forceStrength"),
|
|
37253
|
-
effectTypeLocation = gl.getUniformLocation(this.program, "u_effectType");
|
|
37254
|
-
gl.uniform2f(resolutionLocation, this.webglCanvas.width, this.webglCanvas.height), gl.uniform1f(timeLocation, this.getAnimationTime()), gl.uniform1f(forceStrengthLocation, this.particleConfig.strength);
|
|
37255
|
-
gl.uniform1i(effectTypeLocation, {
|
|
37256
|
-
explode: 0,
|
|
37257
|
-
vortex: 1,
|
|
37258
|
-
gravity: 2
|
|
37259
|
-
}[this.particleConfig.effectType] || 0);
|
|
37260
|
-
}
|
|
37261
|
-
cleanupTempBuffers(gl) {
|
|
37262
|
-
const tempSizeBuffer = this._tempSizeBuffer;
|
|
37263
|
-
tempSizeBuffer && (gl.deleteBuffer(tempSizeBuffer), delete this._tempSizeBuffer);
|
|
37264
|
-
}
|
|
37265
|
-
applyCanvas2DExplode(ctx, canvas, progress) {
|
|
37266
|
-
const centerX = canvas.width / 2,
|
|
37267
|
-
centerY = canvas.height / 2;
|
|
37268
|
-
ctx.save(), ctx.globalAlpha = Math.max(0, 1 - progress), ctx.translate(centerX, centerY);
|
|
37269
|
-
const scale = 1 + .5 * progress;
|
|
37270
|
-
ctx.scale(scale, scale), ctx.translate(-centerX, -centerY), ctx.drawImage(canvas, 0, 0), ctx.restore();
|
|
37271
|
-
}
|
|
37272
|
-
applyCanvas2DGravity(ctx, canvas, progress) {
|
|
37273
|
-
ctx.save(), ctx.globalAlpha = Math.max(0, 1 - progress);
|
|
37274
|
-
const offsetY = progress * canvas.height * .3;
|
|
37275
|
-
ctx.drawImage(canvas, 0, offsetY), ctx.restore();
|
|
37276
|
-
}
|
|
37277
|
-
applyCanvas2DVortex(ctx, canvas, progress) {
|
|
37278
|
-
const centerX = canvas.width / 2,
|
|
37279
|
-
centerY = canvas.height / 2;
|
|
37280
|
-
ctx.save(), ctx.globalAlpha = Math.max(0, 1 - progress), ctx.translate(centerX, centerY), ctx.rotate(progress * Math.PI * 2), ctx.translate(-centerX, -centerY), ctx.drawImage(canvas, 0, 0), ctx.restore();
|
|
37281
|
-
}
|
|
37282
|
-
}
|
|
37283
|
-
|
|
37284
|
-
class Glitch extends Canvas2DEffectBase {
|
|
37285
|
-
constructor(from, to, duration, easing, params) {
|
|
37286
|
-
var _a, _b;
|
|
37287
|
-
super(from, to, duration, easing, params), this.glitchConfig = {
|
|
37288
|
-
effectType: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.effectType) || "rgb-shift",
|
|
37289
|
-
intensity: void 0 !== (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.intensity) ? params.options.intensity : .5
|
|
37290
|
-
};
|
|
37291
|
-
}
|
|
37292
|
-
applyCanvas2DEffect(canvas) {
|
|
37293
|
-
if (this.glitchConfig.intensity <= 0) {
|
|
37294
|
-
const outputCanvas = this.createOutputCanvas(canvas);
|
|
37295
|
-
return outputCanvas ? outputCanvas.canvas : null;
|
|
37296
|
-
}
|
|
37297
|
-
try {
|
|
37298
|
-
switch (this.glitchConfig.effectType) {
|
|
37299
|
-
case "rgb-shift":
|
|
37300
|
-
default:
|
|
37301
|
-
return this.applyRGBShiftGlitch(canvas);
|
|
37302
|
-
case "digital-distortion":
|
|
37303
|
-
return this.applyDigitalDistortionGlitch(canvas);
|
|
37304
|
-
case "scan-lines":
|
|
37305
|
-
return this.applyScanLineGlitch(canvas);
|
|
37306
|
-
case "data-corruption":
|
|
37307
|
-
return this.applyDataCorruptionGlitch(canvas);
|
|
37308
|
-
}
|
|
37309
|
-
} catch (error) {
|
|
37310
|
-
return console.warn("Glitch effect failed:", error), null;
|
|
37311
|
-
}
|
|
37312
|
-
}
|
|
37313
|
-
applyRGBShiftGlitch(canvas) {
|
|
37314
|
-
const outputCanvas = this.createOutputCanvas(canvas);
|
|
37315
|
-
if (!outputCanvas) return null;
|
|
37316
|
-
const {
|
|
37317
|
-
ctx: ctx
|
|
37318
|
-
} = outputCanvas;
|
|
37319
|
-
try {
|
|
37320
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
37321
|
-
const dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
|
|
37322
|
-
maxOffset = Math.floor(20 * dynamicIntensity),
|
|
37323
|
-
redOffset = this.generateRandomOffset(maxOffset),
|
|
37324
|
-
greenOffset = this.generateRandomOffset(maxOffset, .3),
|
|
37325
|
-
blueOffset = this.generateRandomOffset(-maxOffset),
|
|
37326
|
-
tempCanvas = ImageProcessUtils.createTempCanvas(canvas.width, canvas.height),
|
|
37327
|
-
tempCtx = tempCanvas.getContext("2d");
|
|
37328
|
-
tempCtx.drawImage(canvas, 0, 0);
|
|
37329
|
-
const originalImageData = tempCtx.getImageData(0, 0, canvas.width, canvas.height),
|
|
37330
|
-
redChannelData = ImageProcessUtils.extractChannel(originalImageData, 0),
|
|
37331
|
-
greenChannelData = ImageProcessUtils.extractChannel(originalImageData, 1),
|
|
37332
|
-
blueChannelData = ImageProcessUtils.extractChannel(originalImageData, 2);
|
|
37333
|
-
return ctx.globalCompositeOperation = "screen", tempCtx.clearRect(0, 0, canvas.width, canvas.height), tempCtx.putImageData(redChannelData, 0, 0), ctx.drawImage(tempCanvas, redOffset.x, redOffset.y), tempCtx.clearRect(0, 0, canvas.width, canvas.height), tempCtx.putImageData(greenChannelData, 0, 0), ctx.drawImage(tempCanvas, greenOffset.x, greenOffset.y), tempCtx.clearRect(0, 0, canvas.width, canvas.height), tempCtx.putImageData(blueChannelData, 0, 0), ctx.drawImage(tempCanvas, blueOffset.x, blueOffset.y), ctx.globalCompositeOperation = "source-over", outputCanvas.canvas;
|
|
37334
|
-
} catch (error) {
|
|
37335
|
-
return console.warn("RGB shift glitch failed:", error), null;
|
|
37336
|
-
}
|
|
37337
|
-
}
|
|
37338
|
-
applyDigitalDistortionGlitch(canvas) {
|
|
37339
|
-
const outputCanvas = this.createOutputCanvas(canvas);
|
|
37340
|
-
if (!outputCanvas) return null;
|
|
37341
|
-
const {
|
|
37342
|
-
ctx: ctx
|
|
37343
|
-
} = outputCanvas;
|
|
37344
|
-
try {
|
|
37345
|
-
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
|
|
37346
|
-
dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
|
|
37347
|
-
distortedImageData = this.processDigitalDistortion(imageData, dynamicIntensity);
|
|
37348
|
-
return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(distortedImageData, 0, 0), outputCanvas.canvas;
|
|
37349
|
-
} catch (error) {
|
|
37350
|
-
return console.warn("Digital distortion glitch failed:", error), null;
|
|
37351
|
-
}
|
|
37352
|
-
}
|
|
37353
|
-
applyScanLineGlitch(canvas) {
|
|
37354
|
-
const outputCanvas = this.createOutputCanvas(canvas);
|
|
37355
|
-
if (!outputCanvas) return null;
|
|
37356
|
-
const {
|
|
37357
|
-
ctx: ctx
|
|
37358
|
-
} = outputCanvas;
|
|
37359
|
-
try {
|
|
37360
|
-
const dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
|
|
37361
|
-
lineSpacing = Math.max(2, Math.floor(10 - 8 * dynamicIntensity));
|
|
37362
|
-
ctx.globalCompositeOperation = "multiply";
|
|
37363
|
-
for (let y = 0; y < canvas.height; y += lineSpacing) if (Math.random() < dynamicIntensity) {
|
|
37364
|
-
const opacity = .1 + .4 * dynamicIntensity;
|
|
37365
|
-
ctx.fillStyle = `rgba(0, 0, 0, ${opacity})`, ctx.fillRect(0, y, canvas.width, 1);
|
|
37366
|
-
}
|
|
37367
|
-
ctx.globalCompositeOperation = "screen";
|
|
37368
|
-
const brightLineCount = Math.floor(20 * dynamicIntensity);
|
|
37369
|
-
for (let i = 0; i < brightLineCount; i++) {
|
|
37370
|
-
const y = Math.random() * canvas.height,
|
|
37371
|
-
opacity = .3 * dynamicIntensity;
|
|
37372
|
-
ctx.fillStyle = `rgba(255, 255, 255, ${opacity})`, ctx.fillRect(0, Math.floor(y), canvas.width, 1);
|
|
37373
|
-
}
|
|
37374
|
-
return ctx.globalCompositeOperation = "source-over", outputCanvas.canvas;
|
|
37375
|
-
} catch (error) {
|
|
37376
|
-
return console.warn("Scan line glitch failed:", error), null;
|
|
37377
|
-
}
|
|
37378
|
-
}
|
|
37379
|
-
applyDataCorruptionGlitch(canvas) {
|
|
37380
|
-
const outputCanvas = this.createOutputCanvas(canvas);
|
|
37381
|
-
if (!outputCanvas) return null;
|
|
37382
|
-
const {
|
|
37383
|
-
ctx: ctx
|
|
37384
|
-
} = outputCanvas;
|
|
37385
|
-
try {
|
|
37386
|
-
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
|
|
37387
|
-
dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
|
|
37388
|
-
corruptedImageData = this.processDataCorruption(imageData, dynamicIntensity);
|
|
37389
|
-
return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(corruptedImageData, 0, 0), outputCanvas.canvas;
|
|
37390
|
-
} catch (error) {
|
|
37391
|
-
return console.warn("Data corruption glitch failed:", error), null;
|
|
37392
|
-
}
|
|
37393
|
-
}
|
|
37394
|
-
generateRandomOffset(maxOffset, scale = 1) {
|
|
37395
|
-
return {
|
|
37396
|
-
x: (Math.random() - .5) * maxOffset,
|
|
37397
|
-
y: (Math.random() - .5) * maxOffset * scale
|
|
37398
|
-
};
|
|
37399
|
-
}
|
|
37400
|
-
processDigitalDistortion(imageData, intensity) {
|
|
37401
|
-
const {
|
|
37402
|
-
data: data,
|
|
37403
|
-
width: width,
|
|
37404
|
-
height: height
|
|
37405
|
-
} = imageData,
|
|
37406
|
-
result = new Uint8ClampedArray(data),
|
|
37407
|
-
sliceCount = Math.floor(20 * intensity) + 5,
|
|
37408
|
-
sliceHeight = Math.floor(height / sliceCount);
|
|
37409
|
-
for (let i = 0; i < sliceCount; i++) if (Math.random() < intensity) {
|
|
37410
|
-
const y = i * sliceHeight,
|
|
37411
|
-
sliceEnd = Math.min(y + sliceHeight, height),
|
|
37412
|
-
offset = Math.floor((Math.random() - .5) * width * intensity * .1);
|
|
37413
|
-
this.shiftSliceHorizontal(result, width, height, y, sliceEnd, offset);
|
|
37414
|
-
}
|
|
37415
|
-
const noiseIntensity = .3 * intensity;
|
|
37416
|
-
for (let i = 0; i < data.length; i += 4) Math.random() < noiseIntensity && (result[i] = 255 * Math.random(), result[i + 1] = 255 * Math.random(), result[i + 2] = 255 * Math.random());
|
|
37417
|
-
return new ImageData(result, width, height);
|
|
37418
|
-
}
|
|
37419
|
-
shiftSliceHorizontal(data, width, height, startY, endY, offset) {
|
|
37420
|
-
const tempRow = new Uint8ClampedArray(4 * width);
|
|
37421
|
-
for (let y = startY; y < endY; y++) {
|
|
37422
|
-
const rowStart = y * width * 4;
|
|
37423
|
-
for (let x = 0; x < 4 * width; x++) tempRow[x] = data[rowStart + x];
|
|
37424
|
-
for (let x = 0; x < width; x++) {
|
|
37425
|
-
const targetIndex = rowStart + 4 * x,
|
|
37426
|
-
sourceIndex = 4 * ((x - offset + width) % width);
|
|
37427
|
-
data[targetIndex] = tempRow[sourceIndex], data[targetIndex + 1] = tempRow[sourceIndex + 1], data[targetIndex + 2] = tempRow[sourceIndex + 2], data[targetIndex + 3] = tempRow[sourceIndex + 3];
|
|
37428
|
-
}
|
|
37429
|
-
}
|
|
37430
|
-
}
|
|
37431
|
-
processDataCorruption(imageData, intensity) {
|
|
37432
|
-
const {
|
|
37433
|
-
data: data,
|
|
37434
|
-
width: width,
|
|
37435
|
-
height: height
|
|
37436
|
-
} = imageData,
|
|
37437
|
-
result = new Uint8ClampedArray(data),
|
|
37438
|
-
stripeCount = Math.floor(15 * intensity) + 5;
|
|
37439
|
-
for (let i = 0; i < stripeCount; i++) if (Math.random() < intensity) {
|
|
37440
|
-
const x = Math.floor(Math.random() * width),
|
|
37441
|
-
stripeWidth = Math.floor(5 * Math.random()) + 1,
|
|
37442
|
-
color = Math.random() < .5 ? 0 : 255;
|
|
37443
|
-
for (let y = 0; y < height; y++) for (let dx = 0; dx < stripeWidth && x + dx < width; dx++) {
|
|
37444
|
-
const index = 4 * (y * width + x + dx);
|
|
37445
|
-
result[index] = color, result[index + 1] = color, result[index + 2] = color;
|
|
37446
|
-
}
|
|
37447
|
-
}
|
|
37448
|
-
const corruptionCount = Math.floor(20 * intensity);
|
|
37449
|
-
for (let i = 0; i < corruptionCount; i++) {
|
|
37450
|
-
const blockX = Math.floor(Math.random() * width),
|
|
37451
|
-
blockY = Math.floor(Math.random() * height),
|
|
37452
|
-
blockW = Math.floor(20 * Math.random()) + 5,
|
|
37453
|
-
blockH = Math.floor(10 * Math.random()) + 2;
|
|
37454
|
-
this.corruptBlock(result, width, height, blockX, blockY, blockW, blockH);
|
|
37455
|
-
}
|
|
37456
|
-
return new ImageData(result, width, height);
|
|
37457
|
-
}
|
|
37458
|
-
corruptBlock(data, width, height, x, y, w, h) {
|
|
37459
|
-
for (let dy = 0; dy < h && y + dy < height; dy++) for (let dx = 0; dx < w && x + dx < width; dx++) {
|
|
37460
|
-
const index = 4 * ((y + dy) * width + (x + dx));
|
|
37461
|
-
Math.random() < .7 && (data[index] = 255 * Math.random(), data[index + 1] = 255 * Math.random(), data[index + 2] = 255 * Math.random());
|
|
37462
|
-
}
|
|
37463
|
-
}
|
|
37464
|
-
}
|
|
37465
|
-
|
|
37466
|
-
class GaussianBlur extends AStageAnimate {
|
|
37467
|
-
constructor(from, to, duration, easing, params) {
|
|
37468
|
-
var _a, _b;
|
|
37469
|
-
super(from, to, duration, easing, params), this.blurConfig = {
|
|
37470
|
-
blurRadius: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.blurRadius) || 8,
|
|
37471
|
-
useOptimizedBlur: void 0 === (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.useOptimizedBlur) || params.options.useOptimizedBlur
|
|
37472
|
-
};
|
|
37473
|
-
}
|
|
37474
|
-
applyCSSBlur(canvas, radius) {
|
|
37475
|
-
const c = vglobal.createCanvas({
|
|
37476
|
-
width: canvas.width,
|
|
37477
|
-
height: canvas.height,
|
|
37478
|
-
dpr: vglobal.devicePixelRatio
|
|
37479
|
-
}),
|
|
37480
|
-
ctx = c.getContext("2d");
|
|
37481
|
-
return ctx ? (ctx.filter = `blur(${radius}px)`, ctx.drawImage(canvas, 0, 0), ctx.filter = "none", c) : canvas;
|
|
37482
|
-
}
|
|
37483
|
-
applyDownsampleBlur(imageData, radius) {
|
|
37484
|
-
const {
|
|
37485
|
-
width: width,
|
|
37486
|
-
height: height
|
|
37487
|
-
} = imageData,
|
|
37488
|
-
downsample = Math.max(1, Math.floor(radius / 2)),
|
|
37489
|
-
smallWidth = Math.floor(width / downsample),
|
|
37490
|
-
smallHeight = Math.floor(height / downsample),
|
|
37491
|
-
tempCanvas = vglobal.createCanvas({
|
|
37492
|
-
width: smallWidth,
|
|
37493
|
-
height: smallHeight,
|
|
37494
|
-
dpr: 1
|
|
37495
|
-
}),
|
|
37496
|
-
tempCtx = tempCanvas.getContext("2d");
|
|
37497
|
-
if (!tempCtx) return imageData;
|
|
37498
|
-
const originalCanvas = vglobal.createCanvas({
|
|
37499
|
-
width: width,
|
|
37500
|
-
height: height,
|
|
37501
|
-
dpr: 1
|
|
37502
|
-
}),
|
|
37503
|
-
originalCtx = originalCanvas.getContext("2d");
|
|
37504
|
-
return originalCtx ? (originalCtx.putImageData(imageData, 0, 0), tempCtx.drawImage(originalCanvas, 0, 0, smallWidth, smallHeight), tempCtx.filter = `blur(${radius / downsample}px)`, tempCtx.drawImage(tempCanvas, 0, 0), tempCtx.filter = "none", originalCtx.clearRect(0, 0, width, height), originalCtx.drawImage(tempCanvas, 0, 0, width, height), originalCtx.getImageData(0, 0, width, height)) : imageData;
|
|
37505
|
-
}
|
|
37506
|
-
afterStageRender(stage, canvas) {
|
|
37507
|
-
if (this.blurConfig.blurRadius <= 0) return canvas;
|
|
37508
|
-
let result;
|
|
37509
|
-
if (this.blurConfig.useOptimizedBlur) result = this.applyCSSBlur(canvas, this.blurConfig.blurRadius);else {
|
|
37510
|
-
const c = vglobal.createCanvas({
|
|
37511
|
-
width: canvas.width,
|
|
37512
|
-
height: canvas.height,
|
|
37513
|
-
dpr: vglobal.devicePixelRatio
|
|
37514
|
-
}),
|
|
37515
|
-
ctx = c.getContext("2d");
|
|
37516
|
-
if (!ctx) return !1;
|
|
37517
|
-
ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.drawImage(canvas, 0, 0);
|
|
37518
|
-
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
|
|
37519
|
-
blurredImageData = this.applyDownsampleBlur(imageData, this.blurConfig.blurRadius);
|
|
37520
|
-
ctx.putImageData(blurredImageData, 0, 0), result = c;
|
|
37521
|
-
}
|
|
37522
|
-
const ctx = result.getContext("2d");
|
|
37523
|
-
return ctx && (ctx.globalCompositeOperation = "overlay", ctx.fillStyle = "rgba(255, 255, 255, 0.1)", ctx.fillRect(0, 0, result.width, result.height), ctx.globalCompositeOperation = "source-over"), result;
|
|
37524
|
-
}
|
|
37525
|
-
}
|
|
37526
|
-
|
|
37527
|
-
class Pixelation extends DisappearAnimateBase {
|
|
37528
|
-
constructor(from, to, duration, easing, params) {
|
|
37529
|
-
var _a, _b;
|
|
37530
|
-
super(from, to, duration, easing, params), this.pixelationConfig = {
|
|
37531
|
-
maxPixelSize: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.maxPixelSize) || 20,
|
|
37532
|
-
method: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.method) || "out"
|
|
37533
|
-
};
|
|
37534
|
-
}
|
|
37535
|
-
applyDownsamplePixelation(canvas, pixelSize) {
|
|
37536
|
-
if (pixelSize <= 1) return canvas;
|
|
37537
|
-
const {
|
|
37538
|
-
width: width,
|
|
37539
|
-
height: height
|
|
37540
|
-
} = canvas,
|
|
37541
|
-
smallWidth = Math.ceil(width / pixelSize),
|
|
37542
|
-
smallHeight = Math.ceil(height / pixelSize),
|
|
37543
|
-
smallCanvas = vglobal.createCanvas({
|
|
37544
|
-
width: smallWidth,
|
|
37545
|
-
height: smallHeight,
|
|
37546
|
-
dpr: 1
|
|
37547
|
-
}),
|
|
37548
|
-
smallCtx = smallCanvas.getContext("2d");
|
|
37549
|
-
if (!smallCtx) return canvas;
|
|
37550
|
-
const outputCanvas = vglobal.createCanvas({
|
|
37551
|
-
width: width,
|
|
37552
|
-
height: height,
|
|
37553
|
-
dpr: vglobal.devicePixelRatio
|
|
37554
|
-
}),
|
|
37555
|
-
outputCtx = outputCanvas.getContext("2d");
|
|
37556
|
-
return outputCtx ? (smallCtx.imageSmoothingEnabled = !1, outputCtx.imageSmoothingEnabled = !1, smallCtx.drawImage(canvas, 0, 0, smallWidth, smallHeight), outputCtx.drawImage(smallCanvas, 0, 0, width, height), outputCanvas) : canvas;
|
|
37557
|
-
}
|
|
37558
|
-
updateAnimationProgress() {
|
|
37559
|
-
if ("in" === this.pixelationConfig.method) {
|
|
37560
|
-
return this.pixelationConfig.maxPixelSize - this.currentAnimationRatio * (this.pixelationConfig.maxPixelSize - 1);
|
|
37561
|
-
}
|
|
37562
|
-
return 1 + this.currentAnimationRatio * (this.pixelationConfig.maxPixelSize - 1);
|
|
37563
|
-
}
|
|
37564
|
-
afterStageRender(stage, canvas) {
|
|
37565
|
-
const currentPixelSize = this.updateAnimationProgress();
|
|
37566
|
-
if (currentPixelSize <= 1) return canvas;
|
|
37567
|
-
return this.applyDownsamplePixelation(canvas, currentPixelSize);
|
|
37568
|
-
}
|
|
37569
|
-
}
|
|
37570
|
-
|
|
37571
36246
|
const registerCustomAnimate = () => {
|
|
37572
|
-
AnimateExecutor.registerBuiltInAnimate("increaseCount", IncreaseCount), AnimateExecutor.registerBuiltInAnimate("fromTo", FromTo), AnimateExecutor.registerBuiltInAnimate("scaleIn", ScaleIn), AnimateExecutor.registerBuiltInAnimate("scaleOut", ScaleOut), AnimateExecutor.registerBuiltInAnimate("growHeightIn", GrowHeightIn), AnimateExecutor.registerBuiltInAnimate("growHeightOut", GrowHeightOut), AnimateExecutor.registerBuiltInAnimate("growWidthIn", GrowWidthIn), AnimateExecutor.registerBuiltInAnimate("growWidthOut", GrowWidthOut), AnimateExecutor.registerBuiltInAnimate("growCenterIn", GrowCenterIn), AnimateExecutor.registerBuiltInAnimate("growCenterOut", GrowCenterOut), AnimateExecutor.registerBuiltInAnimate("clipIn", ClipIn), AnimateExecutor.registerBuiltInAnimate("clipOut", ClipOut), AnimateExecutor.registerBuiltInAnimate("fadeIn", FadeIn), AnimateExecutor.registerBuiltInAnimate("fadeOut", FadeOut), AnimateExecutor.registerBuiltInAnimate("growPointsIn", GrowPointsIn), AnimateExecutor.registerBuiltInAnimate("growPointsOut", GrowPointsOut), AnimateExecutor.registerBuiltInAnimate("growPointsXIn", GrowPointsXIn), AnimateExecutor.registerBuiltInAnimate("growPointsXOut", GrowPointsXOut), AnimateExecutor.registerBuiltInAnimate("growPointsYIn", GrowPointsYIn), AnimateExecutor.registerBuiltInAnimate("growPointsYOut", GrowPointsYOut), AnimateExecutor.registerBuiltInAnimate("growAngleIn", GrowAngleIn), AnimateExecutor.registerBuiltInAnimate("growAngleOut", GrowAngleOut), AnimateExecutor.registerBuiltInAnimate("growRadiusIn", GrowRadiusIn), AnimateExecutor.registerBuiltInAnimate("growRadiusOut", GrowRadiusOut), AnimateExecutor.registerBuiltInAnimate("moveIn", MoveIn), AnimateExecutor.registerBuiltInAnimate("moveOut", MoveOut), AnimateExecutor.registerBuiltInAnimate("rotateIn", RotateIn), AnimateExecutor.registerBuiltInAnimate("rotateOut", RotateOut), AnimateExecutor.registerBuiltInAnimate("update", Update), AnimateExecutor.registerBuiltInAnimate("state", State), AnimateExecutor.registerBuiltInAnimate("labelItemAppear", LabelItemAppear), AnimateExecutor.registerBuiltInAnimate("labelItemDisappear", LabelItemDisappear), AnimateExecutor.registerBuiltInAnimate("poptipAppear", PoptipAppear), AnimateExecutor.registerBuiltInAnimate("poptipDisappear", PoptipDisappear), AnimateExecutor.registerBuiltInAnimate("inputText", InputText), AnimateExecutor.registerBuiltInAnimate("inputRichText", InputRichText), AnimateExecutor.registerBuiltInAnimate("outputRichText", OutputRichText), AnimateExecutor.registerBuiltInAnimate("slideRichText", SlideRichText), AnimateExecutor.registerBuiltInAnimate("slideOutRichText", SlideOutRichText), AnimateExecutor.registerBuiltInAnimate("slideIn", SlideIn), AnimateExecutor.registerBuiltInAnimate("growIn", GrowIn), AnimateExecutor.registerBuiltInAnimate("spinIn", SpinIn), AnimateExecutor.registerBuiltInAnimate("moveScaleIn", MoveScaleIn), AnimateExecutor.registerBuiltInAnimate("moveRotateIn", MoveRotateIn), AnimateExecutor.registerBuiltInAnimate("strokeIn", StrokeIn), AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut), AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut), AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut), AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut), AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut), AnimateExecutor.registerBuiltInAnimate("strokeOut", StrokeOut), AnimateExecutor.registerBuiltInAnimate("pulse", PulseAnimate), AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath), AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight)
|
|
36247
|
+
AnimateExecutor.registerBuiltInAnimate("increaseCount", IncreaseCount), AnimateExecutor.registerBuiltInAnimate("fromTo", FromTo), AnimateExecutor.registerBuiltInAnimate("scaleIn", ScaleIn), AnimateExecutor.registerBuiltInAnimate("scaleOut", ScaleOut), AnimateExecutor.registerBuiltInAnimate("growHeightIn", GrowHeightIn), AnimateExecutor.registerBuiltInAnimate("growHeightOut", GrowHeightOut), AnimateExecutor.registerBuiltInAnimate("growWidthIn", GrowWidthIn), AnimateExecutor.registerBuiltInAnimate("growWidthOut", GrowWidthOut), AnimateExecutor.registerBuiltInAnimate("growCenterIn", GrowCenterIn), AnimateExecutor.registerBuiltInAnimate("growCenterOut", GrowCenterOut), AnimateExecutor.registerBuiltInAnimate("clipIn", ClipIn), AnimateExecutor.registerBuiltInAnimate("clipOut", ClipOut), AnimateExecutor.registerBuiltInAnimate("fadeIn", FadeIn), AnimateExecutor.registerBuiltInAnimate("fadeOut", FadeOut), AnimateExecutor.registerBuiltInAnimate("growPointsIn", GrowPointsIn), AnimateExecutor.registerBuiltInAnimate("growPointsOut", GrowPointsOut), AnimateExecutor.registerBuiltInAnimate("growPointsXIn", GrowPointsXIn), AnimateExecutor.registerBuiltInAnimate("growPointsXOut", GrowPointsXOut), AnimateExecutor.registerBuiltInAnimate("growPointsYIn", GrowPointsYIn), AnimateExecutor.registerBuiltInAnimate("growPointsYOut", GrowPointsYOut), AnimateExecutor.registerBuiltInAnimate("growAngleIn", GrowAngleIn), AnimateExecutor.registerBuiltInAnimate("growAngleOut", GrowAngleOut), AnimateExecutor.registerBuiltInAnimate("growRadiusIn", GrowRadiusIn), AnimateExecutor.registerBuiltInAnimate("growRadiusOut", GrowRadiusOut), AnimateExecutor.registerBuiltInAnimate("moveIn", MoveIn), AnimateExecutor.registerBuiltInAnimate("moveOut", MoveOut), AnimateExecutor.registerBuiltInAnimate("rotateIn", RotateIn), AnimateExecutor.registerBuiltInAnimate("rotateOut", RotateOut), AnimateExecutor.registerBuiltInAnimate("update", Update), AnimateExecutor.registerBuiltInAnimate("state", State), AnimateExecutor.registerBuiltInAnimate("labelItemAppear", LabelItemAppear), AnimateExecutor.registerBuiltInAnimate("labelItemDisappear", LabelItemDisappear), AnimateExecutor.registerBuiltInAnimate("poptipAppear", PoptipAppear), AnimateExecutor.registerBuiltInAnimate("poptipDisappear", PoptipDisappear), AnimateExecutor.registerBuiltInAnimate("inputText", InputText), AnimateExecutor.registerBuiltInAnimate("inputRichText", InputRichText), AnimateExecutor.registerBuiltInAnimate("outputRichText", OutputRichText), AnimateExecutor.registerBuiltInAnimate("slideRichText", SlideRichText), AnimateExecutor.registerBuiltInAnimate("slideOutRichText", SlideOutRichText), AnimateExecutor.registerBuiltInAnimate("slideIn", SlideIn), AnimateExecutor.registerBuiltInAnimate("growIn", GrowIn), AnimateExecutor.registerBuiltInAnimate("spinIn", SpinIn), AnimateExecutor.registerBuiltInAnimate("moveScaleIn", MoveScaleIn), AnimateExecutor.registerBuiltInAnimate("moveRotateIn", MoveRotateIn), AnimateExecutor.registerBuiltInAnimate("strokeIn", StrokeIn), AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut), AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut), AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut), AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut), AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut), AnimateExecutor.registerBuiltInAnimate("strokeOut", StrokeOut), AnimateExecutor.registerBuiltInAnimate("pulse", PulseAnimate), AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath), AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight);
|
|
37573
36248
|
};
|
|
37574
36249
|
|
|
37575
36250
|
class AxisEnter extends AComponentAnimate {
|
|
@@ -40604,22 +39279,19 @@ class LabelBase extends AnimateComponent {
|
|
|
40604
39279
|
const {
|
|
40605
39280
|
clampForce = !0,
|
|
40606
39281
|
hideOnHit = !0,
|
|
40607
|
-
hideOnOverflow = !1,
|
|
40608
39282
|
overlapPadding: overlapPadding,
|
|
40609
39283
|
strategy: strategy
|
|
40610
39284
|
} = option;
|
|
40611
|
-
if (clampForce
|
|
39285
|
+
if (clampForce) for (let i = 0; i < result.length; i++) {
|
|
40612
39286
|
const text = labels[i],
|
|
40613
39287
|
{
|
|
40614
39288
|
dx = 0,
|
|
40615
39289
|
dy = 0
|
|
40616
39290
|
} = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
|
|
40617
|
-
0 === dx && 0 === dy || (
|
|
40618
|
-
visible: !1
|
|
40619
|
-
}) : (text.setAttributes({
|
|
39291
|
+
0 === dx && 0 === dy || (text.setAttributes({
|
|
40620
39292
|
x: text.attribute.x + dx,
|
|
40621
39293
|
y: text.attribute.y + dy
|
|
40622
|
-
}), text._isClamped = !0)
|
|
39294
|
+
}), text._isClamped = !0);
|
|
40623
39295
|
}
|
|
40624
39296
|
result = shiftY(result, Object.assign(Object.assign({
|
|
40625
39297
|
maxY: bmpTool.height
|
|
@@ -40635,9 +39307,9 @@ class LabelBase extends AnimateComponent {
|
|
|
40635
39307
|
bounds = text.AABBBounds,
|
|
40636
39308
|
range = boundToRange(bmpTool, bounds, !0);
|
|
40637
39309
|
if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) bitmap.setRange(range);else {
|
|
40638
|
-
if (
|
|
40639
|
-
if (this.
|
|
40640
|
-
}
|
|
39310
|
+
if (clampForce) {
|
|
39311
|
+
if (this._processClampForce(text, bmpTool, bitmap, overlapPadding)) continue;
|
|
39312
|
+
}
|
|
40641
39313
|
hideOnHit ? text.setAttributes({
|
|
40642
39314
|
visible: !1
|
|
40643
39315
|
}) : bitmap.setRange(range);
|
|
@@ -40645,15 +39317,6 @@ class LabelBase extends AnimateComponent {
|
|
|
40645
39317
|
}
|
|
40646
39318
|
return result;
|
|
40647
39319
|
}
|
|
40648
|
-
_processHideOnOverflow(text, bmpTool) {
|
|
40649
|
-
const {
|
|
40650
|
-
dy = 0,
|
|
40651
|
-
dx = 0
|
|
40652
|
-
} = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
|
|
40653
|
-
return 0 === dx && 0 === dy || (text.setAttributes({
|
|
40654
|
-
visible: !1
|
|
40655
|
-
}), !1);
|
|
40656
|
-
}
|
|
40657
39320
|
_processClampForce(text, bmpTool, bitmap, overlapPadding = 0) {
|
|
40658
39321
|
const {
|
|
40659
39322
|
dy = 0,
|
|
@@ -40680,8 +39343,7 @@ class LabelBase extends AnimateComponent {
|
|
|
40680
39343
|
hideOnHit = !0,
|
|
40681
39344
|
clampForce = !0,
|
|
40682
39345
|
avoidMarks = [],
|
|
40683
|
-
overlapPadding: overlapPadding
|
|
40684
|
-
hideOnOverflow = !1
|
|
39346
|
+
overlapPadding: overlapPadding
|
|
40685
39347
|
} = option,
|
|
40686
39348
|
result = [],
|
|
40687
39349
|
checkBounds = strategy.some(s => "bound" === s.type);
|
|
@@ -40708,16 +39370,15 @@ class LabelBase extends AnimateComponent {
|
|
|
40708
39370
|
}
|
|
40709
39371
|
}
|
|
40710
39372
|
let hasPlace = !1;
|
|
40711
|
-
for (let j = 0; j < strategy.length; j++) if (hasPlace = place$2(bmpTool, bitmap, strategy[j], this.attribute, text, this._isCollectionBase ? this.getGraphicBounds(null, this._idToPoint.get(labels[i].attribute.id)) : this.getGraphicBounds(baseMark, labels[i].attribute), this.labeling), !1 !== hasPlace
|
|
40712
|
-
|
|
40713
|
-
|
|
40714
|
-
|
|
40715
|
-
result.push(text);
|
|
39373
|
+
for (let j = 0; j < strategy.length; j++) if (hasPlace = place$2(bmpTool, bitmap, strategy[j], this.attribute, text, this._isCollectionBase ? this.getGraphicBounds(null, this._idToPoint.get(labels[i].attribute.id)) : this.getGraphicBounds(baseMark, labels[i].attribute), this.labeling), !1 !== hasPlace) {
|
|
39374
|
+
text.setAttributes({
|
|
39375
|
+
x: hasPlace.x,
|
|
39376
|
+
y: hasPlace.y
|
|
39377
|
+
}), result.push(text);
|
|
40716
39378
|
break;
|
|
40717
39379
|
}
|
|
40718
|
-
if (!hasPlace) {
|
|
40719
|
-
if (
|
|
40720
|
-
if (clampForce && this._processClampForce(text, bmpTool, bitmap, overlapPadding)) {
|
|
39380
|
+
if (!hasPlace && clampForce) {
|
|
39381
|
+
if (this._processClampForce(text, bmpTool, bitmap, overlapPadding)) {
|
|
40721
39382
|
result.push(text);
|
|
40722
39383
|
continue;
|
|
40723
39384
|
}
|
|
@@ -49538,9 +48199,6 @@ class Factory {
|
|
|
49538
48199
|
static registerChartPlugin(key, plugin) {
|
|
49539
48200
|
Factory._chartPlugin[key] = plugin;
|
|
49540
48201
|
}
|
|
49541
|
-
static registerVChartPlugin(key, plugin) {
|
|
49542
|
-
Factory._vChartPlugin[key] = plugin;
|
|
49543
|
-
}
|
|
49544
48202
|
static registerComponentPlugin(key, plugin) {
|
|
49545
48203
|
Factory._componentPlugin[key] = plugin;
|
|
49546
48204
|
}
|
|
@@ -49657,9 +48315,6 @@ class Factory {
|
|
|
49657
48315
|
static getChartPlugins() {
|
|
49658
48316
|
return Object.values(Factory._chartPlugin);
|
|
49659
48317
|
}
|
|
49660
|
-
static getVChartPlugins() {
|
|
49661
|
-
return Object.values(Factory._vChartPlugin);
|
|
49662
|
-
}
|
|
49663
48318
|
static getComponentPlugins() {
|
|
49664
48319
|
return Object.values(Factory._componentPlugin);
|
|
49665
48320
|
}
|
|
@@ -49695,7 +48350,6 @@ Factory._regions = {};
|
|
|
49695
48350
|
Factory._animations = {};
|
|
49696
48351
|
Factory._implements = {};
|
|
49697
48352
|
Factory._chartPlugin = {};
|
|
49698
|
-
Factory._vChartPlugin = {};
|
|
49699
48353
|
Factory._componentPlugin = {};
|
|
49700
48354
|
Factory.transforms = {
|
|
49701
48355
|
fields: fields,
|
|
@@ -50497,7 +49151,7 @@ function transformIndicatorStyle(style, datum) {
|
|
|
50497
49151
|
}
|
|
50498
49152
|
function transformToGraphic(style) {
|
|
50499
49153
|
if (style === null || style === void 0 ? void 0 : style.angle) {
|
|
50500
|
-
|
|
49154
|
+
style.angle = degreeToRadian(style.angle);
|
|
50501
49155
|
}
|
|
50502
49156
|
return style;
|
|
50503
49157
|
}
|
|
@@ -50772,7 +49426,6 @@ var ChartEvent;
|
|
|
50772
49426
|
ChartEvent["afterRender"] = "afterRender";
|
|
50773
49427
|
ChartEvent["afterLayout"] = "afterLayout";
|
|
50774
49428
|
ChartEvent["afterMarkLayoutEnd"] = "afterMarkLayoutEnd";
|
|
50775
|
-
ChartEvent["afterWordcloudShapeDraw"] = "afterWordcloudShapeDraw";
|
|
50776
49429
|
})(ChartEvent || (ChartEvent = {}));
|
|
50777
49430
|
var Event_Source_Type;
|
|
50778
49431
|
(function (Event_Source_Type) {
|
|
@@ -51064,13 +49717,21 @@ class EventDispatcher {
|
|
|
51064
49717
|
}
|
|
51065
49718
|
return true;
|
|
51066
49719
|
}
|
|
49720
|
+
_prepareParams(filter, params) {
|
|
49721
|
+
var _a, _b, _c;
|
|
49722
|
+
if (filter.markName && params.mark) {
|
|
49723
|
+
const markGraphic = (_c = (_b = (_a = params.mark).getGraphics) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c[0];
|
|
49724
|
+
return Object.assign(Object.assign({}, params), { item: markGraphic, datum: getDatumOfGraphic(markGraphic) });
|
|
49725
|
+
}
|
|
49726
|
+
return Object.assign({}, params);
|
|
49727
|
+
}
|
|
51067
49728
|
_invoke(handlers, type, params) {
|
|
51068
49729
|
const result = handlers.map(handler => {
|
|
51069
49730
|
var _a, _b, _c;
|
|
51070
49731
|
const filter = handler.filter;
|
|
51071
49732
|
if (!handler.prevented && (!handler.query || this._filter(filter, type, params))) {
|
|
51072
49733
|
const callback = handler.wrappedCallback || handler.callback;
|
|
51073
|
-
const stopBubble = callback.call(null,
|
|
49734
|
+
const stopBubble = callback.call(null, this._prepareParams(filter, params));
|
|
51074
49735
|
const doStopBubble = stopBubble !== null && stopBubble !== void 0 ? stopBubble : (_a = handler.query) === null || _a === void 0 ? void 0 : _a.consume;
|
|
51075
49736
|
if (doStopBubble) {
|
|
51076
49737
|
(_b = params.event) === null || _b === void 0 ? void 0 : _b.stopPropagation();
|
|
@@ -51600,7 +50261,7 @@ class Compiler {
|
|
|
51600
50261
|
(_b = (_a = this._compileChart) === null || _a === void 0 ? void 0 : _a.getEvent()) === null || _b === void 0 ? void 0 : _b.emit(ChartEvent.afterRender, { chart: this._compileChart });
|
|
51601
50262
|
};
|
|
51602
50263
|
this._handleAfterNextRender = () => {
|
|
51603
|
-
var _a, _b
|
|
50264
|
+
var _a, _b;
|
|
51604
50265
|
if (this._stage && !this._option.disableDirtyBounds) {
|
|
51605
50266
|
this._stage.enableDirtyBounds();
|
|
51606
50267
|
}
|
|
@@ -51610,7 +50271,6 @@ class Compiler {
|
|
|
51610
50271
|
vchart: (_b = this._compileChart.getOption()) === null || _b === void 0 ? void 0 : _b.globalInstance
|
|
51611
50272
|
});
|
|
51612
50273
|
}
|
|
51613
|
-
(_d = (_c = this._option.performanceHook) === null || _c === void 0 ? void 0 : _c.afterVRenderDraw) === null || _d === void 0 ? void 0 : _d.call(_c, this._compileChart.getOption().globalInstance);
|
|
51614
50274
|
};
|
|
51615
50275
|
this.handleProgressiveFrame = () => {
|
|
51616
50276
|
if (this._progressiveMarks.length) {
|
|
@@ -51760,7 +50420,6 @@ class Compiler {
|
|
|
51760
50420
|
});
|
|
51761
50421
|
}
|
|
51762
50422
|
_doRender(immediately) {
|
|
51763
|
-
var _a, _b, _c, _d;
|
|
51764
50423
|
if (this._stage) {
|
|
51765
50424
|
this._rootMarks.forEach(g => {
|
|
51766
50425
|
traverseGroupMark(g, m => {
|
|
@@ -51773,12 +50432,10 @@ class Compiler {
|
|
|
51773
50432
|
}
|
|
51774
50433
|
}, null, true);
|
|
51775
50434
|
});
|
|
51776
|
-
(_b = (_a = this._option.performanceHook) === null || _a === void 0 ? void 0 : _a.beforeVRenderDraw) === null || _b === void 0 ? void 0 : _b.call(_a, this._compileChart.getOption().globalInstance);
|
|
51777
50435
|
this._stage.disableDirtyBounds();
|
|
51778
50436
|
this._stage.afterNextRender(this._handleAfterNextRender);
|
|
51779
50437
|
if (immediately) {
|
|
51780
50438
|
this._stage.render();
|
|
51781
|
-
(_d = (_c = this._option.performanceHook) === null || _c === void 0 ? void 0 : _c.afterVRenderDraw) === null || _d === void 0 ? void 0 : _d.call(_c, this._compileChart.getOption().globalInstance);
|
|
51782
50439
|
}
|
|
51783
50440
|
}
|
|
51784
50441
|
}
|
|
@@ -56847,22 +55504,6 @@ const registerElementSelect = () => {
|
|
|
56847
55504
|
Factory.registerInteractionTrigger(ElementSelect.type, ElementSelect);
|
|
56848
55505
|
};
|
|
56849
55506
|
|
|
56850
|
-
class VChartPluginService extends BasePluginService {
|
|
56851
|
-
constructor(globalInstance) {
|
|
56852
|
-
super();
|
|
56853
|
-
this.globalInstance = globalInstance;
|
|
56854
|
-
}
|
|
56855
|
-
onInit() {
|
|
56856
|
-
this._plugins.forEach(plugin => {
|
|
56857
|
-
plugin.onInit && plugin.onInit(this);
|
|
56858
|
-
});
|
|
56859
|
-
}
|
|
56860
|
-
releaseAll() {
|
|
56861
|
-
super.releaseAll();
|
|
56862
|
-
this.globalInstance = null;
|
|
56863
|
-
}
|
|
56864
|
-
}
|
|
56865
|
-
|
|
56866
55507
|
class VChart {
|
|
56867
55508
|
static useRegisters(comps) {
|
|
56868
55509
|
comps.forEach((fn) => {
|
|
@@ -56944,9 +55585,6 @@ class VChart {
|
|
|
56944
55585
|
getSpecInfo() {
|
|
56945
55586
|
return this._specInfo;
|
|
56946
55587
|
}
|
|
56947
|
-
get event() {
|
|
56948
|
-
return this._event;
|
|
56949
|
-
}
|
|
56950
55588
|
getDataSet() {
|
|
56951
55589
|
return this._dataSet;
|
|
56952
55590
|
}
|
|
@@ -58151,12 +56789,6 @@ class VChart {
|
|
|
58151
56789
|
this._chartPlugin.load(pluginList.map(p => new p()));
|
|
58152
56790
|
this._chartPluginApply('onInit', this._spec);
|
|
58153
56791
|
}
|
|
58154
|
-
const vChartPluginList = Factory.getVChartPlugins();
|
|
58155
|
-
if (vChartPluginList.length > 0) {
|
|
58156
|
-
this._vChartPlugin = new VChartPluginService(this);
|
|
58157
|
-
this._vChartPlugin.load(vChartPluginList.map(p => new p()));
|
|
58158
|
-
this._vChartPlugin.onInit();
|
|
58159
|
-
}
|
|
58160
56792
|
}
|
|
58161
56793
|
_chartPluginApply(funcName, ...args) {
|
|
58162
56794
|
if (!this._chartPlugin || !this._chartPlugin[funcName]) {
|
|
@@ -58309,7 +56941,7 @@ const lookup = (data, opt) => {
|
|
|
58309
56941
|
});
|
|
58310
56942
|
};
|
|
58311
56943
|
|
|
58312
|
-
const version = "2.0.4-alpha.
|
|
56944
|
+
const version = "2.0.4-alpha.8";
|
|
58313
56945
|
|
|
58314
56946
|
const addVChartProperty = (data, op) => {
|
|
58315
56947
|
const context = op.beforeCall();
|
|
@@ -66243,7 +64875,7 @@ class BaseChart extends CompilableBase {
|
|
|
66243
64875
|
this._event = new Event$1(option.eventDispatcher, option.mode);
|
|
66244
64876
|
this._dataSet = option.dataSet;
|
|
66245
64877
|
this._chartData = new ChartData(this._dataSet);
|
|
66246
|
-
this._modelOption = Object.assign(Object.assign({}, option), { mode: this._option.mode, map: this._idMap, getChartLayoutRect: () => this._layoutRect, getChartViewRect: () => this._viewRect, getChart: () => this, globalScale: this._globalScale, onError: (_b = this._option) === null || _b === void 0 ? void 0 : _b.onError, disableTriggerEvent: ((_c = this._option) === null || _c === void 0 ? void 0 : _c.disableTriggerEvent) === true, getSeriesData: this._chartData.getSeriesData.bind(this._chartData)
|
|
64878
|
+
this._modelOption = Object.assign(Object.assign({}, option), { mode: this._option.mode, map: this._idMap, getChartLayoutRect: () => this._layoutRect, getChartViewRect: () => this._viewRect, getChart: () => this, globalScale: this._globalScale, onError: (_b = this._option) === null || _b === void 0 ? void 0 : _b.onError, disableTriggerEvent: ((_c = this._option) === null || _c === void 0 ? void 0 : _c.disableTriggerEvent) === true, getSeriesData: this._chartData.getSeriesData.bind(this._chartData) });
|
|
66247
64879
|
if (this._setModelOption) {
|
|
66248
64880
|
this._setModelOption();
|
|
66249
64881
|
}
|
|
@@ -77860,26 +76492,6 @@ class BaseWordCloudSeries extends BaseSeries {
|
|
|
77860
76492
|
isNil$1(this._maskShape.fontFamily)
|
|
77861
76493
|
? Object.assign({ fontFamily: this._option.getTheme('fontFamily') }, this._maskShape) : this._maskShape,
|
|
77862
76494
|
onUpdateMaskCanvas: this.handleMaskCanvasUpdate,
|
|
77863
|
-
onLayoutFinished: () => {
|
|
77864
|
-
const afterWordcloudShapeDraw = () => {
|
|
77865
|
-
var _a, _b, _c, _d;
|
|
77866
|
-
this._option.globalInstance.getStage().hooks.afterRender.taps = this._option.globalInstance
|
|
77867
|
-
.getStage()
|
|
77868
|
-
.hooks.afterRender.taps.filter(tap => tap.fn !== afterWordcloudShapeDraw);
|
|
77869
|
-
(_b = (_a = this._option).dispatchEvent) === null || _b === void 0 ? void 0 : _b.call(_a, ChartEvent.afterWordcloudShapeDraw, {
|
|
77870
|
-
instance: this._option.globalInstance
|
|
77871
|
-
});
|
|
77872
|
-
(_d = (_c = this._option.globalInstance
|
|
77873
|
-
.getChart()
|
|
77874
|
-
.getOption()
|
|
77875
|
-
.performanceHook) === null || _c === void 0 ? void 0 : _c.afterWordcloudShapeDraw) === null || _d === void 0 ? void 0 : _d.call(_c, this._option.globalInstance);
|
|
77876
|
-
};
|
|
77877
|
-
this._option.globalInstance.getStage().hooks.afterRender.taps.push({
|
|
77878
|
-
type: 'sync',
|
|
77879
|
-
name: 'afterWordcloudShapeDraw',
|
|
77880
|
-
fn: afterWordcloudShapeDraw
|
|
77881
|
-
});
|
|
77882
|
-
},
|
|
77883
76495
|
dataIndexKey: DEFAULT_DATA_KEY,
|
|
77884
76496
|
text: wordSpec.formatMethod
|
|
77885
76497
|
? (datum) => {
|
|
@@ -85631,7 +84243,7 @@ class TreemapSeries extends CartesianSeries {
|
|
|
85631
84243
|
});
|
|
85632
84244
|
[this._labelMark, this._nonLeafLabelMark].forEach(m => {
|
|
85633
84245
|
if (m && m.getComponent()) {
|
|
85634
|
-
m.getComponent().getProduct().enableAnimation();
|
|
84246
|
+
m.getComponent().getProduct().getGroupGraphicItem().enableAnimation();
|
|
85635
84247
|
}
|
|
85636
84248
|
});
|
|
85637
84249
|
this.event.off(HOOK_EVENT.AFTER_DO_RENDER, this._enableAnimationHook);
|
|
@@ -85641,7 +84253,7 @@ class TreemapSeries extends CartesianSeries {
|
|
|
85641
84253
|
});
|
|
85642
84254
|
[this._labelMark, this._nonLeafLabelMark].forEach(m => {
|
|
85643
84255
|
if (m && m.getComponent()) {
|
|
85644
|
-
m.getComponent().getProduct().disableAnimation();
|
|
84256
|
+
m.getComponent().getProduct().getGroupGraphicItem().disableAnimation();
|
|
85645
84257
|
}
|
|
85646
84258
|
});
|
|
85647
84259
|
}
|
|
@@ -89577,8 +88189,6 @@ class RangeAreaChartSpecTransformer extends CartesianChartSpecTransformer {
|
|
|
89577
88189
|
var _a, _b;
|
|
89578
88190
|
const series = super._getDefaultSeriesSpec(spec);
|
|
89579
88191
|
series.area = spec.area;
|
|
89580
|
-
series.point = spec.point;
|
|
89581
|
-
series.line = spec.line;
|
|
89582
88192
|
if (spec.direction === "horizontal") {
|
|
89583
88193
|
series.xField = (_a = spec.xField) !== null && _a !== void 0 ? _a : [spec.minField, spec.maxField];
|
|
89584
88194
|
}
|
|
@@ -93034,19 +91644,16 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
93034
91644
|
return active && hasChange;
|
|
93035
91645
|
};
|
|
93036
91646
|
this._handleChartDrag = (delta, e) => {
|
|
93037
|
-
var _a
|
|
91647
|
+
var _a;
|
|
93038
91648
|
if (!this._activeRoam || (this._dragAttr.filter && !this._dragAttr.filter(delta, e))) {
|
|
93039
91649
|
return;
|
|
93040
91650
|
}
|
|
93041
|
-
if ((_a = this._spec.roamDrag) === null || _a === void 0 ? void 0 : _a.autoVisible) {
|
|
93042
|
-
this.show();
|
|
93043
|
-
}
|
|
93044
91651
|
const [dx, dy] = delta;
|
|
93045
91652
|
let value = this._isHorizontal ? dx : dy;
|
|
93046
91653
|
if (this._dragAttr.reverse) {
|
|
93047
91654
|
value = -value;
|
|
93048
91655
|
}
|
|
93049
|
-
this._handleChartMove(value, (
|
|
91656
|
+
this._handleChartMove(value, (_a = this._dragAttr.rate) !== null && _a !== void 0 ? _a : 1);
|
|
93050
91657
|
};
|
|
93051
91658
|
this._handleChartMove = (value, rate) => {
|
|
93052
91659
|
const totalValue = this._isHorizontal ? this.getLayoutRect().width : this.getLayoutRect().height;
|
|
@@ -93451,9 +92058,9 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
93451
92058
|
return allDomain.slice(Math.min(startIndex, endIndex), Math.max(startIndex, endIndex) + 1);
|
|
93452
92059
|
}
|
|
93453
92060
|
_initCommonEvent() {
|
|
93454
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
92061
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
93455
92062
|
const delayType = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.delayType) !== null && _b !== void 0 ? _b : 'throttle';
|
|
93456
|
-
const delayTime = isValid$1((_c = this._spec) === null || _c === void 0 ? void 0 : _c.delayType) ? (
|
|
92063
|
+
const delayTime = isValid$1((_c = this._spec) === null || _c === void 0 ? void 0 : _c.delayType) ? (_e = (_d = this._spec) === null || _d === void 0 ? void 0 : _d.delayTime) !== null && _e !== void 0 ? _e : 30 : 0;
|
|
93457
92064
|
const realTime = (_g = (_f = this._spec) === null || _f === void 0 ? void 0 : _f.realTime) !== null && _g !== void 0 ? _g : true;
|
|
93458
92065
|
const option = { delayType, delayTime, realTime, allowComponentZoom: true };
|
|
93459
92066
|
if (this._zoomAttr.enable) {
|
|
@@ -93465,13 +92072,6 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
93465
92072
|
if (this._dragAttr.enable) {
|
|
93466
92073
|
this.initDragEventOfRegions(this._regions, null, this._handleChartDrag, option);
|
|
93467
92074
|
}
|
|
93468
|
-
if ((_h = this._spec.roamDrag) === null || _h === void 0 ? void 0 : _h.autoVisible) {
|
|
93469
|
-
const dragEnd = 'panend';
|
|
93470
|
-
this._throttledHide = throttle(() => this.hide(), 300);
|
|
93471
|
-
this.event.on(dragEnd, () => {
|
|
93472
|
-
this._throttledHide();
|
|
93473
|
-
});
|
|
93474
|
-
}
|
|
93475
92075
|
}
|
|
93476
92076
|
updateLayoutAttribute() {
|
|
93477
92077
|
if (this._visible) {
|
|
@@ -93592,9 +92192,6 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
93592
92192
|
_getNeedClearVRenderComponents() {
|
|
93593
92193
|
return [this._component];
|
|
93594
92194
|
}
|
|
93595
|
-
clear() {
|
|
93596
|
-
this._throttledHide = null;
|
|
93597
|
-
}
|
|
93598
92195
|
}
|
|
93599
92196
|
mixin(DataFilterBaseComponent, Zoomable);
|
|
93600
92197
|
|
|
@@ -97672,7 +96269,7 @@ class CartesianMarkPoint extends BaseMarkPoint {
|
|
|
97672
96269
|
this.coordinateType = 'cartesian';
|
|
97673
96270
|
}
|
|
97674
96271
|
_computePointsAttr() {
|
|
97675
|
-
var _a
|
|
96272
|
+
var _a;
|
|
97676
96273
|
const spec = this._spec;
|
|
97677
96274
|
const data = this._markerData;
|
|
97678
96275
|
const relativeSeries = this._relativeSeries;
|
|
@@ -97682,7 +96279,7 @@ class CartesianMarkPoint extends BaseMarkPoint {
|
|
|
97682
96279
|
const autoRange = (_a = spec === null || spec === void 0 ? void 0 : spec.autoRange) !== null && _a !== void 0 ? _a : false;
|
|
97683
96280
|
let point;
|
|
97684
96281
|
if (isXYLayout) {
|
|
97685
|
-
point =
|
|
96282
|
+
point = xyLayout(data, relativeSeries, relativeSeries, relativeSeries, autoRange)[0][0];
|
|
97686
96283
|
}
|
|
97687
96284
|
else if (isCoordinateLayout) {
|
|
97688
96285
|
point = cartesianCoordinateLayout(data, relativeSeries, autoRange, spec.coordinatesOffset)[0];
|
|
@@ -98524,13 +97121,14 @@ class CustomMark extends BaseComponent {
|
|
|
98524
97121
|
getVRenderComponents() {
|
|
98525
97122
|
const comps = [];
|
|
98526
97123
|
const checkFunc = (m) => {
|
|
97124
|
+
var _a;
|
|
98527
97125
|
if (m && m.type === "group") {
|
|
98528
97126
|
m.getMarks().forEach(child => {
|
|
98529
97127
|
checkFunc(child);
|
|
98530
97128
|
});
|
|
98531
97129
|
}
|
|
98532
97130
|
else if (m.type === "component") {
|
|
98533
|
-
const comp = m === null || m === void 0 ? void 0 : m.
|
|
97131
|
+
const comp = (_a = m === null || m === void 0 ? void 0 : m.getProduct()) === null || _a === void 0 ? void 0 : _a.getGroupGraphicItem();
|
|
98534
97132
|
if (comp) {
|
|
98535
97133
|
comps.push(comp);
|
|
98536
97134
|
}
|
|
@@ -99535,7 +98133,7 @@ class DomTooltipHandler extends BaseTooltipHandler {
|
|
|
99535
98133
|
this._container = null;
|
|
99536
98134
|
}
|
|
99537
98135
|
_updateTooltip(visible, params) {
|
|
99538
|
-
var _a, _b;
|
|
98136
|
+
var _a, _b, _c;
|
|
99539
98137
|
if (!visible || !this._rootDom) {
|
|
99540
98138
|
this.setVisibility(visible);
|
|
99541
98139
|
this._cacheCustomTooltipPosition = undefined;
|
|
@@ -99545,26 +98143,29 @@ class DomTooltipHandler extends BaseTooltipHandler {
|
|
|
99545
98143
|
if (!params.changePositionOnly) {
|
|
99546
98144
|
this._tooltipActual = activeTooltipSpec;
|
|
99547
98145
|
}
|
|
98146
|
+
const currentVisible = this.getVisibility();
|
|
99548
98147
|
const el = this._rootDom;
|
|
99549
98148
|
if (el) {
|
|
99550
98149
|
const { x = 0, y = 0 } = (_a = activeTooltipSpec.position) !== null && _a !== void 0 ? _a : {};
|
|
99551
|
-
let position = { x, y };
|
|
99552
|
-
const currentVisible = this.getVisibility();
|
|
99553
98150
|
if (tooltipSpec.updateElement) {
|
|
99554
98151
|
this._updatePosition((_b = this._cacheCustomTooltipPosition) !== null && _b !== void 0 ? _b : { x, y });
|
|
99555
98152
|
tooltipSpec.updateElement(el, activeTooltipSpec, params);
|
|
99556
|
-
position = this._getActualTooltipPosition(activeTooltipSpec, params, {
|
|
98153
|
+
const position = this._getActualTooltipPosition(activeTooltipSpec, params, {
|
|
99557
98154
|
width: el.offsetWidth,
|
|
99558
98155
|
height: el.offsetHeight
|
|
99559
98156
|
});
|
|
98157
|
+
this._updatePosition(position);
|
|
99560
98158
|
this._cacheCustomTooltipPosition = position;
|
|
99561
98159
|
}
|
|
99562
|
-
|
|
99563
|
-
|
|
99564
|
-
|
|
99565
|
-
|
|
98160
|
+
else {
|
|
98161
|
+
if (!currentVisible) {
|
|
98162
|
+
this._rootDom.style.transitionDuration = '0ms';
|
|
98163
|
+
}
|
|
98164
|
+
else {
|
|
98165
|
+
this._rootDom.style.transitionDuration = (_c = this._domStyle.panel.transitionDuration) !== null && _c !== void 0 ? _c : 'initial';
|
|
98166
|
+
}
|
|
98167
|
+
this._updatePosition({ x, y });
|
|
99566
98168
|
}
|
|
99567
|
-
this._updatePosition(position);
|
|
99568
98169
|
}
|
|
99569
98170
|
this.setVisibility(visible);
|
|
99570
98171
|
}
|
|
@@ -99742,13 +98343,9 @@ class DomTooltipHandler extends BaseTooltipHandler {
|
|
|
99742
98343
|
this._updateDomStyle('height', false);
|
|
99743
98344
|
}
|
|
99744
98345
|
}
|
|
99745
|
-
_updatePosition({ x, y }
|
|
98346
|
+
_updatePosition({ x, y }) {
|
|
99746
98347
|
if (this._rootDom) {
|
|
99747
98348
|
this._rootDom.style.transform = `translate3d(${x}px, ${y}px, 0)`;
|
|
99748
|
-
if (resetTransition && this._rootDom.style.transition !== '') {
|
|
99749
|
-
this._rootDom.style.transition = '';
|
|
99750
|
-
Object.assign(this._rootDom.style, this._domStyle.panel);
|
|
99751
|
-
}
|
|
99752
98349
|
}
|
|
99753
98350
|
}
|
|
99754
98351
|
}
|