Skip to content

Component CRT Presentation

Reese Hodge edited this page Sep 26, 2026 · 1 revision

Component CRT Presentation

The CRT presentation layer is the TV cabinet, screen content, avatar/background animation, visual fallback effects, overlays, and physical-style controls used by Component-Frontend-App. It is mostly CSS and React composition; the WebGL shader code exists as exported strings/helpers but is not used by App.tsx today.

Files

  • CrtFrame.tsx renders the bezel, screen slot, optional panel, optional footer, and /TV-frame.png.
  • crtShader.ts exports GLSL strings and uniform helpers for scanlines, aberration, barrel distortion, glitch tears, vignette, and flicker.
  • crtFallback.css adds CSS-only vignette, glow, flicker, glitch, and reduced-motion behavior.
  • StaticNoise.tsx renders an animated SVG turbulence filter.
  • Avatar2D.tsx renders a simple SVG face/shoulders avatar, but it is not used by App.tsx.
  • AvatarFrameCycler.tsx renders PNG avatar frames and preloads frames by theme.
  • BackgroundCycler.tsx shuffles and cycles background frames.
  • TuningOverlay.tsx displays full-screen static during power-on tuning.
  • BroadcastText.tsx renders response/greeting text.
  • SessionStateOverlay.tsx renders terminal and signal-lost overlays.
  • ChannelKnob.tsx and TvKnob.tsx render transparent control hit targets.

Exported functions and props

  • CrtFrame({ children, panel, footer }: CrtFrameProps) where each prop is optional ReactNode.
  • crtVertexShader: string, crtFragmentShader: string
  • interface CrtUniforms { tDiffuse; time; glitchIntensity; resolution; }
  • createCrtUniforms(): CrtUniforms
  • getMobileGlitchIntensity(baseIntensity: number, isMobile: boolean): number
  • StaticNoise(): JSX.Element
  • Avatar2D({ isMouthOpen }: { isMouthOpen: boolean })
  • type AvatarFrame = 'idle' | 'talk-1' | 'talk-2' | 'glitch' | 'blink' | 'laugh' | 'side-eye'
  • AvatarFrameCycler({ isMouthOpen, theme, forceFrame, talking }: AvatarFrameCyclerProps)
  • BackgroundCycler(): JSX.Element
  • TuningOverlay({ visible }: { visible: boolean })
  • BroadcastText({ tokens, fullText }: { tokens: string[]; fullText: string | null })
  • type OverlayState = 'ENDED' | 'BUDGET_CAPPED' | 'RATE_LIMITED' | 'SIGNAL_LOST' | 'ERROR' | null
  • SessionStateOverlay({ state }: { state: OverlayState })
  • ChannelKnob({ onChannelChange, disabled }: ChannelKnobProps)
  • TvKnob({ onToggle, isOn }: TvKnobProps)

How the pieces connect

App wraps all screen content in:

<CrtFrame panel={controlPanel} footer={null}>
  ...
</CrtFrame>

CrtFrame places children inside .crt-screen, panel controls inside .crt-panel, and the TV artwork image above the screen via .crt-frame-image.

AvatarFrameCycler chooses image paths like /avatar/{theme}/{frame}.png. It has independent timers for glitch, blink, laugh, and side-eye, and a talking mode that alternates talk-1/talk-2. forceFrame overrides those timers for deterministic tune-in flashes.

BackgroundCycler preloads /background/max-grid/frame-{0..7}.png, shuffles frame order, avoids immediate repeats across cycle boundaries, and stops cycling when prefers-reduced-motion: reduce matches.

SessionStateOverlay uses normal centered text for ended/budget/rate/error states. SIGNAL_LOST is a distinct off-air composition with color bars, StaticNoise, and a “PLEASE STAND BY” banner.

Gotchas

  • crtShader.ts is present and exported, but there is no visible import or render path for it in App.tsx; current production composition uses the CSS fallback class crt-fallback.
  • Avatar2D exists but is not wired into App.tsx; the active avatar path is AvatarFrameCycler.
  • BroadcastText accepts token arrays, but App.tsx passes displayText.split(''), so token mode is character-by-character at the presentation boundary.
  • TvKnob has no disabled prop; only app state decides whether clicking it powers on or off.

Clone this wiki locally