Skip to content

🎥 Make videos programmatically with React

`@remotion/starburst`: Add interactive demo to docs

Jonny Burgerace44d3eae94
diff --git a/packages/docs/components/demos/StarburstDemo.tsx b/packages/docs/components/demos/StarburstDemo.tsx
new file mode 100644
index 0000000000..07ffad7b62
--- /dev/null
+++ b/packages/docs/components/demos/StarburstDemo.tsx
@@ -0,0 +1,37 @@
+import {Starburst} from '@remotion/starburst';
+import React from 'react';
+import {AbsoluteFill, useVideoConfig} from 'remotion';
+
+interface Props {
+ readonly rays: number;
+ readonly rotation: number;
+ readonly smoothness: number;
+ readonly vignette: number;
+ readonly originOffsetX: number;
+ readonly originOffsetY: number;
+}
+
+export const StarburstDemoComp: React.FC<Props> = ({
+ rays,
+ rotation,
+ smoothness,
+ vignette,
+ originOffsetX,
+ originOffsetY,
+}) => {
+ const {durationInFrames} = useVideoConfig();
+ return (
+ <AbsoluteFill style={{backgroundColor: 'black'}}>
+ <Starburst
+ rays={rays}
+ colors={['#ffdd00', '#ff8800']}
+ rotation={rotation}
+ smoothness={smoothness}
+ vignette={vignette}
+ originOffsetX={originOffsetX}
+ originOffsetY={originOffsetY}
+ durationInFrames={durationInFrames}
+ />
+ </AbsoluteFill>
+ );
+};
diff --git a/packages/docs/components/demos/index.tsx b/packages/docs/components/demos/index.tsx
index b013a83328..512f1d2a28 100644
--- a/packages/docs/components/demos/index.tsx
+++ b/packages/docs/components/demos/index.tsx
@@ -18,6 +18,7 @@ import {
heartDemo,
irisPresentationDemo,
lightLeakDemo,
+ starburstDemo,
noiseDemo,
nonePresentationDemo,
opacityDemo,
@@ -84,6 +85,7 @@ const demos: DemoType[] = [
springDampingDemo,
shaderDemo,
lightLeakDemo,
+ starburstDemo,
transitionSeriesTransitionDemo,
transitionSeriesOverlayDemo,
transitionSeriesEnterExitDemo,
diff --git a/packages/docs/components/demos/types.ts b/packages/docs/components/demos/types.ts
index 6c0d52a660..55795e9736 100644
--- a/packages/docs/components/demos/types.ts
+++ b/packages/docs/components/demos/types.ts
@@ -24,6 +24,7 @@ import {RoundedTextBox} from './RoundedTextBox';
import {ShaderDemoComp} from './ShaderDemo';
import {SpringDemo} from './Spring';
import {StarDemo} from './Star';
+import {StarburstDemoComp} from './StarburstDemo';
import {AnimationMath} from './SubtractAnimations';
import {TransitionSeriesEnterExitDemoComp} from './TransitionSeriesEnterExitDemo';
import {TransitionSeriesOverlayDemoComp} from './TransitionSeriesOverlayDemo';
@@ -1050,6 +1051,73 @@ export const lightLeakDemo: DemoType = {
],
};
+export const starburstDemo: DemoType = {
+ comp: StarburstDemoComp,
+ compHeight: 720,
+ compWidth: 1280,
+ durationInFrames: 90,
+ fps: 30,
+ id: 'starburst',
+ autoPlay: false,
+ controls: false,
+ options: [
+ {
+ name: 'rays',
+ type: 'numeric',
+ default: 12,
+ min: 2,
+ max: 100,
+ step: 1,
+ optional: 'no',
+ },
+ {
+ name: 'rotation',
+ type: 'numeric',
+ default: 0,
+ min: 0,
+ max: 360,
+ step: 1,
+ optional: 'no',
+ },
+ {
+ name: 'smoothness',
+ type: 'numeric',
+ default: 0,
+ min: 0,
+ max: 1,
+ step: 0.01,
+ optional: 'no',
+ },
+ {
+ name: 'vignette',
+ type: 'numeric',
+ default: 1,
+ min: 0,
+ max: 1,
+ step: 0.01,
+ optional: 'no',
+ },
+ {
+ name: 'originOffsetX',
+ type: 'numeric',
+ default: 0,
+ min: -1,
+ max: 1,
+ step: 0.01,
+ optional: 'no',
+ },
+ {
+ name: 'originOffsetY',
+ type: 'numeric',
+ default: 0,
+ min: -1,
+ max: 1,
+ step: 0.01,
+ optional: 'no',
+ },
+ ],
+};
+
export const transitionSeriesTransitionDemo: DemoType = {
comp: TransitionSeriesTransitionDemoComp,
compHeight: 280,
diff --git a/packages/docs/docs/starburst-guide.mdx b/packages/docs/docs/starburst-guide.mdx
index 9f286bb546..3a0a629308 100644
--- a/packages/docs/docs/starburst-guide.mdx
+++ b/packages/docs/docs/starburst-guide.mdx
@@ -9,6 +9,8 @@ crumb: 'Techniques'
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.
+<Demo type="starburst" />
+
```tsx twoslash title="MyComp.tsx"
import {Starburst} from '@remotion/starburst';
import {AbsoluteFill} from 'remotion';