Skip to content

🎥 Make videos programmatically with React

`@remotion/starburst`: Make colors and rays mandatory props

Jonny Burger0be3e396d15c
diff --git a/packages/docs/docs/starburst/starburst.mdx b/packages/docs/docs/starburst/starburst.mdx
index 2ed7cc7246..8c6b9833eb 100644
--- a/packages/docs/docs/starburst/starburst.mdx
+++ b/packages/docs/docs/starburst/starburst.mdx
@@ -39,16 +39,16 @@ 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).
-### `rays?`
+### `rays`
-The number of rays in the starburst pattern. Must be between `2` and `100`. Default: `12`.
+The number of rays in the starburst pattern. Must be between `2` and `100`.
-### `colors?`
+### `colors`
-An array of hex color strings for the rays. Colors are assigned to rays cyclically. Must contain at least 2 colors. Default: `['#ffdd00', '#ff8800']`.
+An array of hex color strings for the rays. Colors are assigned to rays cyclically. Must contain at least 2 colors.
```tsx
-<Starburst colors={['#ff0066', '#6600ff', '#00ccff']} />
+<Starburst rays={12} colors={['#ff0066', '#6600ff', '#00ccff']} />
```
### `rotation?`
diff --git a/packages/starburst/src/Starburst.tsx b/packages/starburst/src/Starburst.tsx
index 0ec1e16605..47f587d089 100644
--- a/packages/starburst/src/Starburst.tsx
+++ b/packages/starburst/src/Starburst.tsx
@@ -17,8 +17,8 @@ export type StarburstProps = Omit<
> &
Omit<AbsoluteFillLayout, 'layout'> & {
readonly durationInFrames?: number;
- readonly rays?: number;
- readonly colors?: readonly string[];
+ readonly rays: number;
+ readonly colors: readonly string[];
readonly rotation?: number;
readonly smoothness?: number;
readonly vignette?: number;
@@ -26,8 +26,6 @@ export type StarburstProps = Omit<
readonly originOffsetY?: number;
};
-const DEFAULT_COLORS = ['#ffdd00', '#ff8800'] as const;
-
const hexToRgb = (hex: string): [number, number, number] => {
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
if (!result) {
@@ -371,8 +369,8 @@ const StarburstInner: React.FC<
readonly controls: SequenceControls | undefined;
}
> = ({
- rays = 12,
- colors = DEFAULT_COLORS,
+ rays,
+ colors,
rotation = 0,
smoothness = 0,
vignette = 1,