@remotion/starburst 4.0.467 → 4.0.469
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/esm/index.mjs +26 -82
- package/dist/index.d.ts +1 -1
- package/dist/starburst-effect.d.ts +6 -23
- package/package.json +3 -3
package/dist/esm/index.mjs
CHANGED
|
@@ -16,6 +16,7 @@ var hexToRgb = (hex) => {
|
|
|
16
16
|
|
|
17
17
|
// src/starburst-effect.ts
|
|
18
18
|
var { createEffect, createWebGL2ContextError } = Internals;
|
|
19
|
+
var DEFAULT_ORIGIN = [0.5, 0.5];
|
|
19
20
|
var starburstEffectSchema = {
|
|
20
21
|
rays: {
|
|
21
22
|
type: "number",
|
|
@@ -41,29 +42,13 @@ var starburstEffectSchema = {
|
|
|
41
42
|
default: 0,
|
|
42
43
|
description: "Edge Smoothness"
|
|
43
44
|
},
|
|
44
|
-
|
|
45
|
-
type: "
|
|
45
|
+
origin: {
|
|
46
|
+
type: "uv-coordinate",
|
|
46
47
|
min: 0,
|
|
47
48
|
max: 1,
|
|
48
49
|
step: 0.01,
|
|
49
|
-
default:
|
|
50
|
-
description: "
|
|
51
|
-
},
|
|
52
|
-
originOffsetX: {
|
|
53
|
-
type: "number",
|
|
54
|
-
min: -1,
|
|
55
|
-
max: 1,
|
|
56
|
-
step: 0.01,
|
|
57
|
-
default: 0,
|
|
58
|
-
description: "Origin Offset X"
|
|
59
|
-
},
|
|
60
|
-
originOffsetY: {
|
|
61
|
-
type: "number",
|
|
62
|
-
min: -1,
|
|
63
|
-
max: 1,
|
|
64
|
-
step: 0.01,
|
|
65
|
-
default: 0,
|
|
66
|
-
description: "Origin Offset Y"
|
|
50
|
+
default: DEFAULT_ORIGIN,
|
|
51
|
+
description: "Origin"
|
|
67
52
|
}
|
|
68
53
|
};
|
|
69
54
|
var resolve = (p) => ({
|
|
@@ -71,9 +56,7 @@ var resolve = (p) => ({
|
|
|
71
56
|
colors: p.colors,
|
|
72
57
|
rotation: p.rotation ?? 0,
|
|
73
58
|
smoothness: p.smoothness ?? 0,
|
|
74
|
-
|
|
75
|
-
originOffsetX: p.originOffsetX ?? 0,
|
|
76
|
-
originOffsetY: p.originOffsetY ?? 0
|
|
59
|
+
origin: p.origin ?? DEFAULT_ORIGIN
|
|
77
60
|
});
|
|
78
61
|
var validateStarburstEffectParams = (params) => {
|
|
79
62
|
if (params === null || typeof params !== "object") {
|
|
@@ -99,17 +82,13 @@ var validateStarburstEffectParams = (params) => {
|
|
|
99
82
|
if (r.smoothness < 0 || r.smoothness > 1) {
|
|
100
83
|
throw new RangeError(`"smoothness" must be between 0 and 1, but got ${r.smoothness}`);
|
|
101
84
|
}
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
throw new RangeError(`"vignette" must be between 0 and 1, but got ${r.vignette}`);
|
|
107
|
-
}
|
|
108
|
-
if (typeof r.originOffsetX !== "number" || !Number.isFinite(r.originOffsetX)) {
|
|
109
|
-
throw new TypeError(`"originOffsetX" must be a finite number, but got ${JSON.stringify(params.originOffsetX)}`);
|
|
85
|
+
if (!Array.isArray(r.origin) || r.origin.length !== 2 || r.origin.some((coordinate) => {
|
|
86
|
+
return typeof coordinate !== "number" || !Number.isFinite(coordinate);
|
|
87
|
+
})) {
|
|
88
|
+
throw new TypeError('"origin" must be a [number, number] tuple');
|
|
110
89
|
}
|
|
111
|
-
if (
|
|
112
|
-
throw new
|
|
90
|
+
if (r.origin.some((coordinate) => coordinate < 0 || coordinate > 1)) {
|
|
91
|
+
throw new RangeError(`"origin" must contain coordinates between 0 and 1, but got ${JSON.stringify(r.origin)}`);
|
|
113
92
|
}
|
|
114
93
|
for (const c of r.colors) {
|
|
115
94
|
hexToRgb(c);
|
|
@@ -127,15 +106,13 @@ void main() {
|
|
|
127
106
|
var STARBURST_FS = `#version 300 es
|
|
128
107
|
precision highp float;
|
|
129
108
|
|
|
130
|
-
uniform sampler2D uSource;
|
|
131
109
|
uniform sampler2D colorPalette;
|
|
132
110
|
uniform float numRays;
|
|
133
111
|
uniform float rotationOffset;
|
|
134
112
|
uniform float smoothEdge;
|
|
135
113
|
uniform vec2 resolution;
|
|
136
114
|
uniform float numColors;
|
|
137
|
-
uniform
|
|
138
|
-
uniform vec2 originOffset;
|
|
115
|
+
uniform vec2 origin;
|
|
139
116
|
|
|
140
117
|
in vec2 vUv;
|
|
141
118
|
out vec4 fragColor;
|
|
@@ -144,7 +121,7 @@ const float Pi = 3.14159265359;
|
|
|
144
121
|
|
|
145
122
|
void main() {
|
|
146
123
|
vec2 uv = vUv;
|
|
147
|
-
vec2 center = uv -
|
|
124
|
+
vec2 center = uv - origin;
|
|
148
125
|
center.x *= resolution.x / resolution.y;
|
|
149
126
|
|
|
150
127
|
float angle = atan(center.y, center.x) + rotationOffset;
|
|
@@ -170,16 +147,7 @@ void main() {
|
|
|
170
147
|
vec3 prevCol = texture(colorPalette, vec2(prevTexCoord, 0.5)).rgb;
|
|
171
148
|
col = mix(col, prevCol, blendStart);
|
|
172
149
|
|
|
173
|
-
|
|
174
|
-
float dist = length(vignetteCenter);
|
|
175
|
-
float radius = vignetteAmount * 3.0;
|
|
176
|
-
float burstAlpha = smoothstep(radius, radius * 0.5, dist);
|
|
177
|
-
|
|
178
|
-
vec4 src = texture(uSource, vUv);
|
|
179
|
-
vec3 burstPm = col * burstAlpha;
|
|
180
|
-
vec3 outRgb = burstPm + src.rgb * (1.0 - burstAlpha);
|
|
181
|
-
float outA = burstAlpha + src.a * (1.0 - burstAlpha);
|
|
182
|
-
fragColor = vec4(outRgb, outA);
|
|
150
|
+
fragColor = vec4(col, 1.0);
|
|
183
151
|
}
|
|
184
152
|
`;
|
|
185
153
|
var compileShader = (gl, type, source) => {
|
|
@@ -213,12 +181,12 @@ var linkProgram = (gl, vs, fs) => {
|
|
|
213
181
|
};
|
|
214
182
|
var starburst = createEffect({
|
|
215
183
|
type: "remotion/starburst",
|
|
216
|
-
label: "
|
|
217
|
-
documentationLink: "https://www.remotion.dev/docs/starburst/starburst",
|
|
184
|
+
label: "starburst()",
|
|
185
|
+
documentationLink: "https://www.remotion.dev/docs/starburst/starburst-effect",
|
|
218
186
|
backend: "webgl2",
|
|
219
187
|
calculateKey: (params) => {
|
|
220
188
|
const r = resolve(params);
|
|
221
|
-
return `starburst-${r.rays}-${r.colors.join("|")}-${r.rotation}-${r.smoothness}-${r.
|
|
189
|
+
return `starburst-${r.rays}-${r.colors.join("|")}-${r.rotation}-${r.smoothness}-${r.origin.join(":")}`;
|
|
222
190
|
},
|
|
223
191
|
setup: (target) => {
|
|
224
192
|
const gl = target.getContext("webgl2", {
|
|
@@ -271,14 +239,6 @@ var starburst = createEffect({
|
|
|
271
239
|
gl.enableVertexAttribArray(aUv);
|
|
272
240
|
gl.vertexAttribPointer(aUv, 2, gl.FLOAT, false, 16, 8);
|
|
273
241
|
gl.bindVertexArray(null);
|
|
274
|
-
const sourceTexture = gl.createTexture();
|
|
275
|
-
if (!sourceTexture) {
|
|
276
|
-
throw new Error("Failed to create WebGL source texture");
|
|
277
|
-
}
|
|
278
|
-
gl.bindTexture(gl.TEXTURE_2D, sourceTexture);
|
|
279
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
280
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
281
|
-
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
282
242
|
const paletteTexture = gl.createTexture();
|
|
283
243
|
if (!paletteTexture) {
|
|
284
244
|
throw new Error("Failed to create WebGL palette texture");
|
|
@@ -294,38 +254,32 @@ var starburst = createEffect({
|
|
|
294
254
|
program,
|
|
295
255
|
vao,
|
|
296
256
|
vbo,
|
|
297
|
-
sourceTexture,
|
|
298
257
|
paletteTexture,
|
|
299
|
-
uSource: gl.getUniformLocation(program, "uSource"),
|
|
300
258
|
uColorPalette: gl.getUniformLocation(program, "colorPalette"),
|
|
301
259
|
uNumRays: gl.getUniformLocation(program, "numRays"),
|
|
302
260
|
uRotationOffset: gl.getUniformLocation(program, "rotationOffset"),
|
|
303
261
|
uSmoothEdge: gl.getUniformLocation(program, "smoothEdge"),
|
|
304
262
|
uResolution: gl.getUniformLocation(program, "resolution"),
|
|
305
263
|
uNumColors: gl.getUniformLocation(program, "numColors"),
|
|
306
|
-
|
|
307
|
-
uOriginOffset: gl.getUniformLocation(program, "originOffset"),
|
|
264
|
+
uOrigin: gl.getUniformLocation(program, "origin"),
|
|
308
265
|
cachedPaletteKey: "",
|
|
309
266
|
palettePixelData: new Uint8Array(0)
|
|
310
267
|
};
|
|
311
268
|
},
|
|
312
|
-
apply: ({
|
|
269
|
+
apply: ({ width, height, params, state }) => {
|
|
313
270
|
const r = resolve(params);
|
|
314
271
|
const {
|
|
315
272
|
gl,
|
|
316
273
|
program,
|
|
317
274
|
vao,
|
|
318
|
-
sourceTexture,
|
|
319
275
|
paletteTexture,
|
|
320
|
-
uSource,
|
|
321
276
|
uColorPalette,
|
|
322
277
|
uNumRays,
|
|
323
278
|
uRotationOffset,
|
|
324
279
|
uSmoothEdge,
|
|
325
280
|
uResolution,
|
|
326
281
|
uNumColors,
|
|
327
|
-
|
|
328
|
-
uOriginOffset
|
|
282
|
+
uOrigin
|
|
329
283
|
} = state;
|
|
330
284
|
const rotationRad = r.rotation * Math.PI / 180;
|
|
331
285
|
const paletteKey = r.colors.join("|");
|
|
@@ -351,20 +305,12 @@ var starburst = createEffect({
|
|
|
351
305
|
gl.useProgram(program);
|
|
352
306
|
gl.bindVertexArray(vao);
|
|
353
307
|
gl.activeTexture(gl.TEXTURE0);
|
|
354
|
-
gl.bindTexture(gl.TEXTURE_2D, sourceTexture);
|
|
355
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
356
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
357
|
-
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipSourceY);
|
|
358
|
-
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, source);
|
|
359
|
-
gl.activeTexture(gl.TEXTURE1);
|
|
360
308
|
gl.bindTexture(gl.TEXTURE_2D, paletteTexture);
|
|
361
309
|
if (paletteDirty) {
|
|
362
310
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, r.colors.length, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, state.palettePixelData);
|
|
363
311
|
}
|
|
364
|
-
if (uSource)
|
|
365
|
-
gl.uniform1i(uSource, 0);
|
|
366
312
|
if (uColorPalette)
|
|
367
|
-
gl.uniform1i(uColorPalette,
|
|
313
|
+
gl.uniform1i(uColorPalette, 0);
|
|
368
314
|
if (uNumRays)
|
|
369
315
|
gl.uniform1f(uNumRays, r.rays);
|
|
370
316
|
if (uNumColors)
|
|
@@ -373,10 +319,8 @@ var starburst = createEffect({
|
|
|
373
319
|
gl.uniform1f(uRotationOffset, rotationRad);
|
|
374
320
|
if (uSmoothEdge)
|
|
375
321
|
gl.uniform1f(uSmoothEdge, r.smoothness);
|
|
376
|
-
if (
|
|
377
|
-
gl.
|
|
378
|
-
if (uOriginOffset)
|
|
379
|
-
gl.uniform2f(uOriginOffset, r.originOffsetX, r.originOffsetY);
|
|
322
|
+
if (uOrigin)
|
|
323
|
+
gl.uniform2f(uOrigin, r.origin[0], 1 - r.origin[1]);
|
|
380
324
|
if (uResolution)
|
|
381
325
|
gl.uniform2f(uResolution, width, height);
|
|
382
326
|
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
|
@@ -384,11 +328,10 @@ var starburst = createEffect({
|
|
|
384
328
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
385
329
|
gl.useProgram(null);
|
|
386
330
|
},
|
|
387
|
-
cleanup: ({ gl, program, vao, vbo,
|
|
331
|
+
cleanup: ({ gl, program, vao, vbo, paletteTexture }) => {
|
|
388
332
|
gl.deleteBuffer(vbo);
|
|
389
333
|
gl.deleteProgram(program);
|
|
390
334
|
gl.deleteVertexArray(vao);
|
|
391
|
-
gl.deleteTexture(sourceTexture);
|
|
392
335
|
gl.deleteTexture(paletteTexture);
|
|
393
336
|
},
|
|
394
337
|
schema: starburstEffectSchema,
|
|
@@ -709,6 +652,7 @@ var StarburstInternals = {
|
|
|
709
652
|
};
|
|
710
653
|
export {
|
|
711
654
|
starburstEffectSchema,
|
|
655
|
+
starburst,
|
|
712
656
|
StarburstInternals,
|
|
713
657
|
Starburst
|
|
714
658
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Starburst } from './Starburst';
|
|
2
2
|
export type { StarburstProps } from './Starburst';
|
|
3
|
-
export { starburstEffectSchema, type StarburstEffectParams, } from './starburst-effect';
|
|
3
|
+
export { starburst, starburstEffectSchema, type StarburstEffectParams, type StarburstOrigin, } from './starburst-effect';
|
|
4
4
|
export declare const StarburstInternals: {
|
|
5
5
|
readonly starburst: (params: import("./starburst-effect").StarburstEffectParams & {
|
|
6
6
|
readonly disabled?: boolean | undefined;
|
|
@@ -23,39 +23,22 @@ export declare const starburstEffectSchema: {
|
|
|
23
23
|
readonly default: 0;
|
|
24
24
|
readonly description: "Edge Smoothness";
|
|
25
25
|
};
|
|
26
|
-
readonly
|
|
27
|
-
readonly type: "
|
|
26
|
+
readonly origin: {
|
|
27
|
+
readonly type: "uv-coordinate";
|
|
28
28
|
readonly min: 0;
|
|
29
29
|
readonly max: 1;
|
|
30
30
|
readonly step: 0.01;
|
|
31
|
-
readonly default:
|
|
32
|
-
readonly description: "
|
|
33
|
-
};
|
|
34
|
-
readonly originOffsetX: {
|
|
35
|
-
readonly type: "number";
|
|
36
|
-
readonly min: -1;
|
|
37
|
-
readonly max: 1;
|
|
38
|
-
readonly step: 0.01;
|
|
39
|
-
readonly default: 0;
|
|
40
|
-
readonly description: "Origin Offset X";
|
|
41
|
-
};
|
|
42
|
-
readonly originOffsetY: {
|
|
43
|
-
readonly type: "number";
|
|
44
|
-
readonly min: -1;
|
|
45
|
-
readonly max: 1;
|
|
46
|
-
readonly step: 0.01;
|
|
47
|
-
readonly default: 0;
|
|
48
|
-
readonly description: "Origin Offset Y";
|
|
31
|
+
readonly default: readonly [0.5, 0.5];
|
|
32
|
+
readonly description: "Origin";
|
|
49
33
|
};
|
|
50
34
|
};
|
|
35
|
+
export type StarburstOrigin = readonly [number, number];
|
|
51
36
|
export type StarburstEffectParams = {
|
|
52
37
|
readonly rays: number;
|
|
53
38
|
readonly colors: readonly string[];
|
|
54
39
|
readonly rotation?: number;
|
|
55
40
|
readonly smoothness?: number;
|
|
56
|
-
readonly
|
|
57
|
-
readonly originOffsetX?: number;
|
|
58
|
-
readonly originOffsetY?: number;
|
|
41
|
+
readonly origin?: StarburstOrigin;
|
|
59
42
|
};
|
|
60
43
|
export declare const starburst: (params: StarburstEffectParams & {
|
|
61
44
|
readonly disabled?: boolean | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/starburst",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.469",
|
|
4
4
|
"description": "Starburst ray effect for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"remotion": "4.0.
|
|
27
|
+
"remotion": "4.0.469",
|
|
28
28
|
"zod": "4.3.6"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"react": "19.2.3",
|
|
44
44
|
"react-dom": "19.2.3",
|
|
45
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
45
|
+
"@remotion/eslint-config-internal": "4.0.469",
|
|
46
46
|
"eslint": "9.19.0",
|
|
47
47
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
48
48
|
},
|