Product Ui Showcase 1
The product doing the job: one day of its real screen on a panel standing tilted on a lit stage, the camera pushes in on the rows that change (a cancellation, the next visit moving up) with a plain caption beside it, then pulls back to the rebuilt day; the mechanism beat of a product demo, trial page or sales video.
Use it in a prompt
Use the video/product-ui-showcase video frame from the FunnelDNA library in my brand (landscape and vertical). Follow the video skill. Ask me for the script facts, voice and images you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/video/product-ui-showcase.tsx. - Import it and pass your copy and images (Props tab):
import { ProductUiShowcase } from "@/components/funneldna/video/product-ui-showcase"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/video/product-ui-showcase/component.tsx 494 lines
// When to use: The product doing the job: one day of its real screen on a panel standing tilted on a lit stage, the camera pushes in on the rows that change (a cancellation, the next visit moving up) with a plain caption beside it, then pulls back to the rebuilt day; the mechanism beat of a product demo, trial page or sales video.
import * as React from "react"
import { Img, useVideoConfig } from "remotion"
import noise from "../fx/textures/noise"
import {
EASE, HOLD, IN_OUT, SPRINGS, StageField, StageLight, T, VideoStage, display, phraseRange, progress, springAt, timeWords, useFitText, useHeld, useStage,
type TimedWord, type VideoFormat, type VideoMeta, type Word,
} from "../fx/video-kit"
export const video = { fps: 30, durationInFrames: 450, formats: ["landscape", "vertical"], poster: 444 } satisfies VideoMeta
/** One region the camera visits. Coordinates are fractions of the screen (0–1), so they hold in every format. */
export type UiHighlight = {
/** Centre of the region, as fractions of the screen's width and height (dayBoardRegion() gives them for the default board). */
x: number
y: number
/** How far the camera zooms in (1 = the whole screen; about 1.4 on the row that changes). Capped so the outlined region is never cropped. */
zoom?: number
/** Size of the outlined region, as fractions of the screen; default: most of what the zoom shows. */
w?: number
h?: number
/** The plain caption set beside the region. */
caption: string
/** A phrase inside the caption that pulses once (100 → 106 → 100%) as its last word lands. */
emphasis?: string
}
/** One visit on the default day board. */
export type DayVisit = {
time?: string
/** The street or job, set large beside the time. */
place: string
/** Who is on the visit (a first name). */
who?: string
/** The time label it rolls to when the day rebuilds and it moves up. */
newTime?: string
}
/** The default screen: one day of a weekly board, cropped to the visits the story is about. Sample data only, never a customer's results. */
export type DayBoard = {
/** The week strip along the top. */
days?: string[]
/** Index in `days` of the day shown. */
day?: number
/** That day's visits in order (two or three; three reads best; later ones are not shown). */
visits?: DayVisit[]
/** Index in `visits` of the visit that cancels; every later visit moves up one row when the day rebuilds. */
cancel?: number
/** The highlight (index) during which it cancels; default the one before the last. */
cancelDuring?: number
/** The highlight (index) during which the later visits move up; default the last. */
moveDuring?: number
/** A visit that slides into the freed last row as the camera pulls back. */
fill?: DayVisit
/** The label a cancelled visit shows. */
cancelledLabel?: string
}
export type ProductUiShowcaseProps = {
format?: VideoFormat
durationInFrames?: number
/** The overview line, shown first and again on the final hold. */
line?: string
/** The phrase inside `line` that pulses once (100 → 106 → 100%) as its last word lands. */
highlight?: string
/** Up to three regions the camera visits, in order. */
highlights?: UiHighlight[]
/** Voice timings for the line, then each caption in order; without them the scene paces itself evenly. */
words?: Word[]
/** The product's real screen built as components; it fills the panel (or keeps `screenAspect`). */
screen?: React.ReactNode
/** Width / height of `screen` or `product` when it should not fill the panel. */
screenAspect?: number
/** A screenshot of the real product screen, passed through slot(); replaces the board. */
product?: string
productAlt?: string
/** Data for the default day board. */
board?: DayBoard
}
/**
* Day-board geometry as fractions of the screen: the week strip, the rules, the stop numerals and each row's words.
* A row's words stay under 0.7 of the width so a 1.4 zoom keeps the whole visit in view; its state tint runs the
* panel's full width, like a selected table row, never a box of its own.
*/
const GEO = {
strip: { x0: 0.06, x1: 0.94, top: 0.035, h: 0.12 },
rule: { x0: 0.05, x1: 0.95 },
rail: { x0: 0.07, x1: 0.23 },
row: { x0: 0.27, x1: 0.95 },
top: 0.19, bottom: 0.975,
}
/** Where visit rows `first`…`last` sit on the default board (as a highlight's x, y, w, h), for a board of `rows` visits. */
export function dayBoardRegion(first: number, last: number, rows = 3) {
const h = (GEO.bottom - GEO.top) / rows
const y0 = GEO.top + first * h, y1 = GEO.top + (last + 1) * h
return { x: (GEO.row.x0 + GEO.row.x1) / 2, y: (y0 + y1) / 2, w: GEO.row.x1 - GEO.row.x0, h: y1 - y0 }
}
const HAIR = "oklch(from var(--ink) l c h / 0.14)"
const SHADOW = "var(--shadow, oklch(0.22 0.03 260))"
type ResolvedBoard = { days: string[]; day: number; visits: DayVisit[]; cancel?: number; fill?: DayVisit; cancelledLabel: string }
const DEFAULT_BOARD: Omit<ResolvedBoard, "cancelledLabel"> = {
days: ["Mon", "Tue", "Wed", "Thu", "Fri"],
day: 2,
visits: [
{ time: "9:00", place: "Site visit" },
{ time: "11:00", place: "Follow-up", newTime: "9:00" },
{ time: "2:00", place: "Check-in", newTime: "11:00" },
],
cancel: 0,
fill: { time: "2:00", place: "New client" },
}
/** Row type per format, in stage px at zoom 1: time and street 64px in 16:9 and 60px in 9:16; nothing on a phone under 44px. */
const TYPE = {
landscape: { big: 64, small: 40, tab: 40, num: 76 },
vertical: { big: 60, small: 44, tab: 44, num: 68 },
square: { big: 56, small: 40, tab: 38, num: 62 },
} as const
type BoardType = (typeof TYPE)[VideoFormat]
type Cam = { s: number; cx: number; cy: number }
/** Mechanism: the screen swings in and stands tilted on the stage, the camera pushes in on each region (outline draws on, caption lands, its key words pulse once), the row that changes reads at full size, then the camera pulls back to the rebuilt day. */
export function ProductUiShowcase({
format = "landscape",
durationInFrames = video.durationInFrames,
line = "",
highlight,
highlights = [],
words,
screen,
screenAspect,
product = "",
productAlt = "",
board,
}: ProductUiShowcaseProps) {
const f = useHeld(durationInFrames)
const { fps } = useVideoConfig()
const { u, width, height, text, format: fmt } = useStage()
const stacked = fmt !== "landscape"
const usable = durationInFrames - HOLD
const segs = highlights.filter((h) => h && h.caption && h.caption.trim()).slice(0, 3)
const n = segs.length
const lineList = split(line)
const capLists = segs.map((h) => split(h.caption))
const capKey = capLists.map((l) => l.join(" ")).join("|")
const plan = React.useMemo(() => schedule(lineList, capLists, words, usable, fps), [line, capKey, words, usable, fps])
// Re-composed per format: a wide caption column beside the screen in 16:9; in 9:16 the headline fitted above a
// screen that spans the safe width in the lower middle of the safe area. The screen keeps clear of the caption band
// with room for its tilt.
const gap = 36 * u
const capH = (fmt === "vertical" ? 360 : 280) * u
const box = stacked
? { left: text.left, top: text.top, w: width - text.left - text.right, h: capH }
: { left: text.left, top: text.top, w: 780 * u, h: height - text.top - text.bottom }
const panelLeft = stacked ? 76 * u : text.left + 840 * u
const panelTop = stacked ? text.top + capH + gap : text.top
const Wc = stacked ? width - 152 * u : width - 96 * u - panelLeft
const Hc = height - text.bottom - 24 * u - panelTop
const fit = stacked ? { max: (fmt === "vertical" ? 116 : 100) * u, lines: [2, 3, 4] } : { max: 128 * u, lines: [2, 3, 4] }
const align: "center" | "flex-end" = stacked ? "flex-end" : "center"
// The screen box: the panel itself, or the image's own aspect fitted inside it.
const aspect = product ? screenAspect ?? 1.6 : screen ? screenAspect : undefined
let sw = Wc, sh = Hc
if (aspect && aspect > 0) { if (Wc / Hc > aspect) sw = Hc * aspect; else sh = Wc / aspect }
const overview: Cam = { s: 1, cx: sw / 2, cy: sh / 2 }
const regions = segs.map((h) => {
const z0 = Math.max(1, h.zoom ?? 1.4)
const rw = frac(h.w ?? 0.8 / z0), rh = frac(h.h ?? 0.8 / z0)
const z = Math.max(1, Math.min(z0, (0.96 * Wc) / (rw * sw), (0.96 * Hc) / (rh * sh)))
const x = Math.min(1, Math.max(0, h.x)), y = Math.min(1, Math.max(0, h.y))
return { x, y, rw, rh, cam: { s: z, cx: x * sw, cy: y * sh } }
})
// The camera arrives, then the outline draws on, then the caption's words land.
const moves = regions.map((r, i) => ({ a: plan.cam[i] - 38, b: plan.cam[i] - 16, to: r.cam }))
if (n) moves.push({ a: plan.outroAt, b: plan.outroAt + 22, to: overview })
const nextA = (i: number) => moves[i + 1]?.a ?? Number.POSITIVE_INFINITY
// A slow push while the camera rests on each region keeps the frame alive; the next move starts from where it got to.
let cam: Cam = { ...overview, s: 1 + (n ? 0.015 * progress(f, 26, moves[0].a, lin) : 0.02 * progress(f, 26, usable, lin)) }
moves.forEach((m, i) => {
if (f <= m.a) return
cam = lerpCam(cam, m.to, progress(f, m.a, m.b, IN_OUT))
if (i < n) cam = { ...cam, s: cam.s * (1 + 0.015 * progress(f, m.b, nextA(i), lin)) }
})
const tx = place(cam.s, cam.cx, Wc, sw), ty = place(cam.s, cam.cy, Hc, sh)
/** How fully a region of the screen (fractions) sits inside the panel under the current camera: 1 inside, 0 once it is cut. */
const seen = (x0: number, y0: number, x1: number, y1: number) => {
const l = tx + cam.s * x0 * sw, r = tx + cam.s * x1 * sw, tp = ty + cam.s * y0 * sh, b = ty + cam.s * y1 * sh
const over = Math.max(0, -l, r - Wc, -tp, b - Hc)
return 1 - progress(over, 0, 10 * u, lin)
}
const outlines = regions.map((r, i) => {
const draw = progress(f, plan.cam[i] - 16, plan.cam[i] - 2, IN_OUT)
const out = progress(f, nextA(i), nextA(i) + 6)
if (draw <= 0 || out >= 1) return null
const p = 10 * u
return (
<rect key={i} x={tx + cam.s * (r.x - r.rw / 2) * sw - p} y={ty + cam.s * (r.y - r.rh / 2) * sh - p}
width={cam.s * r.rw * sw + 2 * p} height={cam.s * r.rh * sh + 2 * p} rx={14 * u} pathLength={1}
style={{ fill: "none", stroke: T.accent, strokeWidth: 3 * u, strokeDasharray: 1, strokeDashoffset: 1 - draw, opacity: 1 - out }} />
)
})
const lineOut = n ? progress(f, moves[0].a, moves[0].a + 10) : 0
const lineBack = n ? progress(f, plan.outroAt + 6, plan.outroAt + 20) : 0
const lineOp = n ? Math.max(1 - lineOut, lineBack) : 1
const lineLift = n && f > plan.outroAt ? (1 - lineBack) * 24 * u : 0
// Pose: the screen swings in from a steep angle and stands at 7° on the stage, facing the words (turned toward the
// caption column in 16:9, leaning back toward the headline in 9:16). It eases to 6° for the close-ups and settles
// at 8° on the rebuilt day, so the hold reads as a lit screen on a set, never a flat screenshot.
const t = progress(f, 0, 26, EASE)
const close = n ? progress(f, moves[0].a, moves[0].b, IN_OUT) * (1 - progress(f, plan.outroAt, plan.outroAt + 24, IN_OUT)) : 0
const end = n ? progress(f, plan.outroAt, plan.outroAt + 24, IN_OUT) : progress(f, usable - 40, usable - 16, IN_OUT)
const lean = 7 - close + end + 8 * (1 - t)
const grow = (0.9 + 0.1 * t).toFixed(4)
const tilt = stacked
? `rotateX(${lean.toFixed(3)}deg) scale(${grow})`
: `rotateY(${(-lean).toFixed(3)}deg) rotateX(${(1.5 + 3 * (1 - t)).toFixed(3)}deg) scale(${grow})`
// The set's horizon sits behind the lower part of the screen, so its base stands on the floor.
const horizon = Math.min(0.9, Math.max(0.5, (panelTop + Hc * 0.82) / height))
const lightX = `${(((panelLeft + Wc / 2) / width) * 100).toFixed(1)}%`
const bd: ResolvedBoard = board
? { days: board.days ?? DEFAULT_BOARD.days, day: board.day ?? DEFAULT_BOARD.day, visits: board.visits ?? DEFAULT_BOARD.visits, cancel: board.cancel, fill: board.fill, cancelledLabel: board.cancelledLabel ?? "Cancelled" }
: { ...DEFAULT_BOARD, cancelledLabel: "Cancelled" }
const within = (i: number) => i >= 0 && i < n
const ci = board?.cancelDuring ?? (n > 1 ? n - 2 : 0), mi = board?.moveDuring ?? n - 1
const cancelAt = within(ci) ? plan.cam[ci] + 6 : 40
let moveAt = within(mi) ? plan.cam[mi] + 8 : 64
if (bd.cancel !== undefined && within(ci) && ci === mi) moveAt += 26
// The freed last row fills as the camera pulls back, so the whole rebuilt day lands in view.
const fillAt = Math.min(usable - 20, n ? Math.max(moveAt + 30, plan.outroAt + 4) : moveAt + 34)
const content = product
? <Img src={product} alt={productAlt} style={{ display: "block", width: "100%", height: "100%", objectFit: "cover" }} />
: screen ?? <DayBoardScreen board={bd} type={TYPE[fmt]} frame={f} cancelAt={cancelAt} moveAt={moveAt} fillAt={fillAt} seen={seen} />
return (
<VideoStage format={format} tone="band">
<StageField tone="band" texture={noise} opacity={0.14} frame={f} horizon={horizon} />
<StageLight x={lightX} strength={0.18} floor />
<div style={{ position: "absolute", left: box.left, top: box.top, width: box.w, height: box.h, zIndex: 1 }}>
{lineList.length > 0 && (
<Kinetic heading text={lineList.join(" ")} timed={plan.line} emphasis={highlight} f={f} box={box} max={fit.max} lines={fit.lines} opacity={lineOp} lift={lineLift} align={align} />
)}
{segs.map((h, i) => (
<Kinetic key={i} text={capLists[i].join(" ")} timed={plan.caps[i]} emphasis={h.emphasis} f={f} box={box} max={fit.max} lines={fit.lines}
opacity={1 - progress(f, nextA(i), nextA(i) + 8)} lift={0} align={align} />
))}
</div>
<div style={{ position: "absolute", left: panelLeft, top: panelTop, width: Wc, height: Hc, perspective: 2600 * u, zIndex: 1 }}>
<div aria-hidden style={{
position: "absolute", left: "7%", right: "7%", top: Hc - 18 * u, height: 44 * u, borderRadius: "50%", opacity: t,
background: `radial-gradient(closest-side, oklch(from ${SHADOW} l c h / 0.5), transparent)`,
}} />
<div style={{
position: "relative", boxSizing: "border-box", width: "100%", height: "100%", transform: tilt, transformOrigin: "50% 50%", opacity: Math.min(1, 0.3 + 2 * t),
background: T.card, color: T.ink, borderRadius: `calc(${T.cardRadius} * ${2 * u})`, border: `${1.5 * u}px solid ${T.cardBorder}`, overflow: "hidden",
boxShadow: `${T.cardShadow}, inset 0 ${1.5 * u}px 0 oklch(from var(--card) calc(l + 0.04) c h / 0.6)`,
}}>
<div style={{ position: "absolute", left: 0, top: 0, width: sw, height: sh, transform: `translate(${tx.toFixed(2)}px, ${ty.toFixed(2)}px) scale(${cam.s.toFixed(4)})`, transformOrigin: "0 0" }}>
{content}
</div>
<svg aria-hidden width={Wc} height={Hc} style={{ position: "absolute", left: 0, top: 0, overflow: "visible" }}>{outlines}</svg>
</div>
</div>
</VideoStage>
)
}
export default ProductUiShowcase
const lin = (x: number) => x
const split = (s: string) => s.trim().split(" ").filter(Boolean)
const frac = (v: number) => Math.min(1, Math.max(0.02, v))
const lerpCam = (a: Cam, b: Cam, k: number): Cam => ({ s: a.s * Math.pow(b.s / a.s, k), cx: a.cx + (b.cx - a.cx) * k, cy: a.cy + (b.cy - a.cy) * k })
/** Offset of the scaled screen inside the panel: centred while it fits, otherwise kept on the focus without showing past its edges. */
const place = (s: number, c: number, view: number, size: number) => {
const span = s * size
return span <= view ? (view - span) / 2 : Math.min(0, Math.max(view - span, view / 2 - s * c))
}
const even = (list: string[], from: number, step: number): TimedWord[] =>
list.map((w, i) => ({ w, at: Math.round(from + i * step), end: Math.round(from + (i + 1) * step), i }))
type Plan = { line: TimedWord[]; caps: TimedWord[][]; cam: number[]; outroAt: number }
/** Word frames for the line and each caption, the frame each highlight's caption starts, and the return to the overview. */
function schedule(lineList: string[], capLists: string[][], words: Word[] | undefined, usable: number, fps: number): Plan {
const n = capLists.length
if (words?.length) {
const all = timeWords([...lineList, ...capLists.flat()].join(" "), words, usable + HOLD, fps)
let k = lineList.length
const line = all.slice(0, k)
const caps = capLists.map((l) => { const part = all.slice(k, k + l.length); k += l.length; return part })
const cam: number[] = []
caps.forEach((c, i) => cam.push(Math.min(usable - 60, Math.max(c[0]?.at ?? 0, i ? cam[i - 1] + 44 : 64))))
const lastEnd = all.length ? all[all.length - 1].end : 0
const outroAt = Math.min(usable - 34, Math.max(lastEnd + 20, (cam[n - 1] ?? 0) + 40))
return { line, caps, cam, outroAt }
}
const intro = n ? Math.round(Math.min(80, Math.max(48, usable * 0.15))) : usable
const outro = n ? 44 : 0
const seg = n ? (usable - intro - outro) / n : 0
const line = even(lineList, 4, lineList.length > 1 ? Math.min(4, 14 / (lineList.length - 1)) : 0)
const cam = capLists.map((_, i) => Math.round(intro + i * seg + 38))
const caps = capLists.map((l, i) => even(l, cam[i], l.length > 1 ? Math.min(5, Math.max(2, (seg - 64) / (l.length - 1))) : 0))
return { line, caps, cam, outroAt: usable - outro }
}
/**
* A display line sized to its box in the theme's own face; words land on their frames in the band's text colour, and
* the emphasis phrase pulses once (100 → 106 → 100%) as its last word lands. No colour change on the band.
*/
function Kinetic({ heading = false, text, timed, emphasis, f, box, max, lines, opacity, lift, align }: {
heading?: boolean; text: string; timed: TimedWord[]; emphasis?: string; f: number; box: { w: number; h: number }
max: number; lines: number[]; opacity: number; lift: number; align: "center" | "flex-end"
}) {
const { u } = useStage()
const { fps } = useVideoConfig()
const hRef = React.useRef<HTMLHeadingElement>(null)
const pRef = React.useRef<HTMLParagraphElement>(null)
const size = useFitText(heading ? hRef : pRef, text, { boxW: box.w, boxH: box.h, guess: max * 0.82, max, min: 76 * u, lines })
const range = phraseRange(timed, emphasis)
const beatAt = range ? timed[range[1] - 1].at + 4 : Number.POSITIVE_INFINITY
const beat = progress(f, beatAt, beatAt + 5) - progress(f, beatAt + 5, beatAt + 13, IN_OUT)
const parts: React.ReactNode[] = []
timed.forEach((x, i) => {
const s = springAt(f, x.at, fps, SPRINGS.pop)
const key = range !== null && i >= range[0] && i < range[1]
const scale = (0.94 + 0.06 * s) * (key ? 1 + 0.06 * beat : 1)
parts.push(
<span key={i} style={{
display: "inline-block", opacity: Math.min(1, s * 2.5), transformOrigin: "50% 75%",
transform: `translateY(${((1 - s) * 26 * u).toFixed(2)}px) scale(${scale.toFixed(4)})`,
}}>
{x.w}
</span>,
)
if (i < timed.length - 1) parts.push(" ")
})
const style: React.CSSProperties = { ...display(size, { lineHeight: 1.04 }), margin: 0, width: "100%", color: T.bandInk }
return (
<div aria-hidden={opacity < 0.01} style={{ position: "absolute", inset: 0, display: "flex", flexDirection: "column", justifyContent: align, opacity, transform: `translateY(${lift.toFixed(2)}px)` }}>
{heading ? <h2 ref={hRef} style={style}>{parts}</h2> : <p ref={pRef} style={style}>{parts}</p>}
</div>
)
}
/** A time label that rolls up to its new value at progress r; a fixed tabular column, so the street beside it never jumps. */
function TimeRoll({ from = "", to, r }: { from?: string; to?: string; r: number }) {
const k = !to || to === from ? 0 : Math.min(1, Math.max(0, r)), e = IN_OUT(k)
const glyph: React.CSSProperties = { position: "absolute", left: 0, top: 0, lineHeight: 1.15, whiteSpace: "nowrap" }
return (
<span style={{ position: "relative", display: "inline-block", flex: "none", minWidth: "3em", height: "1.15em", overflowX: "visible", overflowY: "clip", fontWeight: 800, fontVariantNumeric: "tabular-nums" }}>
{k < 1 && <span style={{ ...glyph, opacity: 1 - e, transform: `translateY(${(-e * 42).toFixed(2)}%)` }}>{from}</span>}
{k > 0 && <span style={{ ...glyph, opacity: e, transform: `translateY(${((1 - e) * 42).toFixed(2)}%)` }}>{to}</span>}
</span>
)
}
/**
* The default screen: one day of a weekly board, its visits as rows on the one panel, separated by hairline rules
* (no boxes inside the screen). One visit cancels (its row takes the danger tint and the label), every later visit
* slides up a row and rolls to its new time, and a visit fills the freed last row, all by frame. The visit that moved
* keeps a full-width accent tint: the one changed row on the hold. While the camera is close, a row the panel edge
* cuts steps back to the --muted text colour (which holds 4.5:1 on the card), never opacity, and drops its words once
* it is out of view.
*/
function DayBoardScreen({ board, type, frame, cancelAt, moveAt, fillAt, seen }: {
board: ResolvedBoard; type: BoardType; frame: number; cancelAt: number; moveAt: number; fillAt: number
seen: (x0: number, y0: number, x1: number, y1: number) => number
}) {
const { u } = useStage()
const { days, cancelledLabel, fill } = board
const day = Math.min(Math.max(0, days.length - 1), Math.max(0, board.day))
const rows = Math.max(2, Math.min(3, board.visits.length))
const list = board.visits.slice(0, rows)
const last = list.length - 1
const c = board.cancel !== undefined && board.cancel >= 0 && board.cancel <= last ? board.cancel : -1
const mover = c >= 0 && c < last ? c + 1 : -1
const cancelled = c >= 0 ? progress(frame, cancelAt, cancelAt + 8) : 0
const freed = c >= 0 ? progress(frame, moveAt - 4, moveAt + 8) : 0
const travel = c >= 0 ? progress(frame, moveAt, moveAt + 22, IN_OUT) : 0
const roll = progress(frame, moveAt + 6, moveAt + 18)
const chosen = mover >= 0 ? progress(frame, moveAt, moveAt + 8) : 0
const fillK = c >= 0 && fill ? progress(frame, fillAt, fillAt + 16, EASE) : 0
const h = (GEO.bottom - GEO.top) / rows
const rowY = (s: number) => GEO.top + s * h
const pct = (v: number) => `${(v * 100).toFixed(3)}%`
const tint = `color-mix(in oklch, ${T.accent} 10%, ${T.card})`
/** A colour at a share of full strength (tints that fade in), mixed toward transparent in OKLCH. */
const share = (colour: string, k: number) => `color-mix(in oklch, ${colour} ${(Math.min(1, Math.max(0, k)) * 100).toFixed(1)}%, transparent)`
const mixTo = (colour: string, k: number, base: string) => `color-mix(in oklab, ${colour} ${(Math.min(1, Math.max(0, k)) * 100).toFixed(1)}%, ${base})`
const words = (v: number): React.CSSProperties => ({ opacity: v, visibility: v <= 0.01 ? "hidden" : "visible" })
/** How far a stop numeral steps back to the muted colour while its row has no live visit. */
const dimOf = (s: number) => {
if (c < 0) return 0
if (s === c && c < last) return cancelled * (1 - travel)
if (s === last) return c === last ? cancelled * (1 - fillK) : travel * (1 - fillK)
return 0
}
/** How strongly a state tint sits under a numeral's row: the numeral steps to ink there, the pair every tint fits. */
const tintedOf = (s: number) => {
if (c < 0) return 0
const gone = cancelled * (1 - freed)
if (s === c) return Math.max(gone, chosen * travel)
if (s === mover) return chosen * (1 - travel)
return 0
}
const rule = (key: string, y: number) => (
<div key={key} aria-hidden style={{ position: "absolute", left: pct(GEO.rule.x0), width: pct(GEO.rule.x1 - GEO.rule.x0), top: pct(y), height: 1.5 * u, marginTop: -0.75 * u, background: HAIR, zIndex: 0 }} />
)
const row = (key: string, v: DayVisit, pos: number, o: { mover?: boolean; cancel?: boolean; shifted?: boolean; enter?: number }) => {
const y0 = rowY(pos) + (o.enter === undefined ? 0 : (1 - o.enter) * h * 0.45)
const vis = seen(GEO.row.x0, y0, GEO.row.x1, y0 + h)
// A row the panel edge cuts steps back in colour, never opacity: its text moves toward --muted (4.5:1 on the card).
const back = 1 - vis
const step = (colour: string) => (back > 0 ? mixTo(T.muted, back, colour) : colour)
const bg = o.mover ? share(tint, chosen) : o.cancel ? share("var(--danger-soft)", cancelled) : "transparent"
const fade = (o.cancel ? 1 - freed : 1) * (o.enter ?? 1)
const timed = !!(v.time || v.newTime)
const label = o.cancel && cancelled > 0.5
? { text: cancelledLabel, color: "var(--danger)", weight: 800 }
: v.who ? { text: v.who, color: o.mover && chosen > 0.5 ? T.ink : T.muted, weight: 600 } : null
return (
<div key={key} style={{
position: "absolute", left: 0, width: "100%", top: pct(y0), height: pct(h), background: bg, color: step(T.ink),
zIndex: o.mover ? 3 : o.enter !== undefined ? 2 : 1, opacity: fade,
}}>
<div style={{
position: "absolute", left: pct(GEO.row.x0), width: pct(GEO.row.x1 - GEO.row.x0), top: 0, bottom: 0, boxSizing: "border-box",
padding: `0 ${26 * u}px`, display: "flex", flexDirection: "column", justifyContent: "center", overflow: "hidden",
}}>
<div style={{ visibility: vis <= 0.01 ? "hidden" : "visible" }}>
<div style={{ display: "flex", alignItems: "center", gap: "0.42em", fontSize: type.big * u, lineHeight: 1.15, whiteSpace: "nowrap" }}>
{timed && <TimeRoll from={v.time} to={o.shifted ? v.newTime : undefined} r={roll} />}
<span style={{ fontWeight: 700, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis" }}>{v.place}</span>
</div>
{label && (
<div style={{
marginTop: 6 * u, paddingLeft: timed ? 3.42 * type.big * u : 0, fontSize: type.small * u, fontWeight: label.weight, lineHeight: 1.2,
color: step(label.color), whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis",
}}>{label.text}</div>
)}
</div>
</div>
</div>
)
}
const S = GEO.strip, cols = Math.max(1, days.length), tabW = (S.x1 - S.x0) / cols
return (
<div style={{ position: "absolute", inset: 0, color: T.ink }}>
{days.map((d, i) => {
const x0 = S.x0 + i * tabW, on = i === day
return (
<div key={"d" + i} style={{
position: "absolute", left: pct(x0), width: pct(tabW), top: pct(S.top), height: pct(S.h), boxSizing: "border-box",
display: "flex", alignItems: "center", justifyContent: "center", fontSize: type.tab * u, fontWeight: on ? 800 : 600, lineHeight: 1.1, whiteSpace: "nowrap",
color: on ? T.ink : T.muted,
}}>
<span style={words(seen(x0, S.top, x0 + tabW, S.top + S.h))}>{d}</span>
{on && <span aria-hidden style={{ position: "absolute", left: "24%", right: "24%", bottom: 0, height: 5 * u, borderRadius: 3 * u, background: T.accentFill }} />}
</div>
)
})}
{rule("strip", S.top + S.h + 0.012)}
{Array.from({ length: rows - 1 }, (_, s) => rule("r" + s, rowY(s + 1)))}
{list.map((v, i) => (i === mover ? null : row("v" + i, v, c >= 0 && i > c ? i - travel : i, { cancel: i === c, shifted: c >= 0 && i > c })))}
{fill && fillK > 0 && row("fill", fill, last, { enter: fillK })}
{mover >= 0 && row("v" + mover, list[mover], mover - travel, { mover: true, shifted: true })}
{Array.from({ length: rows }, (_, s) => {
const y0 = rowY(s)
const base = `color-mix(in oklab, ${T.muted} ${(dimOf(s) * 100).toFixed(1)}%, ${T.accent})`
return (
<div key={"n" + s} aria-hidden style={{
position: "absolute", left: pct(GEO.rail.x0), width: pct(GEO.rail.x1 - GEO.rail.x0), top: pct(y0), height: pct(h), zIndex: 4,
display: "flex", alignItems: "center", justifyContent: "center", ...display(type.num * u, { lineHeight: 1 }), fontVariantNumeric: "tabular-nums",
color: mixTo(T.ink, tintedOf(s), base),
...words(seen(GEO.rail.x0, y0 + h * 0.2, GEO.rail.x1, y0 + h * 0.8)),
}}>{s + 1}</div>
)
})}
</div>
)
}
pieces/video/product-ui-showcase/specimen.tsx 39 lines
import * as React from "react"
import { VideoPreview, type VideoFormat } from "../../fx/video-kit"
import { ProductUiShowcase, dayBoardRegion, video, type ProductUiShowcaseProps } from "../product-ui-showcase"
export const states = ["landscape", "vertical"]
/** Overview line readable, highlight 1 (the day's visits), highlight 2 (the cancellation, zoomed), highlight 3 (the visit moved up, zoomed), final hold on the rebuilt day. */
export const keyframes = [20, 150, 250, 380, 444]
// Fictional sample: Tidewell, scheduling software for home-cleaning teams. Board data is sample data, not a customer's results.
export const sample: ProductUiShowcaseProps = {
line: "The route rebuilds itself.",
highlight: "rebuilds itself.",
highlights: [
{ ...dayBoardRegion(0, 2, 3), zoom: 1, caption: "See every visit for the week on one board.", emphasis: "one board." },
{ ...dayBoardRegion(0, 0, 3), zoom: 1.4, caption: "A client cancels on Wednesday.", emphasis: "cancels" },
{ ...dayBoardRegion(0, 1, 3), zoom: 1.34, caption: "The next visit moves up. The day rebuilds.", emphasis: "rebuilds." },
],
board: {
days: ["Mon", "Tue", "Wed", "Thu", "Fri"],
day: 2,
visits: [
{ time: "8:00", place: "Cove Ln", who: "Ana" },
{ time: "10:30", place: "Mill St", who: "Maya", newTime: "8:00" },
{ time: "3:00", place: "Dune Rd", who: "Leo", newTime: "10:30" },
],
cancel: 0,
cancelDuring: 1,
moveDuring: 2,
fill: { time: "1:00", place: "Shore Dr", who: "Leo" },
cancelledLabel: "Cancelled",
},
}
/** The sample business in its own colours and type (sample-brands.json); Original and every preset stay one click away. */
export const sampleBrand = {"name":"Tidewell","theme":"light","background":"#ffffff","colors":["#ff5a36","#0b3d66"],"fonts":["Fraunces","DM Sans"],"band":"#bfe3ff"}
export default function ProductUiShowcaseSpecimen({ state = "landscape" }: { state?: string }) {
return <VideoPreview component={ProductUiShowcase} props={sample} format={state as VideoFormat} meta={video} />
}
| Name | Type | Details |
|---|---|---|
dayBoardRegion |
number |
|
format OptionalProductUiShowcase |
VideoFormat |
Default "landscape"
|
durationInFrames OptionalProductUiShowcase |
number |
Default video.durationInFrames
|
line OptionalProductUiShowcase |
string |
Default ""
|
highlight OptionalProductUiShowcase |
string |
|
highlights OptionalProductUiShowcase |
UiHighlight[] |
Default []
|
words OptionalProductUiShowcase |
Word[] |
|
screen OptionalProductUiShowcase |
React.ReactNode |
|
screenAspect OptionalProductUiShowcase |
number |
|
product OptionalProductUiShowcase |
string |
Default ""
|
productAlt OptionalProductUiShowcase |
string |
Default ""
|
board OptionalProductUiShowcase |
DayBoard |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
None listed in this pack.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
This piece reads no image slots.
-
bec2a41897a3364d.webp
image/webp · 51.2 KB