@remotion/effects 4.0.462 → 4.0.464

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.
@@ -1,4 +1,6 @@
1
1
  export type BlurParams = {
2
2
  readonly radius: number;
3
3
  };
4
- export declare const blur: (params: BlurParams) => import("remotion").EffectDescriptor<unknown>;
4
+ export declare const blur: (params: BlurParams & {
5
+ readonly disabled?: boolean | undefined;
6
+ }) => import("remotion").EffectDescriptor<unknown>;
@@ -1,4 +1,6 @@
1
1
  import * as blurExports from '../blur/index.js';
2
2
  export type { BlurParams } from '../blur/index.js';
3
- declare const blur: (params: blurExports.BlurParams) => import("remotion").EffectDescriptor<unknown>;
3
+ declare const blur: (params: blurExports.BlurParams & {
4
+ readonly disabled?: boolean | undefined;
5
+ }) => import("remotion").EffectDescriptor<unknown>;
4
6
  export { blur };
package/dist/esm/blur.mjs CHANGED
@@ -14,6 +14,26 @@ var exports_blur = {};
14
14
  __export(exports_blur, {
15
15
  blur: () => blur
16
16
  });
17
+ import { Internals as Internals2 } from "remotion";
18
+
19
+ // src/validate-effect-param.ts
20
+ var assertEffectParamsObject = (params, effectLabel) => {
21
+ if (params === null || typeof params !== "object") {
22
+ throw new TypeError(`${effectLabel} effect requires a parameters object, but got ${JSON.stringify(params)}`);
23
+ }
24
+ };
25
+ var assertRequiredFiniteNumber = (value, name) => {
26
+ if (typeof value !== "number" || !Number.isFinite(value)) {
27
+ throw new TypeError(`"${name}" must be a finite number, but got ${JSON.stringify(value)}`);
28
+ }
29
+ };
30
+ var assertRequiredColor = (value, name) => {
31
+ if (typeof value !== "string" || value.length === 0) {
32
+ throw new TypeError(`"${name}" must be a non-empty string, but got ${JSON.stringify(value)}`);
33
+ }
34
+ };
35
+
36
+ // src/blur/blur-runtime.ts
17
37
  import { Internals } from "remotion";
18
38
 
19
39
  // src/blur/blur-shaders.ts
@@ -69,6 +89,7 @@ var BLUR_FS_HORIZONTAL = buildFs("horizontal");
69
89
  var BLUR_FS_VERTICAL = buildFs("vertical");
70
90
 
71
91
  // src/blur/blur-runtime.ts
92
+ var { createWebGL2ContextError } = Internals;
72
93
  var compileShader = (gl, type, source) => {
73
94
  const shader = gl.createShader(type);
74
95
  if (!shader) {
@@ -131,7 +152,7 @@ var setupBlur = (target) => {
131
152
  preserveDrawingBuffer: true
132
153
  });
133
154
  if (!gl) {
134
- throw new Error("Failed to acquire WebGL2 context for blur effect");
155
+ throw createWebGL2ContextError("blur effect");
135
156
  }
136
157
  gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
137
158
  gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
@@ -293,17 +314,21 @@ var applyBlur = ({
293
314
  };
294
315
 
295
316
  // src/blur/index.ts
296
- var { createEffect } = Internals;
317
+ var { createEffect } = Internals2;
297
318
  var blurSchema = {
298
319
  radius: {
299
320
  type: "number",
300
321
  min: 0,
301
322
  max: 100,
302
323
  step: 1,
303
- default: 10,
324
+ default: undefined,
304
325
  description: "Blur radius"
305
326
  }
306
327
  };
328
+ var validateBlurParams = (params) => {
329
+ assertEffectParamsObject(params, "Blur");
330
+ assertRequiredFiniteNumber(params.radius, "radius");
331
+ };
307
332
  var blur = createEffect({
308
333
  type: "remotion/blur",
309
334
  label: "Blur",
@@ -320,7 +345,8 @@ var blur = createEffect({
320
345
  });
321
346
  },
322
347
  cleanup: (state) => cleanupBlur(state),
323
- schema: blurSchema
348
+ schema: blurSchema,
349
+ validateParams: validateBlurParams
324
350
  });
325
351
 
326
352
  // src/entrypoints/blur.ts
@@ -11,7 +11,7 @@ var __export = (target, all) => {
11
11
 
12
12
  // src/halftone.ts
13
13
  import { Internals } from "remotion";
14
- var { createEffect } = Internals;
14
+ var { createEffect, createWebGL2ContextError } = Internals;
15
15
  var SHADE_OUTSIDE_DOT_SCALE = 0.5;
16
16
  var halftoneSchema = {
17
17
  dotSize: {
@@ -49,6 +49,16 @@ var halftoneSchema = {
49
49
  step: 1,
50
50
  default: 0,
51
51
  description: "Offset Y"
52
+ },
53
+ shape: {
54
+ type: "enum",
55
+ variants: {
56
+ circle: {},
57
+ square: {},
58
+ line: {}
59
+ },
60
+ default: "circle",
61
+ description: "Shape"
52
62
  }
53
63
  };
54
64
  var resolve = (p) => ({
@@ -205,7 +215,7 @@ var halftone = createEffect({
205
215
  preserveDrawingBuffer: true
206
216
  });
207
217
  if (!gl) {
208
- throw new Error("Failed to acquire WebGL2 context for halftone effect");
218
+ throw createWebGL2ContextError("halftone effect");
209
219
  }
210
220
  gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
211
221
  gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
@@ -333,7 +343,8 @@ var halftone = createEffect({
333
343
  gl.deleteVertexArray(vao);
334
344
  gl.deleteTexture(texture);
335
345
  },
336
- schema: halftoneSchema
346
+ schema: halftoneSchema,
347
+ validateParams: () => {}
337
348
  });
338
349
  export {
339
350
  halftoneSchema,
package/dist/esm/tint.mjs CHANGED
@@ -11,13 +11,31 @@ var __export = (target, all) => {
11
11
 
12
12
  // src/tint.ts
13
13
  import { Internals } from "remotion";
14
+
15
+ // src/validate-effect-param.ts
16
+ var assertEffectParamsObject = (params, effectLabel) => {
17
+ if (params === null || typeof params !== "object") {
18
+ throw new TypeError(`${effectLabel} effect requires a parameters object, but got ${JSON.stringify(params)}`);
19
+ }
20
+ };
21
+ var assertRequiredFiniteNumber = (value, name) => {
22
+ if (typeof value !== "number" || !Number.isFinite(value)) {
23
+ throw new TypeError(`"${name}" must be a finite number, but got ${JSON.stringify(value)}`);
24
+ }
25
+ };
26
+ var assertRequiredColor = (value, name) => {
27
+ if (typeof value !== "string" || value.length === 0) {
28
+ throw new TypeError(`"${name}" must be a non-empty string, but got ${JSON.stringify(value)}`);
29
+ }
30
+ };
31
+
32
+ // src/tint.ts
14
33
  var { createEffect } = Internals;
15
34
  var DEFAULT_AMOUNT = 0.5;
16
- var DEFAULT_COLOR = "#ff0000";
17
35
  var tintSchema = {
18
36
  color: {
19
37
  type: "color",
20
- default: DEFAULT_COLOR,
38
+ default: undefined,
21
39
  description: "Color"
22
40
  },
23
41
  amount: {
@@ -33,6 +51,10 @@ var resolve = (p) => ({
33
51
  color: p.color,
34
52
  amount: p.amount ?? DEFAULT_AMOUNT
35
53
  });
54
+ var validateTintParams = (params) => {
55
+ assertEffectParamsObject(params, "Tint");
56
+ assertRequiredColor(params.color, "color");
57
+ };
36
58
  var tint = createEffect({
37
59
  type: "remotion/tint",
38
60
  label: "Tint",
@@ -63,7 +85,8 @@ var tint = createEffect({
63
85
  cleanup: () => {
64
86
  return;
65
87
  },
66
- schema: tintSchema
88
+ schema: tintSchema,
89
+ validateParams: validateTintParams
67
90
  });
68
91
  export {
69
92
  tintSchema,
package/dist/esm/wave.mjs CHANGED
@@ -12,10 +12,46 @@ var __export = (target, all) => {
12
12
  // src/wave.ts
13
13
  import { Internals } from "remotion";
14
14
  var { createEffect } = Internals;
15
+ var waveSchema = {
16
+ amplitude: {
17
+ type: "number",
18
+ min: 0,
19
+ max: 500,
20
+ step: 1,
21
+ default: 60,
22
+ description: "Amplitude"
23
+ },
24
+ wavelength: {
25
+ type: "number",
26
+ min: 1,
27
+ max: 2000,
28
+ step: 1,
29
+ default: 240,
30
+ description: "Wavelength"
31
+ },
32
+ evolution: {
33
+ type: "number",
34
+ default: 0,
35
+ description: "Evolution"
36
+ },
37
+ sliceWidth: {
38
+ type: "number",
39
+ min: 1,
40
+ max: 100,
41
+ step: 1,
42
+ default: 4,
43
+ description: "Slice width"
44
+ },
45
+ background: {
46
+ type: "color",
47
+ default: "transparent",
48
+ description: "Background"
49
+ }
50
+ };
15
51
  var resolve = (p) => ({
16
52
  amplitude: p.amplitude ?? 60,
17
53
  wavelength: p.wavelength ?? 240,
18
- speed: p.speed ?? 1 / 6,
54
+ evolution: p.evolution ?? 0,
19
55
  sliceWidth: p.sliceWidth ?? 4,
20
56
  background: p.background ?? "transparent"
21
57
  });
@@ -25,10 +61,10 @@ var wave = createEffect({
25
61
  backend: "2d",
26
62
  calculateKey: (params) => {
27
63
  const r = resolve(params);
28
- return `wave-${r.amplitude}-${r.wavelength}-${r.speed}-${r.sliceWidth}-${r.background}`;
64
+ return `wave-${r.amplitude}-${r.wavelength}-${r.evolution}-${r.sliceWidth}-${r.background}`;
29
65
  },
30
66
  setup: () => null,
31
- apply: ({ source, target, frame, width, height, params }) => {
67
+ apply: ({ source, target, width, height, params }) => {
32
68
  const ctx = target.getContext("2d");
33
69
  if (!ctx) {
34
70
  throw new Error("Failed to acquire 2D context for wave effect. The canvas may have been assigned a different context type.");
@@ -40,15 +76,17 @@ var wave = createEffect({
40
76
  ctx.fillRect(0, 0, width, height);
41
77
  }
42
78
  for (let x = 0;x < width; x += r.sliceWidth) {
43
- const offset = Math.sin(x / r.wavelength * Math.PI * 2 + frame * r.speed) * r.amplitude;
79
+ const offset = Math.sin(x / r.wavelength * Math.PI * 2 + r.evolution) * r.amplitude;
44
80
  ctx.drawImage(source, x, 0, r.sliceWidth, height, x, offset, r.sliceWidth, height);
45
81
  }
46
82
  },
47
83
  cleanup: () => {
48
84
  return;
49
85
  },
50
- schema: null
86
+ schema: waveSchema,
87
+ validateParams: () => {}
51
88
  });
52
89
  export {
90
+ waveSchema,
53
91
  wave
54
92
  };
@@ -35,6 +35,16 @@ export declare const halftoneSchema: {
35
35
  readonly default: 0;
36
36
  readonly description: "Offset Y";
37
37
  };
38
+ readonly shape: {
39
+ readonly type: "enum";
40
+ readonly variants: {
41
+ readonly circle: {};
42
+ readonly square: {};
43
+ readonly line: {};
44
+ };
45
+ readonly default: "circle";
46
+ readonly description: "Shape";
47
+ };
38
48
  };
39
49
  export type HalftoneShape = 'circle' | 'square' | 'line';
40
50
  export type HalftoneSampling = 'bilinear' | 'nearest';
@@ -60,4 +70,6 @@ export type HalftoneParams = {
60
70
  */
61
71
  readonly shadeOutside?: boolean;
62
72
  };
63
- export declare const halftone: (params?: HalftoneParams | undefined) => import("remotion").EffectDescriptor<unknown>;
73
+ export declare const halftone: (params?: (HalftoneParams & {
74
+ readonly disabled?: boolean | undefined;
75
+ }) | undefined) => import("remotion").EffectDescriptor<unknown>;
package/dist/tint.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export declare const tintSchema: {
2
2
  readonly color: {
3
3
  readonly type: "color";
4
- readonly default: "#ff0000";
4
+ readonly default: undefined;
5
5
  readonly description: "Color";
6
6
  };
7
7
  readonly amount: {
@@ -17,4 +17,6 @@ export type TintParams = {
17
17
  readonly color: string;
18
18
  readonly amount?: number;
19
19
  };
20
- export declare const tint: (params: TintParams) => import("remotion").EffectDescriptor<unknown>;
20
+ export declare const tint: (params: TintParams & {
21
+ readonly disabled?: boolean | undefined;
22
+ }) => import("remotion").EffectDescriptor<unknown>;
@@ -0,0 +1,3 @@
1
+ export declare const assertEffectParamsObject: (params: unknown, effectLabel: string) => void;
2
+ export declare const assertRequiredFiniteNumber: (value: unknown, name: string) => void;
3
+ export declare const assertRequiredColor: (value: unknown, name: string) => void;
package/dist/wave.d.ts CHANGED
@@ -1,8 +1,46 @@
1
+ export declare const waveSchema: {
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
+ };
1
37
  export type WaveParams = {
2
38
  readonly amplitude?: number;
3
39
  readonly wavelength?: number;
4
- readonly speed?: number;
40
+ readonly evolution?: number;
5
41
  readonly sliceWidth?: number;
6
42
  readonly background?: string;
7
43
  };
8
- export declare const wave: (params?: WaveParams | undefined) => import("remotion").EffectDescriptor<unknown>;
44
+ export declare const wave: (params?: (WaveParams & {
45
+ readonly disabled?: boolean | undefined;
46
+ }) | undefined) => import("remotion").EffectDescriptor<unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/effects",
3
- "version": "4.0.462",
3
+ "version": "4.0.464",
4
4
  "description": "Experimental presets for Remotion canvas effect hooks",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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.462"
27
+ "remotion": "4.0.464"
27
28
  },
28
29
  "exports": {
29
30
  ".": {
@@ -70,7 +71,7 @@
70
71
  }
71
72
  },
72
73
  "devDependencies": {
73
- "@remotion/eslint-config-internal": "4.0.462",
74
+ "@remotion/eslint-config-internal": "4.0.464",
74
75
  "eslint": "9.19.0",
75
76
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
76
77
  },
@@ -1,4 +0,0 @@
1
- export type BlurHorizontalParams = {
2
- readonly radius: number;
3
- };
4
- export declare const blurHorizontal: (params: BlurHorizontalParams) => import("remotion").EffectDescriptor<unknown>;
@@ -1,4 +0,0 @@
1
- export type BlurVerticalParams = {
2
- readonly radius: number;
3
- };
4
- export declare const blurVertical: (params: BlurVerticalParams) => import("remotion").EffectDescriptor<unknown>;