Skip to content

🎥 Make videos programmatically with React

very good

Jonny Burgerf865fea058e2
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsx
index ab25c183e0..19a9dee4f8 100644
--- a/packages/example/src/Root.tsx
+++ b/packages/example/src/Root.tsx
@@ -609,7 +609,10 @@ export const Index: React.FC = () => {
width={800}
height={900}
schema={fitTextOnNLinesSchema}
- defaultProps={{line: 'This is awesome, we have', maxLines: 2}}
+ defaultProps={{
+ line: 'This is awesome, it just works extremely well',
+ maxLines: 2,
+ }}
/>
<Composition
id="beta-text"
diff --git a/packages/example/src/TikTokTextbox/TikTokTextBox.tsx b/packages/example/src/TikTokTextbox/TikTokTextBox.tsx
index 439106d50e..8ccb3c3e96 100644
--- a/packages/example/src/TikTokTextbox/TikTokTextBox.tsx
+++ b/packages/example/src/TikTokTextbox/TikTokTextBox.tsx
@@ -16,6 +16,10 @@ interface CornerRounding {
bottomLeft: boolean;
bottomRight: boolean;
classList: string[];
+ currLength: number | undefined;
+ prevLength: number | undefined;
+ nextLength: number | undefined;
+ align: React.CSSProperties['textAlign'];
}
const getCornerRoundings = ({
@@ -62,10 +66,13 @@ const getCornerRoundings = ({
const currLen = lengths[i];
// Determine rounded corners
- let topLeft = isFirst || (prevLen !== undefined && currLen > prevLen);
+ let topLeft =
+ isFirst || (prevLen !== undefined && currLen.width > prevLen.width);
let topRight = topLeft;
- let bottomLeft = isLast || (nextLen !== undefined && currLen > nextLen);
- let bottomRight = bottomLeft;
+ let bottomLeft =
+ isLast || (nextLen !== undefined && currLen.width > nextLen.width);
+ let bottomRight =
+ isLast || (nextLen !== undefined && currLen.width > nextLen.width);
if (!isFirst && !isLast) {
if (align === 'left') {
@@ -106,6 +113,10 @@ const getCornerRoundings = ({
bottomLeft: bottomLeft,
bottomRight: bottomRight,
classList,
+ currLength: currLen?.width,
+ prevLength: prevLen?.width,
+ nextLength: nextLen?.width,
+ align,
};
return roundings;
});
diff --git a/packages/example/src/Title/FitTextOnNLines.tsx b/packages/example/src/Title/FitTextOnNLines.tsx
index 4096555c9d..2ffbda79dc 100644
--- a/packages/example/src/Title/FitTextOnNLines.tsx
+++ b/packages/example/src/Title/FitTextOnNLines.tsx
@@ -56,6 +56,7 @@ export const FitTextOnNLines: React.FC<
textColor="white"
lines={lines}
fontFamily={fontFamily}
+ textAlign="center"
></TikTokTextBox>
</div>
</AbsoluteFill>