@zync/zync-screnplay-player 0.1.187
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ZyncScreenplayPlayer.js +35 -0
- package/dist/bundle.js +2 -0
- package/dist/bundle.js.LICENSE.txt +54 -0
- package/dist/index.js +4 -0
- package/dist/screenplay/RemotionRenderer/RemotionRenderer.js +281 -0
- package/dist/screenplay/RemotionRenderer/Root.js +22 -0
- package/dist/screenplay/RemotionRenderer/components/LottieAnimationGlobal.js +116 -0
- package/dist/screenplay/RemotionRenderer/components/backgrounds/VirtualBackground.js +26 -0
- package/dist/screenplay/RemotionRenderer/components/backgrounds/VirtualBackgroundUnderlay.js +41 -0
- package/dist/screenplay/RemotionRenderer/components/captions/CaptionSimple.js +12 -0
- package/dist/screenplay/RemotionRenderer/components/effects/BrollFullscreen.js +27 -0
- package/dist/screenplay/RemotionRenderer/components/effects/GlitchText.js +22 -0
- package/dist/screenplay/RemotionRenderer/components/effects/HandoffNametag.js +7 -0
- package/dist/screenplay/RemotionRenderer/components/effects/LottieAnimation.js +64 -0
- package/dist/screenplay/RemotionRenderer/components/effects/Nametag.js +9 -0
- package/dist/screenplay/RemotionRenderer/components/effects/PhraseRainbowEffect.js +34 -0
- package/dist/screenplay/RemotionRenderer/components/effects/Sentence.js +50 -0
- package/dist/screenplay/RemotionRenderer/components/effects/Title.js +12 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/BrollGreenScreen.js +742 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/BrollSplitScreen.js +714 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/BrollStudioBackdrop.js +620 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/DynamicTriangle.js +618 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/Handoff.js +161 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/IntroVideo.js +1330 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/KeyPointOverlayDepth.js +397 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/Keyword.js +539 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/KeywordStudioBackdrop.js +714 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/MotionStill.js +381 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/MotionStillFullScreen.js +178 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/MotionStillGreenScreen.js +568 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/MotionStillGreenScreenV2.js +731 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/MotionStillStudioBackdrop.js +588 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/SimpleFrame.js +183 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/SimpleFrameBroll.js +181 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/SimpleFrameSentence.js +17 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/SimpleFrameZoomCut.js +13 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/TextWithVideo.js +373 -0
- package/dist/screenplay/RemotionRenderer/components/layouts/quote-bubble-animation.json +1 -0
- package/dist/screenplay/RemotionRenderer/components/utils/BlurOverlay.js +19 -0
- package/dist/screenplay/RemotionRenderer/components/utils/ChromaKeyedVideo.js +59 -0
- package/dist/screenplay/RemotionRenderer/components/utils/FaceCenteredVideo.js +562 -0
- package/dist/screenplay/RemotionRenderer/components/utils/PausableImg.js +124 -0
- package/dist/screenplay/RemotionRenderer/components/utils/README.md +80 -0
- package/dist/screenplay/RemotionRenderer/components/utils/SafeZones.js +69 -0
- package/dist/screenplay/RemotionRenderer/components/utils/StretchText.js +124 -0
- package/dist/screenplay/RemotionRenderer/components/utils/StretchTextDemo.js +66 -0
- package/dist/screenplay/RemotionRenderer/config.js +8 -0
- package/dist/screenplay/RemotionRenderer/development.js +1370 -0
- package/dist/screenplay/RemotionRenderer/helpers/cleanFacemetadata.js +29 -0
- package/dist/screenplay/RemotionRenderer/helpers/convertToSeconds.js +14 -0
- package/dist/screenplay/RemotionRenderer/helpers/faceBasedVideoStyles.js +212 -0
- package/dist/screenplay/RemotionRenderer/helpers/faceCenteredVideoTransforms.js +468 -0
- package/dist/screenplay/RemotionRenderer/helpers/getContrastColor.js +15 -0
- package/dist/screenplay/RemotionRenderer/helpers/getVideoOrientation.js +21 -0
- package/dist/screenplay/RemotionRenderer/helpers/hexToRgb.js +48 -0
- package/dist/screenplay/RemotionRenderer/hooks/useLottieReplaceColor.js +45 -0
- package/dist/screenplay/RemotionRenderer/hooks/useOrientationBased.js +29 -0
- package/dist/screenplay/RemotionRenderer/hooks/useTimeInterpolate.js +54 -0
- package/dist/screenplay/RemotionRenderer/hooks/useVirtualBackground.js +38 -0
- package/dist/screenplay/RemotionRenderer/index.js +3 -0
- package/dist/screenplay/RemotionRenderer/main/lib/Sequence.js +76 -0
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/DefaultLayout.js +72 -0
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/DynamicTriangleLayout.js +54 -0
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/HandoffLayout.js +50 -0
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/IntroVideoLayout.js +33 -0
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/KeywordLayout.js +36 -0
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/LayoutFactory.js +68 -0
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/MotionStillLayout.js +36 -0
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/SimpleFrameLayout.js +43 -0
- package/dist/screenplay/RemotionRenderer/main/lib/layouts/TextWithVideoLayout.js +52 -0
- package/dist/screenplay/RemotionRenderer/main/screenplaySchema.js +92 -0
- package/dist/screenplay/RemotionRenderer/registeredComponents.js +91 -0
- package/dist/screenplay/RemotionRenderer/theme/config.js +8 -0
- package/dist/screenplay/RemotionRenderer/theme/hooks/useTheme.js +24 -0
- package/dist/screenplay/RemotionRenderer/theme/hooks/useThemedComponents.js +101 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/bigbold/BigBoldNameTag.js +147 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/bigbold/BigBoldSentence.js +138 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/bigbold/BigBoldTitle.js +136 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionColor.js +67 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionColorInverse.js +67 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionColorShadow.js +66 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionElegant.js +134 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionEmphasis.js +122 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionPunctuated.js +84 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionWordBoom.js +88 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionWordBubble.js +91 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/CaptionWordPopup.js +118 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/DefaultCaption.js +62 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/HandoffNametag/handoffNametagConfig.js +59 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/HandoffNametag.js +173 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/Nametag.js +129 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/Sentence/AnimatedSentence.js +20 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/Sentence/AnimatedSentenceDefault.js +29 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/Sentence/SentenceSimple.helpers.js +61 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/Sentence.js +86 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/Title.js +112 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/default/constants.js +1 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/glassmorphism/Nametag.js +134 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/glassmorphism/Sentence.js +49 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/glassmorphism/Title.js +108 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/glassmorphism/animations.js +30 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/glassmorphism/config.js +9 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/glitch/GlitchNametag.js +252 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/glitch/GlitchSentence.js +156 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/glitch/GlitchTitle.js +142 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/glitch/components/DisplacedText.js +66 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/glitch/components/GlitchAnimatedLine.js +38 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/glitch/components/SplitSentence.js +80 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/glitch/helpers.js +32 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/none/Nametag.js +3 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/none/Title.js +3 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/pushpull/PushPullNametag.js +165 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/pushpull/PushPullSentence.js +94 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/pushpull/PushPullTitle.js +98 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/pushpull/designs/sentence.js +92 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/pushpull/designs/title.js +119 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/sports/Nametag.js +122 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/sports/SportsCaption.js +93 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/sports/SportsSentence.js +76 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/sports/Title.js +90 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/sports/shared.js +62 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/sportsbounce/Nametag.js +145 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/sportsbounce/SportsBounceSentence.js +148 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/sportsbounce/Title.js +160 -0
- package/dist/screenplay/RemotionRenderer/tracks/AudioTrack.js +23 -0
- package/dist/screenplay/RemotionRenderer/tracks/CaptionsVideoTrack.js +23 -0
- package/dist/screenplay/RemotionRenderer/tracks/DynamicVideoComposition.js +31 -0
- package/dist/screenplay/RemotionRenderer/tracks/EffectsVideoTrack.js +23 -0
- package/dist/screenplay/RemotionRenderer/tracks/LayoutVideoTrack.js +141 -0
- package/dist/screenplay/RemotionRenderer/tracks/Soundtrack.js +16 -0
- package/dist/screenplay/RemotionRenderer/tracks/Watermark.js +23 -0
- package/dist/screenplay/RemotionRenderer/tracks/transitions/GlitchOne.js +92 -0
- package/package.json +45 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { AbsoluteFill, Easing, useVideoConfig } from "remotion";
|
|
2
|
+
import { useTimeInterpolate } from "../../../hooks/useTimeInterpolate.js";
|
|
3
|
+
import { convertToSeconds } from "../../../helpers/convertToSeconds.js";
|
|
4
|
+
import { loadFont } from "@remotion/google-fonts/Montserrat";
|
|
5
|
+
import { CHROME_PADDING } from "../../../config.js";
|
|
6
|
+
import { distributeTextToFit } from "../default/Sentence/SentenceSimple.helpers.js";
|
|
7
|
+
import { useOrientationBased } from "../../../hooks/useOrientationBased.js";
|
|
8
|
+
import { useTheme } from "../../hooks/useTheme.js";
|
|
9
|
+
import React from "react";
|
|
10
|
+
var _loadFont = loadFont(),
|
|
11
|
+
fontFamily = _loadFont.fontFamily;
|
|
12
|
+
export var BigBoldTitle = function BigBoldTitle(_ref) {
|
|
13
|
+
var text = _ref.text;
|
|
14
|
+
// Calculate time-based values using convertToSeconds
|
|
15
|
+
var _useVideoConfig = useVideoConfig(),
|
|
16
|
+
height = _useVideoConfig.height,
|
|
17
|
+
width = _useVideoConfig.width;
|
|
18
|
+
var _useOrientationBased = useOrientationBased({
|
|
19
|
+
landscape: {
|
|
20
|
+
backdropHeightFactor: 0.6
|
|
21
|
+
},
|
|
22
|
+
portrait: {
|
|
23
|
+
backdropHeightFactor: 0.3
|
|
24
|
+
},
|
|
25
|
+
square: {
|
|
26
|
+
backdropHeightFactor: 0.5
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
backdropHeightFactor = _useOrientationBased.backdropHeightFactor;
|
|
30
|
+
var _distributeTextToFit = distributeTextToFit(text, width * 0.65, height * backdropHeightFactor * 1.3, 210),
|
|
31
|
+
lines = _distributeTextToFit.lines,
|
|
32
|
+
fontSize = _distributeTextToFit.fontSize;
|
|
33
|
+
var disappearStartTime = convertToSeconds(3, 0);
|
|
34
|
+
var disappearDuration = convertToSeconds(0.3, 0);
|
|
35
|
+
var startScaleTime = convertToSeconds(0, 0); // Start at 0 seconds
|
|
36
|
+
var endScaleTime = convertToSeconds(1, 0); // End at 0.5 seconds
|
|
37
|
+
|
|
38
|
+
// Adjust rectangleScale calculation to use an appropriate time range
|
|
39
|
+
var rectangleScale = useTimeInterpolate([startScaleTime, endScaleTime],
|
|
40
|
+
// Input range in seconds
|
|
41
|
+
[0, 2],
|
|
42
|
+
// Output range for width
|
|
43
|
+
{
|
|
44
|
+
easing: Easing.out(Easing.cubic),
|
|
45
|
+
extrapolateLeft: "clamp",
|
|
46
|
+
extrapolateRight: "clamp"
|
|
47
|
+
});
|
|
48
|
+
var disappearScale = useTimeInterpolate([disappearStartTime, disappearStartTime + disappearDuration], [100, 110], {
|
|
49
|
+
easing: Easing["in"](Easing.cubic),
|
|
50
|
+
extrapolateLeft: "clamp",
|
|
51
|
+
extrapolateRight: "clamp"
|
|
52
|
+
});
|
|
53
|
+
var opacity = useTimeInterpolate([disappearStartTime, disappearStartTime + disappearDuration], [1, 0], {
|
|
54
|
+
easing: Easing["in"](Easing.cubic),
|
|
55
|
+
extrapolateLeft: "clamp",
|
|
56
|
+
extrapolateRight: "clamp"
|
|
57
|
+
});
|
|
58
|
+
var _useOrientationBased2 = useOrientationBased({
|
|
59
|
+
landscape: {
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
justifyContent: "center",
|
|
62
|
+
fontSize: "160px"
|
|
63
|
+
},
|
|
64
|
+
portrait: {
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
justifyContent: "center",
|
|
67
|
+
fontSize: "120px"
|
|
68
|
+
},
|
|
69
|
+
square: {
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
justifyContent: "center",
|
|
72
|
+
fontSize: "120px"
|
|
73
|
+
}
|
|
74
|
+
}),
|
|
75
|
+
alignItems = _useOrientationBased2.alignItems,
|
|
76
|
+
justifyContent = _useOrientationBased2.justifyContent;
|
|
77
|
+
var _useTheme = useTheme(),
|
|
78
|
+
primaryContrast = _useTheme.primaryContrast;
|
|
79
|
+
return /*#__PURE__*/React.createElement(AbsoluteFill, {
|
|
80
|
+
style: {
|
|
81
|
+
display: "flex",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
// Center aligns items vertically
|
|
84
|
+
justifyContent: "center",
|
|
85
|
+
padding: CHROME_PADDING * 2.5,
|
|
86
|
+
transform: "scale(".concat(disappearScale, "%)")
|
|
87
|
+
}
|
|
88
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
89
|
+
style: {
|
|
90
|
+
position: "absolute",
|
|
91
|
+
width: "100%",
|
|
92
|
+
height: "92%",
|
|
93
|
+
// Adjust height as needed
|
|
94
|
+
backgroundColor: "#000000b6",
|
|
95
|
+
// Adjust color as needed
|
|
96
|
+
transform: "scale(".concat(rectangleScale, ")"),
|
|
97
|
+
opacity: opacity
|
|
98
|
+
}
|
|
99
|
+
}), lines.map(function (line, lineIndex) {
|
|
100
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
key: lineIndex,
|
|
102
|
+
style: {
|
|
103
|
+
display: "flex",
|
|
104
|
+
marginRight: "30px",
|
|
105
|
+
marginBottom: fontSize === 131 ? "-45px" : "-30px",
|
|
106
|
+
flexDirection: "row",
|
|
107
|
+
justifyContent: "flex-start"
|
|
108
|
+
}
|
|
109
|
+
}, line.split(" ").map(function (word, wordIndex) {
|
|
110
|
+
// alert(lines);
|
|
111
|
+
var delayTime = convertToSeconds(0.2, lineIndex * 0.2 * 30 + 0.1 + wordIndex * 0.12 * 30 // Reduce these multipliers for smoother transitions
|
|
112
|
+
);
|
|
113
|
+
var scale = useTimeInterpolate([delayTime, delayTime + convertToSeconds(0.3, 0)], [0, 100], {
|
|
114
|
+
easing: Easing["in"](Easing.cubic),
|
|
115
|
+
extrapolateLeft: "clamp",
|
|
116
|
+
extrapolateRight: "clamp"
|
|
117
|
+
});
|
|
118
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
119
|
+
key: wordIndex,
|
|
120
|
+
style: {
|
|
121
|
+
fontSize: fontSize,
|
|
122
|
+
fontFamily: fontFamily,
|
|
123
|
+
paddingLeft: "2rem",
|
|
124
|
+
fontWeight: "900",
|
|
125
|
+
textAlign: "center",
|
|
126
|
+
transform: "scale(".concat(scale, "%)"),
|
|
127
|
+
color: "white",
|
|
128
|
+
whiteSpace: "nowrap",
|
|
129
|
+
textTransform: "uppercase",
|
|
130
|
+
transformOrigin: "bottom",
|
|
131
|
+
opacity: opacity // Apply opacity for fade-out effect
|
|
132
|
+
}
|
|
133
|
+
}, word);
|
|
134
|
+
}));
|
|
135
|
+
}));
|
|
136
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AbsoluteFill, Sequence, useVideoConfig } from "remotion";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { loadFont } from "@remotion/google-fonts/Poppins";
|
|
4
|
+
import { useOrientationBased } from "../../../hooks/useOrientationBased.js";
|
|
5
|
+
import { distributeTextToFit } from "./Sentence/SentenceSimple.helpers.js";
|
|
6
|
+
import { useTheme } from "../../hooks/useTheme.js";
|
|
7
|
+
import { CAPTION_PORTRAIT_BOTTOM_OFFSET } from "./constants";
|
|
8
|
+
var _loadFont = loadFont(),
|
|
9
|
+
fontFamily = _loadFont.fontFamily;
|
|
10
|
+
export var CaptionColor = function CaptionColor(_ref) {
|
|
11
|
+
var transcripts = _ref.transcripts;
|
|
12
|
+
var _useTheme = useTheme(),
|
|
13
|
+
accentColor = _useTheme.accentColor,
|
|
14
|
+
accentContrast = _useTheme.accentContrast;
|
|
15
|
+
var _useVideoConfig = useVideoConfig(),
|
|
16
|
+
width = _useVideoConfig.width;
|
|
17
|
+
var _useOrientationBased = useOrientationBased({
|
|
18
|
+
portrait: {
|
|
19
|
+
fontSize: 100,
|
|
20
|
+
bottom: CAPTION_PORTRAIT_BOTTOM_OFFSET
|
|
21
|
+
},
|
|
22
|
+
landscape: {
|
|
23
|
+
fontSize: 110,
|
|
24
|
+
bottom: 110
|
|
25
|
+
},
|
|
26
|
+
square: {
|
|
27
|
+
fontSize: 100,
|
|
28
|
+
bottom: 110
|
|
29
|
+
}
|
|
30
|
+
}),
|
|
31
|
+
bottom = _useOrientationBased.bottom,
|
|
32
|
+
fontSize = _useOrientationBased.fontSize;
|
|
33
|
+
var containerWidth = width * 0.8;
|
|
34
|
+
return /*#__PURE__*/React.createElement(AbsoluteFill, null, transcripts.map(function (transcript, index) {
|
|
35
|
+
var _distributeTextToFit = distributeTextToFit(transcript.text, width * 0.7, fontSize * 1.2, fontSize),
|
|
36
|
+
lines = _distributeTextToFit.lines,
|
|
37
|
+
textFontSize = _distributeTextToFit.fontSize;
|
|
38
|
+
return /*#__PURE__*/React.createElement(Sequence, {
|
|
39
|
+
key: index,
|
|
40
|
+
from: transcript.from,
|
|
41
|
+
durationInFrames: transcript.durationInFrames
|
|
42
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
43
|
+
style: {
|
|
44
|
+
color: accentColor,
|
|
45
|
+
display: "flex",
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
justifyContent: "center",
|
|
48
|
+
height: fontSize * 1.2,
|
|
49
|
+
borderRadius: 10,
|
|
50
|
+
position: "absolute",
|
|
51
|
+
bottom: bottom,
|
|
52
|
+
left: "50%",
|
|
53
|
+
padding: "0 30px",
|
|
54
|
+
margin: "0 auto",
|
|
55
|
+
transform: "translateX(-50%)",
|
|
56
|
+
fontSize: textFontSize,
|
|
57
|
+
textTransform: "uppercase",
|
|
58
|
+
textAlign: "center",
|
|
59
|
+
fontFamily: fontFamily,
|
|
60
|
+
textShadow: "5px 3px 0px ".concat(accentContrast),
|
|
61
|
+
backgroundColor: accentContrast,
|
|
62
|
+
fontWeight: 700,
|
|
63
|
+
textWrap: "nowrap"
|
|
64
|
+
}
|
|
65
|
+
}, transcript.text));
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AbsoluteFill, Sequence, useVideoConfig } from "remotion";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { loadFont } from "@remotion/google-fonts/Poppins";
|
|
4
|
+
import { useOrientationBased } from "../../../hooks/useOrientationBased.js";
|
|
5
|
+
import { distributeTextToFit } from "./Sentence/SentenceSimple.helpers.js";
|
|
6
|
+
import { useTheme } from "../../hooks/useTheme.js";
|
|
7
|
+
import { CAPTION_PORTRAIT_BOTTOM_OFFSET } from "./constants";
|
|
8
|
+
var _loadFont = loadFont(),
|
|
9
|
+
fontFamily = _loadFont.fontFamily;
|
|
10
|
+
export var CaptionColorInverse = function CaptionColorInverse(_ref) {
|
|
11
|
+
var transcripts = _ref.transcripts;
|
|
12
|
+
var _useTheme = useTheme(),
|
|
13
|
+
accentColor = _useTheme.accentColor,
|
|
14
|
+
accentContrast = _useTheme.accentContrast;
|
|
15
|
+
var _useVideoConfig = useVideoConfig(),
|
|
16
|
+
width = _useVideoConfig.width;
|
|
17
|
+
var _useOrientationBased = useOrientationBased({
|
|
18
|
+
portrait: {
|
|
19
|
+
fontSize: 100,
|
|
20
|
+
bottom: CAPTION_PORTRAIT_BOTTOM_OFFSET
|
|
21
|
+
},
|
|
22
|
+
landscape: {
|
|
23
|
+
fontSize: 110,
|
|
24
|
+
bottom: 110
|
|
25
|
+
},
|
|
26
|
+
square: {
|
|
27
|
+
fontSize: 100,
|
|
28
|
+
bottom: 110
|
|
29
|
+
}
|
|
30
|
+
}),
|
|
31
|
+
bottom = _useOrientationBased.bottom,
|
|
32
|
+
fontSize = _useOrientationBased.fontSize;
|
|
33
|
+
var containerWidth = width * 0.8;
|
|
34
|
+
return /*#__PURE__*/React.createElement(AbsoluteFill, null, transcripts.map(function (transcript, index) {
|
|
35
|
+
var _distributeTextToFit = distributeTextToFit(transcript.text, width * 0.7, fontSize * 1.2, fontSize),
|
|
36
|
+
lines = _distributeTextToFit.lines,
|
|
37
|
+
textFontSize = _distributeTextToFit.fontSize;
|
|
38
|
+
return /*#__PURE__*/React.createElement(Sequence, {
|
|
39
|
+
key: index,
|
|
40
|
+
from: transcript.from,
|
|
41
|
+
durationInFrames: transcript.durationInFrames
|
|
42
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
43
|
+
style: {
|
|
44
|
+
color: accentContrast,
|
|
45
|
+
display: "flex",
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
justifyContent: "center",
|
|
48
|
+
height: fontSize * 1.2,
|
|
49
|
+
borderRadius: 10,
|
|
50
|
+
position: "absolute",
|
|
51
|
+
bottom: bottom,
|
|
52
|
+
left: "50%",
|
|
53
|
+
padding: "0 30px",
|
|
54
|
+
margin: "0 auto",
|
|
55
|
+
transform: "translateX(-50%)",
|
|
56
|
+
fontSize: textFontSize,
|
|
57
|
+
textTransform: "uppercase",
|
|
58
|
+
textAlign: "center",
|
|
59
|
+
fontFamily: fontFamily,
|
|
60
|
+
textShadow: "5px 3px 0px ".concat(accentColor),
|
|
61
|
+
backgroundColor: accentColor,
|
|
62
|
+
fontWeight: 700,
|
|
63
|
+
textWrap: "nowrap"
|
|
64
|
+
}
|
|
65
|
+
}, transcript.text));
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { AbsoluteFill, Sequence, useVideoConfig } from "remotion";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { loadFont } from "@remotion/google-fonts/Montserrat";
|
|
4
|
+
import { useOrientationBased } from "../../../hooks/useOrientationBased.js";
|
|
5
|
+
import { distributeTextToFit } from "./Sentence/SentenceSimple.helpers.js";
|
|
6
|
+
import { useTheme } from "../../hooks/useTheme.js";
|
|
7
|
+
import { CAPTION_PORTRAIT_BOTTOM_OFFSET } from "./constants";
|
|
8
|
+
var _loadFont = loadFont(),
|
|
9
|
+
fontFamily = _loadFont.fontFamily;
|
|
10
|
+
export var CaptionColorShadow = function CaptionColorShadow(_ref) {
|
|
11
|
+
var transcripts = _ref.transcripts;
|
|
12
|
+
var _useTheme = useTheme(),
|
|
13
|
+
accentColor = _useTheme.accentColor,
|
|
14
|
+
accentContrast = _useTheme.accentContrast;
|
|
15
|
+
var _useVideoConfig = useVideoConfig(),
|
|
16
|
+
width = _useVideoConfig.width;
|
|
17
|
+
var _useOrientationBased = useOrientationBased({
|
|
18
|
+
portrait: {
|
|
19
|
+
fontSize: 100,
|
|
20
|
+
bottom: CAPTION_PORTRAIT_BOTTOM_OFFSET
|
|
21
|
+
},
|
|
22
|
+
landscape: {
|
|
23
|
+
fontSize: 110,
|
|
24
|
+
bottom: 110
|
|
25
|
+
},
|
|
26
|
+
square: {
|
|
27
|
+
fontSize: 100,
|
|
28
|
+
bottom: 110
|
|
29
|
+
}
|
|
30
|
+
}),
|
|
31
|
+
bottom = _useOrientationBased.bottom,
|
|
32
|
+
fontSize = _useOrientationBased.fontSize;
|
|
33
|
+
var containerWidth = width * 0.8;
|
|
34
|
+
return /*#__PURE__*/React.createElement(AbsoluteFill, null, transcripts.map(function (transcript, index) {
|
|
35
|
+
var _distributeTextToFit = distributeTextToFit(transcript.text, width * 0.7, fontSize * 1.2, fontSize),
|
|
36
|
+
lines = _distributeTextToFit.lines,
|
|
37
|
+
textFontSize = _distributeTextToFit.fontSize;
|
|
38
|
+
return /*#__PURE__*/React.createElement(Sequence, {
|
|
39
|
+
key: index,
|
|
40
|
+
from: transcript.from,
|
|
41
|
+
durationInFrames: transcript.durationInFrames
|
|
42
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
43
|
+
style: {
|
|
44
|
+
color: accentColor,
|
|
45
|
+
display: "flex",
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
justifyContent: "center",
|
|
48
|
+
height: fontSize * 1.2,
|
|
49
|
+
borderRadius: 10,
|
|
50
|
+
position: "absolute",
|
|
51
|
+
bottom: bottom,
|
|
52
|
+
left: "50%",
|
|
53
|
+
padding: "0 30px",
|
|
54
|
+
margin: "0 auto",
|
|
55
|
+
transform: "translateX(-50%)",
|
|
56
|
+
fontSize: textFontSize,
|
|
57
|
+
textTransform: "uppercase",
|
|
58
|
+
textAlign: "center",
|
|
59
|
+
fontFamily: fontFamily,
|
|
60
|
+
textShadow: "5px 3px 0px ".concat(accentContrast),
|
|
61
|
+
fontWeight: 700,
|
|
62
|
+
textWrap: "nowrap"
|
|
63
|
+
}
|
|
64
|
+
}, transcript.text));
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { AbsoluteFill, Sequence, interpolate, random, spring, useCurrentFrame, useVideoConfig } from "remotion";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { loadFont as loadRegularFont } from "@remotion/google-fonts/Montserrat";
|
|
4
|
+
import { loadFont as loadCursiveFont } from "@remotion/google-fonts/Rochester";
|
|
5
|
+
import { useOrientationBased } from "../../../hooks/useOrientationBased.js";
|
|
6
|
+
import { distributeTextToFit } from "./Sentence/SentenceSimple.helpers.js";
|
|
7
|
+
import { CAPTION_PORTRAIT_BOTTOM_OFFSET } from "./constants";
|
|
8
|
+
var _loadRegularFont = loadRegularFont(),
|
|
9
|
+
regularFontFamily = _loadRegularFont.fontFamily;
|
|
10
|
+
var _loadCursiveFont = loadCursiveFont(),
|
|
11
|
+
cursiveFontFamily = _loadCursiveFont.fontFamily;
|
|
12
|
+
var toNumber = function toNumber(value, fallback) {
|
|
13
|
+
var parsed = Number(value);
|
|
14
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
15
|
+
};
|
|
16
|
+
export var CaptionElegant = function CaptionElegant(_ref) {
|
|
17
|
+
var transcripts = _ref.transcripts,
|
|
18
|
+
color = _ref.color;
|
|
19
|
+
var _useVideoConfig = useVideoConfig(),
|
|
20
|
+
width = _useVideoConfig.width,
|
|
21
|
+
fps = _useVideoConfig.fps;
|
|
22
|
+
var frame = useCurrentFrame();
|
|
23
|
+
var _useOrientationBased = useOrientationBased({
|
|
24
|
+
portrait: {
|
|
25
|
+
fontSize: 65,
|
|
26
|
+
bottom: CAPTION_PORTRAIT_BOTTOM_OFFSET
|
|
27
|
+
},
|
|
28
|
+
landscape: {
|
|
29
|
+
fontSize: 90,
|
|
30
|
+
bottom: 110
|
|
31
|
+
},
|
|
32
|
+
square: {
|
|
33
|
+
fontSize: 64,
|
|
34
|
+
bottom: 110
|
|
35
|
+
}
|
|
36
|
+
}),
|
|
37
|
+
bottom = _useOrientationBased.bottom,
|
|
38
|
+
fontSize = _useOrientationBased.fontSize;
|
|
39
|
+
var containerWidth = width * 0.78;
|
|
40
|
+
var baseColor = color || "#ffffff";
|
|
41
|
+
return /*#__PURE__*/React.createElement(AbsoluteFill, null, transcripts.map(function (transcript, transcriptIndex) {
|
|
42
|
+
var _distributeTextToFit = distributeTextToFit(transcript.text, width * 0.72, fontSize * 1.5, fontSize),
|
|
43
|
+
textFontSize = _distributeTextToFit.fontSize;
|
|
44
|
+
var words = transcript.text.split(/\s+/).filter(Boolean);
|
|
45
|
+
var longestWordIndex = words.length > 0 ? words.reduce(function (acc, currentWord, index) {
|
|
46
|
+
var sanitizedLength = currentWord.replace(/[^A-Za-z0-9]/g, "").length || currentWord.length;
|
|
47
|
+
if (sanitizedLength > acc.length) {
|
|
48
|
+
return {
|
|
49
|
+
index: index,
|
|
50
|
+
length: sanitizedLength
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return acc;
|
|
54
|
+
}, {
|
|
55
|
+
index: 0,
|
|
56
|
+
length: 0
|
|
57
|
+
}).index : -1;
|
|
58
|
+
return /*#__PURE__*/React.createElement(Sequence, {
|
|
59
|
+
key: "".concat(transcriptIndex, "-").concat(transcript.from),
|
|
60
|
+
from: transcript.from,
|
|
61
|
+
durationInFrames: transcript.durationInFrames
|
|
62
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
style: {
|
|
64
|
+
display: "flex",
|
|
65
|
+
flexWrap: "wrap",
|
|
66
|
+
gap: textFontSize / 4,
|
|
67
|
+
justifyContent: "center",
|
|
68
|
+
alignItems: "flex-end",
|
|
69
|
+
position: "absolute",
|
|
70
|
+
bottom: bottom,
|
|
71
|
+
left: "50%",
|
|
72
|
+
transform: "translateX(-50%)",
|
|
73
|
+
width: containerWidth,
|
|
74
|
+
margin: 0,
|
|
75
|
+
color: baseColor,
|
|
76
|
+
fontSize: textFontSize,
|
|
77
|
+
textAlign: "center",
|
|
78
|
+
fontFamily: regularFontFamily,
|
|
79
|
+
lineHeight: 1.08,
|
|
80
|
+
textTransform: "none"
|
|
81
|
+
}
|
|
82
|
+
}, words.map(function (word, wordIndex) {
|
|
83
|
+
var _transcript$punctuati;
|
|
84
|
+
var punctuation = (_transcript$punctuati = transcript.punctuations) === null || _transcript$punctuati === void 0 ? void 0 : _transcript$punctuati.find(function (item) {
|
|
85
|
+
return item.index === wordIndex;
|
|
86
|
+
});
|
|
87
|
+
var transcriptFrom = toNumber(transcript.from, 0);
|
|
88
|
+
var wordStart = toNumber(punctuation === null || punctuation === void 0 ? void 0 : punctuation.start, transcriptFrom);
|
|
89
|
+
var wordEnd = toNumber(punctuation === null || punctuation === void 0 ? void 0 : punctuation.end, wordStart);
|
|
90
|
+
var isActive = frame >= wordStart && frame <= wordEnd;
|
|
91
|
+
var isCursiveWord = wordIndex === longestWordIndex;
|
|
92
|
+
var appearProgress = spring({
|
|
93
|
+
frame: Math.max(0, frame - wordStart),
|
|
94
|
+
fps: fps,
|
|
95
|
+
config: {
|
|
96
|
+
damping: 18,
|
|
97
|
+
stiffness: 130,
|
|
98
|
+
mass: 0.6
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
var opacity = frame >= wordStart ? Math.min(1, appearProgress) : 0;
|
|
102
|
+
var translateY = interpolate(appearProgress, [0, 1], [18, 0], {
|
|
103
|
+
extrapolateLeft: "clamp",
|
|
104
|
+
extrapolateRight: "clamp"
|
|
105
|
+
});
|
|
106
|
+
var randomSeed = "caption-elegant-".concat(transcript.id || transcriptIndex, "-").concat(wordIndex);
|
|
107
|
+
var sizeVariance = 0.88 + random(randomSeed) * 0.45;
|
|
108
|
+
var sizeMultiplier = isCursiveWord ? 2.5 : 1;
|
|
109
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
110
|
+
key: "".concat(randomSeed, "-").concat(word),
|
|
111
|
+
style: {
|
|
112
|
+
display: "inline-flex",
|
|
113
|
+
alignItems: "flex-end",
|
|
114
|
+
alignSelf: "baseline",
|
|
115
|
+
padding: "0 ".concat(textFontSize * 0.08, "px"),
|
|
116
|
+
fontSize: textFontSize * sizeVariance * sizeMultiplier,
|
|
117
|
+
fontFamily: isCursiveWord ? cursiveFontFamily : regularFontFamily,
|
|
118
|
+
fontWeight: isCursiveWord ? 500 : 800,
|
|
119
|
+
letterSpacing: isCursiveWord ? "0.01em" : "-0.01em",
|
|
120
|
+
lineHeight: 1,
|
|
121
|
+
verticalAlign: "bottom",
|
|
122
|
+
opacity: opacity,
|
|
123
|
+
transform: "translateY(".concat(translateY, "px)"),
|
|
124
|
+
color: baseColor,
|
|
125
|
+
textShadow: isCursiveWord ? "0 0 1px rgba(255,255,255,.85), 0 0 4px rgba(255,255,255,.55), 0 0 10px rgba(255,255,255,.25)" : "0 3px 0 rgba(0,0,0,.18)",
|
|
126
|
+
WebkitFontSmoothing: "antialiased",
|
|
127
|
+
MozOsxFontSmoothing: "grayscale",
|
|
128
|
+
transition: "font-family 0.2s ease, font-weight 0.2s ease",
|
|
129
|
+
whiteSpace: "pre"
|
|
130
|
+
}
|
|
131
|
+
}, word);
|
|
132
|
+
})));
|
|
133
|
+
}));
|
|
134
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { AbsoluteFill, Sequence, spring, useCurrentFrame, useVideoConfig } from "remotion";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { loadFont } from "@remotion/google-fonts/Montserrat";
|
|
4
|
+
import { useOrientationBased } from "../../../hooks/useOrientationBased.js";
|
|
5
|
+
import { distributeTextToFit } from "./Sentence/SentenceSimple.helpers.js";
|
|
6
|
+
import { useTheme } from "../../hooks/useTheme";
|
|
7
|
+
import { CAPTION_PORTRAIT_BOTTOM_OFFSET } from "./constants";
|
|
8
|
+
var _loadFont = loadFont(),
|
|
9
|
+
fontFamily = _loadFont.fontFamily;
|
|
10
|
+
var Text = function Text(_ref) {
|
|
11
|
+
var transcript = _ref.transcript,
|
|
12
|
+
color = _ref.color,
|
|
13
|
+
accentColor = _ref.accentColor,
|
|
14
|
+
frame = _ref.frame;
|
|
15
|
+
return transcript.text.split(" ").map(function (word, wordIndex) {
|
|
16
|
+
var _transcript$punctuati, _transcript$punctuati2;
|
|
17
|
+
var isPunctuated = frame >= Number(((_transcript$punctuati = transcript.punctuations.find(function (p) {
|
|
18
|
+
return p.index === wordIndex;
|
|
19
|
+
})) === null || _transcript$punctuati === void 0 ? void 0 : _transcript$punctuati.start) || 0) && Number(frame <= ((_transcript$punctuati2 = transcript.punctuations.find(function (p) {
|
|
20
|
+
return p.index === wordIndex;
|
|
21
|
+
})) === null || _transcript$punctuati2 === void 0 ? void 0 : _transcript$punctuati2.end));
|
|
22
|
+
var currentFrame = useCurrentFrame();
|
|
23
|
+
var _useVideoConfig = useVideoConfig(),
|
|
24
|
+
fps = _useVideoConfig.fps;
|
|
25
|
+
var scale = spring({
|
|
26
|
+
frame: currentFrame,
|
|
27
|
+
fps: fps,
|
|
28
|
+
from: 20,
|
|
29
|
+
// Start from above
|
|
30
|
+
to: 100,
|
|
31
|
+
// Move to its original position
|
|
32
|
+
stiffness: 200,
|
|
33
|
+
// Increase stiffness for a more pronounced bounce
|
|
34
|
+
damping: 80,
|
|
35
|
+
// Decrease damping to allow more bounce
|
|
36
|
+
durationInFrames: 15 // Duration for the bounce
|
|
37
|
+
});
|
|
38
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
39
|
+
key: wordIndex,
|
|
40
|
+
style: {
|
|
41
|
+
willChange: "transform",
|
|
42
|
+
transform: "scale(".concat(scale, "%)"),
|
|
43
|
+
position: "relative",
|
|
44
|
+
borderRadius: "10px",
|
|
45
|
+
color: isPunctuated ? color || accentColor : "white"
|
|
46
|
+
}
|
|
47
|
+
}, /*#__PURE__*/React.createElement("span", null, word.split("").map(function (_char) {
|
|
48
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
49
|
+
style: {
|
|
50
|
+
display: "inline-block",
|
|
51
|
+
position: "relative",
|
|
52
|
+
textShadow: "4px 4px 0 #000,\n -4px 4px 0 #000,\n 4px -4px 0 #000,\n -4px -4px 0 #000,\n 0px 4px 0 #000,\n 0px -4px 0 #000,\n -4px 0px 0 #000,\n 4px 0px 0 #000,\n 8px 8px 0 #000,\n -8px 8px 0 #000,\n 8px -8px 0 #000,\n -8px -8px 0 #000,\n 0px 8px 0 #000,\n 0px -8px 0 #000,\n -8px 0px 0 #000,\n 8px 0px 0 #000,\n 4px 8px 0 #000,\n -4px 8px 0 #000,\n 4px -8px 0 #000, \n -4px -8px 0 #000,\n 8px 4px 0 #000,\n -8px 4px 0 #000, \n 8px -4px 0 #000,\n -8px -4px 0 #000"
|
|
53
|
+
}
|
|
54
|
+
}, _char);
|
|
55
|
+
})));
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
export var CaptionEmphasis = function CaptionEmphasis(_ref2) {
|
|
59
|
+
var transcripts = _ref2.transcripts,
|
|
60
|
+
color = _ref2.color;
|
|
61
|
+
var _useVideoConfig2 = useVideoConfig(),
|
|
62
|
+
width = _useVideoConfig2.width;
|
|
63
|
+
var _useOrientationBased = useOrientationBased({
|
|
64
|
+
portrait: {
|
|
65
|
+
fontSize: 90,
|
|
66
|
+
bottom: CAPTION_PORTRAIT_BOTTOM_OFFSET
|
|
67
|
+
},
|
|
68
|
+
landscape: {
|
|
69
|
+
fontSize: 80,
|
|
70
|
+
bottom: 110
|
|
71
|
+
},
|
|
72
|
+
square: {
|
|
73
|
+
fontSize: 60,
|
|
74
|
+
bottom: 110
|
|
75
|
+
}
|
|
76
|
+
}),
|
|
77
|
+
bottom = _useOrientationBased.bottom,
|
|
78
|
+
fontSize = _useOrientationBased.fontSize;
|
|
79
|
+
var _useTheme = useTheme(),
|
|
80
|
+
accentColor = _useTheme.accentColor;
|
|
81
|
+
var containerWidth = width * 0.5;
|
|
82
|
+
var frame = useCurrentFrame();
|
|
83
|
+
return /*#__PURE__*/React.createElement(AbsoluteFill, null, transcripts.map(function (transcript, index) {
|
|
84
|
+
var _distributeTextToFit = distributeTextToFit(transcript.text, width * 0.8, fontSize * 20, fontSize),
|
|
85
|
+
lines = _distributeTextToFit.lines,
|
|
86
|
+
textFontSize = _distributeTextToFit.fontSize;
|
|
87
|
+
return /*#__PURE__*/React.createElement(Sequence, {
|
|
88
|
+
key: index,
|
|
89
|
+
from: transcript.from,
|
|
90
|
+
durationInFrames: transcript.durationInFrames
|
|
91
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
92
|
+
style: {
|
|
93
|
+
display: "flex",
|
|
94
|
+
flexWrap: "wrap",
|
|
95
|
+
gap: textFontSize / 3,
|
|
96
|
+
alignItems: "center",
|
|
97
|
+
justifyContent: "center",
|
|
98
|
+
height: fontSize * 1.6,
|
|
99
|
+
position: "absolute",
|
|
100
|
+
bottom: bottom,
|
|
101
|
+
left: "50%",
|
|
102
|
+
width: containerWidth,
|
|
103
|
+
margin: "0 auto",
|
|
104
|
+
transform: "translate(-50%, -50%)",
|
|
105
|
+
fontSize: textFontSize,
|
|
106
|
+
textAlign: "center",
|
|
107
|
+
fontFamily: fontFamily,
|
|
108
|
+
textWrap: "nowrap",
|
|
109
|
+
lineHeight: 1,
|
|
110
|
+
fontWeight: 900,
|
|
111
|
+
color: "#fff",
|
|
112
|
+
letterSpacing: textFontSize / 5
|
|
113
|
+
}
|
|
114
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
115
|
+
frame: frame,
|
|
116
|
+
transcript: transcript,
|
|
117
|
+
color: color,
|
|
118
|
+
accentColor: accentColor,
|
|
119
|
+
fontSize: fontSize
|
|
120
|
+
})));
|
|
121
|
+
}));
|
|
122
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { AbsoluteFill, Sequence, useCurrentFrame, useVideoConfig } from "remotion";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { loadFont } from "@remotion/google-fonts/Poppins";
|
|
4
|
+
import { useOrientationBased } from "../../../hooks/useOrientationBased.js";
|
|
5
|
+
import { distributeTextToFit } from "./Sentence/SentenceSimple.helpers.js";
|
|
6
|
+
import { useTheme } from "../../hooks/useTheme";
|
|
7
|
+
import { getBrighterColor } from "../../../helpers/hexToRgb";
|
|
8
|
+
import { CAPTION_PORTRAIT_BOTTOM_OFFSET } from "./constants";
|
|
9
|
+
var _loadFont = loadFont(),
|
|
10
|
+
fontFamily = _loadFont.fontFamily;
|
|
11
|
+
export var CaptionPunctuated = function CaptionPunctuated(_ref) {
|
|
12
|
+
var transcripts = _ref.transcripts,
|
|
13
|
+
color = _ref.color;
|
|
14
|
+
var _useVideoConfig = useVideoConfig(),
|
|
15
|
+
width = _useVideoConfig.width;
|
|
16
|
+
var _useOrientationBased = useOrientationBased({
|
|
17
|
+
portrait: {
|
|
18
|
+
fontSize: 75,
|
|
19
|
+
bottom: CAPTION_PORTRAIT_BOTTOM_OFFSET
|
|
20
|
+
},
|
|
21
|
+
landscape: {
|
|
22
|
+
fontSize: 60,
|
|
23
|
+
bottom: 110
|
|
24
|
+
},
|
|
25
|
+
square: {
|
|
26
|
+
fontSize: 75,
|
|
27
|
+
bottom: 110
|
|
28
|
+
}
|
|
29
|
+
}),
|
|
30
|
+
bottom = _useOrientationBased.bottom,
|
|
31
|
+
fontSize = _useOrientationBased.fontSize;
|
|
32
|
+
var _useTheme = useTheme(),
|
|
33
|
+
primaryColor = _useTheme.primaryColor,
|
|
34
|
+
primaryContrast = _useTheme.primaryContrast,
|
|
35
|
+
accentColor = _useTheme.accentColor,
|
|
36
|
+
accentContrast = _useTheme.accentContrast;
|
|
37
|
+
var containerWidth = width * 0.8;
|
|
38
|
+
var frame = useCurrentFrame();
|
|
39
|
+
var brighterColor = getBrighterColor(primaryColor, accentColor);
|
|
40
|
+
return /*#__PURE__*/React.createElement(AbsoluteFill, null, transcripts.map(function (transcript, index) {
|
|
41
|
+
var _distributeTextToFit = distributeTextToFit(transcript.text, width * 0.7, fontSize * 1.6, fontSize),
|
|
42
|
+
lines = _distributeTextToFit.lines,
|
|
43
|
+
textFontSize = _distributeTextToFit.fontSize;
|
|
44
|
+
return /*#__PURE__*/React.createElement(Sequence, {
|
|
45
|
+
key: index,
|
|
46
|
+
from: transcript.from,
|
|
47
|
+
durationInFrames: transcript.durationInFrames
|
|
48
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
49
|
+
style: {
|
|
50
|
+
display: "flex",
|
|
51
|
+
alignItems: "center",
|
|
52
|
+
gap: fontSize / 4,
|
|
53
|
+
justifyContent: "center",
|
|
54
|
+
height: fontSize * 1.6,
|
|
55
|
+
position: "absolute",
|
|
56
|
+
bottom: bottom,
|
|
57
|
+
left: "50%",
|
|
58
|
+
width: containerWidth,
|
|
59
|
+
margin: "0 auto",
|
|
60
|
+
transform: "translateX(-50%)",
|
|
61
|
+
fontSize: textFontSize,
|
|
62
|
+
textTransform: "uppercase",
|
|
63
|
+
textAlign: "center",
|
|
64
|
+
fontFamily: fontFamily,
|
|
65
|
+
fontWeight: 700,
|
|
66
|
+
textWrap: "nowrap"
|
|
67
|
+
}
|
|
68
|
+
}, transcript.text.split(" ").map(function (word, wordIndex) {
|
|
69
|
+
var _transcript$punctuati, _transcript$punctuati2;
|
|
70
|
+
var isPunctuated = frame >= Number(((_transcript$punctuati = transcript.punctuations.find(function (p) {
|
|
71
|
+
return p.index === wordIndex;
|
|
72
|
+
})) === null || _transcript$punctuati === void 0 ? void 0 : _transcript$punctuati.start) || 0) && Number(frame <= ((_transcript$punctuati2 = transcript.punctuations.find(function (p) {
|
|
73
|
+
return p.index === wordIndex;
|
|
74
|
+
})) === null || _transcript$punctuati2 === void 0 ? void 0 : _transcript$punctuati2.end));
|
|
75
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
76
|
+
key: wordIndex,
|
|
77
|
+
style: {
|
|
78
|
+
color: isPunctuated ? color || brighterColor : "white",
|
|
79
|
+
textShadow: "3px 3px 3px #000"
|
|
80
|
+
}
|
|
81
|
+
}, word);
|
|
82
|
+
})));
|
|
83
|
+
}));
|
|
84
|
+
};
|