@zync/zync-screnplay-player 0.1.240 → 0.1.241
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/bundle.js +1 -1
- package/dist/screenplay/RemotionRenderer/development.js +26 -1664
- package/dist/screenplay/RemotionRenderer/theme/hooks/useThemedComponents.js +16 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/boxwipe/Nametag.js +251 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/centerline/Nametag.js +209 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/rightslide/Nametag.js +262 -0
- package/dist/screenplay/RemotionRenderer/theme/themes/stackfill/Nametag.js +212 -0
- package/package.json +1 -1
|
@@ -26,6 +26,10 @@ import { NoneNametag } from "../themes/none/Nametag";
|
|
|
26
26
|
import { NoneTitle } from "../themes/none/Title";
|
|
27
27
|
import { Title as CollabIntroTitle } from "../themes/collabintro/Title";
|
|
28
28
|
import { Nametag as CollabIntroNametag } from "../themes/collabintro/Nametag";
|
|
29
|
+
import { CenterlineNametag } from "../themes/centerline/Nametag";
|
|
30
|
+
import { BoxwipeNametag } from "../themes/boxwipe/Nametag";
|
|
31
|
+
import { StackfillNametag } from "../themes/stackfill/Nametag";
|
|
32
|
+
import { RightslideNametag } from "../themes/rightslide/Nametag";
|
|
29
33
|
import { KeyPointOverlayDepth } from "../../components/layouts/KeyPointOverlayDepth";
|
|
30
34
|
|
|
31
35
|
/** Always update this when adding a new theme and/or components. */
|
|
@@ -75,6 +79,18 @@ var themedComponents = {
|
|
|
75
79
|
Title: CollabIntroTitle,
|
|
76
80
|
Nametag: CollabIntroNametag
|
|
77
81
|
},
|
|
82
|
+
centerline: {
|
|
83
|
+
Nametag: CenterlineNametag
|
|
84
|
+
},
|
|
85
|
+
boxwipe: {
|
|
86
|
+
Nametag: BoxwipeNametag
|
|
87
|
+
},
|
|
88
|
+
stackfill: {
|
|
89
|
+
Nametag: StackfillNametag
|
|
90
|
+
},
|
|
91
|
+
rightslide: {
|
|
92
|
+
Nametag: RightslideNametag
|
|
93
|
+
},
|
|
78
94
|
depth: {
|
|
79
95
|
Sentence: KeyPointOverlayDepth
|
|
80
96
|
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Easing, interpolate, useCurrentFrame, useVideoConfig } from "remotion";
|
|
3
|
+
import { loadFont } from "@remotion/google-fonts/Kanit";
|
|
4
|
+
import { useOrientationBased } from "../../../hooks/useOrientationBased.js";
|
|
5
|
+
import { useTheme } from "../../hooks/useTheme.js";
|
|
6
|
+
import { getContrastColor } from "../../../helpers/getContrastColor";
|
|
7
|
+
var _loadFont = loadFont("normal", {
|
|
8
|
+
subsets: ["latin"],
|
|
9
|
+
weights: ["400", "500", "600", "700"]
|
|
10
|
+
}),
|
|
11
|
+
fontFamily = _loadFont.fontFamily;
|
|
12
|
+
var clamp = function clamp(value, min, max) {
|
|
13
|
+
return Math.max(min, Math.min(max, value));
|
|
14
|
+
};
|
|
15
|
+
var estimateTextWidth = function estimateTextWidth(text, fontSize) {
|
|
16
|
+
return text.length * fontSize * 0.64;
|
|
17
|
+
};
|
|
18
|
+
var fitSingleLineFontSize = function fitSingleLineFontSize(text, maxWidth, maxHeight, maxFontSize) {
|
|
19
|
+
if (!text) {
|
|
20
|
+
return maxFontSize;
|
|
21
|
+
}
|
|
22
|
+
return Math.floor(clamp(maxWidth / (text.length * 0.64), 1, Math.min(maxFontSize, maxHeight)));
|
|
23
|
+
};
|
|
24
|
+
var splitCharacters = function splitCharacters(text) {
|
|
25
|
+
return Array.from(text || "");
|
|
26
|
+
};
|
|
27
|
+
export var BoxwipeNametag = function BoxwipeNametag(_ref) {
|
|
28
|
+
var name = _ref.name,
|
|
29
|
+
title = _ref.title,
|
|
30
|
+
themeSettings = _ref.themeSettings;
|
|
31
|
+
var frame = useCurrentFrame();
|
|
32
|
+
var _useVideoConfig = useVideoConfig(),
|
|
33
|
+
fps = _useVideoConfig.fps,
|
|
34
|
+
width = _useVideoConfig.width,
|
|
35
|
+
height = _useVideoConfig.height;
|
|
36
|
+
var _useTheme = useTheme(),
|
|
37
|
+
primaryColor = _useTheme.primaryColor,
|
|
38
|
+
primaryContrast = _useTheme.primaryContrast,
|
|
39
|
+
accentColor = _useTheme.accentColor;
|
|
40
|
+
var _useOrientationBased = useOrientationBased({
|
|
41
|
+
landscape: {
|
|
42
|
+
borderWidth: clamp(width * 0.004, 5, 8),
|
|
43
|
+
boxHeight: height * 0.092,
|
|
44
|
+
boxWidth: width * 0.62,
|
|
45
|
+
containerBottom: height * 0.12,
|
|
46
|
+
containerLeft: width * 0.045,
|
|
47
|
+
maxNameFontSize: width * 0.066,
|
|
48
|
+
maxTitleFontSize: width * 0.024,
|
|
49
|
+
titleGap: height * 0.008
|
|
50
|
+
},
|
|
51
|
+
portrait: {
|
|
52
|
+
borderWidth: clamp(width * 0.01, 5, 8),
|
|
53
|
+
boxHeight: height * 0.058,
|
|
54
|
+
boxWidth: width * 0.78,
|
|
55
|
+
containerBottom: height * 0.2,
|
|
56
|
+
containerLeft: width * 0.07,
|
|
57
|
+
maxNameFontSize: width * 0.092,
|
|
58
|
+
maxTitleFontSize: width * 0.038,
|
|
59
|
+
titleGap: height * 0.006
|
|
60
|
+
},
|
|
61
|
+
square: {
|
|
62
|
+
borderWidth: clamp(width * 0.007, 5, 8),
|
|
63
|
+
boxHeight: height * 0.072,
|
|
64
|
+
boxWidth: width * 0.74,
|
|
65
|
+
containerBottom: height * 0.15,
|
|
66
|
+
containerLeft: width * 0.06,
|
|
67
|
+
maxNameFontSize: width * 0.078,
|
|
68
|
+
maxTitleFontSize: width * 0.033,
|
|
69
|
+
titleGap: height * 0.007
|
|
70
|
+
}
|
|
71
|
+
}),
|
|
72
|
+
borderWidth = _useOrientationBased.borderWidth,
|
|
73
|
+
boxHeight = _useOrientationBased.boxHeight,
|
|
74
|
+
boxWidth = _useOrientationBased.boxWidth,
|
|
75
|
+
containerBottom = _useOrientationBased.containerBottom,
|
|
76
|
+
containerLeft = _useOrientationBased.containerLeft,
|
|
77
|
+
maxNameFontSize = _useOrientationBased.maxNameFontSize,
|
|
78
|
+
maxTitleFontSize = _useOrientationBased.maxTitleFontSize,
|
|
79
|
+
titleGap = _useOrientationBased.titleGap;
|
|
80
|
+
var displayName = (name || "").toLocaleUpperCase();
|
|
81
|
+
var displayTitle = (title || "").toLocaleUpperCase();
|
|
82
|
+
var nameCharacters = splitCharacters(displayName);
|
|
83
|
+
var boxColor = (themeSettings === null || themeSettings === void 0 ? void 0 : themeSettings.secondaryColor) || accentColor || primaryColor || "#ff6a00";
|
|
84
|
+
var nameTextColor = getContrastColor(boxColor) || "#FFFFFF";
|
|
85
|
+
var titleBackgroundColor = (themeSettings === null || themeSettings === void 0 ? void 0 : themeSettings.primaryColor) || primaryColor || "#000000";
|
|
86
|
+
var titleTextColor = (themeSettings === null || themeSettings === void 0 ? void 0 : themeSettings.primaryContrast) || getContrastColor(titleBackgroundColor) || primaryContrast || "#FFFFFF";
|
|
87
|
+
var horizontalPadding = borderWidth;
|
|
88
|
+
var nameFontSize = fitSingleLineFontSize(displayName, boxWidth - horizontalPadding, boxHeight * 0.84, maxNameFontSize);
|
|
89
|
+
var fittedBoxWidth = clamp(estimateTextWidth(displayName, nameFontSize) + horizontalPadding, boxWidth * 0.42, boxWidth);
|
|
90
|
+
var titleFontSize = fitSingleLineFontSize(displayTitle, fittedBoxWidth, boxHeight * 0.45, maxTitleFontSize);
|
|
91
|
+
var widthGrowEnd = Math.round(fps * 0.65);
|
|
92
|
+
var heightGrowStart = widthGrowEnd + Math.round(fps * 0.06);
|
|
93
|
+
var heightGrowEnd = heightGrowStart + Math.round(fps * 0.45);
|
|
94
|
+
var sweepStart = heightGrowEnd + Math.round(fps * 0.08);
|
|
95
|
+
var sweepEnd = sweepStart + Math.round(fps * 1.05);
|
|
96
|
+
var finishStart = sweepEnd + Math.round(fps * 0.04);
|
|
97
|
+
var finishEnd = finishStart + Math.round(fps * 0.35);
|
|
98
|
+
var widthProgress = interpolate(frame, [0, widthGrowEnd], [0, 1], {
|
|
99
|
+
easing: Easing.out(Easing.cubic),
|
|
100
|
+
extrapolateLeft: "clamp",
|
|
101
|
+
extrapolateRight: "clamp"
|
|
102
|
+
});
|
|
103
|
+
var heightProgress = interpolate(frame, [heightGrowStart, heightGrowEnd], [0, 1], {
|
|
104
|
+
easing: Easing.out(Easing.cubic),
|
|
105
|
+
extrapolateLeft: "clamp",
|
|
106
|
+
extrapolateRight: "clamp"
|
|
107
|
+
});
|
|
108
|
+
var sweepProgress = interpolate(frame, [sweepStart, sweepEnd], [0, 1], {
|
|
109
|
+
easing: Easing.inOut(Easing.cubic),
|
|
110
|
+
extrapolateLeft: "clamp",
|
|
111
|
+
extrapolateRight: "clamp"
|
|
112
|
+
});
|
|
113
|
+
var finishProgress = interpolate(frame, [finishStart, finishEnd], [0, 1], {
|
|
114
|
+
easing: Easing.out(Easing.cubic),
|
|
115
|
+
extrapolateLeft: "clamp",
|
|
116
|
+
extrapolateRight: "clamp"
|
|
117
|
+
});
|
|
118
|
+
var boxWidthProgress = interpolate(widthProgress, [0, 1], [0, 100], {
|
|
119
|
+
extrapolateLeft: "clamp",
|
|
120
|
+
extrapolateRight: "clamp"
|
|
121
|
+
});
|
|
122
|
+
var currentBoxHeight = interpolate(heightProgress, [0, 1], [borderWidth, boxHeight], {
|
|
123
|
+
extrapolateLeft: "clamp",
|
|
124
|
+
extrapolateRight: "clamp"
|
|
125
|
+
});
|
|
126
|
+
var boxTranslateY = interpolate(heightProgress, [0, 1], [(boxHeight - borderWidth) / 2, 0], {
|
|
127
|
+
extrapolateLeft: "clamp",
|
|
128
|
+
extrapolateRight: "clamp"
|
|
129
|
+
});
|
|
130
|
+
var sweepOpacity = interpolate(frame, [sweepStart, sweepStart + Math.round(fps * 0.08), sweepEnd, finishEnd], [0, 1, 1, 0], {
|
|
131
|
+
extrapolateLeft: "clamp",
|
|
132
|
+
extrapolateRight: "clamp"
|
|
133
|
+
});
|
|
134
|
+
var shadowOpacity = interpolate(heightProgress, [0.5, 1], [0, 1], {
|
|
135
|
+
extrapolateLeft: "clamp",
|
|
136
|
+
extrapolateRight: "clamp"
|
|
137
|
+
});
|
|
138
|
+
var titleTranslateY = interpolate(finishProgress, [0, 1], [-boxHeight * 0.28, 0], {
|
|
139
|
+
extrapolateLeft: "clamp",
|
|
140
|
+
extrapolateRight: "clamp"
|
|
141
|
+
});
|
|
142
|
+
var backplateOffset = borderWidth * 1.4;
|
|
143
|
+
var backplateTranslate = interpolate(finishProgress, [0, 1], [-backplateOffset, 0], {
|
|
144
|
+
extrapolateLeft: "clamp",
|
|
145
|
+
extrapolateRight: "clamp"
|
|
146
|
+
});
|
|
147
|
+
var backplateOpacity = interpolate(finishProgress, [0, 0.35, 1], [0, 1, 1], {
|
|
148
|
+
extrapolateLeft: "clamp",
|
|
149
|
+
extrapolateRight: "clamp"
|
|
150
|
+
});
|
|
151
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
152
|
+
style: {
|
|
153
|
+
bottom: containerBottom,
|
|
154
|
+
fontFamily: fontFamily,
|
|
155
|
+
left: containerLeft,
|
|
156
|
+
position: "absolute",
|
|
157
|
+
width: fittedBoxWidth
|
|
158
|
+
}
|
|
159
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
160
|
+
style: {
|
|
161
|
+
alignItems: "center",
|
|
162
|
+
backgroundColor: titleBackgroundColor,
|
|
163
|
+
boxSizing: "border-box",
|
|
164
|
+
color: titleTextColor,
|
|
165
|
+
display: "inline-flex",
|
|
166
|
+
fontSize: titleFontSize,
|
|
167
|
+
fontWeight: 500,
|
|
168
|
+
justifyContent: "center",
|
|
169
|
+
letterSpacing: "0.1em",
|
|
170
|
+
lineHeight: 1.1,
|
|
171
|
+
marginBottom: titleGap,
|
|
172
|
+
maxWidth: fittedBoxWidth,
|
|
173
|
+
opacity: finishProgress,
|
|
174
|
+
overflow: "hidden",
|
|
175
|
+
padding: "0 ".concat(borderWidth * 1.25, "px"),
|
|
176
|
+
textShadow: "0 2px 7px rgba(0, 0, 0, 0.65)",
|
|
177
|
+
textOverflow: "clip",
|
|
178
|
+
transform: "translateY(".concat(titleTranslateY, "px)"),
|
|
179
|
+
whiteSpace: "nowrap"
|
|
180
|
+
}
|
|
181
|
+
}, displayTitle), /*#__PURE__*/React.createElement("div", {
|
|
182
|
+
style: {
|
|
183
|
+
height: boxHeight,
|
|
184
|
+
position: "relative",
|
|
185
|
+
width: fittedBoxWidth
|
|
186
|
+
}
|
|
187
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
188
|
+
style: {
|
|
189
|
+
backgroundColor: titleTextColor,
|
|
190
|
+
bottom: -backplateOffset,
|
|
191
|
+
boxShadow: "0 4px 8px rgba(0, 0, 0, 0.38)",
|
|
192
|
+
height: boxHeight,
|
|
193
|
+
opacity: backplateOpacity,
|
|
194
|
+
position: "absolute",
|
|
195
|
+
right: -backplateOffset,
|
|
196
|
+
transform: "translate(".concat(backplateTranslate, "px, ").concat(backplateTranslate, "px)"),
|
|
197
|
+
width: fittedBoxWidth
|
|
198
|
+
}
|
|
199
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
200
|
+
style: {
|
|
201
|
+
backgroundColor: boxColor,
|
|
202
|
+
boxShadow: "0 5px 8px rgba(0, 0, 0, ".concat(0.4 * shadowOpacity, ")"),
|
|
203
|
+
height: currentBoxHeight,
|
|
204
|
+
overflow: "hidden",
|
|
205
|
+
position: "absolute",
|
|
206
|
+
left: "50%",
|
|
207
|
+
top: 0,
|
|
208
|
+
transform: "translate(-50%, ".concat(boxTranslateY, "px)"),
|
|
209
|
+
width: "".concat(boxWidthProgress, "%")
|
|
210
|
+
}
|
|
211
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
212
|
+
style: {
|
|
213
|
+
backgroundColor: "rgba(255, 255, 255, 0.55)",
|
|
214
|
+
height: "100%",
|
|
215
|
+
left: "".concat(sweepProgress * 100, "%"),
|
|
216
|
+
opacity: sweepOpacity,
|
|
217
|
+
position: "absolute",
|
|
218
|
+
top: 0,
|
|
219
|
+
transform: "translateX(-50%)",
|
|
220
|
+
width: borderWidth
|
|
221
|
+
}
|
|
222
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
223
|
+
style: {
|
|
224
|
+
alignItems: "center",
|
|
225
|
+
display: "flex",
|
|
226
|
+
height: boxHeight,
|
|
227
|
+
left: horizontalPadding / 2,
|
|
228
|
+
position: "absolute",
|
|
229
|
+
top: 0,
|
|
230
|
+
whiteSpace: "pre"
|
|
231
|
+
}
|
|
232
|
+
}, nameCharacters.map(function (character, index) {
|
|
233
|
+
var characterRevealStart = index / nameCharacters.length;
|
|
234
|
+
var characterRevealEnd = (index + 0.65) / nameCharacters.length;
|
|
235
|
+
var opacity = interpolate(sweepProgress, [characterRevealStart, characterRevealEnd], [0, 1], {
|
|
236
|
+
extrapolateLeft: "clamp",
|
|
237
|
+
extrapolateRight: "clamp"
|
|
238
|
+
});
|
|
239
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
240
|
+
key: "".concat(character, "-").concat(index),
|
|
241
|
+
style: {
|
|
242
|
+
color: nameTextColor,
|
|
243
|
+
fontSize: nameFontSize,
|
|
244
|
+
fontWeight: 400,
|
|
245
|
+
lineHeight: 1,
|
|
246
|
+
opacity: opacity,
|
|
247
|
+
textShadow: "0 1px 5px rgba(0, 0, 0, 0.26)"
|
|
248
|
+
}
|
|
249
|
+
}, character);
|
|
250
|
+
})))));
|
|
251
|
+
};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Easing, interpolate, useCurrentFrame, useVideoConfig } from "remotion";
|
|
3
|
+
import { loadFont } from "@remotion/google-fonts/Kanit";
|
|
4
|
+
import { useOrientationBased } from "../../../hooks/useOrientationBased.js";
|
|
5
|
+
import { useTheme } from "../../hooks/useTheme.js";
|
|
6
|
+
import { getContrastColor } from "../../../helpers/getContrastColor";
|
|
7
|
+
import { distributeTextToFit } from "../default/Sentence/SentenceSimple.helpers.js";
|
|
8
|
+
var _loadFont = loadFont("normal", {
|
|
9
|
+
subsets: ["latin"],
|
|
10
|
+
weights: ["400", "500", "600", "700"]
|
|
11
|
+
}),
|
|
12
|
+
fontFamily = _loadFont.fontFamily;
|
|
13
|
+
var clamp = function clamp(value, min, max) {
|
|
14
|
+
return Math.max(min, Math.min(max, value));
|
|
15
|
+
};
|
|
16
|
+
var estimateLineWidth = function estimateLineWidth(text, fontSize) {
|
|
17
|
+
return text.length * fontSize * 0.6;
|
|
18
|
+
};
|
|
19
|
+
var fitSingleLineFontSize = function fitSingleLineFontSize(text, maxWidth, maxHeight, maxFontSize) {
|
|
20
|
+
if (!text) {
|
|
21
|
+
return maxFontSize;
|
|
22
|
+
}
|
|
23
|
+
return Math.floor(clamp(maxWidth / (text.length * 0.6), 1, Math.min(maxFontSize, maxHeight)));
|
|
24
|
+
};
|
|
25
|
+
var getReadableColor = function getReadableColor(preferredColor, backgroundColor, fallbackColor) {
|
|
26
|
+
if (preferredColor && preferredColor !== backgroundColor) {
|
|
27
|
+
return preferredColor;
|
|
28
|
+
}
|
|
29
|
+
return getContrastColor(backgroundColor) || fallbackColor;
|
|
30
|
+
};
|
|
31
|
+
export var CenterlineNametag = function CenterlineNametag(_ref) {
|
|
32
|
+
var name = _ref.name,
|
|
33
|
+
title = _ref.title,
|
|
34
|
+
themeSettings = _ref.themeSettings;
|
|
35
|
+
var frame = useCurrentFrame();
|
|
36
|
+
var _useVideoConfig = useVideoConfig(),
|
|
37
|
+
fps = _useVideoConfig.fps,
|
|
38
|
+
width = _useVideoConfig.width,
|
|
39
|
+
height = _useVideoConfig.height;
|
|
40
|
+
var _useTheme = useTheme(),
|
|
41
|
+
primaryColor = _useTheme.primaryColor,
|
|
42
|
+
primaryContrast = _useTheme.primaryContrast,
|
|
43
|
+
accentColor = _useTheme.accentColor,
|
|
44
|
+
accentContrast = _useTheme.accentContrast;
|
|
45
|
+
var _useOrientationBased = useOrientationBased({
|
|
46
|
+
landscape: {
|
|
47
|
+
containerBottom: height * 0.13,
|
|
48
|
+
containerWidth: width * 0.76,
|
|
49
|
+
lineHeight: clamp(height * 0.008, 5, 9),
|
|
50
|
+
lineOffset: height * 0.01,
|
|
51
|
+
maxNameFontSize: width * 0.09,
|
|
52
|
+
maxTitleFontSize: width * 0.029,
|
|
53
|
+
nameHeight: height * 0.115,
|
|
54
|
+
titleBarHeight: height * 0.052,
|
|
55
|
+
titleInset: width * 0.01
|
|
56
|
+
},
|
|
57
|
+
portrait: {
|
|
58
|
+
containerBottom: height * 0.22,
|
|
59
|
+
containerWidth: width * 0.86,
|
|
60
|
+
lineHeight: clamp(height * 0.005, 5, 8),
|
|
61
|
+
lineOffset: height * 0.008,
|
|
62
|
+
maxNameFontSize: width * 0.13,
|
|
63
|
+
maxTitleFontSize: width * 0.052,
|
|
64
|
+
nameHeight: height * 0.075,
|
|
65
|
+
titleBarHeight: height * 0.038,
|
|
66
|
+
titleInset: width * 0.014
|
|
67
|
+
},
|
|
68
|
+
square: {
|
|
69
|
+
containerBottom: height * 0.16,
|
|
70
|
+
containerWidth: width * 0.82,
|
|
71
|
+
lineHeight: clamp(height * 0.007, 5, 8),
|
|
72
|
+
lineOffset: height * 0.008,
|
|
73
|
+
maxNameFontSize: width * 0.105,
|
|
74
|
+
maxTitleFontSize: width * 0.04,
|
|
75
|
+
nameHeight: height * 0.085,
|
|
76
|
+
titleBarHeight: height * 0.046,
|
|
77
|
+
titleInset: width * 0.012
|
|
78
|
+
}
|
|
79
|
+
}),
|
|
80
|
+
containerBottom = _useOrientationBased.containerBottom,
|
|
81
|
+
containerWidth = _useOrientationBased.containerWidth,
|
|
82
|
+
lineHeight = _useOrientationBased.lineHeight,
|
|
83
|
+
lineOffset = _useOrientationBased.lineOffset,
|
|
84
|
+
maxNameFontSize = _useOrientationBased.maxNameFontSize,
|
|
85
|
+
maxTitleFontSize = _useOrientationBased.maxTitleFontSize,
|
|
86
|
+
nameHeight = _useOrientationBased.nameHeight,
|
|
87
|
+
titleBarHeight = _useOrientationBased.titleBarHeight,
|
|
88
|
+
titleInset = _useOrientationBased.titleInset;
|
|
89
|
+
var displayName = (name || "").toLocaleUpperCase();
|
|
90
|
+
var displayTitle = (title || "").toLocaleUpperCase();
|
|
91
|
+
var brandColor = (themeSettings === null || themeSettings === void 0 ? void 0 : themeSettings.secondaryColor) || accentColor || primaryColor || "#ff6a00";
|
|
92
|
+
var nameTextColor = (themeSettings === null || themeSettings === void 0 ? void 0 : themeSettings.primaryContrast) || primaryContrast || "#FFFFFF";
|
|
93
|
+
var titleTextColor = !(themeSettings !== null && themeSettings !== void 0 && themeSettings.secondaryColor) && brandColor === accentColor ? getReadableColor(accentContrast, brandColor, "#FFFFFF") : getContrastColor(brandColor) || "#FFFFFF";
|
|
94
|
+
var nameFit = distributeTextToFit(displayName, containerWidth, nameHeight, maxNameFontSize);
|
|
95
|
+
var nametagWidth = clamp(estimateLineWidth(displayName, nameFit.fontSize), containerWidth * 0.35, containerWidth);
|
|
96
|
+
var titleFontSize = fitSingleLineFontSize(displayTitle, nametagWidth - titleInset * 2, titleBarHeight * 0.74, maxTitleFontSize);
|
|
97
|
+
var titleGrowEnd = Math.round(fps * 1.45);
|
|
98
|
+
var lineFillStart = Math.round(fps * 0.6);
|
|
99
|
+
var lineFillEnd = lineFillStart + Math.round(fps * 1.15);
|
|
100
|
+
var nameRevealStart = lineFillEnd + Math.round(fps * 0.28);
|
|
101
|
+
var nameRevealEnd = nameRevealStart + Math.round(fps * 1.25);
|
|
102
|
+
var baseScale = interpolate(frame, [0, titleGrowEnd], [0, 1], {
|
|
103
|
+
easing: Easing.out(Easing.cubic),
|
|
104
|
+
extrapolateLeft: "clamp",
|
|
105
|
+
extrapolateRight: "clamp"
|
|
106
|
+
});
|
|
107
|
+
var fillScale = interpolate(frame, [lineFillStart, lineFillEnd], [0, 1], {
|
|
108
|
+
easing: Easing.out(Easing.cubic),
|
|
109
|
+
extrapolateLeft: "clamp",
|
|
110
|
+
extrapolateRight: "clamp"
|
|
111
|
+
});
|
|
112
|
+
var nameReveal = interpolate(frame, [nameRevealStart, nameRevealEnd], [0, 1], {
|
|
113
|
+
easing: Easing.out(Easing.cubic),
|
|
114
|
+
extrapolateLeft: "clamp",
|
|
115
|
+
extrapolateRight: "clamp"
|
|
116
|
+
});
|
|
117
|
+
var nameTranslateY = interpolate(nameReveal, [0, 1], [-nameHeight, 0], {
|
|
118
|
+
extrapolateLeft: "clamp",
|
|
119
|
+
extrapolateRight: "clamp"
|
|
120
|
+
});
|
|
121
|
+
var titleClipInset = interpolate(baseScale, [0, 1], [50, 0], {
|
|
122
|
+
extrapolateLeft: "clamp",
|
|
123
|
+
extrapolateRight: "clamp"
|
|
124
|
+
});
|
|
125
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
126
|
+
style: {
|
|
127
|
+
position: "absolute",
|
|
128
|
+
bottom: containerBottom,
|
|
129
|
+
left: "50%",
|
|
130
|
+
width: containerWidth,
|
|
131
|
+
transform: "translateX(-50%)",
|
|
132
|
+
fontFamily: fontFamily,
|
|
133
|
+
textAlign: "center"
|
|
134
|
+
}
|
|
135
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
136
|
+
style: {
|
|
137
|
+
height: lineHeight,
|
|
138
|
+
margin: "0 auto ".concat(lineOffset, "px"),
|
|
139
|
+
position: "relative",
|
|
140
|
+
width: nametagWidth
|
|
141
|
+
}
|
|
142
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
143
|
+
style: {
|
|
144
|
+
backgroundColor: "#FFFFFF",
|
|
145
|
+
height: "100%",
|
|
146
|
+
left: 0,
|
|
147
|
+
position: "absolute",
|
|
148
|
+
top: 0,
|
|
149
|
+
transform: "scaleX(".concat(baseScale, ")"),
|
|
150
|
+
transformOrigin: "center",
|
|
151
|
+
width: "100%"
|
|
152
|
+
}
|
|
153
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
154
|
+
style: {
|
|
155
|
+
backgroundColor: brandColor,
|
|
156
|
+
height: "100%",
|
|
157
|
+
left: 0,
|
|
158
|
+
position: "absolute",
|
|
159
|
+
top: 0,
|
|
160
|
+
transform: "scaleX(".concat(fillScale, ")"),
|
|
161
|
+
transformOrigin: "center",
|
|
162
|
+
width: "100%"
|
|
163
|
+
}
|
|
164
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
165
|
+
style: {
|
|
166
|
+
height: nameHeight,
|
|
167
|
+
margin: "0 auto",
|
|
168
|
+
overflow: "hidden",
|
|
169
|
+
position: "relative",
|
|
170
|
+
width: nametagWidth
|
|
171
|
+
}
|
|
172
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
173
|
+
style: {
|
|
174
|
+
color: nameTextColor,
|
|
175
|
+
fontSize: nameFit.fontSize,
|
|
176
|
+
fontWeight: 400,
|
|
177
|
+
lineHeight: "".concat(nameHeight, "px"),
|
|
178
|
+
textShadow: "0 2px 8px rgba(0, 0, 0, 0.55)",
|
|
179
|
+
transform: "translateY(".concat(nameTranslateY, "px)"),
|
|
180
|
+
whiteSpace: "nowrap"
|
|
181
|
+
}
|
|
182
|
+
}, displayName)), /*#__PURE__*/React.createElement("div", {
|
|
183
|
+
style: {
|
|
184
|
+
alignItems: "center",
|
|
185
|
+
backgroundColor: brandColor,
|
|
186
|
+
borderRadius: titleBarHeight / 2,
|
|
187
|
+
display: "flex",
|
|
188
|
+
height: titleBarHeight,
|
|
189
|
+
justifyContent: "center",
|
|
190
|
+
margin: "0 auto",
|
|
191
|
+
overflow: "hidden",
|
|
192
|
+
padding: "0 ".concat(titleInset, "px"),
|
|
193
|
+
clipPath: "inset(0 ".concat(titleClipInset, "% 0 ").concat(titleClipInset, "% round ").concat(titleBarHeight / 2, "px)"),
|
|
194
|
+
width: nametagWidth
|
|
195
|
+
}
|
|
196
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
197
|
+
style: {
|
|
198
|
+
color: titleTextColor,
|
|
199
|
+
fontSize: titleFontSize,
|
|
200
|
+
fontWeight: 400,
|
|
201
|
+
lineHeight: 1,
|
|
202
|
+
opacity: baseScale,
|
|
203
|
+
overflow: "hidden",
|
|
204
|
+
textOverflow: "clip",
|
|
205
|
+
textShadow: "0 1px 3px rgba(0, 0, 0, 0.28)",
|
|
206
|
+
whiteSpace: "nowrap"
|
|
207
|
+
}
|
|
208
|
+
}, displayTitle)));
|
|
209
|
+
};
|