@remotion/starburst 4.0.468 → 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 +20 -26
- package/dist/index.d.ts +1 -1
- package/dist/starburst-effect.d.ts +7 -15
- 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,21 +42,13 @@ var starburstEffectSchema = {
|
|
|
41
42
|
default: 0,
|
|
42
43
|
description: "Edge Smoothness"
|
|
43
44
|
},
|
|
44
|
-
|
|
45
|
-
type: "
|
|
46
|
-
min:
|
|
47
|
-
max: 1,
|
|
48
|
-
step: 0.01,
|
|
49
|
-
default: 0,
|
|
50
|
-
description: "Origin Offset X"
|
|
51
|
-
},
|
|
52
|
-
originOffsetY: {
|
|
53
|
-
type: "number",
|
|
54
|
-
min: -1,
|
|
45
|
+
origin: {
|
|
46
|
+
type: "uv-coordinate",
|
|
47
|
+
min: 0,
|
|
55
48
|
max: 1,
|
|
56
49
|
step: 0.01,
|
|
57
|
-
default:
|
|
58
|
-
description: "Origin
|
|
50
|
+
default: DEFAULT_ORIGIN,
|
|
51
|
+
description: "Origin"
|
|
59
52
|
}
|
|
60
53
|
};
|
|
61
54
|
var resolve = (p) => ({
|
|
@@ -63,8 +56,7 @@ var resolve = (p) => ({
|
|
|
63
56
|
colors: p.colors,
|
|
64
57
|
rotation: p.rotation ?? 0,
|
|
65
58
|
smoothness: p.smoothness ?? 0,
|
|
66
|
-
|
|
67
|
-
originOffsetY: p.originOffsetY ?? 0
|
|
59
|
+
origin: p.origin ?? DEFAULT_ORIGIN
|
|
68
60
|
});
|
|
69
61
|
var validateStarburstEffectParams = (params) => {
|
|
70
62
|
if (params === null || typeof params !== "object") {
|
|
@@ -90,11 +82,13 @@ var validateStarburstEffectParams = (params) => {
|
|
|
90
82
|
if (r.smoothness < 0 || r.smoothness > 1) {
|
|
91
83
|
throw new RangeError(`"smoothness" must be between 0 and 1, but got ${r.smoothness}`);
|
|
92
84
|
}
|
|
93
|
-
if (
|
|
94
|
-
|
|
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');
|
|
95
89
|
}
|
|
96
|
-
if (
|
|
97
|
-
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)}`);
|
|
98
92
|
}
|
|
99
93
|
for (const c of r.colors) {
|
|
100
94
|
hexToRgb(c);
|
|
@@ -118,7 +112,7 @@ uniform float rotationOffset;
|
|
|
118
112
|
uniform float smoothEdge;
|
|
119
113
|
uniform vec2 resolution;
|
|
120
114
|
uniform float numColors;
|
|
121
|
-
uniform vec2
|
|
115
|
+
uniform vec2 origin;
|
|
122
116
|
|
|
123
117
|
in vec2 vUv;
|
|
124
118
|
out vec4 fragColor;
|
|
@@ -127,7 +121,7 @@ const float Pi = 3.14159265359;
|
|
|
127
121
|
|
|
128
122
|
void main() {
|
|
129
123
|
vec2 uv = vUv;
|
|
130
|
-
vec2 center = uv -
|
|
124
|
+
vec2 center = uv - origin;
|
|
131
125
|
center.x *= resolution.x / resolution.y;
|
|
132
126
|
|
|
133
127
|
float angle = atan(center.y, center.x) + rotationOffset;
|
|
@@ -192,7 +186,7 @@ var starburst = createEffect({
|
|
|
192
186
|
backend: "webgl2",
|
|
193
187
|
calculateKey: (params) => {
|
|
194
188
|
const r = resolve(params);
|
|
195
|
-
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(":")}`;
|
|
196
190
|
},
|
|
197
191
|
setup: (target) => {
|
|
198
192
|
const gl = target.getContext("webgl2", {
|
|
@@ -267,7 +261,7 @@ var starburst = createEffect({
|
|
|
267
261
|
uSmoothEdge: gl.getUniformLocation(program, "smoothEdge"),
|
|
268
262
|
uResolution: gl.getUniformLocation(program, "resolution"),
|
|
269
263
|
uNumColors: gl.getUniformLocation(program, "numColors"),
|
|
270
|
-
|
|
264
|
+
uOrigin: gl.getUniformLocation(program, "origin"),
|
|
271
265
|
cachedPaletteKey: "",
|
|
272
266
|
palettePixelData: new Uint8Array(0)
|
|
273
267
|
};
|
|
@@ -285,7 +279,7 @@ var starburst = createEffect({
|
|
|
285
279
|
uSmoothEdge,
|
|
286
280
|
uResolution,
|
|
287
281
|
uNumColors,
|
|
288
|
-
|
|
282
|
+
uOrigin
|
|
289
283
|
} = state;
|
|
290
284
|
const rotationRad = r.rotation * Math.PI / 180;
|
|
291
285
|
const paletteKey = r.colors.join("|");
|
|
@@ -325,8 +319,8 @@ var starburst = createEffect({
|
|
|
325
319
|
gl.uniform1f(uRotationOffset, rotationRad);
|
|
326
320
|
if (uSmoothEdge)
|
|
327
321
|
gl.uniform1f(uSmoothEdge, r.smoothness);
|
|
328
|
-
if (
|
|
329
|
-
gl.uniform2f(
|
|
322
|
+
if (uOrigin)
|
|
323
|
+
gl.uniform2f(uOrigin, r.origin[0], 1 - r.origin[1]);
|
|
330
324
|
if (uResolution)
|
|
331
325
|
gl.uniform2f(uResolution, width, height);
|
|
332
326
|
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
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 { starburst, 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,30 +23,22 @@ export declare const starburstEffectSchema: {
|
|
|
23
23
|
readonly default: 0;
|
|
24
24
|
readonly description: "Edge Smoothness";
|
|
25
25
|
};
|
|
26
|
-
readonly
|
|
27
|
-
readonly type: "
|
|
28
|
-
readonly min:
|
|
29
|
-
readonly max: 1;
|
|
30
|
-
readonly step: 0.01;
|
|
31
|
-
readonly default: 0;
|
|
32
|
-
readonly description: "Origin Offset X";
|
|
33
|
-
};
|
|
34
|
-
readonly originOffsetY: {
|
|
35
|
-
readonly type: "number";
|
|
36
|
-
readonly min: -1;
|
|
26
|
+
readonly origin: {
|
|
27
|
+
readonly type: "uv-coordinate";
|
|
28
|
+
readonly min: 0;
|
|
37
29
|
readonly max: 1;
|
|
38
30
|
readonly step: 0.01;
|
|
39
|
-
readonly default: 0;
|
|
40
|
-
readonly description: "Origin
|
|
31
|
+
readonly default: readonly [0.5, 0.5];
|
|
32
|
+
readonly description: "Origin";
|
|
41
33
|
};
|
|
42
34
|
};
|
|
35
|
+
export type StarburstOrigin = readonly [number, number];
|
|
43
36
|
export type StarburstEffectParams = {
|
|
44
37
|
readonly rays: number;
|
|
45
38
|
readonly colors: readonly string[];
|
|
46
39
|
readonly rotation?: number;
|
|
47
40
|
readonly smoothness?: number;
|
|
48
|
-
readonly
|
|
49
|
-
readonly originOffsetY?: number;
|
|
41
|
+
readonly origin?: StarburstOrigin;
|
|
50
42
|
};
|
|
51
43
|
export declare const starburst: (params: StarburstEffectParams & {
|
|
52
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
|
},
|