🎥 Make videos programmatically with React
template-helloworld: Make title and logo editable in Studio
JonnyBurger386da8a9dbea
diff --git a/packages/template-helloworld/src/HelloWorld/Arc.tsx b/packages/template-helloworld/src/HelloWorld/Arc.tsxindex 309ce30dce..f39e6d57dc 100644--- a/packages/template-helloworld/src/HelloWorld/Arc.tsx+++ b/packages/template-helloworld/src/HelloWorld/Arc.tsx@@ -7,8 +7,8 @@ const getCircumferenceOfArc = (rx: number, ry: number) => {const rx = 135;const ry = 300;-const cx = 960;-const cy = 540;+const cx = 315;+const cy = 315;const arcLength = getCircumferenceOfArc(rx, ry);const strokeWidth = 30;@@ -17,7 +17,7 @@ export const Arc: React.FC<{color1: string;color2: string;}> = ({ rotation, color1, color2 }) => {- const { width, height, fps } = useVideoConfig();+ const { fps } = useVideoConfig();const frame = useCurrentFrame();const progress = interpolate(frame, [0, fps], [0, 1], {easing: Easing.spring({ damping: 100, mass: 0.5 }),@@ -30,9 +30,11 @@ export const Arc: React.FC<{return (<svg- viewBox={`0 0 ${width} ${height}`}+ viewBox="0 0 630 630"style={{position: "absolute",+ width: "100%",+ height: "100%",rotate: `${rotation * progress}deg`,}}>diff --git a/packages/template-helloworld/src/HelloWorld/Atom.tsx b/packages/template-helloworld/src/HelloWorld/Atom.tsxindex 22f02c5b04..b0b9ba6822 100644--- a/packages/template-helloworld/src/HelloWorld/Atom.tsx+++ b/packages/template-helloworld/src/HelloWorld/Atom.tsx@@ -5,7 +5,7 @@ export const Atom: React.FC<{color1: string;color2: string;}> = ({ color1, color2 }) => {- const { width, height, fps } = useVideoConfig();+ const { fps } = useVideoConfig();const frame = useCurrentFrame();// Each SVG ID must be unique to not conflict with each other@@ -13,9 +13,11 @@ export const Atom: React.FC<{return (<svg- viewBox={`0 0 ${width} ${height}`}+ viewBox="0 0 630 630"style={{position: "absolute",+ width: "100%",+ height: "100%",scale: interpolate(frame, [0, fps], [0, 1], {easing: Easing.spring({ damping: 100, mass: 0.5 }),output: "perceptual-scale",@@ -32,8 +34,8 @@ export const Atom: React.FC<{</defs><circler={70}- cx={width / 2}- cy={height / 2}+ cx={315}+ cy={315}fill={`url(#${gradientId})`}/></svg>diff --git a/packages/template-helloworld/src/HelloWorld/Logo.tsx b/packages/template-helloworld/src/HelloWorld/Logo.tsxindex 3756d9b0c5..ea4a32d68c 100644--- a/packages/template-helloworld/src/HelloWorld/Logo.tsx+++ b/packages/template-helloworld/src/HelloWorld/Logo.tsx@@ -24,7 +24,12 @@ const LogoInner: React.FC<LogoProps> = ({ logoColor1, logoColor2, style }) => {<Interactive.Divstyle={{position: "absolute",- inset: 0,+ left: "50%",+ top: "50%",+ width: 500,+ height: 500,+ marginLeft: -250,+ marginTop: -250,scale: interpolate(frame, [0, fps], [0, 1], {easing: Easing.spring({ mass: 0.5 }),output: "perceptual-scale",