@visactor/vrender 1.0.12 → 1.0.13-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -35149,11 +35149,1279 @@
35149
35149
  }
35150
35150
  }
35151
35151
 
35152
+ class DisappearAnimateBase extends AStageAnimate {
35153
+ constructor(from, to, duration, easing, params) {
35154
+ super(from, to, duration, easing, params), this.webglCanvas = null, this.gl = null, this.program = null, this.currentAnimationRatio = 0, this.animationTime = 0;
35155
+ }
35156
+ onUpdate(end, ratio, out) {
35157
+ super.onUpdate(end, ratio, out), this.currentAnimationRatio = ratio, this.animationTime = ratio * Math.PI * 2;
35158
+ }
35159
+ getAnimationTime() {
35160
+ return this.currentAnimationRatio > 0 ? this.animationTime : Date.now() / 1e3;
35161
+ }
35162
+ getDurationFromParent() {
35163
+ return this.duration || 1e3;
35164
+ }
35165
+ initWebGL(canvas) {
35166
+ try {
35167
+ if (this.webglCanvas = vglobal.createCanvas({
35168
+ width: canvas.width,
35169
+ height: canvas.height,
35170
+ dpr: vglobal.devicePixelRatio
35171
+ }), !this.webglCanvas) return console.warn("WebGL canvas creation failed"), !1;
35172
+ this.webglCanvas.style.width = canvas.style.width || `${canvas.width}px`, this.webglCanvas.style.height = canvas.style.height || `${canvas.height}px`;
35173
+ let glContext = null;
35174
+ try {
35175
+ glContext = this.webglCanvas.getContext("webgl"), glContext || (glContext = this.webglCanvas.getContext("experimental-webgl"));
35176
+ } catch (e) {
35177
+ console.warn("Failed to get WebGL context:", e);
35178
+ }
35179
+ if (this.gl = glContext, !this.gl) return console.warn("WebGL not supported"), !1;
35180
+ const shaders = this.getShaderSources();
35181
+ return this.program = this.createShaderProgram(shaders.vertex, shaders.fragment), null !== this.program;
35182
+ } catch (error) {
35183
+ return console.warn("Failed to initialize WebGL:", error), !1;
35184
+ }
35185
+ }
35186
+ createShaderProgram(vertexSource, fragmentSource) {
35187
+ if (!this.gl) return null;
35188
+ const vertexShader = this.createShader(this.gl.VERTEX_SHADER, vertexSource),
35189
+ fragmentShader = this.createShader(this.gl.FRAGMENT_SHADER, fragmentSource);
35190
+ if (!vertexShader || !fragmentShader) return null;
35191
+ const program = this.gl.createProgram();
35192
+ 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;
35193
+ }
35194
+ createShader(type, source) {
35195
+ if (!this.gl) return null;
35196
+ const shader = this.gl.createShader(type);
35197
+ 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;
35198
+ }
35199
+ setupWebGLState(canvas) {
35200
+ 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));
35201
+ }
35202
+ createFullScreenQuad() {
35203
+ if (!this.gl) return null;
35204
+ const vertices = new Float32Array([-1, -1, 0, 1, 1, -1, 1, 1, -1, 1, 0, 0, 1, 1, 1, 0]),
35205
+ vertexBuffer = this.gl.createBuffer();
35206
+ return this.gl.bindBuffer(this.gl.ARRAY_BUFFER, vertexBuffer), this.gl.bufferData(this.gl.ARRAY_BUFFER, vertices, this.gl.STATIC_DRAW), vertexBuffer;
35207
+ }
35208
+ createTextureFromCanvas(canvas) {
35209
+ if (!this.gl) return null;
35210
+ const texture = this.gl.createTexture();
35211
+ 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;
35212
+ }
35213
+ setupVertexAttributes() {
35214
+ if (!this.gl || !this.program) return;
35215
+ const positionLocation = this.gl.getAttribLocation(this.program, "a_position"),
35216
+ texCoordLocation = this.gl.getAttribLocation(this.program, "a_texCoord");
35217
+ 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);
35218
+ }
35219
+ createOutputCanvas(canvas) {
35220
+ const outputCanvas = vglobal.createCanvas({
35221
+ width: canvas.width,
35222
+ height: canvas.height,
35223
+ dpr: vglobal.devicePixelRatio
35224
+ }),
35225
+ ctx = outputCanvas.getContext("2d");
35226
+ return ctx ? (ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.drawImage(canvas, 0, 0), {
35227
+ canvas: outputCanvas,
35228
+ ctx: ctx
35229
+ }) : null;
35230
+ }
35231
+ getShaderSources() {
35232
+ return null;
35233
+ }
35234
+ applyWebGLEffect(canvas) {
35235
+ return null;
35236
+ }
35237
+ applyCanvas2DEffect(canvas) {
35238
+ return null;
35239
+ }
35240
+ supportsWebGL() {
35241
+ return null !== this.getShaderSources();
35242
+ }
35243
+ supportsCanvas2D() {
35244
+ return this.applyCanvas2DEffect !== DisappearAnimateBase.prototype.applyCanvas2DEffect;
35245
+ }
35246
+ release() {
35247
+ 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;
35248
+ }
35249
+ afterStageRender(stage, canvas) {
35250
+ let result = null;
35251
+ if (this.supportsWebGL() && (this.gl || this.initWebGL(canvas) || console.warn("WebGL初始化失败,尝试Canvas 2D回退"), this.gl)) {
35252
+ if (result = this.applyWebGLEffect(canvas), result) return result;
35253
+ console.warn("WebGL特效执行失败,尝试Canvas 2D回退");
35254
+ }
35255
+ if (this.supportsCanvas2D()) {
35256
+ if (result = this.applyCanvas2DEffect(canvas), result) return result;
35257
+ console.warn("Canvas 2D特效执行失败");
35258
+ }
35259
+ return this.supportsWebGL() || this.supportsCanvas2D() || console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`), canvas;
35260
+ }
35261
+ }
35262
+
35263
+ class Canvas2DEffectBase extends DisappearAnimateBase {
35264
+ constructor(from, to, duration, easing, params) {
35265
+ super(from, to, duration, easing, params);
35266
+ }
35267
+ getShaderSources() {
35268
+ return null;
35269
+ }
35270
+ applyWebGLEffect(canvas) {
35271
+ return null;
35272
+ }
35273
+ }
35274
+ class HybridEffectBase extends DisappearAnimateBase {
35275
+ constructor(from, to, duration, easing, params) {
35276
+ super(from, to, duration, easing, params);
35277
+ }
35278
+ getShaderSources() {
35279
+ return null;
35280
+ }
35281
+ applyWebGLEffect(canvas) {
35282
+ return null;
35283
+ }
35284
+ applyCanvas2DEffect(canvas) {
35285
+ return null;
35286
+ }
35287
+ supportsWebGL() {
35288
+ return this.getShaderSources !== HybridEffectBase.prototype.getShaderSources && null !== this.getShaderSources();
35289
+ }
35290
+ supportsCanvas2D() {
35291
+ return this.applyCanvas2DEffect !== HybridEffectBase.prototype.applyCanvas2DEffect;
35292
+ }
35293
+ afterStageRender(stage, canvas) {
35294
+ var _a, _b;
35295
+ let result = null;
35296
+ if (null === (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.options) || void 0 === _b ? void 0 : _b.useWebGL) {
35297
+ if (this.supportsWebGL() && (this.gl || this.initWebGL(canvas) || console.warn("WebGL初始化失败,尝试Canvas 2D回退"), this.gl)) {
35298
+ if (result = this.applyWebGLEffect(canvas), result) return result;
35299
+ console.warn("WebGL特效执行失败,尝试Canvas 2D回退");
35300
+ }
35301
+ if (this.supportsCanvas2D()) {
35302
+ if (result = this.applyCanvas2DEffect(canvas), result) return result;
35303
+ console.warn("Canvas 2D特效执行失败");
35304
+ }
35305
+ } else if (this.supportsCanvas2D()) {
35306
+ if (result = this.applyCanvas2DEffect(canvas), result) return result;
35307
+ console.warn("Canvas 2D特效执行失败");
35308
+ } else console.warn(`${this.constructor.name}: useWebGL=false 但未实现Canvas 2D方法`);
35309
+ return this.supportsWebGL() || this.supportsCanvas2D() || console.error(`特效类 ${this.constructor.name} 未实现任何渲染方法。请实现 applyWebGLEffect 或 applyCanvas2DEffect 方法。`), canvas;
35310
+ }
35311
+ }
35312
+
35313
+ class ImageProcessUtils {
35314
+ static createTempCanvas(width, height, dpr) {
35315
+ return vglobal.createCanvas({
35316
+ width: width,
35317
+ height: height,
35318
+ dpr: dpr || vglobal.devicePixelRatio
35319
+ });
35320
+ }
35321
+ static cloneImageData(imageData) {
35322
+ const clonedData = new Uint8ClampedArray(imageData.data);
35323
+ return new ImageData(clonedData, imageData.width, imageData.height);
35324
+ }
35325
+ static lerp(start, end, t) {
35326
+ return start * (1 - t) + end * t;
35327
+ }
35328
+ static smoothstep(edge0, edge1, x) {
35329
+ const t = Math.max(0, Math.min(1, (x - edge0) / (edge1 - edge0)));
35330
+ return t * t * (3 - 2 * t);
35331
+ }
35332
+ static distance(x1, y1, x2, y2) {
35333
+ const dx = x2 - x1,
35334
+ dy = y2 - y1;
35335
+ return Math.sqrt(dx * dx + dy * dy);
35336
+ }
35337
+ static normalizeAngle(angle) {
35338
+ return (angle + Math.PI) / (2 * Math.PI);
35339
+ }
35340
+ static pixelNoise(x, y, pixelSize) {
35341
+ if (pixelSize <= 0) return 0;
35342
+ const gridX = Math.floor(x / pixelSize) * pixelSize,
35343
+ gridY = Math.floor(y / pixelSize) * pixelSize,
35344
+ n = 43758.5453 * Math.sin(12.9898 * gridX + 78.233 * gridY);
35345
+ return n - Math.floor(n);
35346
+ }
35347
+ static generateNoiseTexture(width, height) {
35348
+ const data = new Uint8Array(width * height);
35349
+ for (let i = 0; i < data.length; i++) data[i] = Math.floor(256 * Math.random());
35350
+ return data;
35351
+ }
35352
+ static applyCSSFilter(canvas, filter) {
35353
+ const outputCanvas = this.createTempCanvas(canvas.width, canvas.height),
35354
+ ctx = outputCanvas.getContext("2d");
35355
+ return ctx ? (ctx.filter = filter, ctx.drawImage(canvas, 0, 0), ctx.filter = "none", outputCanvas) : canvas;
35356
+ }
35357
+ static extractChannel(imageData, channelIndex) {
35358
+ const {
35359
+ data: data,
35360
+ width: width,
35361
+ height: height
35362
+ } = imageData,
35363
+ channelData = new Uint8ClampedArray(data.length);
35364
+ 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]);
35365
+ return new ImageData(channelData, width, height);
35366
+ }
35367
+ static blendImageData(imageData1, imageData2, ratio) {
35368
+ const {
35369
+ data: data1,
35370
+ width: width,
35371
+ height: height
35372
+ } = imageData1,
35373
+ {
35374
+ data: data2
35375
+ } = imageData2,
35376
+ result = new Uint8ClampedArray(data1.length);
35377
+ 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));
35378
+ return new ImageData(result, width, height);
35379
+ }
35380
+ static getLuminance(r, g, b) {
35381
+ return .299 * r + .587 * g + .114 * b;
35382
+ }
35383
+ static applySepiaToPixel(r, g, b) {
35384
+ 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)];
35385
+ }
35386
+ static calculateDynamicStrength(baseStrength, animationTime) {
35387
+ return baseStrength * (animationTime / (2 * Math.PI));
35388
+ }
35389
+ }
35390
+ class ShaderLibrary {}
35391
+ 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 ";
35392
+
35393
+ class Dissolve extends HybridEffectBase {
35394
+ constructor(from, to, duration, easing, params) {
35395
+ var _a, _b, _c, _d;
35396
+ super(from, to, duration, easing, params), this.noiseData = null;
35397
+ const rawNoiseScale = null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.noiseScale,
35398
+ clampedNoiseScale = void 0 !== rawNoiseScale ? Math.max(0, Math.floor(rawNoiseScale)) : 8;
35399
+ this.dissolveConfig = {
35400
+ dissolveType: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.dissolveType) || "outward",
35401
+ useWebGL: void 0 === (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.useWebGL) || params.options.useWebGL,
35402
+ noiseScale: clampedNoiseScale,
35403
+ fadeEdge: void 0 === (null === (_d = null == params ? void 0 : params.options) || void 0 === _d ? void 0 : _d.fadeEdge) || params.options.fadeEdge
35404
+ };
35405
+ }
35406
+ getShaderSources() {
35407
+ return {
35408
+ vertex: ShaderLibrary.STANDARD_VERTEX_SHADER,
35409
+ 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 `
35410
+ };
35411
+ }
35412
+ applyWebGLEffect(canvas) {
35413
+ if (!this.gl || !this.program || !this.webglCanvas) return canvas;
35414
+ this.setupWebGLState(canvas);
35415
+ const texture = this.createTextureFromCanvas(canvas);
35416
+ if (!texture) return canvas;
35417
+ this.noiseData || (this.noiseData = ImageProcessUtils.generateNoiseTexture(256, 256));
35418
+ const noiseTexture = this.gl.createTexture();
35419
+ 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);
35420
+ const vertexBuffer = this.createFullScreenQuad();
35421
+ 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;
35422
+ }
35423
+ setUniforms() {
35424
+ if (!this.gl || !this.program || !this.webglCanvas) return;
35425
+ const textureLocation = this.gl.getUniformLocation(this.program, "u_texture"),
35426
+ noiseTextureLocation = this.gl.getUniformLocation(this.program, "u_noiseTexture"),
35427
+ timeLocation = this.gl.getUniformLocation(this.program, "u_time"),
35428
+ dissolveTypeLocation = this.gl.getUniformLocation(this.program, "u_dissolveType"),
35429
+ resolutionLocation = this.gl.getUniformLocation(this.program, "u_resolution"),
35430
+ noiseScaleLocation = this.gl.getUniformLocation(this.program, "u_noiseScale"),
35431
+ fadeEdgeLocation = this.gl.getUniformLocation(this.program, "u_fadeEdge");
35432
+ 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);
35433
+ this.gl.uniform1i(dissolveTypeLocation, {
35434
+ outward: 0,
35435
+ inward: 1,
35436
+ radial: 2,
35437
+ leftToRight: 3,
35438
+ rightToLeft: 4,
35439
+ topToBottom: 5,
35440
+ bottomToTop: 6
35441
+ }[this.dissolveConfig.dissolveType] || 0);
35442
+ }
35443
+ applyCanvas2DEffect(canvas) {
35444
+ const outputCanvas = this.createOutputCanvas(canvas);
35445
+ if (!outputCanvas) return canvas;
35446
+ const {
35447
+ canvas: outputCanvasElement,
35448
+ ctx: ctx
35449
+ } = outputCanvas,
35450
+ imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
35451
+ progress = this.currentAnimationRatio;
35452
+ let dissolvedImageData;
35453
+ switch (this.dissolveConfig.dissolveType) {
35454
+ case "outward":
35455
+ dissolvedImageData = this.applyOutwardDissolve(imageData, progress);
35456
+ break;
35457
+ case "inward":
35458
+ dissolvedImageData = this.applyInwardDissolve(imageData, progress);
35459
+ break;
35460
+ case "radial":
35461
+ dissolvedImageData = this.applyRadialDissolve(imageData, progress);
35462
+ break;
35463
+ case "leftToRight":
35464
+ dissolvedImageData = this.applyLeftToRightDissolve(imageData, progress);
35465
+ break;
35466
+ case "rightToLeft":
35467
+ dissolvedImageData = this.applyRightToLeftDissolve(imageData, progress);
35468
+ break;
35469
+ case "topToBottom":
35470
+ dissolvedImageData = this.applyTopToBottomDissolve(imageData, progress);
35471
+ break;
35472
+ case "bottomToTop":
35473
+ dissolvedImageData = this.applyBottomToTopDissolve(imageData, progress);
35474
+ break;
35475
+ default:
35476
+ dissolvedImageData = imageData;
35477
+ }
35478
+ return ctx.putImageData(dissolvedImageData, 0, 0), outputCanvasElement;
35479
+ }
35480
+ applyOutwardDissolve(imageData, progress) {
35481
+ const {
35482
+ data: data,
35483
+ width: width,
35484
+ height: height
35485
+ } = imageData,
35486
+ result = new Uint8ClampedArray(data.length);
35487
+ result.set(data);
35488
+ const centerX = width / 2,
35489
+ centerY = height / 2,
35490
+ maxDist = Math.sqrt(centerX * centerX + centerY * centerY),
35491
+ pixelSize = this.dissolveConfig.noiseScale;
35492
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
35493
+ const dx = x - centerX,
35494
+ dy = y - centerY,
35495
+ normalizedDist = Math.sqrt(dx * dx + dy * dy) / maxDist;
35496
+ let dissolveThreshold = 1.2 - 1.4 * progress,
35497
+ alpha = 1;
35498
+ if (pixelSize > 0) {
35499
+ dissolveThreshold += .4 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedDist > dissolveThreshold ? 0 : 1;
35500
+ } else if (this.dissolveConfig.fadeEdge) {
35501
+ const fadeStart = dissolveThreshold - .15;
35502
+ alpha = normalizedDist < fadeStart ? 1 : normalizedDist > dissolveThreshold ? 0 : 1 - (normalizedDist - fadeStart) / (dissolveThreshold - fadeStart);
35503
+ } else alpha = normalizedDist > dissolveThreshold ? 0 : 1;
35504
+ const index = 4 * (y * width + x);
35505
+ result[index + 3] = Math.floor(result[index + 3] * alpha);
35506
+ }
35507
+ return new ImageData(result, width, height);
35508
+ }
35509
+ applyInwardDissolve(imageData, progress) {
35510
+ const {
35511
+ data: data,
35512
+ width: width,
35513
+ height: height
35514
+ } = imageData,
35515
+ result = new Uint8ClampedArray(data.length);
35516
+ result.set(data);
35517
+ const centerX = width / 2,
35518
+ centerY = height / 2,
35519
+ maxDist = Math.sqrt(centerX * centerX + centerY * centerY),
35520
+ pixelSize = this.dissolveConfig.noiseScale;
35521
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
35522
+ const dx = x - centerX,
35523
+ dy = y - centerY,
35524
+ normalizedDist = Math.sqrt(dx * dx + dy * dy) / maxDist;
35525
+ let dissolveThreshold = 1.4 * progress,
35526
+ alpha = 1;
35527
+ if (pixelSize > 0) {
35528
+ dissolveThreshold += .4 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedDist < dissolveThreshold ? 0 : 1;
35529
+ } else if (this.dissolveConfig.fadeEdge) {
35530
+ const fadeEnd = dissolveThreshold + .15;
35531
+ alpha = normalizedDist < dissolveThreshold ? 0 : normalizedDist > fadeEnd ? 1 : (normalizedDist - dissolveThreshold) / (fadeEnd - dissolveThreshold);
35532
+ } else alpha = normalizedDist < dissolveThreshold ? 0 : 1;
35533
+ const index = 4 * (y * width + x);
35534
+ result[index + 3] = Math.floor(result[index + 3] * alpha);
35535
+ }
35536
+ return new ImageData(result, width, height);
35537
+ }
35538
+ applyRadialDissolve(imageData, progress) {
35539
+ const {
35540
+ data: data,
35541
+ width: width,
35542
+ height: height
35543
+ } = imageData,
35544
+ result = new Uint8ClampedArray(data.length);
35545
+ result.set(data);
35546
+ const centerX = width / 2,
35547
+ centerY = height / 2,
35548
+ pixelSize = this.dissolveConfig.noiseScale;
35549
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
35550
+ const dx = x - centerX,
35551
+ dy = y - centerY,
35552
+ normalizedAngle = (Math.atan2(dy, dx) + Math.PI) / (2 * Math.PI);
35553
+ let dissolveThreshold = 1.2 * progress,
35554
+ alpha = 1;
35555
+ if (pixelSize > 0) {
35556
+ dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedAngle < dissolveThreshold ? 0 : 1;
35557
+ } else if (this.dissolveConfig.fadeEdge) {
35558
+ const fadeEnd = dissolveThreshold + .08;
35559
+ alpha = normalizedAngle < dissolveThreshold ? 0 : normalizedAngle > fadeEnd ? 1 : (normalizedAngle - dissolveThreshold) / (fadeEnd - dissolveThreshold);
35560
+ } else alpha = normalizedAngle < dissolveThreshold ? 0 : 1;
35561
+ const index = 4 * (y * width + x);
35562
+ result[index + 3] = Math.floor(result[index + 3] * alpha);
35563
+ }
35564
+ return new ImageData(result, width, height);
35565
+ }
35566
+ applyLeftToRightDissolve(imageData, progress) {
35567
+ const {
35568
+ data: data,
35569
+ width: width,
35570
+ height: height
35571
+ } = imageData,
35572
+ result = new Uint8ClampedArray(data.length);
35573
+ result.set(data);
35574
+ const pixelSize = this.dissolveConfig.noiseScale;
35575
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
35576
+ const normalizedX = x / width;
35577
+ let dissolveThreshold = 1.2 * progress,
35578
+ alpha = 1;
35579
+ if (pixelSize > 0) {
35580
+ dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedX < dissolveThreshold ? 0 : 1;
35581
+ } else if (this.dissolveConfig.fadeEdge) {
35582
+ const fadeEnd = dissolveThreshold + .08;
35583
+ alpha = normalizedX < dissolveThreshold ? 0 : normalizedX > fadeEnd ? 1 : (normalizedX - dissolveThreshold) / (fadeEnd - dissolveThreshold);
35584
+ } else alpha = normalizedX < dissolveThreshold ? 0 : 1;
35585
+ const index = 4 * (y * width + x);
35586
+ result[index + 3] = Math.floor(result[index + 3] * alpha);
35587
+ }
35588
+ return new ImageData(result, width, height);
35589
+ }
35590
+ applyRightToLeftDissolve(imageData, progress) {
35591
+ const {
35592
+ data: data,
35593
+ width: width,
35594
+ height: height
35595
+ } = imageData,
35596
+ result = new Uint8ClampedArray(data.length);
35597
+ result.set(data);
35598
+ const pixelSize = this.dissolveConfig.noiseScale;
35599
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
35600
+ const normalizedX = x / width;
35601
+ let dissolveThreshold = 1 - 1.2 * progress,
35602
+ alpha = 1;
35603
+ if (pixelSize > 0) {
35604
+ dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedX > dissolveThreshold ? 0 : 1;
35605
+ } else if (this.dissolveConfig.fadeEdge) {
35606
+ const fadeStart = dissolveThreshold - .08;
35607
+ alpha = normalizedX < fadeStart ? 1 : normalizedX > dissolveThreshold ? 0 : 1 - (normalizedX - fadeStart) / (dissolveThreshold - fadeStart);
35608
+ } else alpha = normalizedX > dissolveThreshold ? 0 : 1;
35609
+ const index = 4 * (y * width + x);
35610
+ result[index + 3] = Math.floor(result[index + 3] * alpha);
35611
+ }
35612
+ return new ImageData(result, width, height);
35613
+ }
35614
+ applyTopToBottomDissolve(imageData, progress) {
35615
+ const {
35616
+ data: data,
35617
+ width: width,
35618
+ height: height
35619
+ } = imageData,
35620
+ result = new Uint8ClampedArray(data.length);
35621
+ result.set(data);
35622
+ const pixelSize = this.dissolveConfig.noiseScale;
35623
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
35624
+ const normalizedY = y / height;
35625
+ let dissolveThreshold = 1.2 * progress,
35626
+ alpha = 1;
35627
+ if (pixelSize > 0) {
35628
+ dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedY < dissolveThreshold ? 0 : 1;
35629
+ } else if (this.dissolveConfig.fadeEdge) {
35630
+ const fadeEnd = dissolveThreshold + .08;
35631
+ alpha = normalizedY < dissolveThreshold ? 0 : normalizedY > fadeEnd ? 1 : (normalizedY - dissolveThreshold) / (fadeEnd - dissolveThreshold);
35632
+ } else alpha = normalizedY < dissolveThreshold ? 0 : 1;
35633
+ const index = 4 * (y * width + x);
35634
+ result[index + 3] = Math.floor(result[index + 3] * alpha);
35635
+ }
35636
+ return new ImageData(result, width, height);
35637
+ }
35638
+ applyBottomToTopDissolve(imageData, progress) {
35639
+ const {
35640
+ data: data,
35641
+ width: width,
35642
+ height: height
35643
+ } = imageData,
35644
+ result = new Uint8ClampedArray(data.length);
35645
+ result.set(data);
35646
+ const pixelSize = this.dissolveConfig.noiseScale;
35647
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
35648
+ const normalizedY = y / height;
35649
+ let dissolveThreshold = 1 - 1.2 * progress,
35650
+ alpha = 1;
35651
+ if (pixelSize > 0) {
35652
+ dissolveThreshold += .3 * (ImageProcessUtils.pixelNoise(x, y, pixelSize) - .5), alpha = normalizedY > dissolveThreshold ? 0 : 1;
35653
+ } else if (this.dissolveConfig.fadeEdge) {
35654
+ const fadeStart = dissolveThreshold - .08;
35655
+ alpha = normalizedY < fadeStart ? 1 : normalizedY > dissolveThreshold ? 0 : 1 - (normalizedY - fadeStart) / (dissolveThreshold - fadeStart);
35656
+ } else alpha = normalizedY > dissolveThreshold ? 0 : 1;
35657
+ const index = 4 * (y * width + x);
35658
+ result[index + 3] = Math.floor(result[index + 3] * alpha);
35659
+ }
35660
+ return new ImageData(result, width, height);
35661
+ }
35662
+ }
35663
+
35664
+ class Grayscale extends HybridEffectBase {
35665
+ constructor(from, to, duration, easing, params) {
35666
+ var _a, _b, _c;
35667
+ super(from, to, duration, easing, params);
35668
+ const rawStrength = void 0 !== (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.strength) ? params.options.strength : 1,
35669
+ clampedStrength = Math.max(0, Math.min(1, rawStrength));
35670
+ this.colorConfig = {
35671
+ effectType: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.effectType) || "grayscale",
35672
+ strength: clampedStrength,
35673
+ useWebGL: void 0 === (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.useWebGL) || params.options.useWebGL
35674
+ };
35675
+ }
35676
+ getShaderSources() {
35677
+ return {
35678
+ vertex: ShaderLibrary.STANDARD_VERTEX_SHADER,
35679
+ 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 `
35680
+ };
35681
+ }
35682
+ applyWebGLEffect(canvas) {
35683
+ if (!this.gl || !this.program || !this.webglCanvas) return null;
35684
+ this.setupWebGLState(canvas);
35685
+ const texture = this.createTextureFromCanvas(canvas);
35686
+ if (!texture) return null;
35687
+ const vertexBuffer = this.createFullScreenQuad();
35688
+ if (!vertexBuffer) return this.gl.deleteTexture(texture), null;
35689
+ try {
35690
+ return this.gl.useProgram(this.program), this.setupVertexAttributes(), this.setColorUniforms(), this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4), this.webglCanvas;
35691
+ } finally {
35692
+ this.gl.deleteTexture(texture), this.gl.deleteBuffer(vertexBuffer);
35693
+ }
35694
+ }
35695
+ setColorUniforms() {
35696
+ if (!this.gl || !this.program) return;
35697
+ const currentTime = this.getAnimationTime(),
35698
+ timeLocation = this.gl.getUniformLocation(this.program, "u_time"),
35699
+ strengthLocation = this.gl.getUniformLocation(this.program, "u_strength"),
35700
+ effectTypeLocation = this.gl.getUniformLocation(this.program, "u_effectType"),
35701
+ resolutionLocation = this.gl.getUniformLocation(this.program, "u_resolution");
35702
+ this.gl.uniform1f(timeLocation, currentTime), this.gl.uniform1f(strengthLocation, this.colorConfig.strength), this.gl.uniform2f(resolutionLocation, this.webglCanvas.width, this.webglCanvas.height);
35703
+ this.gl.uniform1i(effectTypeLocation, {
35704
+ grayscale: 0,
35705
+ sepia: 1
35706
+ }[this.colorConfig.effectType] || 0);
35707
+ }
35708
+ applyCanvas2DEffect(canvas) {
35709
+ if (this.colorConfig.strength <= 0) {
35710
+ const outputCanvas = this.createOutputCanvas(canvas);
35711
+ return outputCanvas ? outputCanvas.canvas : null;
35712
+ }
35713
+ if (this.canUseCSSFilter()) return this.applyCSSFilter(canvas);
35714
+ const outputCanvas = this.createOutputCanvas(canvas);
35715
+ if (!outputCanvas) return null;
35716
+ const {
35717
+ ctx: ctx
35718
+ } = outputCanvas;
35719
+ try {
35720
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
35721
+ currentTime = this.getAnimationTime();
35722
+ let processedImageData;
35723
+ switch (this.colorConfig.effectType) {
35724
+ case "grayscale":
35725
+ default:
35726
+ processedImageData = this.applyGrayscaleEffect(imageData, this.colorConfig.strength, currentTime);
35727
+ break;
35728
+ case "sepia":
35729
+ processedImageData = this.applySepiaEffect(imageData, this.colorConfig.strength, currentTime);
35730
+ }
35731
+ return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(processedImageData, 0, 0), outputCanvas.canvas;
35732
+ } catch (error) {
35733
+ return console.warn("Canvas 2D color effect failed:", error), null;
35734
+ }
35735
+ }
35736
+ canUseCSSFilter() {
35737
+ var _a;
35738
+ return !!window.useFilterAPI && "undefined" != typeof CSS && (null === (_a = CSS.supports) || void 0 === _a ? void 0 : _a.call(CSS, "filter", "grayscale(1)"));
35739
+ }
35740
+ applyCSSFilter(canvas) {
35741
+ try {
35742
+ const outputCanvas = ImageProcessUtils.createTempCanvas(canvas.width, canvas.height),
35743
+ ctx = outputCanvas.getContext("2d");
35744
+ if (!ctx) return null;
35745
+ const currentTime = this.getAnimationTime(),
35746
+ dynamicStrength = ImageProcessUtils.calculateDynamicStrength(this.colorConfig.strength, currentTime);
35747
+ let filterValue = "";
35748
+ 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;
35749
+ } catch (error) {
35750
+ return console.warn("CSS Filter API failed, falling back to pixel processing:", error), null;
35751
+ }
35752
+ }
35753
+ applyGrayscaleEffect(imageData, strength, time) {
35754
+ const {
35755
+ data: data,
35756
+ width: width,
35757
+ height: height
35758
+ } = imageData,
35759
+ result = new Uint8ClampedArray(data.length),
35760
+ dynamicStrength = ImageProcessUtils.calculateDynamicStrength(strength, time);
35761
+ for (let i = 0; i < data.length; i += 4) {
35762
+ const r = data[i],
35763
+ g = data[i + 1],
35764
+ b = data[i + 2],
35765
+ a = data[i + 3],
35766
+ gray = ImageProcessUtils.getLuminance(r, g, b);
35767
+ 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;
35768
+ }
35769
+ return new ImageData(result, width, height);
35770
+ }
35771
+ applySepiaEffect(imageData, strength, time) {
35772
+ const {
35773
+ data: data,
35774
+ width: width,
35775
+ height: height
35776
+ } = imageData,
35777
+ result = new Uint8ClampedArray(data.length),
35778
+ dynamicStrength = ImageProcessUtils.calculateDynamicStrength(strength, time);
35779
+ for (let i = 0; i < data.length; i += 4) {
35780
+ const r = data[i],
35781
+ g = data[i + 1],
35782
+ b = data[i + 2],
35783
+ a = data[i + 3],
35784
+ [sepiaR, sepiaG, sepiaB] = ImageProcessUtils.applySepiaToPixel(r, g, b);
35785
+ 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;
35786
+ }
35787
+ return new ImageData(result, width, height);
35788
+ }
35789
+ afterStageRender(stage, canvas) {
35790
+ if (this.canUseCSSFilter() && this.colorConfig.strength > 0) {
35791
+ const cssResult = this.applyCSSFilter(canvas);
35792
+ if (cssResult) return cssResult;
35793
+ }
35794
+ return super.afterStageRender(stage, canvas);
35795
+ }
35796
+ }
35797
+
35798
+ class Distortion extends HybridEffectBase {
35799
+ constructor(from, to, duration, easing, params) {
35800
+ var _a, _b, _c;
35801
+ super(from, to, duration, easing, params), this.distortionConfig = {
35802
+ distortionType: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.distortionType) || "wave",
35803
+ strength: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.strength) || .3,
35804
+ useWebGL: void 0 === (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.useWebGL) || params.options.useWebGL
35805
+ };
35806
+ }
35807
+ getShaderSources() {
35808
+ return {
35809
+ 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 ",
35810
+ 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 "
35811
+ };
35812
+ }
35813
+ applyWebGLEffect(canvas) {
35814
+ if (!this.gl || !this.program || !this.webglCanvas) return null;
35815
+ this.setupWebGLState(canvas);
35816
+ const texture = this.createTextureFromCanvas(canvas);
35817
+ if (!texture) return null;
35818
+ const vertexBuffer = this.createFullScreenQuad();
35819
+ if (!vertexBuffer) return this.gl.deleteTexture(texture), null;
35820
+ try {
35821
+ return this.gl.useProgram(this.program), this.setupVertexAttributes(), this.setDistortionUniforms(), this.gl.drawArrays(this.gl.TRIANGLE_STRIP, 0, 4), this.webglCanvas;
35822
+ } finally {
35823
+ this.gl.deleteTexture(texture), this.gl.deleteBuffer(vertexBuffer);
35824
+ }
35825
+ }
35826
+ setDistortionUniforms() {
35827
+ if (!this.gl || !this.program) return;
35828
+ const currentTime = this.getAnimationTime(),
35829
+ timeLocation = this.gl.getUniformLocation(this.program, "u_time"),
35830
+ strengthLocation = this.gl.getUniformLocation(this.program, "u_strength"),
35831
+ distortionTypeLocation = this.gl.getUniformLocation(this.program, "u_distortionType"),
35832
+ resolutionLocation = this.gl.getUniformLocation(this.program, "u_resolution");
35833
+ this.gl.uniform1f(timeLocation, currentTime), this.gl.uniform1f(strengthLocation, this.distortionConfig.strength), this.gl.uniform2f(resolutionLocation, this.webglCanvas.width, this.webglCanvas.height);
35834
+ this.gl.uniform1i(distortionTypeLocation, {
35835
+ wave: 0,
35836
+ ripple: 1,
35837
+ swirl: 2
35838
+ }[this.distortionConfig.distortionType] || 0);
35839
+ }
35840
+ applyCanvas2DEffect(canvas) {
35841
+ const outputCanvas = this.createOutputCanvas(canvas);
35842
+ if (!outputCanvas) return null;
35843
+ const {
35844
+ ctx: ctx
35845
+ } = outputCanvas;
35846
+ try {
35847
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
35848
+ currentTime = this.getAnimationTime();
35849
+ let distortedImageData;
35850
+ switch (this.distortionConfig.distortionType) {
35851
+ case "wave":
35852
+ distortedImageData = this.applyWaveDistortion(imageData, this.distortionConfig.strength, currentTime);
35853
+ break;
35854
+ case "ripple":
35855
+ distortedImageData = this.applyRippleDistortion(imageData, this.distortionConfig.strength, currentTime);
35856
+ break;
35857
+ case "swirl":
35858
+ distortedImageData = this.applySwirlDistortion(imageData, this.distortionConfig.strength, currentTime);
35859
+ break;
35860
+ default:
35861
+ distortedImageData = imageData;
35862
+ }
35863
+ return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(distortedImageData, 0, 0), outputCanvas.canvas;
35864
+ } catch (error) {
35865
+ return console.warn("Canvas 2D distortion effect failed:", error), null;
35866
+ }
35867
+ }
35868
+ applyWaveDistortion(imageData, strength, time) {
35869
+ const {
35870
+ data: data,
35871
+ width: width,
35872
+ height: height
35873
+ } = imageData,
35874
+ result = new Uint8ClampedArray(data.length);
35875
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
35876
+ const waveX = Math.sin(.1 * y + 3 * time) * strength * 20,
35877
+ waveY = Math.sin(.1 * x + 2 * time) * strength * 20,
35878
+ sourceX = Math.round(x - waveX),
35879
+ sourceY = Math.round(y - waveY),
35880
+ targetIndex = 4 * (y * width + x);
35881
+ if (sourceX >= 0 && sourceX < width && sourceY >= 0 && sourceY < height) {
35882
+ const sourceIndex = 4 * (sourceY * width + sourceX);
35883
+ result[targetIndex] = data[sourceIndex], result[targetIndex + 1] = data[sourceIndex + 1], result[targetIndex + 2] = data[sourceIndex + 2], result[targetIndex + 3] = data[sourceIndex + 3];
35884
+ } else result[targetIndex + 3] = 0;
35885
+ }
35886
+ return new ImageData(result, width, height);
35887
+ }
35888
+ applyRippleDistortion(imageData, strength, time) {
35889
+ const {
35890
+ data: data,
35891
+ width: width,
35892
+ height: height
35893
+ } = imageData,
35894
+ result = new Uint8ClampedArray(data.length),
35895
+ centerX = width / 2,
35896
+ centerY = height / 2;
35897
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
35898
+ const dx = x - centerX,
35899
+ dy = y - centerY,
35900
+ distance = Math.sqrt(dx * dx + dy * dy),
35901
+ ripple = Math.sin(.2 * distance - 5 * time) * strength * 10,
35902
+ angle = Math.atan2(dy, dx),
35903
+ sourceX = Math.round(x - Math.cos(angle) * ripple),
35904
+ sourceY = Math.round(y - Math.sin(angle) * ripple),
35905
+ targetIndex = 4 * (y * width + x);
35906
+ if (sourceX >= 0 && sourceX < width && sourceY >= 0 && sourceY < height) {
35907
+ const sourceIndex = 4 * (sourceY * width + sourceX);
35908
+ result[targetIndex] = data[sourceIndex], result[targetIndex + 1] = data[sourceIndex + 1], result[targetIndex + 2] = data[sourceIndex + 2], result[targetIndex + 3] = data[sourceIndex + 3];
35909
+ } else result[targetIndex + 3] = 0;
35910
+ }
35911
+ return new ImageData(result, width, height);
35912
+ }
35913
+ applySwirlDistortion(imageData, strength, time) {
35914
+ const {
35915
+ data: data,
35916
+ width: width,
35917
+ height: height
35918
+ } = imageData,
35919
+ result = new Uint8ClampedArray(data.length),
35920
+ centerX = width / 2,
35921
+ centerY = height / 2;
35922
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
35923
+ const dx = x - centerX,
35924
+ dy = y - centerY,
35925
+ distance = Math.sqrt(dx * dx + dy * dy),
35926
+ finalAngle = Math.atan2(dy, dx) + distance * strength * time * .02,
35927
+ sourceX = Math.round(centerX + distance * Math.cos(finalAngle)),
35928
+ sourceY = Math.round(centerY + distance * Math.sin(finalAngle)),
35929
+ targetIndex = 4 * (y * width + x);
35930
+ if (sourceX >= 0 && sourceX < width && sourceY >= 0 && sourceY < height) {
35931
+ const sourceIndex = 4 * (sourceY * width + sourceX);
35932
+ result[targetIndex] = data[sourceIndex], result[targetIndex + 1] = data[sourceIndex + 1], result[targetIndex + 2] = data[sourceIndex + 2], result[targetIndex + 3] = data[sourceIndex + 3];
35933
+ } else result[targetIndex + 3] = 0;
35934
+ }
35935
+ return new ImageData(result, width, height);
35936
+ }
35937
+ afterStageRender(stage, canvas) {
35938
+ return this.distortionConfig.strength <= 0 ? canvas : super.afterStageRender(stage, canvas);
35939
+ }
35940
+ }
35941
+
35942
+ class Particle extends HybridEffectBase {
35943
+ constructor(from, to, duration, easing, params) {
35944
+ var _a, _b, _c, _d;
35945
+ super(from, to, duration, easing, params), this.particles = [], this.positionBuffer = null, this.colorBuffer = null, this.particleConfig = {
35946
+ effectType: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.effectType) || "gravity",
35947
+ count: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.count) || 4e3,
35948
+ size: (null === (_c = null == params ? void 0 : params.options) || void 0 === _c ? void 0 : _c.size) || 20,
35949
+ strength: (null === (_d = null == params ? void 0 : params.options) || void 0 === _d ? void 0 : _d.strength) || 1.5
35950
+ };
35951
+ }
35952
+ getShaderSources() {
35953
+ return {
35954
+ 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 ",
35955
+ 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 "
35956
+ };
35957
+ }
35958
+ applyWebGLEffect(canvas) {
35959
+ if (!this.gl || !this.program || !this.webglCanvas) return null;
35960
+ this.setupWebGLState(canvas), 0 === this.particles.length && this.extractParticles(canvas), this.updateParticles(canvas);
35961
+ const gl = this.gl;
35962
+ return gl.enable(gl.BLEND), gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA), gl.useProgram(this.program), this.prepareAndDrawParticles(gl), this.webglCanvas;
35963
+ }
35964
+ applyCanvas2DEffect(canvas) {
35965
+ const output = this.createOutputCanvas(canvas);
35966
+ if (!output) return null;
35967
+ const {
35968
+ canvas: outputCanvas,
35969
+ ctx: ctx
35970
+ } = output,
35971
+ progress = this.currentAnimationRatio;
35972
+ switch (this.particleConfig.effectType) {
35973
+ case "explode":
35974
+ this.applyCanvas2DExplode(ctx, canvas, progress);
35975
+ break;
35976
+ case "gravity":
35977
+ this.applyCanvas2DGravity(ctx, canvas, progress);
35978
+ break;
35979
+ case "vortex":
35980
+ this.applyCanvas2DVortex(ctx, canvas, progress);
35981
+ break;
35982
+ default:
35983
+ ctx.globalAlpha = Math.max(0, 1 - progress), ctx.drawImage(canvas, 0, 0);
35984
+ }
35985
+ return outputCanvas;
35986
+ }
35987
+ extractParticles(canvas) {
35988
+ const tempCanvas = ImageProcessUtils.createTempCanvas(canvas.width, canvas.height, 1),
35989
+ tempCtx = tempCanvas.getContext("2d");
35990
+ if (!tempCtx) return;
35991
+ tempCtx.drawImage(canvas, 0, 0, tempCanvas.width, tempCanvas.height);
35992
+ const data = tempCtx.getImageData(0, 0, tempCanvas.width, tempCanvas.height).data;
35993
+ this.particles = [];
35994
+ const step = Math.max(1, Math.floor(Math.sqrt(tempCanvas.width * tempCanvas.height / (1.5 * this.particleConfig.count))));
35995
+ for (let y = 0; y < tempCanvas.height; y += step) for (let x = 0; x < tempCanvas.width; x += step) {
35996
+ const index = 4 * (y * tempCanvas.width + x),
35997
+ r = data[index],
35998
+ g = data[index + 1],
35999
+ b = data[index + 2],
36000
+ a = data[index + 3];
36001
+ if (a > 5) {
36002
+ const realX = x / tempCanvas.width * canvas.width,
36003
+ realY = y / tempCanvas.height * canvas.height,
36004
+ particle = {
36005
+ x: realX,
36006
+ y: realY,
36007
+ originX: realX,
36008
+ originY: realY,
36009
+ vx: 0,
36010
+ vy: 0,
36011
+ r: r / 255,
36012
+ g: g / 255,
36013
+ b: b / 255,
36014
+ a: Math.max(.6, a / 255),
36015
+ life: 1,
36016
+ size: this.particleConfig.size * (1 + .5 * Math.random())
36017
+ };
36018
+ this.particles.push(particle);
36019
+ }
36020
+ }
36021
+ }
36022
+ updateParticles(canvas) {
36023
+ const centerX = canvas.width / 2,
36024
+ centerY = canvas.height / 2,
36025
+ progress = this.currentAnimationRatio,
36026
+ duration = this.getDurationFromParent(),
36027
+ isShortAnimation = duration < 2e3,
36028
+ timeMultiplier = isShortAnimation ? Math.max(1.5, 3e3 / duration) : 1,
36029
+ intensityBoost = isShortAnimation ? Math.min(2, 2e3 / duration) : 1;
36030
+ this.particles.forEach(particle => {
36031
+ const dx = particle.x - centerX,
36032
+ dy = particle.y - centerY,
36033
+ distance = Math.sqrt(dx * dx + dy * dy),
36034
+ angle = Math.atan2(dy, dx);
36035
+ this.applyParticleForces(particle, angle, distance, progress, intensityBoost, canvas), this.updateParticleProperties(particle, progress, isShortAnimation, timeMultiplier, intensityBoost);
36036
+ });
36037
+ }
36038
+ applyParticleForces(particle, angle, distance, progress, intensityBoost, canvas) {
36039
+ const time = this.getAnimationTime();
36040
+ switch (this.particleConfig.effectType) {
36041
+ case "explode":
36042
+ const explodeIntensity = progress * this.particleConfig.strength * intensityBoost * 5;
36043
+ particle.vx += Math.cos(angle) * explodeIntensity, particle.vy += Math.sin(angle) * explodeIntensity;
36044
+ break;
36045
+ case "gravity":
36046
+ this.applyGravityEffect(particle, progress, intensityBoost, canvas, time);
36047
+ break;
36048
+ case "vortex":
36049
+ this.applyVortexEffect(particle, progress, intensityBoost, canvas, angle, distance);
36050
+ }
36051
+ }
36052
+ applyGravityEffect(particle, progress, intensityBoost, canvas, time) {
36053
+ const gravityThreshold = (particle.originX + .7 * particle.originY) / (canvas.width + canvas.height) * .8;
36054
+ if (progress > gravityThreshold) {
36055
+ const gravityProgress = (progress - gravityThreshold) / (1 - gravityThreshold),
36056
+ gravityForce = this.particleConfig.strength * gravityProgress * gravityProgress * 12 * intensityBoost;
36057
+ particle.vy += gravityForce;
36058
+ const turbulence = Math.sin(3 * time + .02 * particle.originX) * Math.cos(2 * time + .015 * particle.originY);
36059
+ particle.vx += turbulence * this.particleConfig.strength * 2 * intensityBoost;
36060
+ }
36061
+ }
36062
+ applyVortexEffect(particle, progress, intensityBoost, canvas, angle, distance) {
36063
+ const centerX = canvas.width / 2,
36064
+ centerY = canvas.height / 2,
36065
+ spiralAngle = angle + progress * Math.PI * .8,
36066
+ targetRadius = distance + progress * Math.max(canvas.width, canvas.height) * .7 * 1.8,
36067
+ targetX = centerX + Math.cos(spiralAngle) * targetRadius,
36068
+ targetY = centerY + Math.sin(spiralAngle) * targetRadius,
36069
+ baseForce = progress * this.particleConfig.strength * .08 * intensityBoost;
36070
+ particle.vx += (targetX - particle.x) * baseForce, particle.vy += (targetY - particle.y) * baseForce;
36071
+ }
36072
+ updateParticleProperties(particle, progress, isShortAnimation, timeMultiplier, intensityBoost) {
36073
+ const dragCoeff = isShortAnimation ? .99 : .98;
36074
+ if (particle.vx *= dragCoeff, particle.vy *= dragCoeff, particle.x += particle.vx, particle.y += particle.vy, isShortAnimation) {
36075
+ const lifeDecayRate = Math.max(.1, .5 / timeMultiplier);
36076
+ 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));
36077
+ } 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));
36078
+ }
36079
+ prepareAndDrawParticles(gl) {
36080
+ const positions = new Float32Array(2 * this.particles.length),
36081
+ colors = new Float32Array(4 * this.particles.length),
36082
+ sizes = new Float32Array(this.particles.length);
36083
+ this.particles.forEach((particle, i) => {
36084
+ 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);
36085
+ }), this.updateParticleBuffers(gl, positions, colors, sizes), this.setParticleUniforms(gl), gl.drawArrays(gl.POINTS, 0, this.particles.length), this.cleanupTempBuffers(gl);
36086
+ }
36087
+ updateParticleBuffers(gl, positions, colors, sizes) {
36088
+ this.positionBuffer || (this.positionBuffer = gl.createBuffer()), gl.bindBuffer(gl.ARRAY_BUFFER, this.positionBuffer), gl.bufferData(gl.ARRAY_BUFFER, positions, gl.DYNAMIC_DRAW);
36089
+ const positionLocation = gl.getAttribLocation(this.program, "a_position");
36090
+ 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);
36091
+ const colorLocation = gl.getAttribLocation(this.program, "a_color");
36092
+ gl.enableVertexAttribArray(colorLocation), gl.vertexAttribPointer(colorLocation, 4, gl.FLOAT, !1, 0, 0);
36093
+ const sizeBuffer = gl.createBuffer();
36094
+ gl.bindBuffer(gl.ARRAY_BUFFER, sizeBuffer), gl.bufferData(gl.ARRAY_BUFFER, sizes, gl.DYNAMIC_DRAW);
36095
+ const sizeLocation = gl.getAttribLocation(this.program, "a_size");
36096
+ gl.enableVertexAttribArray(sizeLocation), gl.vertexAttribPointer(sizeLocation, 1, gl.FLOAT, !1, 0, 0), this._tempSizeBuffer = sizeBuffer;
36097
+ }
36098
+ setParticleUniforms(gl) {
36099
+ const resolutionLocation = gl.getUniformLocation(this.program, "u_resolution"),
36100
+ timeLocation = gl.getUniformLocation(this.program, "u_time"),
36101
+ forceStrengthLocation = gl.getUniformLocation(this.program, "u_forceStrength"),
36102
+ effectTypeLocation = gl.getUniformLocation(this.program, "u_effectType");
36103
+ gl.uniform2f(resolutionLocation, this.webglCanvas.width, this.webglCanvas.height), gl.uniform1f(timeLocation, this.getAnimationTime()), gl.uniform1f(forceStrengthLocation, this.particleConfig.strength);
36104
+ gl.uniform1i(effectTypeLocation, {
36105
+ explode: 0,
36106
+ vortex: 1,
36107
+ gravity: 2
36108
+ }[this.particleConfig.effectType] || 0);
36109
+ }
36110
+ cleanupTempBuffers(gl) {
36111
+ const tempSizeBuffer = this._tempSizeBuffer;
36112
+ tempSizeBuffer && (gl.deleteBuffer(tempSizeBuffer), delete this._tempSizeBuffer);
36113
+ }
36114
+ applyCanvas2DExplode(ctx, canvas, progress) {
36115
+ const centerX = canvas.width / 2,
36116
+ centerY = canvas.height / 2;
36117
+ ctx.save(), ctx.globalAlpha = Math.max(0, 1 - progress), ctx.translate(centerX, centerY);
36118
+ const scale = 1 + .5 * progress;
36119
+ ctx.scale(scale, scale), ctx.translate(-centerX, -centerY), ctx.drawImage(canvas, 0, 0), ctx.restore();
36120
+ }
36121
+ applyCanvas2DGravity(ctx, canvas, progress) {
36122
+ ctx.save(), ctx.globalAlpha = Math.max(0, 1 - progress);
36123
+ const offsetY = progress * canvas.height * .3;
36124
+ ctx.drawImage(canvas, 0, offsetY), ctx.restore();
36125
+ }
36126
+ applyCanvas2DVortex(ctx, canvas, progress) {
36127
+ const centerX = canvas.width / 2,
36128
+ centerY = canvas.height / 2;
36129
+ 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();
36130
+ }
36131
+ }
36132
+
36133
+ class Glitch extends Canvas2DEffectBase {
36134
+ constructor(from, to, duration, easing, params) {
36135
+ var _a, _b;
36136
+ super(from, to, duration, easing, params), this.glitchConfig = {
36137
+ effectType: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.effectType) || "rgb-shift",
36138
+ intensity: void 0 !== (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.intensity) ? params.options.intensity : .5
36139
+ };
36140
+ }
36141
+ applyCanvas2DEffect(canvas) {
36142
+ if (this.glitchConfig.intensity <= 0) {
36143
+ const outputCanvas = this.createOutputCanvas(canvas);
36144
+ return outputCanvas ? outputCanvas.canvas : null;
36145
+ }
36146
+ try {
36147
+ switch (this.glitchConfig.effectType) {
36148
+ case "rgb-shift":
36149
+ default:
36150
+ return this.applyRGBShiftGlitch(canvas);
36151
+ case "digital-distortion":
36152
+ return this.applyDigitalDistortionGlitch(canvas);
36153
+ case "scan-lines":
36154
+ return this.applyScanLineGlitch(canvas);
36155
+ case "data-corruption":
36156
+ return this.applyDataCorruptionGlitch(canvas);
36157
+ }
36158
+ } catch (error) {
36159
+ return console.warn("Glitch effect failed:", error), null;
36160
+ }
36161
+ }
36162
+ applyRGBShiftGlitch(canvas) {
36163
+ const outputCanvas = this.createOutputCanvas(canvas);
36164
+ if (!outputCanvas) return null;
36165
+ const {
36166
+ ctx: ctx
36167
+ } = outputCanvas;
36168
+ try {
36169
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
36170
+ const dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
36171
+ maxOffset = Math.floor(20 * dynamicIntensity),
36172
+ redOffset = this.generateRandomOffset(maxOffset),
36173
+ greenOffset = this.generateRandomOffset(maxOffset, .3),
36174
+ blueOffset = this.generateRandomOffset(-maxOffset),
36175
+ tempCanvas = ImageProcessUtils.createTempCanvas(canvas.width, canvas.height),
36176
+ tempCtx = tempCanvas.getContext("2d");
36177
+ tempCtx.drawImage(canvas, 0, 0);
36178
+ const originalImageData = tempCtx.getImageData(0, 0, canvas.width, canvas.height),
36179
+ redChannelData = ImageProcessUtils.extractChannel(originalImageData, 0),
36180
+ greenChannelData = ImageProcessUtils.extractChannel(originalImageData, 1),
36181
+ blueChannelData = ImageProcessUtils.extractChannel(originalImageData, 2);
36182
+ 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;
36183
+ } catch (error) {
36184
+ return console.warn("RGB shift glitch failed:", error), null;
36185
+ }
36186
+ }
36187
+ applyDigitalDistortionGlitch(canvas) {
36188
+ const outputCanvas = this.createOutputCanvas(canvas);
36189
+ if (!outputCanvas) return null;
36190
+ const {
36191
+ ctx: ctx
36192
+ } = outputCanvas;
36193
+ try {
36194
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
36195
+ dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
36196
+ distortedImageData = this.processDigitalDistortion(imageData, dynamicIntensity);
36197
+ return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(distortedImageData, 0, 0), outputCanvas.canvas;
36198
+ } catch (error) {
36199
+ return console.warn("Digital distortion glitch failed:", error), null;
36200
+ }
36201
+ }
36202
+ applyScanLineGlitch(canvas) {
36203
+ const outputCanvas = this.createOutputCanvas(canvas);
36204
+ if (!outputCanvas) return null;
36205
+ const {
36206
+ ctx: ctx
36207
+ } = outputCanvas;
36208
+ try {
36209
+ const dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
36210
+ lineSpacing = Math.max(2, Math.floor(10 - 8 * dynamicIntensity));
36211
+ ctx.globalCompositeOperation = "multiply";
36212
+ for (let y = 0; y < canvas.height; y += lineSpacing) if (Math.random() < dynamicIntensity) {
36213
+ const opacity = .1 + .4 * dynamicIntensity;
36214
+ ctx.fillStyle = `rgba(0, 0, 0, ${opacity})`, ctx.fillRect(0, y, canvas.width, 1);
36215
+ }
36216
+ ctx.globalCompositeOperation = "screen";
36217
+ const brightLineCount = Math.floor(20 * dynamicIntensity);
36218
+ for (let i = 0; i < brightLineCount; i++) {
36219
+ const y = Math.random() * canvas.height,
36220
+ opacity = .3 * dynamicIntensity;
36221
+ ctx.fillStyle = `rgba(255, 255, 255, ${opacity})`, ctx.fillRect(0, Math.floor(y), canvas.width, 1);
36222
+ }
36223
+ return ctx.globalCompositeOperation = "source-over", outputCanvas.canvas;
36224
+ } catch (error) {
36225
+ return console.warn("Scan line glitch failed:", error), null;
36226
+ }
36227
+ }
36228
+ applyDataCorruptionGlitch(canvas) {
36229
+ const outputCanvas = this.createOutputCanvas(canvas);
36230
+ if (!outputCanvas) return null;
36231
+ const {
36232
+ ctx: ctx
36233
+ } = outputCanvas;
36234
+ try {
36235
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
36236
+ dynamicIntensity = ImageProcessUtils.calculateDynamicStrength(this.glitchConfig.intensity, this.getAnimationTime()),
36237
+ corruptedImageData = this.processDataCorruption(imageData, dynamicIntensity);
36238
+ return ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.putImageData(corruptedImageData, 0, 0), outputCanvas.canvas;
36239
+ } catch (error) {
36240
+ return console.warn("Data corruption glitch failed:", error), null;
36241
+ }
36242
+ }
36243
+ generateRandomOffset(maxOffset, scale = 1) {
36244
+ return {
36245
+ x: (Math.random() - .5) * maxOffset,
36246
+ y: (Math.random() - .5) * maxOffset * scale
36247
+ };
36248
+ }
36249
+ processDigitalDistortion(imageData, intensity) {
36250
+ const {
36251
+ data: data,
36252
+ width: width,
36253
+ height: height
36254
+ } = imageData,
36255
+ result = new Uint8ClampedArray(data),
36256
+ sliceCount = Math.floor(20 * intensity) + 5,
36257
+ sliceHeight = Math.floor(height / sliceCount);
36258
+ for (let i = 0; i < sliceCount; i++) if (Math.random() < intensity) {
36259
+ const y = i * sliceHeight,
36260
+ sliceEnd = Math.min(y + sliceHeight, height),
36261
+ offset = Math.floor((Math.random() - .5) * width * intensity * .1);
36262
+ this.shiftSliceHorizontal(result, width, height, y, sliceEnd, offset);
36263
+ }
36264
+ const noiseIntensity = .3 * intensity;
36265
+ 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());
36266
+ return new ImageData(result, width, height);
36267
+ }
36268
+ shiftSliceHorizontal(data, width, height, startY, endY, offset) {
36269
+ const tempRow = new Uint8ClampedArray(4 * width);
36270
+ for (let y = startY; y < endY; y++) {
36271
+ const rowStart = y * width * 4;
36272
+ for (let x = 0; x < 4 * width; x++) tempRow[x] = data[rowStart + x];
36273
+ for (let x = 0; x < width; x++) {
36274
+ const targetIndex = rowStart + 4 * x,
36275
+ sourceIndex = 4 * ((x - offset + width) % width);
36276
+ data[targetIndex] = tempRow[sourceIndex], data[targetIndex + 1] = tempRow[sourceIndex + 1], data[targetIndex + 2] = tempRow[sourceIndex + 2], data[targetIndex + 3] = tempRow[sourceIndex + 3];
36277
+ }
36278
+ }
36279
+ }
36280
+ processDataCorruption(imageData, intensity) {
36281
+ const {
36282
+ data: data,
36283
+ width: width,
36284
+ height: height
36285
+ } = imageData,
36286
+ result = new Uint8ClampedArray(data),
36287
+ stripeCount = Math.floor(15 * intensity) + 5;
36288
+ for (let i = 0; i < stripeCount; i++) if (Math.random() < intensity) {
36289
+ const x = Math.floor(Math.random() * width),
36290
+ stripeWidth = Math.floor(5 * Math.random()) + 1,
36291
+ color = Math.random() < .5 ? 0 : 255;
36292
+ for (let y = 0; y < height; y++) for (let dx = 0; dx < stripeWidth && x + dx < width; dx++) {
36293
+ const index = 4 * (y * width + x + dx);
36294
+ result[index] = color, result[index + 1] = color, result[index + 2] = color;
36295
+ }
36296
+ }
36297
+ const corruptionCount = Math.floor(20 * intensity);
36298
+ for (let i = 0; i < corruptionCount; i++) {
36299
+ const blockX = Math.floor(Math.random() * width),
36300
+ blockY = Math.floor(Math.random() * height),
36301
+ blockW = Math.floor(20 * Math.random()) + 5,
36302
+ blockH = Math.floor(10 * Math.random()) + 2;
36303
+ this.corruptBlock(result, width, height, blockX, blockY, blockW, blockH);
36304
+ }
36305
+ return new ImageData(result, width, height);
36306
+ }
36307
+ corruptBlock(data, width, height, x, y, w, h) {
36308
+ for (let dy = 0; dy < h && y + dy < height; dy++) for (let dx = 0; dx < w && x + dx < width; dx++) {
36309
+ const index = 4 * ((y + dy) * width + (x + dx));
36310
+ Math.random() < .7 && (data[index] = 255 * Math.random(), data[index + 1] = 255 * Math.random(), data[index + 2] = 255 * Math.random());
36311
+ }
36312
+ }
36313
+ }
36314
+
36315
+ class GaussianBlur extends AStageAnimate {
36316
+ constructor(from, to, duration, easing, params) {
36317
+ var _a, _b;
36318
+ super(from, to, duration, easing, params), this.blurConfig = {
36319
+ blurRadius: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.blurRadius) || 8,
36320
+ useOptimizedBlur: void 0 === (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.useOptimizedBlur) || params.options.useOptimizedBlur
36321
+ };
36322
+ }
36323
+ applyCSSBlur(canvas, radius) {
36324
+ const c = vglobal.createCanvas({
36325
+ width: canvas.width,
36326
+ height: canvas.height,
36327
+ dpr: vglobal.devicePixelRatio
36328
+ }),
36329
+ ctx = c.getContext("2d");
36330
+ return ctx ? (ctx.filter = `blur(${radius}px)`, ctx.drawImage(canvas, 0, 0), ctx.filter = "none", c) : canvas;
36331
+ }
36332
+ applyDownsampleBlur(imageData, radius) {
36333
+ const {
36334
+ width: width,
36335
+ height: height
36336
+ } = imageData,
36337
+ downsample = Math.max(1, Math.floor(radius / 2)),
36338
+ smallWidth = Math.floor(width / downsample),
36339
+ smallHeight = Math.floor(height / downsample),
36340
+ tempCanvas = vglobal.createCanvas({
36341
+ width: smallWidth,
36342
+ height: smallHeight,
36343
+ dpr: 1
36344
+ }),
36345
+ tempCtx = tempCanvas.getContext("2d");
36346
+ if (!tempCtx) return imageData;
36347
+ const originalCanvas = vglobal.createCanvas({
36348
+ width: width,
36349
+ height: height,
36350
+ dpr: 1
36351
+ }),
36352
+ originalCtx = originalCanvas.getContext("2d");
36353
+ 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;
36354
+ }
36355
+ afterStageRender(stage, canvas) {
36356
+ if (this.blurConfig.blurRadius <= 0) return canvas;
36357
+ let result;
36358
+ if (this.blurConfig.useOptimizedBlur) result = this.applyCSSBlur(canvas, this.blurConfig.blurRadius);else {
36359
+ const c = vglobal.createCanvas({
36360
+ width: canvas.width,
36361
+ height: canvas.height,
36362
+ dpr: vglobal.devicePixelRatio
36363
+ }),
36364
+ ctx = c.getContext("2d");
36365
+ if (!ctx) return !1;
36366
+ ctx.clearRect(0, 0, canvas.width, canvas.height), ctx.drawImage(canvas, 0, 0);
36367
+ const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height),
36368
+ blurredImageData = this.applyDownsampleBlur(imageData, this.blurConfig.blurRadius);
36369
+ ctx.putImageData(blurredImageData, 0, 0), result = c;
36370
+ }
36371
+ const ctx = result.getContext("2d");
36372
+ 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;
36373
+ }
36374
+ }
36375
+
36376
+ class Pixelation extends DisappearAnimateBase {
36377
+ constructor(from, to, duration, easing, params) {
36378
+ var _a, _b;
36379
+ super(from, to, duration, easing, params), this.pixelationConfig = {
36380
+ maxPixelSize: (null === (_a = null == params ? void 0 : params.options) || void 0 === _a ? void 0 : _a.maxPixelSize) || 20,
36381
+ method: (null === (_b = null == params ? void 0 : params.options) || void 0 === _b ? void 0 : _b.method) || "out"
36382
+ };
36383
+ }
36384
+ applyDownsamplePixelation(canvas, pixelSize) {
36385
+ if (pixelSize <= 1) return canvas;
36386
+ const {
36387
+ width: width,
36388
+ height: height
36389
+ } = canvas,
36390
+ smallWidth = Math.ceil(width / pixelSize),
36391
+ smallHeight = Math.ceil(height / pixelSize),
36392
+ smallCanvas = vglobal.createCanvas({
36393
+ width: smallWidth,
36394
+ height: smallHeight,
36395
+ dpr: 1
36396
+ }),
36397
+ smallCtx = smallCanvas.getContext("2d");
36398
+ if (!smallCtx) return canvas;
36399
+ const outputCanvas = vglobal.createCanvas({
36400
+ width: width,
36401
+ height: height,
36402
+ dpr: vglobal.devicePixelRatio
36403
+ }),
36404
+ outputCtx = outputCanvas.getContext("2d");
36405
+ return outputCtx ? (smallCtx.imageSmoothingEnabled = !1, outputCtx.imageSmoothingEnabled = !1, smallCtx.drawImage(canvas, 0, 0, smallWidth, smallHeight), outputCtx.drawImage(smallCanvas, 0, 0, width, height), outputCanvas) : canvas;
36406
+ }
36407
+ updateAnimationProgress() {
36408
+ if ("in" === this.pixelationConfig.method) {
36409
+ return this.pixelationConfig.maxPixelSize - this.currentAnimationRatio * (this.pixelationConfig.maxPixelSize - 1);
36410
+ }
36411
+ return 1 + this.currentAnimationRatio * (this.pixelationConfig.maxPixelSize - 1);
36412
+ }
36413
+ afterStageRender(stage, canvas) {
36414
+ const currentPixelSize = this.updateAnimationProgress();
36415
+ if (currentPixelSize <= 1) return canvas;
36416
+ return this.applyDownsamplePixelation(canvas, currentPixelSize);
36417
+ }
36418
+ }
36419
+
35152
36420
  const registerCustomAnimate = () => {
35153
- 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);
36421
+ 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), AnimateExecutor.registerBuiltInAnimate("dissolve", Dissolve), AnimateExecutor.registerBuiltInAnimate("grayscale", Grayscale), AnimateExecutor.registerBuiltInAnimate("distortion", Distortion), AnimateExecutor.registerBuiltInAnimate("particle", Particle), AnimateExecutor.registerBuiltInAnimate("glitch", Glitch), AnimateExecutor.registerBuiltInAnimate("gaussianBlur", GaussianBlur), AnimateExecutor.registerBuiltInAnimate("pixelation", Pixelation);
35154
36422
  };
35155
36423
 
35156
- const version = "1.0.12";
36424
+ const version = "1.0.13-alpha.1";
35157
36425
  preLoadAllModule();
35158
36426
  if (isBrowserEnv()) {
35159
36427
  loadBrowserEnv(container);
@@ -35321,6 +36589,8 @@
35321
36589
  exports.DefaultTimeline = DefaultTimeline;
35322
36590
  exports.DefaultTransform = DefaultTransform;
35323
36591
  exports.DirectionalLight = DirectionalLight;
36592
+ exports.Dissolve = Dissolve;
36593
+ exports.Distortion = Distortion;
35324
36594
  exports.DragNDrop = DragNDrop;
35325
36595
  exports.DrawContribution = DrawContribution;
35326
36596
  exports.DrawItemInterceptor = DrawItemInterceptor;
@@ -35347,9 +36617,11 @@
35347
36617
  exports.GLYPH_NUMBER_TYPE = GLYPH_NUMBER_TYPE;
35348
36618
  exports.GRAPHIC_UPDATE_TAG_KEY = GRAPHIC_UPDATE_TAG_KEY;
35349
36619
  exports.GROUP_NUMBER_TYPE = GROUP_NUMBER_TYPE;
36620
+ exports.GaussianBlur = GaussianBlur;
35350
36621
  exports.Generator = Generator;
35351
36622
  exports.Gesture = Gesture;
35352
36623
  exports.GifImage = GifImage;
36624
+ exports.Glitch = Glitch;
35353
36625
  exports.GlobalPickerService = GlobalPickerService;
35354
36626
  exports.Glyph = Glyph;
35355
36627
  exports.GlyphRender = GlyphRender;
@@ -35360,6 +36632,7 @@
35360
36632
  exports.GraphicService = GraphicService;
35361
36633
  exports.GraphicStateExtension = GraphicStateExtension;
35362
36634
  exports.GraphicUtil = GraphicUtil;
36635
+ exports.Grayscale = Grayscale;
35363
36636
  exports.Group = Group;
35364
36637
  exports.GroupFadeIn = GroupFadeIn;
35365
36638
  exports.GroupFadeOut = GroupFadeOut;
@@ -35438,6 +36711,7 @@
35438
36711
  exports.POLYGON_NUMBER_TYPE = POLYGON_NUMBER_TYPE;
35439
36712
  exports.PURE_STYLE_KEY = PURE_STYLE_KEY;
35440
36713
  exports.PYRAMID3D_NUMBER_TYPE = PYRAMID3D_NUMBER_TYPE;
36714
+ exports.Particle = Particle;
35441
36715
  exports.Path = Path;
35442
36716
  exports.PathRender = PathRender;
35443
36717
  exports.PathRenderContribution = PathRenderContribution;
@@ -35445,6 +36719,7 @@
35445
36719
  exports.PickItemInterceptor = PickItemInterceptor;
35446
36720
  exports.PickServiceInterceptor = PickServiceInterceptor;
35447
36721
  exports.PickerService = PickerService;
36722
+ exports.Pixelation = Pixelation;
35448
36723
  exports.PluginService = PluginService;
35449
36724
  exports.Polygon = Polygon;
35450
36725
  exports.PolygonRender = PolygonRender;