🎥 Make videos programmatically with React
`@remotion/starburst`: Make starburst static, remove animation and vignette
Jonny Burgerdf1a0c9aebe5
diff --git a/packages/docs/docs/starburst-guide.mdx b/packages/docs/docs/starburst-guide.mdxindex 354499cdbd..6745ae1386 100644--- a/packages/docs/docs/starburst-guide.mdx+++ b/packages/docs/docs/starburst-guide.mdx@@ -7,7 +7,7 @@ crumb: 'Techniques'# Starburst<AvailableFrom v="4.0.435"/>-The [`<Starburst>`](/docs/starburst/starburst) component from [`@remotion/starburst`](/docs/starburst/api) renders a WebGL-based retro starburst ray effect. The effect reveals during the first half of its duration and retracts during the second half.+The [`<Starburst>`](/docs/starburst/starburst) component from [`@remotion/starburst`](/docs/starburst/api) renders a static WebGL-based retro starburst ray pattern. It can be used as a background or combined with animations for transitions.```tsx twoslash title="MyComp.tsx"import {Starburst} from '@remotion/starburst';@@ -105,7 +105,7 @@ const StarburstTransition = () => {};```-At the midpoint, the starburst covers most of the canvas, hiding the cut between scenes.+The starburst covers the full canvas, hiding the cut between scenes.## See alsodiff --git a/packages/docs/docs/starburst/starburst.mdx b/packages/docs/docs/starburst/starburst.mdxindex 0fd59571f6..e80a6e0ebc 100644--- a/packages/docs/docs/starburst/starburst.mdx+++ b/packages/docs/docs/starburst/starburst.mdx@@ -6,8 +6,7 @@ crumb: '@remotion/starburst'# <Starburst><AvailableFrom v="4.0.435" />-Renders a WebGL-based retro starburst ray effect.-The effect reveals during the first half of the duration and retracts during the second half.+Renders a static WebGL-based retro starburst ray pattern.Is a [`<Sequence>`](/docs/sequence) component under the hood and accepts its props.## Example@@ -37,7 +36,7 @@ Apart from the props listed below, all props from [`<Sequence>`](/docs/sequence)### `durationInFrames?`-The duration of the starburst effect in frames. The effect reveals during the first half and retracts during the second half.+The duration of the starburst in frames.If not specified, defaults to the duration of the composition or sequence, reading from [`useVideoConfig()`](/docs/use-video-config).diff --git a/packages/starburst/src/Starburst.tsx b/packages/starburst/src/Starburst.tsxindex ac5abb4489..79e5f34abc 100644--- a/packages/starburst/src/Starburst.tsx+++ b/packages/starburst/src/Starburst.tsx@@ -4,7 +4,6 @@ import {AbsoluteFill,Internals,Sequence,- useCurrentFrame,useDelayRender,useVideoConfig,type AbsoluteFillLayout,@@ -50,7 +49,6 @@ const FRAGMENT_SHADER = `precision mediump float;#endif-uniform float progress;uniform float numRays;uniform vec3 color1;uniform vec3 color2;@@ -58,8 +56,6 @@ uniform float rotationOffset;uniform float smoothEdge;uniform vec2 resolution;-const float Pi = 3.14159265359;-void main() {vec2 uv = gl_FragCoord.xy / resolution;vec2 center = uv - 0.5;@@ -73,25 +69,13 @@ void main() {vec3 col = mix(color2, color1, ray);- float dist = length(center);-- float revealRadius = progress * 2.0;- float alpha = smoothstep(revealRadius, revealRadius - 0.3, dist);-- float retractProgress = max(0.0, progress * 2.0 - 1.0);- float innerRadius = retractProgress * 1.5;- float retractAlpha = smoothstep(innerRadius - 0.3, innerRadius, dist);-- alpha *= retractAlpha;-- gl_FragColor = vec4(col, alpha);+ gl_FragColor = vec4(col, 1.0);}`;type GlContext = {gl: WebGLRenderingContext;resLoc: WebGLUniformLocation;- progressLoc: WebGLUniformLocation;numRaysLoc: WebGLUniformLocation;color1Loc: WebGLUniformLocation;color2Loc: WebGLUniformLocation;@@ -106,8 +90,7 @@ const StarburstCanvas: React.FC<{readonly rotation: number;readonly smoothness: number;}> = ({rays, color1, color2, rotation, smoothness}) => {- const frame = useCurrentFrame();- const {width, height, durationInFrames} = useVideoConfig();+ const {width, height} = useVideoConfig();const canvasRef = useRef<HTMLCanvasElement>(null);const glRef = useRef<GlContext | null>(null);@@ -161,7 +144,6 @@ const StarburstCanvas: React.FC<{return {gl,resLoc: gl.getUniformLocation(program, 'resolution')!,- progressLoc: gl.getUniformLocation(program, 'progress')!,numRaysLoc: gl.getUniformLocation(program, 'numRays')!,color1Loc: gl.getUniformLocation(program, 'color1')!,color2Loc: gl.getUniformLocation(program, 'color2')!,@@ -184,7 +166,6 @@ const StarburstCanvas: React.FC<{const {gl,resLoc,- progressLoc,numRaysLoc,color1Loc,color2Loc,@@ -192,9 +173,6 @@ const StarburstCanvas: React.FC<{smoothEdgeLoc,} = ctx;- const normalized =- durationInFrames <= 1 ? 0 : frame / (durationInFrames - 1);-const rgb1 = hexToRgb(color1);const rgb2 = hexToRgb(color2);const rotationRad = (rotation * Math.PI) / 180;@@ -202,7 +180,6 @@ const StarburstCanvas: React.FC<{gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);gl.clearColor(0, 0, 0, 0);gl.clear(gl.COLOR_BUFFER_BIT);- gl.uniform1f(progressLoc, normalized);gl.uniform1f(numRaysLoc, rays);gl.uniform3f(color1Loc, rgb1[0], rgb1[1], rgb1[2]);gl.uniform3f(color2Loc, rgb2[0], rgb2[1], rgb2[2]);@@ -210,17 +187,7 @@ const StarburstCanvas: React.FC<{gl.uniform1f(smoothEdgeLoc, smoothness);gl.uniform2f(resLoc, gl.canvas.width, gl.canvas.height);gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);- }, [- frame,- durationInFrames,- rays,- color1,- color2,- rotation,- smoothness,- width,- height,- ]);+ }, [rays, color1, color2, rotation, smoothness, width, height]);return (<AbsoluteFill>@@ -230,7 +197,7 @@ const StarburstCanvas: React.FC<{};/*- * @description Renders a WebGL-based starburst ray effect as a Sequence.+ * @description Renders a static WebGL-based starburst ray pattern as a Sequence.* @see [Documentation](https://www.remotion.dev/docs/starburst/starburst)*/const starburstSchema = {