diff --git a/client/src/remotion/ImageComposition.tsx b/client/src/remotion/ImageComposition.tsx index ecd3dfe..1fa0622 100644 --- a/client/src/remotion/ImageComposition.tsx +++ b/client/src/remotion/ImageComposition.tsx @@ -120,47 +120,53 @@ export const ImageComposition = ({ {/* Background music */} {musicUrl && } - {/* TikTok-style word-by-word text overlay (content section only) */} + {/* TikTok-style 3-words-at-a-time overlay (content section only) */} {frame < endingStart && ( - wordTimings && wordTimings.length > 0 ? ( - -
- {wordTimings.map((w, i) => { - const isActive = i === activeWordIdx; - if (!isActive) return null; - return ( - - {w.word} - - ); - })} -
-
- ) : overlayText ? ( + wordTimings && wordTimings.length > 0 && activeWordIdx >= 0 ? (() => { + // Group index: which chunk of 3 is currently active + const groupIdx = Math.floor(activeWordIdx / 3); + const groupStart = groupIdx * 3; + const groupWords = wordTimings.slice(groupStart, groupStart + 3); + return ( + +
+ {groupWords.map((w, gi) => { + const isActive = groupStart + gi === activeWordIdx; + return ( + + {w.word} + + ); + })} +
+
+ ); + })() : overlayText ? (