@zync/zync-screnplay-player 0.1.228 → 0.1.229

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.
@@ -15,6 +15,7 @@ import FaceCenteredVideo from "../utils/FaceCenteredVideo";
15
15
  import PausableImg from "../utils/PausableImg";
16
16
  import { useVirtualBackground } from "../../hooks/useVirtualBackground";
17
17
  import { VirtualBackgroundUnderlay } from "../backgrounds/VirtualBackgroundUnderlay";
18
+ import { HookThreeGlitchOverlay } from "./HookThreeGlitchOverlay";
18
19
  var _loadHeadlineFont = loadHeadlineFont(),
19
20
  headlineFontFamily = _loadHeadlineFont.fontFamily;
20
21
  var HOOK_STYLE_PRESETS = {
@@ -24,6 +25,9 @@ var HOOK_STYLE_PRESETS = {
24
25
  border_alarm: "border_alarm",
25
26
  split_reveal: "split_reveal"
26
27
  };
28
+ var coerceBoolean = function coerceBoolean(value) {
29
+ return value === true || value === "true" || value === 1 || value === "1";
30
+ };
27
31
  var normalizeWordForMatch = function normalizeWordForMatch(word) {
28
32
  return word.toLowerCase().replace(/^[^a-z0-9]+|[^a-z0-9]+$/gi, "");
29
33
  };
@@ -218,9 +222,8 @@ var HookHeadline = function HookHeadline(_ref3) {
218
222
  extrapolateLeft: "clamp",
219
223
  extrapolateRight: "clamp"
220
224
  });
221
- var glitchOffset = style === HOOK_STYLE_PRESETS.glitch_verdict ? (frame % 2 === 0 ? 1 : -1) * 4 : 0;
222
225
  var headlineColor = style === HOOK_STYLE_PRESETS.mono_shock ? "rgba(255, 255, 255, 0.98)" : primaryContrast || "#ffffff";
223
- var headlineTextShadow = style === HOOK_STYLE_PRESETS.glitch_verdict ? "3px 0 rgba(255, 40, 95, 0.9), -3px 0 rgba(0, 240, 255, 0.9), 0 10px 40px rgba(0, 0, 0, 0.55)" : style === HOOK_STYLE_PRESETS.mono_shock ? "0 3px 0 rgba(0, 0, 0, 0.48), 0 14px 36px rgba(0, 0, 0, 0.62)" : "0 12px 36px rgba(0, 0, 0, 0.45)";
226
+ var headlineTextShadow = style === HOOK_STYLE_PRESETS.mono_shock ? "0 3px 0 rgba(0, 0, 0, 0.48), 0 14px 36px rgba(0, 0, 0, 0.62)" : "0 12px 36px rgba(0, 0, 0, 0.45)";
224
227
  var containerStyle = style === HOOK_STYLE_PRESETS.mono_shock ? {
225
228
  display: "inline-flex",
226
229
  flexDirection: "column",
@@ -234,7 +237,7 @@ var HookHeadline = function HookHeadline(_ref3) {
234
237
  return /*#__PURE__*/React.createElement("div", {
235
238
  style: {
236
239
  opacity: reveal * outroOpacity,
237
- transform: "translate3d(".concat(glitchOffset, "px, ").concat((1 - reveal) * 24, "px, 0) scale(").concat(0.94 + reveal * 0.06, ")"),
240
+ transform: "translate3d(0, ".concat((1 - reveal) * 24, "px, 0) scale(").concat(0.94 + reveal * 0.06, ")"),
238
241
  willChange: "transform, opacity",
239
242
  maxWidth: maxWidth
240
243
  }
@@ -430,7 +433,13 @@ export var HookVideo = function HookVideo(_ref5) {
430
433
  hookDurationSeconds = _ref5$hookDurationSec === void 0 ? 1.6 : _ref5$hookDurationSec,
431
434
  hookAccentText = _ref5.hookAccentText,
432
435
  _ref5$disableHookSoun = _ref5.disableHookSounds,
433
- disableHookSounds = _ref5$disableHookSoun === void 0 ? false : _ref5$disableHookSoun;
436
+ disableHookSounds = _ref5$disableHookSoun === void 0 ? false : _ref5$disableHookSoun,
437
+ _ref5$hookExitEffectE = _ref5.hookExitEffectEnabled,
438
+ hookExitEffectEnabled = _ref5$hookExitEffectE === void 0 ? false : _ref5$hookExitEffectE,
439
+ _ref5$hookThreeGlitch = _ref5.hookThreeGlitchEffectEnabled,
440
+ hookThreeGlitchEffectEnabled = _ref5$hookThreeGlitch === void 0 ? false : _ref5$hookThreeGlitch,
441
+ _ref5$disableHookThre = _ref5.disableHookThreeGlitchEffect,
442
+ disableHookThreeGlitchEffect = _ref5$disableHookThre === void 0 ? false : _ref5$disableHookThre;
434
443
  var frame = useCurrentFrame();
435
444
  var _useVideoConfig = useVideoConfig(),
436
445
  outputWidth = _useVideoConfig.width,
@@ -456,6 +465,7 @@ export var HookVideo = function HookVideo(_ref5) {
456
465
  primaryColor = _useTheme.primaryColor,
457
466
  primaryContrast = _useTheme.primaryContrast;
458
467
  var style = Object.values(HOOK_STYLE_PRESETS).includes(hookStyle) ? hookStyle : HOOK_STYLE_PRESETS.punch_zoom;
468
+ var titleStyle = style === HOOK_STYLE_PRESETS.glitch_verdict ? HOOK_STYLE_PRESETS.mono_shock : style;
459
469
  var baseZoom = videoZoom || 1;
460
470
  var _getHookTiming = getHookTiming({
461
471
  durationInFrames: durationInFrames,
@@ -467,28 +477,28 @@ export var HookVideo = function HookVideo(_ref5) {
467
477
  shortSegment = _getHookTiming.shortSegment;
468
478
  var preset = useOrientationBased({
469
479
  landscape: {
470
- textBoxWidth: style === HOOK_STYLE_PRESETS.split_reveal ? width * 0.38 : style === HOOK_STYLE_PRESETS.mono_shock ? width * 0.46 : width * 0.58,
471
- textBoxHeight: style === HOOK_STYLE_PRESETS.split_reveal ? height * 0.62 : style === HOOK_STYLE_PRESETS.mono_shock ? height * 0.38 : height * 0.54,
472
- maxFontSize: style === HOOK_STYLE_PRESETS.glitch_verdict ? 138 : 148,
473
- top: style === HOOK_STYLE_PRESETS.split_reveal ? height * 0.18 : style === HOOK_STYLE_PRESETS.mono_shock ? height * 0.17 : height * 0.19,
474
- left: style === HOOK_STYLE_PRESETS.split_reveal ? CHROME_PADDING * 2.2 : style === HOOK_STYLE_PRESETS.mono_shock || style === HOOK_STYLE_PRESETS.glitch_verdict ? CHROME_PADDING * 2.1 : width * 0.21,
475
- align: style === HOOK_STYLE_PRESETS.punch_zoom || style === HOOK_STYLE_PRESETS.border_alarm ? "center" : "left"
480
+ textBoxWidth: titleStyle === HOOK_STYLE_PRESETS.split_reveal ? width * 0.38 : titleStyle === HOOK_STYLE_PRESETS.mono_shock ? width * 0.46 : width * 0.58,
481
+ textBoxHeight: titleStyle === HOOK_STYLE_PRESETS.split_reveal ? height * 0.62 : titleStyle === HOOK_STYLE_PRESETS.mono_shock ? height * 0.38 : height * 0.54,
482
+ maxFontSize: 148,
483
+ top: titleStyle === HOOK_STYLE_PRESETS.split_reveal ? height * 0.18 : titleStyle === HOOK_STYLE_PRESETS.mono_shock ? height * 0.17 : height * 0.19,
484
+ left: titleStyle === HOOK_STYLE_PRESETS.split_reveal ? CHROME_PADDING * 2.2 : titleStyle === HOOK_STYLE_PRESETS.mono_shock ? CHROME_PADDING * 2.1 : width * 0.21,
485
+ align: titleStyle === HOOK_STYLE_PRESETS.punch_zoom || titleStyle === HOOK_STYLE_PRESETS.border_alarm ? "center" : "left"
476
486
  },
477
487
  portrait: {
478
- textBoxWidth: style === HOOK_STYLE_PRESETS.split_reveal ? width * 0.78 : style === HOOK_STYLE_PRESETS.mono_shock ? width * 0.76 : width * 0.84,
479
- textBoxHeight: style === HOOK_STYLE_PRESETS.mono_shock ? height * 0.28 : height * 0.36,
480
- maxFontSize: style === HOOK_STYLE_PRESETS.glitch_verdict ? 118 : 126,
481
- top: style === HOOK_STYLE_PRESETS.mono_shock ? height * 0.15 : style === HOOK_STYLE_PRESETS.split_reveal ? height * 0.18 : height * 0.16,
482
- left: style === HOOK_STYLE_PRESETS.punch_zoom || style === HOOK_STYLE_PRESETS.border_alarm ? width * 0.08 : CHROME_PADDING * 1.8,
483
- align: style === HOOK_STYLE_PRESETS.punch_zoom || style === HOOK_STYLE_PRESETS.border_alarm ? "center" : "left"
488
+ textBoxWidth: titleStyle === HOOK_STYLE_PRESETS.split_reveal ? width * 0.78 : titleStyle === HOOK_STYLE_PRESETS.mono_shock ? width * 0.76 : width * 0.84,
489
+ textBoxHeight: titleStyle === HOOK_STYLE_PRESETS.mono_shock ? height * 0.28 : height * 0.36,
490
+ maxFontSize: 126,
491
+ top: titleStyle === HOOK_STYLE_PRESETS.mono_shock ? height * 0.15 : titleStyle === HOOK_STYLE_PRESETS.split_reveal ? height * 0.18 : height * 0.16,
492
+ left: titleStyle === HOOK_STYLE_PRESETS.punch_zoom || titleStyle === HOOK_STYLE_PRESETS.border_alarm ? width * 0.08 : CHROME_PADDING * 1.8,
493
+ align: titleStyle === HOOK_STYLE_PRESETS.punch_zoom || titleStyle === HOOK_STYLE_PRESETS.border_alarm ? "center" : "left"
484
494
  },
485
495
  square: {
486
- textBoxWidth: style === HOOK_STYLE_PRESETS.split_reveal ? width * 0.46 : style === HOOK_STYLE_PRESETS.mono_shock ? width * 0.52 : width * 0.72,
487
- textBoxHeight: style === HOOK_STYLE_PRESETS.split_reveal ? height * 0.62 : style === HOOK_STYLE_PRESETS.mono_shock ? height * 0.32 : height * 0.42,
496
+ textBoxWidth: titleStyle === HOOK_STYLE_PRESETS.split_reveal ? width * 0.46 : titleStyle === HOOK_STYLE_PRESETS.mono_shock ? width * 0.52 : width * 0.72,
497
+ textBoxHeight: titleStyle === HOOK_STYLE_PRESETS.split_reveal ? height * 0.62 : titleStyle === HOOK_STYLE_PRESETS.mono_shock ? height * 0.32 : height * 0.42,
488
498
  maxFontSize: 116,
489
- top: style === HOOK_STYLE_PRESETS.mono_shock ? height * 0.15 : style === HOOK_STYLE_PRESETS.split_reveal ? height * 0.16 : height * 0.18,
490
- left: style === HOOK_STYLE_PRESETS.punch_zoom || style === HOOK_STYLE_PRESETS.border_alarm ? width * 0.14 : CHROME_PADDING * 1.8,
491
- align: style === HOOK_STYLE_PRESETS.punch_zoom || style === HOOK_STYLE_PRESETS.border_alarm ? "center" : "left"
499
+ top: titleStyle === HOOK_STYLE_PRESETS.mono_shock ? height * 0.15 : titleStyle === HOOK_STYLE_PRESETS.split_reveal ? height * 0.16 : height * 0.18,
500
+ left: titleStyle === HOOK_STYLE_PRESETS.punch_zoom || titleStyle === HOOK_STYLE_PRESETS.border_alarm ? width * 0.14 : CHROME_PADDING * 1.8,
501
+ align: titleStyle === HOOK_STYLE_PRESETS.punch_zoom || titleStyle === HOOK_STYLE_PRESETS.border_alarm ? "center" : "left"
492
502
  }
493
503
  }, orientationOverride);
494
504
  var monoOverlayHoldFrames = style === HOOK_STYLE_PRESETS.mono_shock ? Math.round(fps * 0.55) : 0;
@@ -535,6 +545,9 @@ export var HookVideo = function HookVideo(_ref5) {
535
545
  extrapolateLeft: "clamp",
536
546
  extrapolateRight: "clamp"
537
547
  }) : 0;
548
+ var threeGlitchDurationInFrames = Math.max(12, Math.min(24, Math.round(fps * 0.55), durationInFrames));
549
+ var threeGlitchStartFrame = Math.max(0, effectiveHookFrames - Math.round(threeGlitchDurationInFrames * 0.62));
550
+ var showThreeGlitch = !shortSegment && !coerceBoolean(disableHookThreeGlitchEffect) && (style === HOOK_STYLE_PRESETS.glitch_verdict || coerceBoolean(hookThreeGlitchEffectEnabled));
538
551
  var _getVideoTreatment = getVideoTreatment({
539
552
  frame: frame,
540
553
  style: style,
@@ -775,7 +788,15 @@ export var HookVideo = function HookVideo(_ref5) {
775
788
  objectFit: "cover",
776
789
  opacity: frame % 2 === 0 ? 0.35 : 0.12
777
790
  }
778
- })) : null, flashOpacity > 0 ? /*#__PURE__*/React.createElement(AbsoluteFill, {
791
+ })) : null, showThreeGlitch ? /*#__PURE__*/React.createElement(HookThreeGlitchOverlay, {
792
+ width: contentWidth,
793
+ height: contentHeight,
794
+ startFrame: threeGlitchStartFrame,
795
+ durationInFrames: threeGlitchDurationInFrames,
796
+ accentColor: accentColor,
797
+ intensity: style === HOOK_STYLE_PRESETS.glitch_verdict ? 1 : 0.72,
798
+ zIndex: 19
799
+ }) : null, flashOpacity > 0 ? /*#__PURE__*/React.createElement(AbsoluteFill, {
779
800
  style: {
780
801
  zIndex: 18,
781
802
  opacity: flashOpacity,
@@ -807,7 +828,7 @@ export var HookVideo = function HookVideo(_ref5) {
807
828
  accentColor: accentColor,
808
829
  accentContrast: accentContrast,
809
830
  primaryContrast: primaryContrast,
810
- style: style,
831
+ style: titleStyle,
811
832
  frame: frame,
812
833
  fps: fps,
813
834
  hookFrames: effectiveHookFrames
@@ -834,7 +855,7 @@ export var HookVideo = function HookVideo(_ref5) {
834
855
  })) : null)), playHookSounds ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Audio, {
835
856
  src: staticFile("swoosh.mp3"),
836
857
  volume: 0.28
837
- }), !shortSegment ? /*#__PURE__*/React.createElement(Sequence, {
858
+ }), !shortSegment && !hookExitEffectEnabled ? /*#__PURE__*/React.createElement(Sequence, {
838
859
  from: effectiveHookFrames
839
860
  }, /*#__PURE__*/React.createElement(Audio, {
840
861
  src: staticFile("ding-short.mp3"),
@@ -8,34 +8,34 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
8
8
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
9
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
10
10
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
11
- /**
12
- * Face-Centered Video Component
13
- *
14
- * A reusable component that wraps OffthreadVideo to ensure the video is always
15
- * centered on a person's face within a flexible container.
16
- *
17
- * The video maintains its source dimensions and is positioned using translateX/translateY
18
- * to center the face within the container, regardless of container size.
11
+ /**
12
+ * Face-Centered Video Component
13
+ *
14
+ * A reusable component that wraps OffthreadVideo to ensure the video is always
15
+ * centered on a person's face within a flexible container.
16
+ *
17
+ * The video maintains its source dimensions and is positioned using translateX/translateY
18
+ * to center the face within the container, regardless of container size.
19
19
  */
20
20
 
21
21
  import React from "react";
22
22
  import { OffthreadVideo, useCurrentFrame } from "remotion";
23
23
  import { useOrientationBased } from "../../hooks/useOrientationBased.js";
24
24
 
25
- /**
26
- * Calculate face-centered translation for flexible container
27
- * @param {Object} params - Configuration object
28
- * @param {Object} params.faceMetadata - Face detection metadata
29
- * @param {number} params.containerWidth - Container width in pixels
30
- * @param {number} params.containerHeight - Container height in pixels
31
- * @param {number} params.currentFrame - Current frame number (optional)
32
- * @param {boolean} params.enableInterpolation - Whether to interpolate between frames
33
- * @param {boolean} params.useAveragePosition - Whether to use average face position
34
- * @param {boolean} params.centerHorizontally - Whether to only center horizontally
35
- * @param {number} params.translateX - Additional translateX offset
36
- * @param {number} params.translateY - Additional translateY offset
37
- * @param {string} params.orientation - Viewport orientation (portrait, square, landscape)
38
- * @returns {Object} Transform styles and debug info
25
+ /**
26
+ * Calculate face-centered translation for flexible container
27
+ * @param {Object} params - Configuration object
28
+ * @param {Object} params.faceMetadata - Face detection metadata
29
+ * @param {number} params.containerWidth - Container width in pixels
30
+ * @param {number} params.containerHeight - Container height in pixels
31
+ * @param {number} params.currentFrame - Current frame number (optional)
32
+ * @param {boolean} params.enableInterpolation - Whether to interpolate between frames
33
+ * @param {boolean} params.useAveragePosition - Whether to use average face position
34
+ * @param {boolean} params.centerHorizontally - Whether to only center horizontally
35
+ * @param {number} params.translateX - Additional translateX offset
36
+ * @param {number} params.translateY - Additional translateY offset
37
+ * @param {string} params.orientation - Viewport orientation (portrait, square, landscape)
38
+ * @returns {Object} Transform styles and debug info
39
39
  */
40
40
  var calculateFaceCenteredTranslation = function calculateFaceCenteredTranslation(_ref) {
41
41
  var _faceMetadata$metadat, _faceMetadata$metadat2;
@@ -214,8 +214,8 @@ var calculateFaceCenteredTranslation = function calculateFaceCenteredTranslation
214
214
  };
215
215
  };
216
216
 
217
- /**
218
- * Get face data for a specific frame with optional interpolation
217
+ /**
218
+ * Get face data for a specific frame with optional interpolation
219
219
  */
220
220
  function getFaceDataForFrame(frames, frameIndex, enableInterpolation) {
221
221
  var _prevFrame, _nextFrame;
@@ -274,8 +274,8 @@ function getFaceDataForFrame(frames, frameIndex, enableInterpolation) {
274
274
  return ((_prevFrame = prevFrame) === null || _prevFrame === void 0 ? void 0 : _prevFrame.data) || ((_nextFrame = nextFrame) === null || _nextFrame === void 0 ? void 0 : _nextFrame.data) || null;
275
275
  }
276
276
 
277
- /**
278
- * Calculate average face position from all frames with face data
277
+ /**
278
+ * Calculate average face position from all frames with face data
279
279
  */
280
280
  function getAverageFaceData(frames) {
281
281
  if (!frames || frames.length === 0) return null;
@@ -310,14 +310,14 @@ function getAverageFaceData(frames) {
310
310
  };
311
311
  }
312
312
 
313
- /**
314
- * Calculate the negative space offset when face-centering a video
315
- *
316
- * @param {Object} faceMetadata - Face detection metadata object
317
- * @param {number} containerWidth - Container width in pixels
318
- * @param {number} containerHeight - Container height in pixels
319
- * @param {number} scale - Scale factor applied to the video
320
- * @returns {Object} Object containing horizontal and vertical offsets and which side has negative space
313
+ /**
314
+ * Calculate the negative space offset when face-centering a video
315
+ *
316
+ * @param {Object} faceMetadata - Face detection metadata object
317
+ * @param {number} containerWidth - Container width in pixels
318
+ * @param {number} containerHeight - Container height in pixels
319
+ * @param {number} scale - Scale factor applied to the video
320
+ * @returns {Object} Object containing horizontal and vertical offsets and which side has negative space
321
321
  */
322
322
  export var calculateNegativeSpaceOffset = function calculateNegativeSpaceOffset(faceMetadata, containerWidth, containerHeight) {
323
323
  var _faceMetadata$metadat4, _faceMetadata$metadat5;
@@ -415,22 +415,22 @@ export var calculateNegativeSpaceOffset = function calculateNegativeSpaceOffset(
415
415
  };
416
416
  };
417
417
 
418
- /**
419
- * FaceCenteredVideo Component
420
- * @param {Object} props - Component props
421
- * @param {string} props.src - Video source URL
422
- * @param {Object} props.faceMetadata - Face detection metadata
423
- * @param {number} props.containerWidth - Container width in pixels (required)
424
- * @param {number} props.containerHeight - Container height in pixels (required)
425
- * @param {boolean} props.enableInterpolation - Whether to interpolate between frames
426
- * @param {boolean} props.useAveragePosition - Whether to use average face position for entire video duration
427
- * @param {boolean} props.centerHorizontally - Whether to only center horizontally (X axis), not vertically (Y axis)
428
- * @param {number} props.translateX - Additional translateX offset (optional)
429
- * @param {number} props.translateY - Additional translateY offset (optional)
430
- * @param {boolean} props.showDebugInfo - Whether to show debug information
431
- * @param {Object} props.style - Additional styles to apply to video
432
- * @param {string} props.className - CSS class name
433
- * @param {...Object} props.otherProps - Other props to pass to OffthreadVideo
418
+ /**
419
+ * FaceCenteredVideo Component
420
+ * @param {Object} props - Component props
421
+ * @param {string} props.src - Video source URL
422
+ * @param {Object} props.faceMetadata - Face detection metadata
423
+ * @param {number} props.containerWidth - Container width in pixels (required)
424
+ * @param {number} props.containerHeight - Container height in pixels (required)
425
+ * @param {boolean} props.enableInterpolation - Whether to interpolate between frames
426
+ * @param {boolean} props.useAveragePosition - Whether to use average face position for entire video duration
427
+ * @param {boolean} props.centerHorizontally - Whether to only center horizontally (X axis), not vertically (Y axis)
428
+ * @param {number} props.translateX - Additional translateX offset (optional)
429
+ * @param {number} props.translateY - Additional translateY offset (optional)
430
+ * @param {boolean} props.showDebugInfo - Whether to show debug information
431
+ * @param {Object} props.style - Additional styles to apply to video
432
+ * @param {string} props.className - CSS class name
433
+ * @param {...Object} props.otherProps - Other props to pass to OffthreadVideo
434
434
  */
435
435
  export var FaceCenteredVideo = function FaceCenteredVideo(_ref2) {
436
436
  var _faceMetadata$metadat7, _faceMetadata$metadat8, _faceMetadata$metadat9, _faceMetadata$metadat10;
@@ -15,10 +15,10 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
15
15
  import React, { useEffect, useState } from "react";
16
16
  import { Img, delayRender, continueRender } from "remotion";
17
17
 
18
- /**
19
- * PausableImg component that extends Remotion's Img with fetch validation.
20
- * It delays rendering until the image source can be successfully fetched.
21
- * If there's an error fetching the image, it renders nothing.
18
+ /**
19
+ * PausableImg component that extends Remotion's Img with fetch validation.
20
+ * It delays rendering until the image source can be successfully fetched.
21
+ * If there's an error fetching the image, it renders nothing.
22
22
  */
23
23
  export var PausableImg = /*#__PURE__*/React.memo(function (_ref) {
24
24
  var src = _ref.src,
@@ -1,80 +1,80 @@
1
- # StretchText Component
2
-
3
- A React component that renders text that stretches to fit the parent's width. Words with fewer characters will have a larger font size than words with more characters. The component uses SVG for rendering text, which ensures proper text-stroke rendering in headless mode.
4
-
5
- ## Usage
6
-
7
- ```jsx
8
- import StretchText from './StretchText';
9
-
10
- // Basic usage
11
- <StretchText text="Hello World" />
12
-
13
- // With custom styling
14
- <StretchText
15
- text="Contribution"
16
- color="#1a73e8"
17
- fontFamily="Arial"
18
- maxFontSize={200}
19
- minFontSize={10}
20
- style={{ fontWeight: 'bold' }}
21
- />
22
-
23
- // With text stroke
24
- <StretchText
25
- text="Outlined Text"
26
- color="transparent"
27
- textStrokeColor="white"
28
- textStrokeWidth="2px"
29
- style={{ fontWeight: 'bold' }}
30
- />
31
- ```
32
-
33
- ## Props
34
-
35
- | Prop | Type | Default | Description |
36
- |------|------|---------|-------------|
37
- | `text` | string | required | The text to display |
38
- | `color` | string | '#000000' | Text color |
39
- | `fontFamily` | string | 'Arial' | Font family |
40
- | `maxFontSize` | number | 100 | Maximum font size in pixels |
41
- | `minFontSize` | number | 10 | Minimum font size in pixels |
42
- | `textStrokeColor` | string | undefined | Color of the text stroke |
43
- | `textStrokeWidth` | string | undefined | Width of the text stroke (e.g., '2px') |
44
- | `textFillColor` | string | undefined | Color of the text fill (overrides `color` if provided) |
45
- | `style` | object | {} | Additional style properties |
46
-
47
- ## Examples
48
-
49
- The component automatically calculates the appropriate font size to make the text stretch to fit the parent width. For example:
50
-
51
- - "Work" (4 characters) will have a larger font size than "Contribution" (12 characters) when both are rendered in containers of the same width.
52
- - The text will always be contained within the parent container and will not overflow.
53
- - The component recalculates the font size when the window is resized.
54
-
55
- ## Demo
56
-
57
- You can see a demo of the StretchText component by running the development environment and looking at the first segment in the video timeline.
58
-
59
- The demo shows several words of different lengths rendered in containers of the same width:
60
-
61
- - "Contribution" (longer word, smaller font)
62
- - "Work" (shorter word, larger font)
63
- - "Hello" (medium length word, medium font)
64
- - "Supercalifragilisticexpialidocious" (very long word, very small font)
65
-
66
- Each word stretches to fill the entire width of its container, demonstrating how the component automatically adjusts the font size based on the text length.
67
-
68
- ## Implementation Details
69
-
70
- The component uses a binary search algorithm to find the optimal font size that makes the text fit the parent width. It uses a simple approximation for text width calculation (character count * fontSize * 0.75) which works well for most fonts.
71
-
72
- The component uses SVG for rendering text, which provides several advantages:
73
- - Proper text-stroke rendering in headless mode
74
- - Better control over text positioning and alignment
75
- - Consistent rendering across different browsers and environments
76
- - Support for advanced SVG features like filters for text shadows
77
-
78
- For text with stroke effects, the component uses SVG's native stroke and fill attributes, which are more reliable than CSS text-stroke properties, especially in headless rendering environments.
79
-
80
- The component also includes a resize listener to recalculate the font size when the window size changes.
1
+ # StretchText Component
2
+
3
+ A React component that renders text that stretches to fit the parent's width. Words with fewer characters will have a larger font size than words with more characters. The component uses SVG for rendering text, which ensures proper text-stroke rendering in headless mode.
4
+
5
+ ## Usage
6
+
7
+ ```jsx
8
+ import StretchText from './StretchText';
9
+
10
+ // Basic usage
11
+ <StretchText text="Hello World" />
12
+
13
+ // With custom styling
14
+ <StretchText
15
+ text="Contribution"
16
+ color="#1a73e8"
17
+ fontFamily="Arial"
18
+ maxFontSize={200}
19
+ minFontSize={10}
20
+ style={{ fontWeight: 'bold' }}
21
+ />
22
+
23
+ // With text stroke
24
+ <StretchText
25
+ text="Outlined Text"
26
+ color="transparent"
27
+ textStrokeColor="white"
28
+ textStrokeWidth="2px"
29
+ style={{ fontWeight: 'bold' }}
30
+ />
31
+ ```
32
+
33
+ ## Props
34
+
35
+ | Prop | Type | Default | Description |
36
+ |------|------|---------|-------------|
37
+ | `text` | string | required | The text to display |
38
+ | `color` | string | '#000000' | Text color |
39
+ | `fontFamily` | string | 'Arial' | Font family |
40
+ | `maxFontSize` | number | 100 | Maximum font size in pixels |
41
+ | `minFontSize` | number | 10 | Minimum font size in pixels |
42
+ | `textStrokeColor` | string | undefined | Color of the text stroke |
43
+ | `textStrokeWidth` | string | undefined | Width of the text stroke (e.g., '2px') |
44
+ | `textFillColor` | string | undefined | Color of the text fill (overrides `color` if provided) |
45
+ | `style` | object | {} | Additional style properties |
46
+
47
+ ## Examples
48
+
49
+ The component automatically calculates the appropriate font size to make the text stretch to fit the parent width. For example:
50
+
51
+ - "Work" (4 characters) will have a larger font size than "Contribution" (12 characters) when both are rendered in containers of the same width.
52
+ - The text will always be contained within the parent container and will not overflow.
53
+ - The component recalculates the font size when the window is resized.
54
+
55
+ ## Demo
56
+
57
+ You can see a demo of the StretchText component by running the development environment and looking at the first segment in the video timeline.
58
+
59
+ The demo shows several words of different lengths rendered in containers of the same width:
60
+
61
+ - "Contribution" (longer word, smaller font)
62
+ - "Work" (shorter word, larger font)
63
+ - "Hello" (medium length word, medium font)
64
+ - "Supercalifragilisticexpialidocious" (very long word, very small font)
65
+
66
+ Each word stretches to fill the entire width of its container, demonstrating how the component automatically adjusts the font size based on the text length.
67
+
68
+ ## Implementation Details
69
+
70
+ The component uses a binary search algorithm to find the optimal font size that makes the text fit the parent width. It uses a simple approximation for text width calculation (character count * fontSize * 0.75) which works well for most fonts.
71
+
72
+ The component uses SVG for rendering text, which provides several advantages:
73
+ - Proper text-stroke rendering in headless mode
74
+ - Better control over text positioning and alignment
75
+ - Consistent rendering across different browsers and environments
76
+ - Support for advanced SVG features like filters for text shadows
77
+
78
+ For text with stroke effects, the component uses SVG's native stroke and fill attributes, which are more reliable than CSS text-stroke properties, especially in headless rendering environments.
79
+
80
+ The component also includes a resize listener to recalculate the font size when the window size changes.
@@ -2,9 +2,9 @@ import React from "react";
2
2
  import { AbsoluteFill } from "remotion";
3
3
  import StretchText from "./StretchText";
4
4
 
5
- /**
6
- * Demo component to showcase the StretchText component
7
- * Shows how different words stretch to the same width with different font sizes
5
+ /**
6
+ * Demo component to showcase the StretchText component
7
+ * Shows how different words stretch to the same width with different font sizes
8
8
  */
9
9
  var StretchTextDemo = function StretchTextDemo() {
10
10
  var containerStyle = {
@@ -51,7 +51,7 @@ var renderer = new RemotionRenderer({
51
51
  },
52
52
  hookText: "Send a personal thank you note",
53
53
  hookAccentText: "thank you note",
54
- hookStyle: "mono_shock",
54
+ hookStyle: "glitch_verdict",
55
55
  hookDurationSeconds: 14.805,
56
56
  paddingLeft: 8.72,
57
57
  paddingRight: 39.366822,
@@ -1,11 +1,11 @@
1
- /**
2
- * Converts seconds and a portion of frames to a numeric value of seconds.
3
- *
4
- * @param {number} seconds - The number of full seconds.
5
- * @param {number} nthFrame - The current frame within the second.
6
- * @param {number} delayInSeconds - Optional delay that adds up to the calculation
7
- * @param {number} frameRate - The frame rate (frames per second).
8
- * @return {number} The total time in seconds (with decimals for frames).
1
+ /**
2
+ * Converts seconds and a portion of frames to a numeric value of seconds.
3
+ *
4
+ * @param {number} seconds - The number of full seconds.
5
+ * @param {number} nthFrame - The current frame within the second.
6
+ * @param {number} delayInSeconds - Optional delay that adds up to the calculation
7
+ * @param {number} frameRate - The frame rate (frames per second).
8
+ * @return {number} The total time in seconds (with decimals for frames).
9
9
  */
10
10
  export var convertToSeconds = function convertToSeconds(seconds, nthFrame) {
11
11
  var delayInSeconds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
@@ -4,10 +4,10 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
4
4
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
5
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
6
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
- /**
8
- * Calculate video styles based on face detection metadata
9
- * This helper adjusts video positioning and transform origin to center faces in the viewport
10
- * when zooming, accounting for objectFit: "cover" behavior
7
+ /**
8
+ * Calculate video styles based on face detection metadata
9
+ * This helper adjusts video positioning and transform origin to center faces in the viewport
10
+ * when zooming, accounting for objectFit: "cover" behavior
11
11
  */
12
12
  export var getFaceBasedVideoStyles = function getFaceBasedVideoStyles(_ref) {
13
13
  var faceMetadata = _ref.faceMetadata,