# All files / src/components/scenes TerminalScene.tsx

22.22% Statements 2/9
0% Branches 0/11
0% Functions 0/2
22.22% Lines 2/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170

    1x

    1x

     import React from "react";
    import {
      AbsoluteFill,
      OffthreadVideo,
      staticFile,
      useCurrentFrame,
      interpolate,
    } from "remotion";

    interface TerminalSceneProps {
      videoPath: string;
      showHeader?: boolean;
      headerText?: string;
      primaryColor?: string;
    }

    export const TerminalScene: React.FC<TerminalSceneProps> = ({
      videoPath,
      showHeader = false,
      headerText,
      primaryColor = "#8b5cf6",
    }) => {
      const frame = useCurrentFrame();

      // Subtle zoom pulse during key moments
      const scale = interpolate(
        frame,
        [0, 10, 30, 40],
        [0.98, 1, 1.01, 1],
        { extrapolateLeft: "clamp", extrapolateRight: "clamp" }
      );

      const opacity = interpolate(frame, [0, 10], [0, 1], {
        extrapolateRight: "clamp",
      });

      return (
        <AbsoluteFill style={{ backgroundColor: "#0a0a0f" }}>
          {/* Optional header */}
          {showHeader && headerText && (
            <div
              style={{
                position: "absolute",
                top: 20,
                left: 0,
                right: 0,
                textAlign: "center",
                zIndex: 10,
                opacity: interpolate(frame, [0, 15], [0, 0.8], {
                  extrapolateRight: "clamp",
                }),
              }}
            >
              <span
                style={{
                  fontSize: 14,
                  color: primaryColor,
                  fontFamily: "Menlo, monospace",
                  backgroundColor: "rgba(10,10,15,0.8)",
                  padding: "8px 16px",
                  borderRadius: 8,
                  border: `1px solid ${primaryColor}40`,
                }}
              >
                {headerText}
              </span>
            </div>
          )}

          {/* Terminal video */}
          <AbsoluteFill
            style={{
              display: "flex",
              justifyContent: "center",
              alignItems: "center",
              opacity,
              transform: `scale(${scale})`,
            }}
          >
            <OffthreadVideo
              src={staticFile(videoPath)}
              style={{
                width: "100%",
                maxHeight: "90%",
                objectFit: "contain",
              }}
            />
          </AbsoluteFill>

          {/* Subtle vignette overlay */}
          <AbsoluteFill
            style={{
              background:
                "radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.4) 100%)",
              pointerEvents: "none",
            }}
          />
        </AbsoluteFill>
      );
    };

    // Terminal with text overlay for narration
    interface TerminalWithOverlayProps extends TerminalSceneProps {
      overlayText?: string;
      overlayPosition?: "top" | "bottom";
      showOverlayAt?: number;
      hideOverlayAt?: number;
    }

    export const TerminalWithOverlay: React.FC<TerminalWithOverlayProps> = ({
      videoPath,
      overlayText,
      overlayPosition = "bottom",
      showOverlayAt = 0,
      hideOverlayAt = 999,
      primaryColor = "#8b5cf6",
    }) => {
      const frame = useCurrentFrame();

      const overlayOpacity = interpolate(
        frame,
        [showOverlayAt, showOverlayAt + 15, hideOverlayAt - 15, hideOverlayAt],
        [0, 1, 1, 0],
        { extrapolateLeft: "clamp", extrapolateRight: "clamp" }
      );

      return (
        <AbsoluteFill style={{ backgroundColor: "#0a0a0f" }}>
          {/* Terminal video */}
          <TerminalScene videoPath={videoPath} primaryColor={primaryColor} />

          {/* Text overlay */}
          {overlayText && (
            <div
              style={{
                position: "absolute",
                left: 0,
                right: 0,
                [overlayPosition]: 60,
                textAlign: "center",
                opacity: overlayOpacity,
                zIndex: 10,
              }}
            >
              <div
                style={{
                  display: "inline-block",
                  backgroundColor: "rgba(10,10,15,0.9)",
                  padding: "12px 24px",
                  borderRadius: 12,
                  border: `1px solid ${primaryColor}40`,
                }}
              >
                <span
                  style={{
                    fontSize: 20,
                    color: "white",
                    fontFamily: "Inter, system-ui",
                    fontWeight: 500,
                  }}
                >
                  {overlayText}
                </span>
              </div>
            </div>
          )}
        </AbsoluteFill>
      );
    };