@vfx-js/effects 1.2.0 → 1.4.0
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/README.md +2 -0
- package/lib/cjs/_figma-common.d.ts +8 -0
- package/lib/cjs/_figma-common.js +46 -0
- package/lib/cjs/_figma-common.js.map +1 -0
- package/lib/cjs/_pad.d.ts +2 -0
- package/lib/cjs/_pad.js +12 -0
- package/lib/cjs/_pad.js.map +1 -0
- package/lib/cjs/_particle-common.d.ts +0 -1
- package/lib/cjs/_particle-common.js +1 -6
- package/lib/cjs/_particle-common.js.map +1 -1
- package/lib/cjs/ascii.d.ts +137 -0
- package/lib/cjs/ascii.js +482 -0
- package/lib/cjs/ascii.js.map +1 -0
- package/lib/cjs/bloom.d.ts +2 -2
- package/lib/cjs/bloom.js +2 -7
- package/lib/cjs/bloom.js.map +1 -1
- package/lib/cjs/chromatic.d.ts +15 -0
- package/lib/cjs/chromatic.js +70 -0
- package/lib/cjs/chromatic.js.map +1 -0
- package/lib/cjs/colored-edges.d.ts +23 -0
- package/lib/cjs/colored-edges.js +88 -0
- package/lib/cjs/colored-edges.js.map +1 -0
- package/lib/cjs/datamosh.d.ts +11 -0
- package/lib/cjs/datamosh.js +28 -6
- package/lib/cjs/datamosh.js.map +1 -1
- package/lib/cjs/dither.d.ts +24 -0
- package/lib/cjs/dither.js +120 -0
- package/lib/cjs/dither.js.map +1 -0
- package/lib/cjs/duotone.d.ts +17 -0
- package/lib/cjs/duotone.js +62 -0
- package/lib/cjs/duotone.js.map +1 -0
- package/lib/cjs/fluid.js +1 -6
- package/lib/cjs/fluid.js.map +1 -1
- package/lib/cjs/glitch.d.ts +13 -0
- package/lib/cjs/glitch.js +108 -0
- package/lib/cjs/glitch.js.map +1 -0
- package/lib/cjs/gradient-map.d.ts +25 -0
- package/lib/cjs/gradient-map.js +154 -0
- package/lib/cjs/gradient-map.js.map +1 -0
- package/lib/cjs/hue-shift.d.ts +11 -0
- package/lib/cjs/hue-shift.js +65 -0
- package/lib/cjs/hue-shift.js.map +1 -0
- package/lib/cjs/index.d.ts +21 -0
- package/lib/cjs/index.js +45 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/light-streak.d.ts +91 -0
- package/lib/cjs/light-streak.js +385 -0
- package/lib/cjs/light-streak.js.map +1 -0
- package/lib/cjs/matrix.d.ts +135 -0
- package/lib/cjs/matrix.js +593 -0
- package/lib/cjs/matrix.js.map +1 -0
- package/lib/cjs/package.json +6 -6
- package/lib/cjs/particle-explode.d.ts +2 -2
- package/lib/cjs/particle-explode.js +4 -4
- package/lib/cjs/particle-explode.js.map +1 -1
- package/lib/cjs/particle.d.ts +2 -2
- package/lib/cjs/particle.js +1 -1
- package/lib/cjs/particle.js.map +1 -1
- package/lib/cjs/pattern-refraction.d.ts +31 -0
- package/lib/cjs/pattern-refraction.js +190 -0
- package/lib/cjs/pattern-refraction.js.map +1 -0
- package/lib/cjs/pixel-stretch.d.ts +21 -0
- package/lib/cjs/pixel-stretch.js +78 -0
- package/lib/cjs/pixel-stretch.js.map +1 -0
- package/lib/cjs/rainbow.d.ts +13 -0
- package/lib/cjs/rainbow.js +79 -0
- package/lib/cjs/rainbow.js.map +1 -0
- package/lib/cjs/rgb-glitch.d.ts +13 -0
- package/lib/cjs/rgb-glitch.js +79 -0
- package/lib/cjs/rgb-glitch.js.map +1 -0
- package/lib/cjs/rgb-shift.d.ts +13 -0
- package/lib/cjs/rgb-shift.js +76 -0
- package/lib/cjs/rgb-shift.js.map +1 -0
- package/lib/cjs/sinewave.d.ts +17 -0
- package/lib/cjs/sinewave.js +76 -0
- package/lib/cjs/sinewave.js.map +1 -0
- package/lib/cjs/slice-shift.d.ts +21 -0
- package/lib/cjs/slice-shift.js +75 -0
- package/lib/cjs/slice-shift.js.map +1 -0
- package/lib/cjs/tile-pixelate.d.ts +28 -0
- package/lib/cjs/tile-pixelate.js +168 -0
- package/lib/cjs/tile-pixelate.js.map +1 -0
- package/lib/cjs/tritone.d.ts +18 -0
- package/lib/cjs/tritone.js +67 -0
- package/lib/cjs/tritone.js.map +1 -0
- package/lib/cjs/vignette.d.ts +15 -0
- package/lib/cjs/vignette.js +59 -0
- package/lib/cjs/vignette.js.map +1 -0
- package/lib/cjs/warp.d.ts +22 -0
- package/lib/cjs/warp.js +92 -0
- package/lib/cjs/warp.js.map +1 -0
- package/lib/esm/_figma-common.d.ts +8 -0
- package/lib/esm/_figma-common.js +42 -0
- package/lib/esm/_figma-common.js.map +1 -0
- package/lib/esm/_pad.d.ts +2 -0
- package/lib/esm/_pad.js +9 -0
- package/lib/esm/_pad.js.map +1 -0
- package/lib/esm/_particle-common.d.ts +0 -1
- package/lib/esm/_particle-common.js +0 -5
- package/lib/esm/_particle-common.js.map +1 -1
- package/lib/esm/ascii.d.ts +137 -0
- package/lib/esm/ascii.js +478 -0
- package/lib/esm/ascii.js.map +1 -0
- package/lib/esm/bloom.d.ts +2 -2
- package/lib/esm/bloom.js +2 -7
- package/lib/esm/bloom.js.map +1 -1
- package/lib/esm/chromatic.d.ts +15 -0
- package/lib/esm/chromatic.js +66 -0
- package/lib/esm/chromatic.js.map +1 -0
- package/lib/esm/colored-edges.d.ts +23 -0
- package/lib/esm/colored-edges.js +84 -0
- package/lib/esm/colored-edges.js.map +1 -0
- package/lib/esm/datamosh.d.ts +11 -0
- package/lib/esm/datamosh.js +28 -6
- package/lib/esm/datamosh.js.map +1 -1
- package/lib/esm/dither.d.ts +24 -0
- package/lib/esm/dither.js +116 -0
- package/lib/esm/dither.js.map +1 -0
- package/lib/esm/duotone.d.ts +17 -0
- package/lib/esm/duotone.js +58 -0
- package/lib/esm/duotone.js.map +1 -0
- package/lib/esm/fluid.js +1 -6
- package/lib/esm/fluid.js.map +1 -1
- package/lib/esm/glitch.d.ts +13 -0
- package/lib/esm/glitch.js +104 -0
- package/lib/esm/glitch.js.map +1 -0
- package/lib/esm/gradient-map.d.ts +25 -0
- package/lib/esm/gradient-map.js +150 -0
- package/lib/esm/gradient-map.js.map +1 -0
- package/lib/esm/hue-shift.d.ts +11 -0
- package/lib/esm/hue-shift.js +61 -0
- package/lib/esm/hue-shift.js.map +1 -0
- package/lib/esm/index.d.ts +21 -0
- package/lib/esm/index.js +21 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/light-streak.d.ts +91 -0
- package/lib/esm/light-streak.js +381 -0
- package/lib/esm/light-streak.js.map +1 -0
- package/lib/esm/matrix.d.ts +135 -0
- package/lib/esm/matrix.js +589 -0
- package/lib/esm/matrix.js.map +1 -0
- package/lib/esm/package.json +6 -6
- package/lib/esm/particle-explode.d.ts +2 -2
- package/lib/esm/particle-explode.js +5 -5
- package/lib/esm/particle-explode.js.map +1 -1
- package/lib/esm/particle.d.ts +2 -2
- package/lib/esm/particle.js +2 -2
- package/lib/esm/particle.js.map +1 -1
- package/lib/esm/pattern-refraction.d.ts +31 -0
- package/lib/esm/pattern-refraction.js +186 -0
- package/lib/esm/pattern-refraction.js.map +1 -0
- package/lib/esm/pixel-stretch.d.ts +21 -0
- package/lib/esm/pixel-stretch.js +74 -0
- package/lib/esm/pixel-stretch.js.map +1 -0
- package/lib/esm/rainbow.d.ts +13 -0
- package/lib/esm/rainbow.js +75 -0
- package/lib/esm/rainbow.js.map +1 -0
- package/lib/esm/rgb-glitch.d.ts +13 -0
- package/lib/esm/rgb-glitch.js +75 -0
- package/lib/esm/rgb-glitch.js.map +1 -0
- package/lib/esm/rgb-shift.d.ts +13 -0
- package/lib/esm/rgb-shift.js +72 -0
- package/lib/esm/rgb-shift.js.map +1 -0
- package/lib/esm/sinewave.d.ts +17 -0
- package/lib/esm/sinewave.js +72 -0
- package/lib/esm/sinewave.js.map +1 -0
- package/lib/esm/slice-shift.d.ts +21 -0
- package/lib/esm/slice-shift.js +71 -0
- package/lib/esm/slice-shift.js.map +1 -0
- package/lib/esm/tile-pixelate.d.ts +28 -0
- package/lib/esm/tile-pixelate.js +164 -0
- package/lib/esm/tile-pixelate.js.map +1 -0
- package/lib/esm/tritone.d.ts +18 -0
- package/lib/esm/tritone.js +63 -0
- package/lib/esm/tritone.js.map +1 -0
- package/lib/esm/vignette.d.ts +15 -0
- package/lib/esm/vignette.js +55 -0
- package/lib/esm/vignette.js.map +1 -0
- package/lib/esm/warp.d.ts +22 -0
- package/lib/esm/warp.js +88 -0
- package/lib/esm/warp.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Effect, EffectContext } from "@vfx-js/core";
|
|
2
|
+
export type VignetteParams = {
|
|
3
|
+
/** Strength of the edge darkening. */
|
|
4
|
+
intensity: number;
|
|
5
|
+
/** Radius (in normalised units) where the darkening begins. */
|
|
6
|
+
radius: number;
|
|
7
|
+
/** Falloff exponent of the darkening curve. */
|
|
8
|
+
power: number;
|
|
9
|
+
};
|
|
10
|
+
export declare class VignetteEffect implements Effect {
|
|
11
|
+
params: VignetteParams;
|
|
12
|
+
constructor(initial?: Partial<VignetteParams>);
|
|
13
|
+
setParams(updates: Partial<VignetteParams>): void;
|
|
14
|
+
render(ctx: EffectContext): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VignetteEffect = void 0;
|
|
4
|
+
const FRAG_VIGNETTE = `#version 300 es
|
|
5
|
+
precision highp float;
|
|
6
|
+
in vec2 uvContent;
|
|
7
|
+
out vec4 outColor;
|
|
8
|
+
uniform sampler2D src;
|
|
9
|
+
uniform vec4 srcRectUv;
|
|
10
|
+
uniform float aspect;
|
|
11
|
+
uniform float intensity;
|
|
12
|
+
uniform float radius;
|
|
13
|
+
uniform float power;
|
|
14
|
+
|
|
15
|
+
vec4 readTex(vec2 c) {
|
|
16
|
+
if (c.x < 0.0 || c.x > 1.0 || c.y < 0.0 || c.y > 1.0) return vec4(0.0);
|
|
17
|
+
return texture(src, srcRectUv.xy + c * srcRectUv.zw);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
void main() {
|
|
21
|
+
vec2 uv = uvContent;
|
|
22
|
+
outColor = readTex(uv);
|
|
23
|
+
|
|
24
|
+
vec2 p = uv * 2.0 - 1.0;
|
|
25
|
+
p.x *= aspect;
|
|
26
|
+
|
|
27
|
+
float l = max(length(p) - radius, 0.);
|
|
28
|
+
outColor *= 1. - pow(l, power) * intensity;
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
const DEFAULT_PARAMS = {
|
|
32
|
+
intensity: 0.5,
|
|
33
|
+
radius: 1.0,
|
|
34
|
+
power: 2.0,
|
|
35
|
+
};
|
|
36
|
+
class VignetteEffect {
|
|
37
|
+
constructor(initial = {}) {
|
|
38
|
+
this.params = { ...DEFAULT_PARAMS, ...initial };
|
|
39
|
+
}
|
|
40
|
+
setParams(updates) {
|
|
41
|
+
Object.assign(this.params, updates);
|
|
42
|
+
}
|
|
43
|
+
render(ctx) {
|
|
44
|
+
const [w, h] = ctx.dims.element;
|
|
45
|
+
ctx.draw({
|
|
46
|
+
frag: FRAG_VIGNETTE,
|
|
47
|
+
uniforms: {
|
|
48
|
+
src: ctx.src,
|
|
49
|
+
aspect: (w || 1) / (h || 1),
|
|
50
|
+
intensity: this.params.intensity,
|
|
51
|
+
radius: this.params.radius,
|
|
52
|
+
power: this.params.power,
|
|
53
|
+
},
|
|
54
|
+
target: ctx.target,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.VignetteEffect = VignetteEffect;
|
|
59
|
+
//# sourceMappingURL=vignette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vignette.js","sourceRoot":"","sources":["../../src/vignette.ts"],"names":[],"mappings":";;;AAIA,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BrB,CAAC;AAWF,MAAM,cAAc,GAAmB;IACnC,SAAS,EAAE,GAAG;IACd,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,GAAG;CACb,CAAC;AAEF,MAAa,cAAc;IAGvB,YAAY,UAAmC,EAAE;QAC7C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,OAAO,EAAE,CAAC;IACpD,CAAC;IAED,SAAS,CAAC,OAAgC;QACtC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,GAAkB;QACrB,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;QAChC,GAAG,CAAC,IAAI,CAAC;YACL,IAAI,EAAE,aAAa;YACnB,QAAQ,EAAE;gBACN,GAAG,EAAE,GAAG,CAAC,GAAG;gBACZ,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;gBAC3B,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS;gBAChC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;gBAC1B,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK;aAC3B;YACD,MAAM,EAAE,GAAG,CAAC,MAAM;SACrB,CAAC,CAAC;IACP,CAAC;CACJ;AAzBD,wCAyBC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Effect, EffectContext } from "@vfx-js/core";
|
|
2
|
+
export type WarpType = "sine wave" | "twist" | "ripple";
|
|
3
|
+
export type WarpParams = {
|
|
4
|
+
/** Distortion shape. */
|
|
5
|
+
type: WarpType;
|
|
6
|
+
/** Distortion strength. */
|
|
7
|
+
amplitude: number;
|
|
8
|
+
/** Spatial frequency (affects the wave-based types). */
|
|
9
|
+
frequency: number;
|
|
10
|
+
/** Effect center X, in [0, 1]. */
|
|
11
|
+
centerX: number;
|
|
12
|
+
/** Effect center Y, in [0, 1]. */
|
|
13
|
+
centerY: number;
|
|
14
|
+
/** Animation speed for the wave-based types (0 = static). */
|
|
15
|
+
speed: number;
|
|
16
|
+
};
|
|
17
|
+
export declare class WarpEffect implements Effect {
|
|
18
|
+
params: WarpParams;
|
|
19
|
+
constructor(initial?: Partial<WarpParams>);
|
|
20
|
+
setParams(updates: Partial<WarpParams>): void;
|
|
21
|
+
render(ctx: EffectContext): void;
|
|
22
|
+
}
|
package/lib/cjs/warp.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WarpEffect = void 0;
|
|
4
|
+
const _figma_common_1 = require("./_figma-common");
|
|
5
|
+
const FRAG_WARP = `#version 300 es
|
|
6
|
+
precision highp float;
|
|
7
|
+
#define TAU 6.28318530718
|
|
8
|
+
in vec2 uvContent;
|
|
9
|
+
out vec4 outColor;
|
|
10
|
+
uniform sampler2D src;
|
|
11
|
+
uniform vec4 srcRectUv;
|
|
12
|
+
uniform vec2 center;
|
|
13
|
+
uniform vec2 resolution;
|
|
14
|
+
uniform int mode;
|
|
15
|
+
uniform float amp;
|
|
16
|
+
uniform float freq;
|
|
17
|
+
uniform float time;
|
|
18
|
+
${_figma_common_1.GLSL_COMMON}
|
|
19
|
+
|
|
20
|
+
vec4 readTex(vec2 c) {
|
|
21
|
+
c = clamp(c, 0.0, 1.0);
|
|
22
|
+
return texture(src, srcRectUv.xy + c * srcRectUv.zw);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
void main(void) {
|
|
26
|
+
vec2 uv = uvContent;
|
|
27
|
+
vec2 p = uv - center;
|
|
28
|
+
float r = length(p);
|
|
29
|
+
|
|
30
|
+
if (mode == 0) {
|
|
31
|
+
// Sine wave: ripples per axis, centered so both diagonals stay straight.
|
|
32
|
+
uv.x -= sin(p.y * freq * TAU + time) * amp * 0.05;
|
|
33
|
+
uv.y -= sin(p.x * freq * TAU + time) * amp * 0.05;
|
|
34
|
+
} else if (mode == 1) {
|
|
35
|
+
// Twist: swirl that rotates most at the center and unwinds to the edge.
|
|
36
|
+
// aspect scale keeps the field circular and contained in the element.
|
|
37
|
+
vec2 s = resolution / max(resolution.x, resolution.y);
|
|
38
|
+
vec2 tp = (uv - center) * 2.0 * s;
|
|
39
|
+
float t = length(tp) / 1.41421356;
|
|
40
|
+
tp = rot2d(amp * freq * (1.0 - t)) * tp;
|
|
41
|
+
uv = tp / s * 0.5 + center;
|
|
42
|
+
} else if (mode == 2) {
|
|
43
|
+
// Ripple: scale the radius by a cosine of the distance from center.
|
|
44
|
+
p *= 1.0 - cos((r-.5) * freq * 10.0 + time) * amp * 0.2;
|
|
45
|
+
uv = p + center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
outColor = readTex(uv);
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
const WARP_MODES = {
|
|
52
|
+
"sine wave": 0,
|
|
53
|
+
twist: 1,
|
|
54
|
+
ripple: 2,
|
|
55
|
+
};
|
|
56
|
+
const DEFAULT_PARAMS = {
|
|
57
|
+
type: "twist",
|
|
58
|
+
amplitude: 3,
|
|
59
|
+
frequency: 1,
|
|
60
|
+
centerX: 0.5,
|
|
61
|
+
centerY: 0.5,
|
|
62
|
+
speed: 0,
|
|
63
|
+
};
|
|
64
|
+
class WarpEffect {
|
|
65
|
+
constructor(initial = {}) {
|
|
66
|
+
this.params = { ...DEFAULT_PARAMS, ...initial };
|
|
67
|
+
}
|
|
68
|
+
setParams(updates) {
|
|
69
|
+
Object.assign(this.params, updates);
|
|
70
|
+
}
|
|
71
|
+
render(ctx) {
|
|
72
|
+
const p = this.params;
|
|
73
|
+
ctx.draw({
|
|
74
|
+
frag: FRAG_WARP,
|
|
75
|
+
uniforms: {
|
|
76
|
+
src: ctx.src,
|
|
77
|
+
center: [p.centerX, p.centerY],
|
|
78
|
+
resolution: [
|
|
79
|
+
ctx.dims.element[0] || 1,
|
|
80
|
+
ctx.dims.element[1] || 1,
|
|
81
|
+
],
|
|
82
|
+
mode: WARP_MODES[p.type] ?? 0,
|
|
83
|
+
amp: p.amplitude,
|
|
84
|
+
freq: p.frequency,
|
|
85
|
+
time: ctx.time * p.speed,
|
|
86
|
+
},
|
|
87
|
+
target: ctx.target,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.WarpEffect = WarpEffect;
|
|
92
|
+
//# sourceMappingURL=warp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warp.js","sourceRoot":"","sources":["../../src/warp.ts"],"names":[],"mappings":";;;AAKA,mDAA8C;AAE9C,MAAM,SAAS,GAAG;;;;;;;;;;;;;EAahB,2BAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCZ,CAAC;AAIF,MAAM,UAAU,GAA6B;IACzC,WAAW,EAAE,CAAC;IACd,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;CACZ,CAAC;AAiBF,MAAM,cAAc,GAAe;IAC/B,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC;IACZ,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,GAAG;IACZ,KAAK,EAAE,CAAC;CACX,CAAC;AAEF,MAAa,UAAU;IAGnB,YAAY,UAA+B,EAAE;QACzC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,OAAO,EAAE,CAAC;IACpD,CAAC;IAED,SAAS,CAAC,OAA4B;QAClC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,GAAkB;QACrB,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,GAAG,CAAC,IAAI,CAAC;YACL,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE;gBACN,GAAG,EAAE,GAAG,CAAC,GAAG;gBACZ,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC;gBAC9B,UAAU,EAAE;oBACR,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;oBACxB,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;iBAC3B;gBACD,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC7B,GAAG,EAAE,CAAC,CAAC,SAAS;gBAChB,IAAI,EAAE,CAAC,CAAC,SAAS;gBACjB,IAAI,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK;aAC3B;YACD,MAAM,EAAE,GAAG,CAAC,MAAM;SACrB,CAAC,CAAC;IACP,CAAC;CACJ;AA9BD,gCA8BC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a hex color into an RGBA tuple in [0, 1].
|
|
3
|
+
* Accepts `#rgb`, `#rgba`, `#rrggbb`, or `#rrggbbaa` (with or without `#`).
|
|
4
|
+
* Alpha defaults to 1. Falls back to transparent black on a malformed value.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseHexColor(hex: string): [number, number, number, number];
|
|
7
|
+
/** 2D rotation matrix and a small hash, shared by the warp/slice ports. */
|
|
8
|
+
export declare const GLSL_COMMON = "\nmat2 rot2d(float a) {\n float c = cos(a), s = sin(a);\n return mat2(c, -s, s, c);\n}\n\nfloat hash11(float p) {\n p = fract(p * 0.1031);\n p *= p + 33.33;\n p *= p + p;\n return fract(p);\n}\n";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Shared helpers for the Figma Shader effect ports.
|
|
2
|
+
// Internal module — not part of the public @vfx-js/effects API.
|
|
3
|
+
/**
|
|
4
|
+
* Parse a hex color into an RGBA tuple in [0, 1].
|
|
5
|
+
* Accepts `#rgb`, `#rgba`, `#rrggbb`, or `#rrggbbaa` (with or without `#`).
|
|
6
|
+
* Alpha defaults to 1. Falls back to transparent black on a malformed value.
|
|
7
|
+
*/
|
|
8
|
+
export function parseHexColor(hex) {
|
|
9
|
+
let s = hex.startsWith("#") ? hex.slice(1) : hex;
|
|
10
|
+
if (s.length === 3 || s.length === 4) {
|
|
11
|
+
s = s
|
|
12
|
+
.split("")
|
|
13
|
+
.map((c) => c + c)
|
|
14
|
+
.join("");
|
|
15
|
+
}
|
|
16
|
+
if (s.length === 6) {
|
|
17
|
+
s += "ff";
|
|
18
|
+
}
|
|
19
|
+
if (s.length !== 8) {
|
|
20
|
+
return [0, 0, 0, 0];
|
|
21
|
+
}
|
|
22
|
+
const r = Number.parseInt(s.slice(0, 2), 16) / 255;
|
|
23
|
+
const g = Number.parseInt(s.slice(2, 4), 16) / 255;
|
|
24
|
+
const b = Number.parseInt(s.slice(4, 6), 16) / 255;
|
|
25
|
+
const a = Number.parseInt(s.slice(6, 8), 16) / 255;
|
|
26
|
+
return [r, g, b, a];
|
|
27
|
+
}
|
|
28
|
+
/** 2D rotation matrix and a small hash, shared by the warp/slice ports. */
|
|
29
|
+
export const GLSL_COMMON = `
|
|
30
|
+
mat2 rot2d(float a) {
|
|
31
|
+
float c = cos(a), s = sin(a);
|
|
32
|
+
return mat2(c, -s, s, c);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
float hash11(float p) {
|
|
36
|
+
p = fract(p * 0.1031);
|
|
37
|
+
p *= p + 33.33;
|
|
38
|
+
p *= p + p;
|
|
39
|
+
return fract(p);
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
//# sourceMappingURL=_figma-common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_figma-common.js","sourceRoot":"","sources":["../../src/_figma-common.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,gEAAgE;AAEhE;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACrC,IAAI,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACjD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,CAAC,GAAG,CAAC;aACA,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;aACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IACD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjB,CAAC,IAAI,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACxB,CAAC;IACD,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;IACnD,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;IACnD,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;IACnD,MAAM,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC;IACnD,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACxB,CAAC;AAED,2EAA2E;AAC3E,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;CAY1B,CAAC"}
|
package/lib/esm/_pad.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function padOutputRect(pad, dims) {
|
|
2
|
+
if (pad === "fullscreen") {
|
|
3
|
+
return dims.canvasRect;
|
|
4
|
+
}
|
|
5
|
+
const px = pad * dims.pixelRatio;
|
|
6
|
+
const [, , ew, eh] = dims.contentRect;
|
|
7
|
+
return [-px, -px, ew + 2 * px, eh + 2 * px];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=_pad.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_pad.js","sourceRoot":"","sources":["../../src/_pad.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,aAAa,CACzB,GAA0B,EAC1B,IAAgB;IAEhB,IAAI,GAAG,KAAK,YAAY,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IACD,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC;IACjC,MAAM,CAAC,EAAE,AAAD,EAAG,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;IACtC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare const QUAD_VERTS: Float32Array<ArrayBuffer>;
|
|
2
2
|
export declare const GLSL_HASH = "\nfloat hash21(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n}\n";
|
|
3
|
-
export declare const FRAG_CLEAR = "#version 300 es\nprecision highp float;\nout vec4 outColor;\nvoid main() { outColor = vec4(0.0); }\n";
|
|
4
3
|
export declare const FRAG_PARTICLE = "#version 300 es\nprecision highp float;\nin vec2 vCorner;\nin vec4 vColor;\nout vec4 outColor;\n\nvoid main() {\n float d = length(vCorner) * 2.0;\n float fall = 1.0 - smoothstep(0.6, 1.0, d);\n if (fall <= 0.0) discard;\n float a = vColor.a * fall;\n outColor = vec4(vColor.rgb * a, a);\n}\n";
|
|
5
4
|
export declare const FRAG_TRAIL_COMPOSITE = "#version 300 es\nprecision highp float;\nin vec2 uv;\nout vec4 outColor;\n\nuniform sampler2D trailPrev;\nuniform sampler2D particleStamp;\nuniform float trailFade;\nuniform int blendMode;\n\nvoid main() {\n vec4 prev = texture(trailPrev, uv);\n vec4 stamp = texture(particleStamp, uv);\n vec4 faded = prev * trailFade;\n if (blendMode == 1) {\n outColor = vec4(\n stamp.rgb + faded.rgb * (1.0 - stamp.a),\n clamp(stamp.a + faded.a * (1.0 - stamp.a), 0.0, 1.0)\n );\n } else {\n outColor = vec4(\n faded.rgb + stamp.rgb,\n clamp(faded.a + stamp.a, 0.0, 1.0)\n );\n }\n}\n";
|
|
6
5
|
export declare function stateSizeFromCount(count: number): number;
|
|
@@ -11,11 +11,6 @@ float hash21(vec2 p) {
|
|
|
11
11
|
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
|
|
12
12
|
}
|
|
13
13
|
`;
|
|
14
|
-
export const FRAG_CLEAR = `#version 300 es
|
|
15
|
-
precision highp float;
|
|
16
|
-
out vec4 outColor;
|
|
17
|
-
void main() { outColor = vec4(0.0); }
|
|
18
|
-
`;
|
|
19
14
|
// Disc sprite with smooth falloff. Premultiplied output: additive
|
|
20
15
|
// blend lets overlapping particles brighten naturally.
|
|
21
16
|
export const FRAG_PARTICLE = `#version 300 es
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_particle-common.js","sourceRoot":"","sources":["../../src/_particle-common.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAE3D,qEAAqE;AACrE,oEAAoE;AACpE,8BAA8B;AAC9B,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,YAAY,CAAC;IACvC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG;CACnE,CAAC,CAAC;AAEH,wDAAwD;AACxD,MAAM,CAAC,MAAM,SAAS,GAAG;;;;CAIxB,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"_particle-common.js","sourceRoot":"","sources":["../../src/_particle-common.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAE3D,qEAAqE;AACrE,oEAAoE;AACpE,8BAA8B;AAC9B,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,YAAY,CAAC;IACvC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG;CACnE,CAAC,CAAC;AAEH,wDAAwD;AACxD,MAAM,CAAC,MAAM,SAAS,GAAG;;;;CAIxB,CAAC;AAEF,kEAAkE;AAClE,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;CAa5B,CAAC;AAEF,sEAAsE;AACtE,mEAAmE;AACnE,gDAAgD;AAChD,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BnC,CAAC;AAEF,6DAA6D;AAC7D,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC5C,MAAM,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC;AAED,kEAAkE;AAClE,gEAAgE;AAChE,MAAM,UAAU,aAAa,CAAC,KAAa;IACvC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,CAAC;IACb,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAW;IAChC,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;IAClB,OAAO;QACH,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG;QACxB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG;QACvB,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG;KACnB,CAAC;AACN,CAAC;AAED,wDAAwD;AACxD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;AAC1B,MAAM,UAAU,OAAO,CAAC,EAAU;IAC9B,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { Effect, EffectContext } from "@vfx-js/core";
|
|
2
|
+
/** RGBA colour, each channel in [0, 1]. */
|
|
3
|
+
export type AsciiColor = [number, number, number, number];
|
|
4
|
+
/**
|
|
5
|
+
* A character ramp ordered **dark → light**: index `0` maps to the
|
|
6
|
+
* darkest input luminance, the last entry to the brightest. Pass a
|
|
7
|
+
* string (split per Unicode code point) or an array of single chars.
|
|
8
|
+
*/
|
|
9
|
+
export type AsciiCharRamp = string | readonly string[];
|
|
10
|
+
/**
|
|
11
|
+
* An image tile source. Strings are treated as URLs (loaded and decoded
|
|
12
|
+
* in `init()`); the rest are used directly.
|
|
13
|
+
*/
|
|
14
|
+
export type AsciiImageSource = HTMLImageElement | HTMLCanvasElement | ImageBitmap | string;
|
|
15
|
+
/** Name of a built-in {@link ASCII_PRESETS} ramp. */
|
|
16
|
+
export type AsciiPresetName = "standard" | "minimal" | "blocks" | "dots" | "circles" | "detailed";
|
|
17
|
+
/**
|
|
18
|
+
* Built-in character ramps, ordered dark → light. Suited for
|
|
19
|
+
* light-on-dark output (more "ink" = brighter); flip with
|
|
20
|
+
* `invert: true` for dark-on-light.
|
|
21
|
+
*/
|
|
22
|
+
export declare const ASCII_PRESETS: Record<AsciiPresetName, string>;
|
|
23
|
+
export type AsciiParams = {
|
|
24
|
+
/**
|
|
25
|
+
* Cell size in CSS px. A single number is a square cell; a
|
|
26
|
+
* `[width, height]` tuple sets the axes independently.
|
|
27
|
+
*
|
|
28
|
+
* Glyphs always keep their native aspect ratio — a cell wider/taller
|
|
29
|
+
* than the character box letterboxes the glyph rather than stretching
|
|
30
|
+
* it. Set the cell to the font's character aspect (≈ advance : em, so
|
|
31
|
+
* cells narrower than they are tall) for gap-free tiling.
|
|
32
|
+
*/
|
|
33
|
+
grid: number | [number, number];
|
|
34
|
+
/**
|
|
35
|
+
* Character ramp, ordered dark → light. Overrides {@link preset}.
|
|
36
|
+
*
|
|
37
|
+
* Baked into the glyph atlas at `init()`; changing it (or `font` /
|
|
38
|
+
* `fontWeight`) after the effect is added has no effect until it is
|
|
39
|
+
* re-added.
|
|
40
|
+
*/
|
|
41
|
+
chars?: AsciiCharRamp;
|
|
42
|
+
/** Built-in ramp to use when {@link chars} is omitted. */
|
|
43
|
+
preset: AsciiPresetName;
|
|
44
|
+
/**
|
|
45
|
+
* Image tiles, ordered dark → light — an alternative to character
|
|
46
|
+
* glyphs. Takes precedence over {@link chars} / {@link preset} when
|
|
47
|
+
* non-empty. Each tile keeps its own colour (the `color` RGB /
|
|
48
|
+
* `colorFromSource` tint is bypassed, though `color`'s alpha still
|
|
49
|
+
* scales opacity), is contain-fitted into the cell at a shared aspect
|
|
50
|
+
* (taken from the first tile), and the atlas is auto-downscaled to
|
|
51
|
+
* stay within GPU texture limits.
|
|
52
|
+
*
|
|
53
|
+
* Baked into the atlas at `init()`; change by re-adding the effect.
|
|
54
|
+
*/
|
|
55
|
+
tiles?: readonly AsciiImageSource[];
|
|
56
|
+
/**
|
|
57
|
+
* CSS font family used to render the glyph atlas (e.g. `"monospace"`,
|
|
58
|
+
* `"Helvetica"`). Loaded via the Font Loading API before the atlas is
|
|
59
|
+
* built. Construction-time only (see {@link chars}).
|
|
60
|
+
*/
|
|
61
|
+
font: string;
|
|
62
|
+
/**
|
|
63
|
+
* Character box aspect ratio (width / height) used to keep glyphs
|
|
64
|
+
* undistorted when the cell is non-square.
|
|
65
|
+
*
|
|
66
|
+
* Omit (default) to auto-measure it from the font — the glyph advance
|
|
67
|
+
* (`measureText`) over the em height. That is exact for monospace
|
|
68
|
+
* fonts; set it explicitly for proportional fonts, non-browser
|
|
69
|
+
* builds, or to force a specific look (e.g. `0.5` for tall, narrow
|
|
70
|
+
* characters). Construction-time only (see {@link chars}).
|
|
71
|
+
*/
|
|
72
|
+
charAspect?: number;
|
|
73
|
+
/**
|
|
74
|
+
* CSS font weight for the glyph atlas — a keyword (`"normal"`,
|
|
75
|
+
* `"bold"`) or numeric weight (`100`–`900`). Construction-time only
|
|
76
|
+
* (see {@link chars}).
|
|
77
|
+
*/
|
|
78
|
+
fontWeight: string | number;
|
|
79
|
+
/** Fixed glyph colour, used when {@link colorFromSource} is `false`. */
|
|
80
|
+
color: AsciiColor;
|
|
81
|
+
/** Cell backdrop behind the glyphs, non-premultiplied. */
|
|
82
|
+
background: AsciiColor;
|
|
83
|
+
/** Tint each glyph with the average colour of its source cell. */
|
|
84
|
+
colorFromSource: boolean;
|
|
85
|
+
/** Flip the luminance → glyph mapping (for dark-on-light output). */
|
|
86
|
+
invert: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Ordered (Bayer 4×4) dithering amount, [0, 1]. `0` disables it; `1`
|
|
89
|
+
* spreads each quantisation step across a full ramp level so short
|
|
90
|
+
* ramps (e.g. `minimal`, `dots`) render smooth gradients instead of
|
|
91
|
+
* hard bands. Applied per cell, so each character stays consistent.
|
|
92
|
+
*/
|
|
93
|
+
dither: number;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* ASCII / glyph-mosaic effect.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* vfx.add(el, { effect: new AsciiEffect({ font: "Helvetica", grid: 16 }) });
|
|
101
|
+
* vfx.add(el, { effect: new AsciiEffect({ chars: [" ", ".", "+", "#"] }) });
|
|
102
|
+
* // Image tiles (dark → light), each keeping its own colour:
|
|
103
|
+
* vfx.add(el, { effect: new AsciiEffect({ tiles: ["/0.png", "/1.png"] }) });
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* Glyphs keep their native aspect ratio regardless of the `grid` ratio:
|
|
107
|
+
* each is fitted (contain) into its cell, so a non-square cell letterboxes
|
|
108
|
+
* rather than stretching the character. Match `grid` to the font's
|
|
109
|
+
* character box (≈ advance : em) for gap-free tiling.
|
|
110
|
+
*
|
|
111
|
+
* `grid`, `color`, `background`, `colorFromSource`, `invert`, and `dither`
|
|
112
|
+
* are live (read every frame). `chars` / `tiles` / `font` / `fontWeight` /
|
|
113
|
+
* `charAspect` are baked into the atlas at `init()` — after changing them
|
|
114
|
+
* via `setParams`, call {@link AsciiEffect.updateAtlas} (or re-add the
|
|
115
|
+
* effect) to rebuild.
|
|
116
|
+
*/
|
|
117
|
+
export declare class AsciiEffect implements Effect {
|
|
118
|
+
#private;
|
|
119
|
+
params: AsciiParams;
|
|
120
|
+
constructor(initial?: Partial<AsciiParams>);
|
|
121
|
+
setParams(updates: Partial<AsciiParams>): void;
|
|
122
|
+
init(ctx: EffectContext): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Rebuild the atlas from the current params, applying changes to the
|
|
125
|
+
* baked fields (`chars` / `tiles` / `font` / `fontWeight` /
|
|
126
|
+
* `charAspect`) without removing and re-adding the effect. Async — it
|
|
127
|
+
* may load fonts or decode image tiles. No-op before `init()`.
|
|
128
|
+
*
|
|
129
|
+
* Allocates a fresh atlas texture and disposes the previous one once the
|
|
130
|
+
* swap is live, so repeated calls don't leak. Still does real work
|
|
131
|
+
* (rasterising / decoding), so prefer occasional calls (e.g. on a
|
|
132
|
+
* settings change) over per-frame use.
|
|
133
|
+
*/
|
|
134
|
+
updateAtlas(): Promise<void>;
|
|
135
|
+
render(ctx: EffectContext): void;
|
|
136
|
+
dispose(): void;
|
|
137
|
+
}
|