@remotion/starburst 4.0.460 → 4.0.462
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 +405 -13
- package/dist/hex-to-rgb.d.ts +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/starburst-effect.d.ts +61 -0
- package/package.json +3 -4
package/dist/esm/index.mjs
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Internals,
|
|
6
|
-
Sequence,
|
|
7
|
-
useDelayRender,
|
|
8
|
-
useVideoConfig
|
|
9
|
-
} from "remotion";
|
|
10
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
// src/starburst-effect.ts
|
|
2
|
+
import { Internals } from "remotion";
|
|
3
|
+
|
|
4
|
+
// src/hex-to-rgb.ts
|
|
11
5
|
var hexToRgb = (hex) => {
|
|
12
6
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
13
7
|
if (!result) {
|
|
@@ -19,6 +13,397 @@ var hexToRgb = (hex) => {
|
|
|
19
13
|
parseInt(result[3], 16) / 255
|
|
20
14
|
];
|
|
21
15
|
};
|
|
16
|
+
|
|
17
|
+
// src/starburst-effect.ts
|
|
18
|
+
var { createEffect } = Internals;
|
|
19
|
+
var starburstEffectSchema = {
|
|
20
|
+
rays: {
|
|
21
|
+
type: "number",
|
|
22
|
+
min: 2,
|
|
23
|
+
max: 100,
|
|
24
|
+
step: 1,
|
|
25
|
+
default: 12,
|
|
26
|
+
description: "Number of Rays"
|
|
27
|
+
},
|
|
28
|
+
rotation: {
|
|
29
|
+
type: "number",
|
|
30
|
+
min: 0,
|
|
31
|
+
max: 360,
|
|
32
|
+
step: 1,
|
|
33
|
+
default: 0,
|
|
34
|
+
description: "Rotation"
|
|
35
|
+
},
|
|
36
|
+
smoothness: {
|
|
37
|
+
type: "number",
|
|
38
|
+
min: 0,
|
|
39
|
+
max: 1,
|
|
40
|
+
step: 0.01,
|
|
41
|
+
default: 0,
|
|
42
|
+
description: "Edge Smoothness"
|
|
43
|
+
},
|
|
44
|
+
vignette: {
|
|
45
|
+
type: "number",
|
|
46
|
+
min: 0,
|
|
47
|
+
max: 1,
|
|
48
|
+
step: 0.01,
|
|
49
|
+
default: 1,
|
|
50
|
+
description: "Vignette"
|
|
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"
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
var resolve = (p) => ({
|
|
70
|
+
rays: p.rays,
|
|
71
|
+
colors: p.colors,
|
|
72
|
+
rotation: p.rotation ?? 0,
|
|
73
|
+
smoothness: p.smoothness ?? 0,
|
|
74
|
+
vignette: p.vignette ?? 1,
|
|
75
|
+
originOffsetX: p.originOffsetX ?? 0,
|
|
76
|
+
originOffsetY: p.originOffsetY ?? 0
|
|
77
|
+
});
|
|
78
|
+
var validateStarburstEffectParams = (params) => {
|
|
79
|
+
const { rays, colors } = params;
|
|
80
|
+
if (typeof rays !== "number" || !Number.isFinite(rays)) {
|
|
81
|
+
throw new TypeError(`"rays" must be a finite number, but got ${JSON.stringify(rays)}`);
|
|
82
|
+
}
|
|
83
|
+
if (rays < 2 || rays > 100) {
|
|
84
|
+
throw new RangeError(`"rays" must be between 2 and 100, but got ${rays}`);
|
|
85
|
+
}
|
|
86
|
+
if (!Array.isArray(colors) || colors.length < 2) {
|
|
87
|
+
throw new TypeError(`"colors" must be an array with at least 2 colors, but got ${JSON.stringify(colors)}`);
|
|
88
|
+
}
|
|
89
|
+
const r = resolve(params);
|
|
90
|
+
if (typeof r.rotation !== "number" || !Number.isFinite(r.rotation)) {
|
|
91
|
+
throw new TypeError(`"rotation" must be a finite number, but got ${JSON.stringify(params.rotation)}`);
|
|
92
|
+
}
|
|
93
|
+
if (typeof r.smoothness !== "number" || !Number.isFinite(r.smoothness)) {
|
|
94
|
+
throw new TypeError(`"smoothness" must be a finite number, but got ${JSON.stringify(params.smoothness)}`);
|
|
95
|
+
}
|
|
96
|
+
if (r.smoothness < 0 || r.smoothness > 1) {
|
|
97
|
+
throw new RangeError(`"smoothness" must be between 0 and 1, but got ${r.smoothness}`);
|
|
98
|
+
}
|
|
99
|
+
if (typeof r.vignette !== "number" || !Number.isFinite(r.vignette)) {
|
|
100
|
+
throw new TypeError(`"vignette" must be a finite number, but got ${JSON.stringify(params.vignette)}`);
|
|
101
|
+
}
|
|
102
|
+
if (r.vignette < 0 || r.vignette > 1) {
|
|
103
|
+
throw new RangeError(`"vignette" must be between 0 and 1, but got ${r.vignette}`);
|
|
104
|
+
}
|
|
105
|
+
if (typeof r.originOffsetX !== "number" || !Number.isFinite(r.originOffsetX)) {
|
|
106
|
+
throw new TypeError(`"originOffsetX" must be a finite number, but got ${JSON.stringify(params.originOffsetX)}`);
|
|
107
|
+
}
|
|
108
|
+
if (typeof r.originOffsetY !== "number" || !Number.isFinite(r.originOffsetY)) {
|
|
109
|
+
throw new TypeError(`"originOffsetY" must be a finite number, but got ${JSON.stringify(params.originOffsetY)}`);
|
|
110
|
+
}
|
|
111
|
+
for (const c of r.colors) {
|
|
112
|
+
hexToRgb(c);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
var STARBURST_VS = `#version 300 es
|
|
116
|
+
in vec2 aPos;
|
|
117
|
+
in vec2 aUv;
|
|
118
|
+
out vec2 vUv;
|
|
119
|
+
void main() {
|
|
120
|
+
vUv = aUv;
|
|
121
|
+
gl_Position = vec4(aPos, 0.0, 1.0);
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
124
|
+
var STARBURST_FS = `#version 300 es
|
|
125
|
+
precision highp float;
|
|
126
|
+
|
|
127
|
+
uniform sampler2D uSource;
|
|
128
|
+
uniform sampler2D colorPalette;
|
|
129
|
+
uniform float numRays;
|
|
130
|
+
uniform float rotationOffset;
|
|
131
|
+
uniform float smoothEdge;
|
|
132
|
+
uniform vec2 resolution;
|
|
133
|
+
uniform float numColors;
|
|
134
|
+
uniform float vignetteAmount;
|
|
135
|
+
uniform vec2 originOffset;
|
|
136
|
+
|
|
137
|
+
in vec2 vUv;
|
|
138
|
+
out vec4 fragColor;
|
|
139
|
+
|
|
140
|
+
const float Pi = 3.14159265359;
|
|
141
|
+
|
|
142
|
+
void main() {
|
|
143
|
+
vec2 uv = vUv;
|
|
144
|
+
vec2 center = uv - 0.5 - originOffset;
|
|
145
|
+
center.x *= resolution.x / resolution.y;
|
|
146
|
+
|
|
147
|
+
float angle = atan(center.y, center.x) + rotationOffset;
|
|
148
|
+
float normalizedAngle = (angle + Pi) / (2.0 * Pi);
|
|
149
|
+
float sector = normalizedAngle * numRays;
|
|
150
|
+
float rayIndex = mod(floor(sector), numRays);
|
|
151
|
+
|
|
152
|
+
float colorIndex = mod(rayIndex, numColors);
|
|
153
|
+
float texCoord = (colorIndex + 0.5) / numColors;
|
|
154
|
+
vec3 col = texture(colorPalette, vec2(texCoord, 0.5)).rgb;
|
|
155
|
+
|
|
156
|
+
float fractSector = fract(sector);
|
|
157
|
+
float edgeSmooth = smoothEdge * 0.5;
|
|
158
|
+
float nextColorIndex = mod(rayIndex + 1.0, numColors);
|
|
159
|
+
float nextTexCoord = (nextColorIndex + 0.5) / numColors;
|
|
160
|
+
vec3 nextCol = texture(colorPalette, vec2(nextTexCoord, 0.5)).rgb;
|
|
161
|
+
|
|
162
|
+
float blend = smoothstep(1.0 - edgeSmooth, 1.0, fractSector);
|
|
163
|
+
col = mix(col, nextCol, blend);
|
|
164
|
+
float blendStart = smoothstep(edgeSmooth, 0.0, fractSector);
|
|
165
|
+
float prevColorIndex = mod(rayIndex - 1.0 + numColors, numColors);
|
|
166
|
+
float prevTexCoord = (prevColorIndex + 0.5) / numColors;
|
|
167
|
+
vec3 prevCol = texture(colorPalette, vec2(prevTexCoord, 0.5)).rgb;
|
|
168
|
+
col = mix(col, prevCol, blendStart);
|
|
169
|
+
|
|
170
|
+
vec2 vignetteCenter = (uv - 0.5) * vec2(resolution.x / resolution.y, 1.0);
|
|
171
|
+
float dist = length(vignetteCenter);
|
|
172
|
+
float radius = vignetteAmount * 3.0;
|
|
173
|
+
float burstAlpha = smoothstep(radius, radius * 0.5, dist);
|
|
174
|
+
|
|
175
|
+
vec4 src = texture(uSource, vUv);
|
|
176
|
+
vec3 burstPm = col * burstAlpha;
|
|
177
|
+
vec3 outRgb = burstPm + src.rgb * (1.0 - burstAlpha);
|
|
178
|
+
float outA = burstAlpha + src.a * (1.0 - burstAlpha);
|
|
179
|
+
fragColor = vec4(outRgb, outA);
|
|
180
|
+
}
|
|
181
|
+
`;
|
|
182
|
+
var compileShader = (gl, type, source) => {
|
|
183
|
+
const shader = gl.createShader(type);
|
|
184
|
+
if (!shader) {
|
|
185
|
+
throw new Error("Failed to create WebGL shader");
|
|
186
|
+
}
|
|
187
|
+
gl.shaderSource(shader, source);
|
|
188
|
+
gl.compileShader(shader);
|
|
189
|
+
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
190
|
+
const log = gl.getShaderInfoLog(shader);
|
|
191
|
+
gl.deleteShader(shader);
|
|
192
|
+
throw new Error(`Starburst shader compile failed: ${log ?? "(no log)"}`);
|
|
193
|
+
}
|
|
194
|
+
return shader;
|
|
195
|
+
};
|
|
196
|
+
var linkProgram = (gl, vs, fs) => {
|
|
197
|
+
const program = gl.createProgram();
|
|
198
|
+
if (!program) {
|
|
199
|
+
throw new Error("Failed to create WebGL program");
|
|
200
|
+
}
|
|
201
|
+
gl.attachShader(program, vs);
|
|
202
|
+
gl.attachShader(program, fs);
|
|
203
|
+
gl.linkProgram(program);
|
|
204
|
+
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
|
205
|
+
const log = gl.getProgramInfoLog(program);
|
|
206
|
+
gl.deleteProgram(program);
|
|
207
|
+
throw new Error(`Starburst program link failed: ${log ?? "(no log)"}`);
|
|
208
|
+
}
|
|
209
|
+
return program;
|
|
210
|
+
};
|
|
211
|
+
var starburstImpl = createEffect({
|
|
212
|
+
type: "remotion/starburst",
|
|
213
|
+
label: "Starburst",
|
|
214
|
+
backend: "webgl2",
|
|
215
|
+
calculateKey: (params) => {
|
|
216
|
+
const r = resolve(params);
|
|
217
|
+
return `starburst-${r.rays}-${r.colors.join("|")}-${r.rotation}-${r.smoothness}-${r.vignette}-${r.originOffsetX}-${r.originOffsetY}`;
|
|
218
|
+
},
|
|
219
|
+
setup: (target) => {
|
|
220
|
+
const gl = target.getContext("webgl2", {
|
|
221
|
+
premultipliedAlpha: true,
|
|
222
|
+
alpha: true,
|
|
223
|
+
preserveDrawingBuffer: true
|
|
224
|
+
});
|
|
225
|
+
if (!gl) {
|
|
226
|
+
throw new Error("Failed to acquire WebGL2 context for starburst effect");
|
|
227
|
+
}
|
|
228
|
+
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
|
|
229
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
|
|
230
|
+
const vs = compileShader(gl, gl.VERTEX_SHADER, STARBURST_VS);
|
|
231
|
+
const fs = compileShader(gl, gl.FRAGMENT_SHADER, STARBURST_FS);
|
|
232
|
+
const program = linkProgram(gl, vs, fs);
|
|
233
|
+
gl.deleteShader(vs);
|
|
234
|
+
gl.deleteShader(fs);
|
|
235
|
+
const vao = gl.createVertexArray();
|
|
236
|
+
if (!vao) {
|
|
237
|
+
throw new Error("Failed to create WebGL vertex array");
|
|
238
|
+
}
|
|
239
|
+
gl.bindVertexArray(vao);
|
|
240
|
+
const data = new Float32Array([
|
|
241
|
+
-1,
|
|
242
|
+
-1,
|
|
243
|
+
0,
|
|
244
|
+
0,
|
|
245
|
+
1,
|
|
246
|
+
-1,
|
|
247
|
+
1,
|
|
248
|
+
0,
|
|
249
|
+
-1,
|
|
250
|
+
1,
|
|
251
|
+
0,
|
|
252
|
+
1,
|
|
253
|
+
1,
|
|
254
|
+
1,
|
|
255
|
+
1,
|
|
256
|
+
1
|
|
257
|
+
]);
|
|
258
|
+
const vbo = gl.createBuffer();
|
|
259
|
+
if (!vbo) {
|
|
260
|
+
throw new Error("Failed to create WebGL buffer");
|
|
261
|
+
}
|
|
262
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
|
|
263
|
+
gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
|
|
264
|
+
const aPos = gl.getAttribLocation(program, "aPos");
|
|
265
|
+
const aUv = gl.getAttribLocation(program, "aUv");
|
|
266
|
+
gl.enableVertexAttribArray(aPos);
|
|
267
|
+
gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 16, 0);
|
|
268
|
+
gl.enableVertexAttribArray(aUv);
|
|
269
|
+
gl.vertexAttribPointer(aUv, 2, gl.FLOAT, false, 16, 8);
|
|
270
|
+
gl.bindVertexArray(null);
|
|
271
|
+
const sourceTexture = gl.createTexture();
|
|
272
|
+
if (!sourceTexture) {
|
|
273
|
+
throw new Error("Failed to create WebGL source texture");
|
|
274
|
+
}
|
|
275
|
+
gl.bindTexture(gl.TEXTURE_2D, sourceTexture);
|
|
276
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
277
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
278
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
279
|
+
const paletteTexture = gl.createTexture();
|
|
280
|
+
if (!paletteTexture) {
|
|
281
|
+
throw new Error("Failed to create WebGL palette texture");
|
|
282
|
+
}
|
|
283
|
+
gl.bindTexture(gl.TEXTURE_2D, paletteTexture);
|
|
284
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
285
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
286
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
287
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
288
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
289
|
+
return {
|
|
290
|
+
gl,
|
|
291
|
+
program,
|
|
292
|
+
vao,
|
|
293
|
+
vbo,
|
|
294
|
+
sourceTexture,
|
|
295
|
+
paletteTexture,
|
|
296
|
+
uSource: gl.getUniformLocation(program, "uSource"),
|
|
297
|
+
uColorPalette: gl.getUniformLocation(program, "colorPalette"),
|
|
298
|
+
uNumRays: gl.getUniformLocation(program, "numRays"),
|
|
299
|
+
uRotationOffset: gl.getUniformLocation(program, "rotationOffset"),
|
|
300
|
+
uSmoothEdge: gl.getUniformLocation(program, "smoothEdge"),
|
|
301
|
+
uResolution: gl.getUniformLocation(program, "resolution"),
|
|
302
|
+
uNumColors: gl.getUniformLocation(program, "numColors"),
|
|
303
|
+
uVignetteAmount: gl.getUniformLocation(program, "vignetteAmount"),
|
|
304
|
+
uOriginOffset: gl.getUniformLocation(program, "originOffset"),
|
|
305
|
+
cachedPaletteKey: "",
|
|
306
|
+
palettePixelData: new Uint8Array(0)
|
|
307
|
+
};
|
|
308
|
+
},
|
|
309
|
+
apply: ({ source, width, height, params, state }) => {
|
|
310
|
+
const r = resolve(params);
|
|
311
|
+
const {
|
|
312
|
+
gl,
|
|
313
|
+
program,
|
|
314
|
+
vao,
|
|
315
|
+
sourceTexture,
|
|
316
|
+
paletteTexture,
|
|
317
|
+
uSource,
|
|
318
|
+
uColorPalette,
|
|
319
|
+
uNumRays,
|
|
320
|
+
uRotationOffset,
|
|
321
|
+
uSmoothEdge,
|
|
322
|
+
uResolution,
|
|
323
|
+
uNumColors,
|
|
324
|
+
uVignetteAmount,
|
|
325
|
+
uOriginOffset
|
|
326
|
+
} = state;
|
|
327
|
+
const rotationRad = r.rotation * Math.PI / 180;
|
|
328
|
+
const paletteKey = r.colors.join("|");
|
|
329
|
+
const paletteDirty = state.cachedPaletteKey !== paletteKey;
|
|
330
|
+
if (paletteDirty) {
|
|
331
|
+
state.cachedPaletteKey = paletteKey;
|
|
332
|
+
const len = r.colors.length * 4;
|
|
333
|
+
if (state.palettePixelData.length !== len) {
|
|
334
|
+
state.palettePixelData = new Uint8Array(len);
|
|
335
|
+
}
|
|
336
|
+
const { palettePixelData } = state;
|
|
337
|
+
for (let i = 0;i < r.colors.length; i++) {
|
|
338
|
+
const rgb = hexToRgb(r.colors[i]);
|
|
339
|
+
palettePixelData[i * 4] = Math.round(rgb[0] * 255);
|
|
340
|
+
palettePixelData[i * 4 + 1] = Math.round(rgb[1] * 255);
|
|
341
|
+
palettePixelData[i * 4 + 2] = Math.round(rgb[2] * 255);
|
|
342
|
+
palettePixelData[i * 4 + 3] = 255;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
gl.viewport(0, 0, width, height);
|
|
346
|
+
gl.clearColor(0, 0, 0, 0);
|
|
347
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
348
|
+
gl.useProgram(program);
|
|
349
|
+
gl.bindVertexArray(vao);
|
|
350
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
351
|
+
gl.bindTexture(gl.TEXTURE_2D, sourceTexture);
|
|
352
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
353
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
354
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, source);
|
|
355
|
+
gl.activeTexture(gl.TEXTURE1);
|
|
356
|
+
gl.bindTexture(gl.TEXTURE_2D, paletteTexture);
|
|
357
|
+
if (paletteDirty) {
|
|
358
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, r.colors.length, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, state.palettePixelData);
|
|
359
|
+
}
|
|
360
|
+
if (uSource)
|
|
361
|
+
gl.uniform1i(uSource, 0);
|
|
362
|
+
if (uColorPalette)
|
|
363
|
+
gl.uniform1i(uColorPalette, 1);
|
|
364
|
+
if (uNumRays)
|
|
365
|
+
gl.uniform1f(uNumRays, r.rays);
|
|
366
|
+
if (uNumColors)
|
|
367
|
+
gl.uniform1f(uNumColors, r.colors.length);
|
|
368
|
+
if (uRotationOffset)
|
|
369
|
+
gl.uniform1f(uRotationOffset, rotationRad);
|
|
370
|
+
if (uSmoothEdge)
|
|
371
|
+
gl.uniform1f(uSmoothEdge, r.smoothness);
|
|
372
|
+
if (uVignetteAmount)
|
|
373
|
+
gl.uniform1f(uVignetteAmount, r.vignette);
|
|
374
|
+
if (uOriginOffset)
|
|
375
|
+
gl.uniform2f(uOriginOffset, r.originOffsetX, r.originOffsetY);
|
|
376
|
+
if (uResolution)
|
|
377
|
+
gl.uniform2f(uResolution, width, height);
|
|
378
|
+
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
|
379
|
+
gl.bindVertexArray(null);
|
|
380
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
381
|
+
gl.useProgram(null);
|
|
382
|
+
},
|
|
383
|
+
cleanup: ({ gl, program, vao, vbo, sourceTexture, paletteTexture }) => {
|
|
384
|
+
gl.deleteBuffer(vbo);
|
|
385
|
+
gl.deleteProgram(program);
|
|
386
|
+
gl.deleteVertexArray(vao);
|
|
387
|
+
gl.deleteTexture(sourceTexture);
|
|
388
|
+
gl.deleteTexture(paletteTexture);
|
|
389
|
+
},
|
|
390
|
+
schema: starburstEffectSchema
|
|
391
|
+
});
|
|
392
|
+
var starburst = (params) => {
|
|
393
|
+
validateStarburstEffectParams(params);
|
|
394
|
+
return starburstImpl(params);
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
// src/Starburst.tsx
|
|
398
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
399
|
+
import {
|
|
400
|
+
AbsoluteFill,
|
|
401
|
+
Internals as Internals2,
|
|
402
|
+
Sequence,
|
|
403
|
+
useDelayRender,
|
|
404
|
+
useVideoConfig
|
|
405
|
+
} from "remotion";
|
|
406
|
+
import { jsx } from "react/jsx-runtime";
|
|
22
407
|
var VERTEX_SHADER = `
|
|
23
408
|
attribute vec2 position;
|
|
24
409
|
void main() {
|
|
@@ -253,7 +638,7 @@ var starburstSchema = {
|
|
|
253
638
|
default: 0,
|
|
254
639
|
description: "Origin Offset Y"
|
|
255
640
|
},
|
|
256
|
-
...
|
|
641
|
+
...Internals2.sequenceStyleSchema
|
|
257
642
|
};
|
|
258
643
|
var StarburstInner = ({
|
|
259
644
|
rays,
|
|
@@ -311,9 +696,16 @@ var StarburstInner = ({
|
|
|
311
696
|
})
|
|
312
697
|
});
|
|
313
698
|
};
|
|
314
|
-
var Starburst =
|
|
699
|
+
var Starburst = Internals2.wrapInSchema(StarburstInner, starburstSchema);
|
|
315
700
|
Starburst.displayName = "Starburst";
|
|
316
|
-
|
|
701
|
+
Internals2.addSequenceStackTraces(Starburst);
|
|
702
|
+
|
|
703
|
+
// src/index.ts
|
|
704
|
+
var StarburstInternals = {
|
|
705
|
+
starburst
|
|
706
|
+
};
|
|
317
707
|
export {
|
|
708
|
+
starburstEffectSchema,
|
|
709
|
+
StarburstInternals,
|
|
318
710
|
Starburst
|
|
319
711
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const hexToRgb: (hex: string) => [number, number, number];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export { Starburst } from './Starburst';
|
|
2
2
|
export type { StarburstProps } from './Starburst';
|
|
3
|
+
export { starburstEffectSchema, type StarburstEffectParams, } from './starburst-effect';
|
|
4
|
+
export declare const StarburstInternals: {
|
|
5
|
+
readonly starburst: (params: import("./starburst-effect").StarburstEffectParams) => import("remotion").EffectDescriptor<unknown>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { EffectDescriptor } from 'remotion';
|
|
2
|
+
export declare const starburstEffectSchema: {
|
|
3
|
+
readonly rays: {
|
|
4
|
+
readonly type: "number";
|
|
5
|
+
readonly min: 2;
|
|
6
|
+
readonly max: 100;
|
|
7
|
+
readonly step: 1;
|
|
8
|
+
readonly default: 12;
|
|
9
|
+
readonly description: "Number of Rays";
|
|
10
|
+
};
|
|
11
|
+
readonly rotation: {
|
|
12
|
+
readonly type: "number";
|
|
13
|
+
readonly min: 0;
|
|
14
|
+
readonly max: 360;
|
|
15
|
+
readonly step: 1;
|
|
16
|
+
readonly default: 0;
|
|
17
|
+
readonly description: "Rotation";
|
|
18
|
+
};
|
|
19
|
+
readonly smoothness: {
|
|
20
|
+
readonly type: "number";
|
|
21
|
+
readonly min: 0;
|
|
22
|
+
readonly max: 1;
|
|
23
|
+
readonly step: 0.01;
|
|
24
|
+
readonly default: 0;
|
|
25
|
+
readonly description: "Edge Smoothness";
|
|
26
|
+
};
|
|
27
|
+
readonly vignette: {
|
|
28
|
+
readonly type: "number";
|
|
29
|
+
readonly min: 0;
|
|
30
|
+
readonly max: 1;
|
|
31
|
+
readonly step: 0.01;
|
|
32
|
+
readonly default: 1;
|
|
33
|
+
readonly description: "Vignette";
|
|
34
|
+
};
|
|
35
|
+
readonly originOffsetX: {
|
|
36
|
+
readonly type: "number";
|
|
37
|
+
readonly min: -1;
|
|
38
|
+
readonly max: 1;
|
|
39
|
+
readonly step: 0.01;
|
|
40
|
+
readonly default: 0;
|
|
41
|
+
readonly description: "Origin Offset X";
|
|
42
|
+
};
|
|
43
|
+
readonly originOffsetY: {
|
|
44
|
+
readonly type: "number";
|
|
45
|
+
readonly min: -1;
|
|
46
|
+
readonly max: 1;
|
|
47
|
+
readonly step: 0.01;
|
|
48
|
+
readonly default: 0;
|
|
49
|
+
readonly description: "Origin Offset Y";
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export type StarburstEffectParams = {
|
|
53
|
+
readonly rays: number;
|
|
54
|
+
readonly colors: readonly string[];
|
|
55
|
+
readonly rotation?: number;
|
|
56
|
+
readonly smoothness?: number;
|
|
57
|
+
readonly vignette?: number;
|
|
58
|
+
readonly originOffsetX?: number;
|
|
59
|
+
readonly originOffsetY?: number;
|
|
60
|
+
};
|
|
61
|
+
export declare const starburst: (params: StarburstEffectParams) => EffectDescriptor<unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/starburst",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.462",
|
|
4
4
|
"description": "Starburst ray effect for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
"repository": {
|
|
9
9
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/starburst"
|
|
10
10
|
},
|
|
11
|
-
"sideEffects": false,
|
|
12
11
|
"type": "module",
|
|
13
12
|
"scripts": {
|
|
14
13
|
"formatting": "oxfmt src --check",
|
|
@@ -24,7 +23,7 @@
|
|
|
24
23
|
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"remotion": "4.0.
|
|
26
|
+
"remotion": "4.0.462",
|
|
28
27
|
"zod": "4.3.6"
|
|
29
28
|
},
|
|
30
29
|
"peerDependencies": {
|
|
@@ -42,7 +41,7 @@
|
|
|
42
41
|
"devDependencies": {
|
|
43
42
|
"react": "19.2.3",
|
|
44
43
|
"react-dom": "19.2.3",
|
|
45
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
44
|
+
"@remotion/eslint-config-internal": "4.0.462",
|
|
46
45
|
"eslint": "9.19.0",
|
|
47
46
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
48
47
|
},
|