@remotion/effects 4.0.463 → 4.0.465
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 +13 -2
- package/dist/blur/blur-runtime.d.ts +4 -1
- package/dist/blur/index.d.ts +4 -0
- package/dist/blur.d.ts +1 -0
- package/dist/effect-internals.d.ts +8 -0
- package/dist/esm/blur.mjs +135 -51
- package/dist/esm/halftone.mjs +5 -8
- package/dist/esm/index.mjs +428 -1
- package/dist/esm/tint.mjs +27 -8
- package/dist/esm/wave.mjs +289 -59
- package/dist/index.d.ts +3 -1
- package/dist/tint.d.ts +1 -1
- package/dist/validate-effect-param.d.ts +3 -0
- package/dist/wave/index.d.ts +12 -0
- package/dist/wave/wave-runtime.d.ts +29 -0
- package/dist/wave/wave-shaders.d.ts +2 -0
- package/dist/wave.d.ts +1 -46
- package/package.json +12 -26
package/dist/esm/wave.mjs
CHANGED
|
@@ -1,22 +1,254 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
// src/wave/index.ts
|
|
2
|
+
import { Internals as Internals2 } from "remotion";
|
|
3
|
+
|
|
4
|
+
// src/validate-effect-param.ts
|
|
5
|
+
var assertEffectParamsObject = (params, effectLabel) => {
|
|
6
|
+
if (params === null || typeof params !== "object") {
|
|
7
|
+
throw new TypeError(`${effectLabel} effect requires a parameters object, but got ${JSON.stringify(params)}`);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var assertRequiredFiniteNumber = (value, name) => {
|
|
11
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
12
|
+
throw new TypeError(`"${name}" must be a finite number, but got ${JSON.stringify(value)}`);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var assertRequiredColor = (value, name) => {
|
|
16
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
17
|
+
throw new TypeError(`"${name}" must be a non-empty string, but got ${JSON.stringify(value)}`);
|
|
18
|
+
}
|
|
14
19
|
};
|
|
15
20
|
|
|
16
|
-
// src/wave.ts
|
|
21
|
+
// src/wave/wave-runtime.ts
|
|
17
22
|
import { Internals } from "remotion";
|
|
18
|
-
|
|
23
|
+
|
|
24
|
+
// src/wave/wave-shaders.ts
|
|
25
|
+
var WAVE_VS = `#version 300 es
|
|
26
|
+
layout(location = 0) in vec2 aPos;
|
|
27
|
+
layout(location = 1) in vec2 aUv;
|
|
28
|
+
out vec2 vUv;
|
|
29
|
+
void main() {
|
|
30
|
+
vUv = aUv;
|
|
31
|
+
gl_Position = vec4(aPos, 0.0, 1.0);
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
var WAVE_FS = `#version 300 es
|
|
35
|
+
precision highp float;
|
|
36
|
+
in vec2 vUv;
|
|
37
|
+
out vec4 fragColor;
|
|
38
|
+
|
|
39
|
+
uniform sampler2D uSource;
|
|
40
|
+
uniform vec2 uResolution;
|
|
41
|
+
uniform float uAmplitude;
|
|
42
|
+
uniform float uWavelength;
|
|
43
|
+
uniform float uPhase;
|
|
44
|
+
uniform int uDirection;
|
|
45
|
+
|
|
46
|
+
const float TWO_PI = 6.28318530718;
|
|
47
|
+
|
|
48
|
+
void main() {
|
|
49
|
+
float wavelength = max(uWavelength, 0.001);
|
|
50
|
+
vec2 srcUv = vUv;
|
|
51
|
+
|
|
52
|
+
if (uDirection == 0) {
|
|
53
|
+
float coordPx = vUv.x * uResolution.x;
|
|
54
|
+
float offsetPx =
|
|
55
|
+
sin((coordPx / wavelength) * TWO_PI + uPhase) * uAmplitude;
|
|
56
|
+
srcUv.y -= offsetPx / uResolution.y;
|
|
57
|
+
} else {
|
|
58
|
+
float coordPx = vUv.y * uResolution.y;
|
|
59
|
+
float offsetPx =
|
|
60
|
+
sin((coordPx / wavelength) * TWO_PI + uPhase) * uAmplitude;
|
|
61
|
+
srcUv.x -= offsetPx / uResolution.x;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
fragColor = texture(uSource, srcUv);
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
|
|
68
|
+
// src/wave/wave-runtime.ts
|
|
69
|
+
var { createWebGL2ContextError } = Internals;
|
|
70
|
+
var compileShader = (gl, type, source) => {
|
|
71
|
+
const shader = gl.createShader(type);
|
|
72
|
+
if (!shader) {
|
|
73
|
+
throw new Error("Failed to create WebGL shader");
|
|
74
|
+
}
|
|
75
|
+
gl.shaderSource(shader, source);
|
|
76
|
+
gl.compileShader(shader);
|
|
77
|
+
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
78
|
+
const log = gl.getShaderInfoLog(shader);
|
|
79
|
+
gl.deleteShader(shader);
|
|
80
|
+
throw new Error(`Shader compile failed: ${log ?? "(no log)"}`);
|
|
81
|
+
}
|
|
82
|
+
return shader;
|
|
83
|
+
};
|
|
84
|
+
var linkProgram = (gl, vs, fs) => {
|
|
85
|
+
const program = gl.createProgram();
|
|
86
|
+
if (!program) {
|
|
87
|
+
throw new Error("Failed to create WebGL program");
|
|
88
|
+
}
|
|
89
|
+
gl.attachShader(program, vs);
|
|
90
|
+
gl.attachShader(program, fs);
|
|
91
|
+
gl.linkProgram(program);
|
|
92
|
+
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
|
93
|
+
const log = gl.getProgramInfoLog(program);
|
|
94
|
+
gl.deleteProgram(program);
|
|
95
|
+
throw new Error(`Program link failed: ${log ?? "(no log)"}`);
|
|
96
|
+
}
|
|
97
|
+
return program;
|
|
98
|
+
};
|
|
99
|
+
var createProgram = (gl, vertexSource, fragmentSource) => {
|
|
100
|
+
const vs = compileShader(gl, gl.VERTEX_SHADER, vertexSource);
|
|
101
|
+
const fs = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSource);
|
|
102
|
+
const program = linkProgram(gl, vs, fs);
|
|
103
|
+
gl.deleteShader(vs);
|
|
104
|
+
gl.deleteShader(fs);
|
|
105
|
+
return program;
|
|
106
|
+
};
|
|
107
|
+
var getWaveUniforms = (gl, program) => ({
|
|
108
|
+
uSource: gl.getUniformLocation(program, "uSource"),
|
|
109
|
+
uResolution: gl.getUniformLocation(program, "uResolution"),
|
|
110
|
+
uAmplitude: gl.getUniformLocation(program, "uAmplitude"),
|
|
111
|
+
uWavelength: gl.getUniformLocation(program, "uWavelength"),
|
|
112
|
+
uPhase: gl.getUniformLocation(program, "uPhase"),
|
|
113
|
+
uDirection: gl.getUniformLocation(program, "uDirection")
|
|
114
|
+
});
|
|
115
|
+
var createRgbaTexture = (gl) => {
|
|
116
|
+
const texture = gl.createTexture();
|
|
117
|
+
if (!texture) {
|
|
118
|
+
throw new Error("Failed to create WebGL texture");
|
|
119
|
+
}
|
|
120
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
121
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
122
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
123
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
124
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
125
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
126
|
+
return texture;
|
|
127
|
+
};
|
|
128
|
+
var setupWave = (target) => {
|
|
129
|
+
const gl = target.getContext("webgl2", {
|
|
130
|
+
premultipliedAlpha: true,
|
|
131
|
+
alpha: true,
|
|
132
|
+
preserveDrawingBuffer: true
|
|
133
|
+
});
|
|
134
|
+
if (!gl) {
|
|
135
|
+
throw createWebGL2ContextError("wave effect");
|
|
136
|
+
}
|
|
137
|
+
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
|
|
138
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
|
|
139
|
+
const program = createProgram(gl, WAVE_VS, WAVE_FS);
|
|
140
|
+
const vao = gl.createVertexArray();
|
|
141
|
+
if (!vao) {
|
|
142
|
+
throw new Error("Failed to create WebGL vertex array");
|
|
143
|
+
}
|
|
144
|
+
gl.bindVertexArray(vao);
|
|
145
|
+
const data = new Float32Array([
|
|
146
|
+
-1,
|
|
147
|
+
-1,
|
|
148
|
+
0,
|
|
149
|
+
0,
|
|
150
|
+
1,
|
|
151
|
+
-1,
|
|
152
|
+
1,
|
|
153
|
+
0,
|
|
154
|
+
-1,
|
|
155
|
+
1,
|
|
156
|
+
0,
|
|
157
|
+
1,
|
|
158
|
+
1,
|
|
159
|
+
1,
|
|
160
|
+
1,
|
|
161
|
+
1
|
|
162
|
+
]);
|
|
163
|
+
const vbo = gl.createBuffer();
|
|
164
|
+
if (!vbo) {
|
|
165
|
+
throw new Error("Failed to create WebGL buffer");
|
|
166
|
+
}
|
|
167
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
|
|
168
|
+
gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
|
|
169
|
+
gl.enableVertexAttribArray(0);
|
|
170
|
+
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 16, 0);
|
|
171
|
+
gl.enableVertexAttribArray(1);
|
|
172
|
+
gl.vertexAttribPointer(1, 2, gl.FLOAT, false, 16, 8);
|
|
173
|
+
gl.bindVertexArray(null);
|
|
174
|
+
const textureSource = createRgbaTexture(gl);
|
|
175
|
+
return {
|
|
176
|
+
gl,
|
|
177
|
+
program,
|
|
178
|
+
vao,
|
|
179
|
+
vbo,
|
|
180
|
+
textureSource,
|
|
181
|
+
uniforms: getWaveUniforms(gl, program)
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
var cleanupWave = (state) => {
|
|
185
|
+
const { gl, program, vao, vbo, textureSource } = state;
|
|
186
|
+
gl.deleteTexture(textureSource);
|
|
187
|
+
gl.deleteBuffer(vbo);
|
|
188
|
+
gl.deleteProgram(program);
|
|
189
|
+
gl.deleteVertexArray(vao);
|
|
190
|
+
};
|
|
191
|
+
var drawFullscreenQuad = (state) => {
|
|
192
|
+
const { gl, vao } = state;
|
|
193
|
+
gl.bindVertexArray(vao);
|
|
194
|
+
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
|
195
|
+
gl.bindVertexArray(null);
|
|
196
|
+
};
|
|
197
|
+
var applyWave = ({
|
|
198
|
+
state,
|
|
199
|
+
source,
|
|
200
|
+
width,
|
|
201
|
+
height,
|
|
202
|
+
amplitude,
|
|
203
|
+
wavelength,
|
|
204
|
+
phase,
|
|
205
|
+
direction
|
|
206
|
+
}) => {
|
|
207
|
+
const { gl, program, textureSource, uniforms } = state;
|
|
208
|
+
gl.viewport(0, 0, width, height);
|
|
209
|
+
gl.bindTexture(gl.TEXTURE_2D, textureSource);
|
|
210
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, source);
|
|
211
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
212
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
213
|
+
gl.clearColor(0, 0, 0, 0);
|
|
214
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
215
|
+
gl.useProgram(program);
|
|
216
|
+
if (uniforms.uSource)
|
|
217
|
+
gl.uniform1i(uniforms.uSource, 0);
|
|
218
|
+
if (uniforms.uResolution)
|
|
219
|
+
gl.uniform2f(uniforms.uResolution, width, height);
|
|
220
|
+
if (uniforms.uAmplitude)
|
|
221
|
+
gl.uniform1f(uniforms.uAmplitude, amplitude);
|
|
222
|
+
if (uniforms.uWavelength)
|
|
223
|
+
gl.uniform1f(uniforms.uWavelength, wavelength);
|
|
224
|
+
if (uniforms.uPhase)
|
|
225
|
+
gl.uniform1f(uniforms.uPhase, phase);
|
|
226
|
+
if (uniforms.uDirection)
|
|
227
|
+
gl.uniform1i(uniforms.uDirection, direction === "horizontal" ? 0 : 1);
|
|
228
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
229
|
+
gl.bindTexture(gl.TEXTURE_2D, textureSource);
|
|
230
|
+
drawFullscreenQuad(state);
|
|
231
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
232
|
+
gl.useProgram(null);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// src/wave/index.ts
|
|
236
|
+
var { createEffect } = Internals2;
|
|
19
237
|
var waveSchema = {
|
|
238
|
+
phase: {
|
|
239
|
+
type: "number",
|
|
240
|
+
default: 0,
|
|
241
|
+
description: "Phase"
|
|
242
|
+
},
|
|
243
|
+
direction: {
|
|
244
|
+
type: "enum",
|
|
245
|
+
variants: {
|
|
246
|
+
horizontal: {},
|
|
247
|
+
vertical: {}
|
|
248
|
+
},
|
|
249
|
+
default: "horizontal",
|
|
250
|
+
description: "Direction"
|
|
251
|
+
},
|
|
20
252
|
amplitude: {
|
|
21
253
|
type: "number",
|
|
22
254
|
min: 0,
|
|
@@ -32,64 +264,62 @@ var waveSchema = {
|
|
|
32
264
|
step: 1,
|
|
33
265
|
default: 240,
|
|
34
266
|
description: "Wavelength"
|
|
35
|
-
},
|
|
36
|
-
evolution: {
|
|
37
|
-
type: "number",
|
|
38
|
-
default: 0,
|
|
39
|
-
description: "Evolution"
|
|
40
|
-
},
|
|
41
|
-
sliceWidth: {
|
|
42
|
-
type: "number",
|
|
43
|
-
min: 1,
|
|
44
|
-
max: 100,
|
|
45
|
-
step: 1,
|
|
46
|
-
default: 4,
|
|
47
|
-
description: "Slice width"
|
|
48
|
-
},
|
|
49
|
-
background: {
|
|
50
|
-
type: "color",
|
|
51
|
-
default: "transparent",
|
|
52
|
-
description: "Background"
|
|
53
267
|
}
|
|
54
268
|
};
|
|
55
269
|
var resolve = (p) => ({
|
|
270
|
+
phase: p.phase ?? 0,
|
|
271
|
+
direction: p.direction ?? "horizontal",
|
|
56
272
|
amplitude: p.amplitude ?? 60,
|
|
57
|
-
wavelength: p.wavelength ?? 240
|
|
58
|
-
evolution: p.evolution ?? 0,
|
|
59
|
-
sliceWidth: p.sliceWidth ?? 4,
|
|
60
|
-
background: p.background ?? "transparent"
|
|
273
|
+
wavelength: p.wavelength ?? 240
|
|
61
274
|
});
|
|
275
|
+
var assertOptionalFiniteNumber = (value, name) => {
|
|
276
|
+
if (value === undefined) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
assertRequiredFiniteNumber(value, name);
|
|
280
|
+
};
|
|
281
|
+
var validateWaveParams = (params) => {
|
|
282
|
+
assertEffectParamsObject(params, "Wave");
|
|
283
|
+
assertOptionalFiniteNumber(params.phase, "phase");
|
|
284
|
+
assertOptionalFiniteNumber(params.amplitude, "amplitude");
|
|
285
|
+
assertOptionalFiniteNumber(params.wavelength, "wavelength");
|
|
286
|
+
if (params.direction !== undefined && params.direction !== "horizontal" && params.direction !== "vertical") {
|
|
287
|
+
throw new TypeError(`"direction" must be "horizontal" or "vertical", but got ${JSON.stringify(params.direction)}`);
|
|
288
|
+
}
|
|
289
|
+
const resolved = resolve(params);
|
|
290
|
+
if (resolved.amplitude < 0) {
|
|
291
|
+
throw new TypeError(`"amplitude" must be >= 0, but got ${JSON.stringify(resolved.amplitude)}`);
|
|
292
|
+
}
|
|
293
|
+
if (resolved.wavelength <= 0) {
|
|
294
|
+
throw new TypeError(`"wavelength" must be > 0, but got ${JSON.stringify(resolved.wavelength)}`);
|
|
295
|
+
}
|
|
296
|
+
};
|
|
62
297
|
var wave = createEffect({
|
|
63
298
|
type: "remotion/wave",
|
|
64
299
|
label: "Wave",
|
|
65
|
-
backend: "
|
|
300
|
+
backend: "webgl2",
|
|
66
301
|
calculateKey: (params) => {
|
|
67
302
|
const r = resolve(params);
|
|
68
|
-
return `wave-${r.
|
|
303
|
+
return `wave-${r.phase}-${r.direction}-${r.amplitude}-${r.wavelength}`;
|
|
69
304
|
},
|
|
70
|
-
setup: () =>
|
|
71
|
-
apply: ({ source,
|
|
72
|
-
const ctx = target.getContext("2d");
|
|
73
|
-
if (!ctx) {
|
|
74
|
-
throw new Error("Failed to acquire 2D context for wave effect. The canvas may have been assigned a different context type.");
|
|
75
|
-
}
|
|
305
|
+
setup: (target) => setupWave(target),
|
|
306
|
+
apply: ({ source, width, height, params, state }) => {
|
|
76
307
|
const r = resolve(params);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
cleanup: () => {
|
|
88
|
-
return;
|
|
308
|
+
applyWave({
|
|
309
|
+
state,
|
|
310
|
+
source,
|
|
311
|
+
width,
|
|
312
|
+
height,
|
|
313
|
+
amplitude: r.amplitude,
|
|
314
|
+
wavelength: r.wavelength,
|
|
315
|
+
phase: r.phase,
|
|
316
|
+
direction: r.direction
|
|
317
|
+
});
|
|
89
318
|
},
|
|
90
|
-
|
|
319
|
+
cleanup: (state) => cleanupWave(state),
|
|
320
|
+
schema: waveSchema,
|
|
321
|
+
validateParams: validateWaveParams
|
|
91
322
|
});
|
|
92
323
|
export {
|
|
93
|
-
waveSchema,
|
|
94
324
|
wave
|
|
95
325
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/tint.d.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type WaveDirection = 'horizontal' | 'vertical';
|
|
2
|
+
export type WaveParams = {
|
|
3
|
+
/** Phase offset in radians. */
|
|
4
|
+
readonly phase?: number;
|
|
5
|
+
/** Wave propagation axis. Defaults to `horizontal`. */
|
|
6
|
+
readonly direction?: WaveDirection;
|
|
7
|
+
readonly amplitude?: number;
|
|
8
|
+
readonly wavelength?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const wave: (params?: (WaveParams & {
|
|
11
|
+
readonly disabled?: boolean | undefined;
|
|
12
|
+
}) | undefined) => import("remotion").EffectDescriptor<unknown>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type WaveState = {
|
|
2
|
+
gl: WebGL2RenderingContext;
|
|
3
|
+
program: WebGLProgram;
|
|
4
|
+
vao: WebGLVertexArrayObject;
|
|
5
|
+
vbo: WebGLBuffer;
|
|
6
|
+
textureSource: WebGLTexture;
|
|
7
|
+
uniforms: {
|
|
8
|
+
uSource: WebGLUniformLocation | null;
|
|
9
|
+
uResolution: WebGLUniformLocation | null;
|
|
10
|
+
uAmplitude: WebGLUniformLocation | null;
|
|
11
|
+
uWavelength: WebGLUniformLocation | null;
|
|
12
|
+
uPhase: WebGLUniformLocation | null;
|
|
13
|
+
uDirection: WebGLUniformLocation | null;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare const setupWave: (target: HTMLCanvasElement) => WaveState;
|
|
17
|
+
export declare const cleanupWave: (state: WaveState) => void;
|
|
18
|
+
type ApplyWaveParams = {
|
|
19
|
+
readonly state: WaveState;
|
|
20
|
+
readonly source: CanvasImageSource;
|
|
21
|
+
readonly width: number;
|
|
22
|
+
readonly height: number;
|
|
23
|
+
readonly amplitude: number;
|
|
24
|
+
readonly wavelength: number;
|
|
25
|
+
readonly phase: number;
|
|
26
|
+
readonly direction: 'horizontal' | 'vertical';
|
|
27
|
+
};
|
|
28
|
+
export declare const applyWave: ({ state, source, width, height, amplitude, wavelength, phase, direction, }: ApplyWaveParams) => void;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const WAVE_VS = "#version 300 es\nlayout(location = 0) in vec2 aPos;\nlayout(location = 1) in vec2 aUv;\nout vec2 vUv;\nvoid main() {\n\tvUv = aUv;\n\tgl_Position = vec4(aPos, 0.0, 1.0);\n}\n";
|
|
2
|
+
export declare const WAVE_FS = "#version 300 es\nprecision highp float;\nin vec2 vUv;\nout vec4 fragColor;\n\nuniform sampler2D uSource;\nuniform vec2 uResolution;\nuniform float uAmplitude;\nuniform float uWavelength;\nuniform float uPhase;\nuniform int uDirection;\n\nconst float TWO_PI = 6.28318530718;\n\nvoid main() {\n\tfloat wavelength = max(uWavelength, 0.001);\n\tvec2 srcUv = vUv;\n\n\tif (uDirection == 0) {\n\t\tfloat coordPx = vUv.x * uResolution.x;\n\t\tfloat offsetPx =\n\t\t\tsin((coordPx / wavelength) * TWO_PI + uPhase) * uAmplitude;\n\t\tsrcUv.y -= offsetPx / uResolution.y;\n\t} else {\n\t\tfloat coordPx = vUv.y * uResolution.y;\n\t\tfloat offsetPx =\n\t\t\tsin((coordPx / wavelength) * TWO_PI + uPhase) * uAmplitude;\n\t\tsrcUv.x -= offsetPx / uResolution.x;\n\t}\n\n\tfragColor = texture(uSource, srcUv);\n}\n";
|
package/dist/wave.d.ts
CHANGED
|
@@ -1,46 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
readonly amplitude: {
|
|
3
|
-
readonly type: "number";
|
|
4
|
-
readonly min: 0;
|
|
5
|
-
readonly max: 500;
|
|
6
|
-
readonly step: 1;
|
|
7
|
-
readonly default: 60;
|
|
8
|
-
readonly description: "Amplitude";
|
|
9
|
-
};
|
|
10
|
-
readonly wavelength: {
|
|
11
|
-
readonly type: "number";
|
|
12
|
-
readonly min: 1;
|
|
13
|
-
readonly max: 2000;
|
|
14
|
-
readonly step: 1;
|
|
15
|
-
readonly default: 240;
|
|
16
|
-
readonly description: "Wavelength";
|
|
17
|
-
};
|
|
18
|
-
readonly evolution: {
|
|
19
|
-
readonly type: "number";
|
|
20
|
-
readonly default: 0;
|
|
21
|
-
readonly description: "Evolution";
|
|
22
|
-
};
|
|
23
|
-
readonly sliceWidth: {
|
|
24
|
-
readonly type: "number";
|
|
25
|
-
readonly min: 1;
|
|
26
|
-
readonly max: 100;
|
|
27
|
-
readonly step: 1;
|
|
28
|
-
readonly default: 4;
|
|
29
|
-
readonly description: "Slice width";
|
|
30
|
-
};
|
|
31
|
-
readonly background: {
|
|
32
|
-
readonly type: "color";
|
|
33
|
-
readonly default: "transparent";
|
|
34
|
-
readonly description: "Background";
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
export type WaveParams = {
|
|
38
|
-
readonly amplitude?: number;
|
|
39
|
-
readonly wavelength?: number;
|
|
40
|
-
readonly evolution?: number;
|
|
41
|
-
readonly sliceWidth?: number;
|
|
42
|
-
readonly background?: string;
|
|
43
|
-
};
|
|
44
|
-
export declare const wave: (params?: (WaveParams & {
|
|
45
|
-
readonly disabled?: boolean | undefined;
|
|
46
|
-
}) | undefined) => import("remotion").EffectDescriptor<unknown>;
|
|
1
|
+
export { wave, type WaveDirection, type WaveParams } from './wave/index.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/effects",
|
|
3
|
-
"version": "4.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "4.0.465",
|
|
4
|
+
"description": "Effects that can be applied to Remotion-based canvas components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"module": "dist/esm/index.mjs",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
|
12
12
|
"scripts": {
|
|
13
|
+
"test": "bun test src/test",
|
|
13
14
|
"formatting": "oxfmt src --check",
|
|
14
15
|
"format": "oxfmt src",
|
|
15
16
|
"lint": "eslint src",
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"remotion": "4.0.
|
|
27
|
+
"remotion": "4.0.465"
|
|
27
28
|
},
|
|
28
29
|
"exports": {
|
|
29
30
|
".": {
|
|
@@ -31,46 +32,31 @@
|
|
|
31
32
|
"module": "./dist/esm/index.mjs",
|
|
32
33
|
"import": "./dist/esm/index.mjs"
|
|
33
34
|
},
|
|
34
|
-
"./
|
|
35
|
-
"types": "./dist/
|
|
36
|
-
"module": "./dist/esm/
|
|
37
|
-
"import": "./dist/esm/
|
|
38
|
-
},
|
|
39
|
-
"./tint": {
|
|
40
|
-
"types": "./dist/tint.d.ts",
|
|
41
|
-
"module": "./dist/esm/tint.mjs",
|
|
42
|
-
"import": "./dist/esm/tint.mjs"
|
|
35
|
+
"./blur": {
|
|
36
|
+
"types": "./dist/blur.d.ts",
|
|
37
|
+
"module": "./dist/esm/blur.mjs",
|
|
38
|
+
"import": "./dist/esm/blur.mjs"
|
|
43
39
|
},
|
|
44
40
|
"./wave": {
|
|
45
41
|
"types": "./dist/wave.d.ts",
|
|
46
42
|
"module": "./dist/esm/wave.mjs",
|
|
47
43
|
"import": "./dist/esm/wave.mjs"
|
|
48
44
|
},
|
|
49
|
-
"./blur": {
|
|
50
|
-
"types": "./dist/entrypoints/blur.d.ts",
|
|
51
|
-
"module": "./dist/esm/blur.mjs",
|
|
52
|
-
"import": "./dist/esm/blur.mjs"
|
|
53
|
-
},
|
|
54
45
|
"./package.json": "./package.json"
|
|
55
46
|
},
|
|
56
47
|
"typesVersions": {
|
|
57
48
|
">=1.0": {
|
|
58
|
-
"
|
|
59
|
-
"dist/
|
|
60
|
-
],
|
|
61
|
-
"tint": [
|
|
62
|
-
"dist/tint.d.ts"
|
|
49
|
+
"blur": [
|
|
50
|
+
"dist/blur.d.ts"
|
|
63
51
|
],
|
|
64
52
|
"wave": [
|
|
65
53
|
"dist/wave.d.ts"
|
|
66
|
-
],
|
|
67
|
-
"blur": [
|
|
68
|
-
"dist/entrypoints/blur.d.ts"
|
|
69
54
|
]
|
|
70
55
|
}
|
|
71
56
|
},
|
|
57
|
+
"homepage": "https://www.remotion.dev/docs/effects/api",
|
|
72
58
|
"devDependencies": {
|
|
73
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
59
|
+
"@remotion/eslint-config-internal": "4.0.465",
|
|
74
60
|
"eslint": "9.19.0",
|
|
75
61
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
76
62
|
},
|