// The MARQUEE over the Films player (the Picture House, 4 Nov 2026,// `cinemas14-materials`' `marquee-plate`): as an episode starts, its caption// ("S2 E5 · The Long Night", the lobby card's own words,// `EpisodeLobbySetting.caption`) typed in the cream on the painted charcoal// plate under its worn brass rule, laid over the top of the player's// picture; it stands three seconds and fades (with Reduce Motion it stands// the same three seconds and goes without fading). The plate is painted// (`Media.xcassets`, imported by `scripts/import-cinemas-materials.py`// `marquee`); the words are live, placed where `layout.json`'s `marquee`// puts them in the 1488 x 195 plate's box.//// The player lays it over its chrome; the plate itself only draws, and// takes no touch.importCottonPaperimportCottonValuesimportCoreTextimportSwiftUIpublicenumCinemaMarqueeKnobs {// THE PLATE'S BOX, in its painting's pixels (`marquee`'s `size`), drawn// at most `widest` points wide (its `phoneMaxSize`), `margin` in from// either side of the player.staticlet box = CGSize(width: 1488, height: 195)publicstaticlet widest: CGFloat = 496publicstaticlet margin: CGFloat = 16staticlet top: CGFloat = 12// THE WORDS (`liveTypeRect`), set from its left as the sample is// (`samplePlacement`: 22 letters across 840 pixels), taken down a step// at a time to the least before they are cut.staticlet words = CGRect(x: 90, y: 35, width: 1308, height: 125)staticlet size: CGFloat = 64staticlet least: CGFloat = 44staticlet shrink: CGFloat = 0.94/// How long it stands, and how long it takes to fade, in seconds.publicstaticlet stands: Double = 3publicstaticlet fades: Double = 0.6/// When it is gone either way, and the player may let it go.publicstaticvar gone: Double { stands + fades }}/// How the marquee's words are set.publicenumCinemaMarqueeSetting {/// The caption on one line in the typewriter, at the plate's own size/// taken down to the least, past it cut with an ellipsis. In the plate's/// pixels.publicstaticfunc line(_ caption: String) -> (line: String?, size: CGFloat) {let knobs = CinemaMarqueeKnobs.selflet words = caption.split(whereSeparator: \.isWhitespace).joined(separator: " ")guard !words.isEmpty else { return (nil, knobs.size) }var size = knobs.sizewhileHighlightPassageSetting.wide(words, EpisodeLobbySetting.type(size)) > knobs.words.width, size * knobs.shrink >= knobs.least { size *= knobs.shrink }return (HighlightPassageSetting.lines(words, font: EpisodeLobbySetting.type(size), width: knobs.words.width, limit: 1).first, size) }}/// The plate with the caption on it, `width` points wide.publicstructCinemaMarqueePlate: View {let caption: Stringlet width: CGFloatpublicinit(caption: String, width: CGFloat) {self.caption = captionself.width = width }publicvar body: someView {let knobs = CinemaMarqueeKnobs.selflet s = width / knobs.box.widthlet (line, size) = CinemaMarqueeSetting.line(caption) ZStack(alignment: .topLeading) {CinemaPainted(name: "marquee-plate") .frame(width: knobs.box.width * s, height: knobs.box.height * s)iflet line {Text(line) .font(CottonFonts.type(size * s)) .foregroundStyle(CinemasMaterial.cream.colour) .lineLimit(1) .fixedSize() .frame(width: knobs.words.width * s, height: knobs.words.height * s, alignment: .leading) .offset(x: knobs.words.minX * s, y: knobs.words.minY * s) } } .frame(width: knobs.box.width * s, height: knobs.box.height * s, alignment: .topLeading) .accessibilityElement(children: .ignore) .accessibilityLabel(line ?? "") .accessibilityIdentifier("cinema-marquee") }}/// The marquee as the player lays it over its chrome at the start: the/// plate at the top, as wide as the player allows up to its own width,/// standing three seconds, then fading (Reduce Motion: gone, unfaded).publicstructCinemaMarqueeOverlay: View {let caption: String/// How far below the overlay's top the screen's status bar reaches: the/// plate hangs under it, never under the clock.let below: CGFloat @State privatevar shown = true @Environment(\.accessibilityReduceMotion) privatevar reduceMotionpublicinit(caption: String, below: CGFloat = 0) {self.caption = captionself.below = below }publicvar body: someView {let knobs = CinemaMarqueeKnobs.selfGeometryReader { room inif shown {CinemaMarqueePlate(caption: caption, width: min(knobs.widest, room.size.width - 2 * knobs.margin)) .padding(.top, below + knobs.top) .frame(width: room.size.width, alignment: .top) .transition(.opacity) } } .allowsHitTesting(false) .task {try? awaitTask.sleep(for: .seconds(knobs.stands))if reduceMotion { shown = false } else { withAnimation(.easeOut(duration: knobs.fades)) { shown = false } } } }}