Countdown Deadline 1
A real deadline counts down in large tiles (days, hours, minutes, seconds) over a calm scene, with the closing day and time written out in full; the urgency beat of a sales video, VSL or video ad, only when the page states that deadline.
Use it in a prompt
Use the video/countdown-deadline video frame from the FunnelDNA library in my brand (landscape and vertical and square). 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/countdown-deadline.tsx. - Import it and pass your copy and images (Props tab):
import { CountdownDeadline } from "@/components/funneldna/video/countdown-deadline"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/video/countdown-deadline/component.tsx 286 lines
// When to use: A real deadline counts down in large tiles (days, hours, minutes, seconds) over a calm scene, with the closing day and time written out in full; the urgency beat of a sales video, VSL or video ad, only when the page states that deadline.
import * as React from "react"
import { useVideoConfig } from "remotion"
import { CalendarClock } from "lucide-react"
import noise from "../fx/textures/noise"
import type { BackdropTreatment } from "../fx/fx"
import {
HOLD, IN_OUT, Rise, SafeArea, StageField, StageLight, StagePhoto, T, TONES, VideoStage, display, progress, springAt, useFitText, useHeld, useStage, useWords,
type SpringConfig, type VideoFormat, type VideoMeta, type Word,
} from "../fx/video-kit"
export const video = { fps: 30, durationInFrames: 150, formats: ["landscape", "vertical", "square"], poster: 140 } satisfies VideoMeta
/** Every visible word. Templates take {weekday} {day} {month} {year} {time} {zone}. */
export type CountdownCopy = {
/** The written close under the tiles while it is open (and the headline when there is no `asOf`). */
closesTemplate: string
/** The written close in the closed state. */
closedTemplate: string
/** The headline when `closes` is missing or not after `asOf`. */
closedLine: string
am: string
pm: string
day: string
days: string
hour: string
hours: string
minute: string
minutes: string
second: string
seconds: string
}
export type CountdownDeadlineProps = {
format?: VideoFormat
durationInFrames?: number
/** What closes, one line that the tiles complete ("Spring cohort enrolment closes in"). */
line?: string
/** The page's real closing moment, ISO 8601 with its offset ("2027-03-12T23:59:00-05:00"). Missing, or not after `asOf`: the closed state. */
closes?: string
/** The moment the count is measured from, ISO 8601 with its offset: when the file is published. Required for the tiles; without it the frame writes the close out as its headline. Re-render when it moves. */
asOf?: string
/** Legacy alias for `asOf`, used only when `asOf` is undefined. */
renderedAt?: string
/** Show the seconds tile (ticks down by frame). */
showSeconds?: boolean
/** IANA time zone the close is written in. */
timeZone?: string
/** The zone as the page writes it ("ET"). */
zone?: string
/** Locale for the weekday and month names. */
locale?: string
/** The page's own wording for the close, used verbatim while open instead of the template. */
closesText?: string
copy?: Partial<CountdownCopy>
/** Voice timings for `line`; without them the words land evenly in the first third of a second. */
words?: Word[]
/** The field: band (default, the dark end) or surface (the bright end). */
tone?: "band" | "surface"
/** Scene photo behind everything (pass slot("scene", …)): a slow push under an even scrim. Without one, a drifting texture and a stage light. */
scene?: string
/** How the photo takes the theme: natural (its own colours under a tone scrim, default) or duotone / tint (mapped to the tokens). */
treatment?: BackdropTreatment
/** Photo focal point (CSS object-position). */
focus?: string
}
const COPY: CountdownCopy = {
closesTemplate: "Closes {weekday} {day} {month}, {time} {zone}",
closedTemplate: "Closed {weekday} {day} {month}, {time} {zone}",
closedLine: "This offer has closed.",
am: "a.m.", pm: "p.m.",
day: "day", days: "days", hour: "hour", hours: "hours", minute: "minute", minutes: "minutes", second: "second", seconds: "seconds",
}
type Unit = { ms: number; mod: number; pad: number; one: keyof CountdownCopy; many: keyof CountdownCopy }
const UNITS: Unit[] = [
{ ms: 86400000, mod: 0, pad: 1, one: "day", many: "days" },
{ ms: 3600000, mod: 24, pad: 2, one: "hour", many: "hours" },
{ ms: 60000, mod: 60, pad: 2, one: "minute", many: "minutes" },
{ ms: 1000, mod: 60, pad: 2, one: "second", many: "seconds" },
]
/** The rise entrance: a soft spring that lands in about half a second with barely any overshoot. */
const RISE: SpringConfig = { damping: 20, stiffness: 160, mass: 0.8 }
/** Per-format tile and type metrics (stage px). Square is height-bound: compact 2×2 tiles leave the headline two full rows. `numGap` is the floor; the gap also scales with the numeral. */
const LAYOUT = {
landscape: { gap: 36, pad: 28, label: 40, numGap: 16, dateSize: 54, dateLines: 1, lineGap: 52, dateGap: 40, guess: 120, max: 130, min: 90 },
vertical: { gap: 24, pad: 24, label: 34, numGap: 16, dateSize: 44, dateLines: 2, lineGap: 40, dateGap: 32, guess: 88, max: 130, min: 72 },
square: { gap: 20, pad: 20, label: 30, numGap: 14, dateSize: 44, dateLines: 2, lineGap: 28, dateGap: 24, guess: 84, max: 112, min: 64 },
} as const
/** Space between a tile's numeral and its unit label: at least 0.11 of the numeral size, never under the format floor. */
const NUM_GAP = 0.11
/** Urgency: the line rises, the tiles arrive by frame ~25 and tick down by frame, the written close lands, the lead number beats once, the scene pushes in. */
export function CountdownDeadline({
format = "landscape",
durationInFrames = video.durationInFrames,
line = "",
closes = "",
asOf,
renderedAt,
showSeconds = true,
timeZone = "America/New_York",
zone = "ET",
locale = "en-US",
closesText = "",
copy,
words,
tone = "band",
scene = "",
treatment = "natural",
focus = "50% 50%",
}: CountdownDeadlineProps) {
const c: CountdownCopy = { ...COPY, ...copy }
const f = useHeld(durationInFrames)
const live = durationInFrames - HOLD
const { fps } = useVideoConfig()
const { u, portrait, width, height, text, format: fmt } = useStage()
const square = fmt === "square"
const stacked = portrait || square
const L = LAYOUT[square ? "square" : portrait ? "vertical" : "landscape"]
const s = (n: number) => n * u
const colors = TONES[tone]
// The count comes from props only (the close and the moment it is published); the wall clock is never read.
const fromMs = Date.parse((asOf ?? renderedAt) || "")
const closesMs = closes ? Date.parse(closes) : NaN
const dated = Number.isFinite(closesMs)
const state: "open" | "closed" | "undated" = !dated ? "closed" : !Number.isFinite(fromMs) ? "undated" : closesMs - fromMs > 0 ? "open" : "closed"
const open = state === "open"
// Inside the scene the count runs down with the frame, and freezes with it for the final hold.
const rem = open ? Math.max(0, closesMs - fromMs - (f * 1000) / fps) : 0
const closeText = !dated ? "" : state !== "closed" && closesText ? closesText
: written(closesMs, state === "closed" ? c.closedTemplate : c.closesTemplate, locale, timeZone, zone, c.am, c.pm)
// Without a measured start the frame cannot say how long is left, so the written close becomes the line.
const headline = open ? line : state === "undated" ? closeText : c.closedLine
const dateText = state === "undated" ? "" : closeText
const timed = useWords(headline, open ? words : undefined, durationInFrames, { from: 1, span: Math.min(0.5, 10 / durationInFrames) })
const lastAt = timed.length ? timed[timed.length - 1].at : 0
const tiles = (open ? UNITS.slice(0, showSeconds ? 4 : 3) : []).map((x) => {
const whole = Math.floor(rem / x.ms)
const v = x.mod ? whole % x.mod : whole
// Frames since this unit last stepped down: the new figure drops into place.
const since = (((whole + 1) * x.ms - rem) * fps) / 1000
return { v, text: String(v).padStart(x.pad, "0"), label: v === 1 ? c[x.one] : c[x.many], since }
})
const n = tiles.length
// Timing: the tiles start right behind the line and are all in by about frame 25, whatever the voice does;
// the written close follows, then one beat on the lead number, all done long before the hold.
const stagger = 3
const tilesAt = Math.max(8, Math.min(lastAt + 3, 18))
const dateAt = open ? tilesAt + stagger * Math.max(0, n - 1) + 8 : Math.max(8, Math.min(lastAt + 8, live - 20))
const pulseAt = dateAt + 8
const bump = progress(f, pulseAt, pulseAt + 5) - progress(f, pulseAt + 5, pulseAt + 12, IN_OUT)
const lead = Math.max(0, tiles.findIndex((t) => t.v > 0))
// Re-composed per format: one row spanning ~86% of the safe width in landscape; a 2×2 grid across the full safe
// width in 9:16; in 1:1 a compact 2×2 grid about 85% of the frame wide, the headline fitted on top and the close
// under it (three tiles stay one row). Numerals shrink only if a long day count would not fit its tile.
const safeW = (width - text.left - text.right) / u
const colW = portrait ? safeW : square ? Math.min(safeW, Math.round((width / u) * 0.85)) : Math.round(safeW * 0.86)
const grid = stacked && n === 4 ? 2 : Math.max(1, n)
const { gap, pad, label, dateSize, lineGap, dateGap } = L
const tileW = (colW - gap * (grid - 1)) / grid
const digits = Math.max(2, ...tiles.map((t) => t.text.length))
const numCap = portrait ? (grid === 2 ? 184 : 150) : square ? (grid === 2 ? 128 : 150) : n === 4 ? 188 : 208
const num = Math.min(numCap, Math.floor((tileW - pad * 2) / (digits * 0.64)))
// The numeral and its label never touch: a real gap that grows with the numeral (184px → 20px) in every format.
const numGap = Math.max(L.numGap, Math.round(num * NUM_GAP))
const tileH = num + numGap + label * 1.2 + pad * 2
const rows = n ? Math.ceil(n / grid) : 0
const tilesH = rows ? rows * tileH + (rows - 1) * gap : 0
const dateH = dateText ? dateSize * 1.3 * L.dateLines : 0
const avail = (height - text.top - text.bottom) / u
const boxH = avail - (n ? tilesH + lineGap : 0) - (dateText ? dateGap + dateH : 0) - 12
// The line takes the height the tiles and the close leave, measured in the theme's own face at the tile row's width.
const head = React.useRef<HTMLHeadingElement>(null)
const size = useFitText(head, headline, {
boxW: s(colW), boxH: s(Math.max(150, boxH)), guess: s(L.guess),
max: s(L.max), min: s(L.min), lines: [2, 3],
})
const radius = `calc(${T.cardRadius} * ${1.6 * u})`
const contact = `0 ${s(2)}px ${s(3)}px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.3)`
const ambient = `0 ${s(12)}px ${s(20)}px ${-s(8)}px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.4)`
// Crisp contact + short ambient on the theme's dark shadow colour, plus a faint inset top highlight.
const tileShadow = [`inset 0 ${s(2)}px 0 oklch(from var(--card) calc(l + 0.04) c h / 0.6)`, contact, ambient].join(", ")
const hotShadow = [`inset 0 ${s(2)}px 0 oklch(from var(--accent-fill, var(--accent)) calc(l + 0.12) c h / 0.6)`, contact, ambient].join(", ")
const rowW = grid * tileW + gap * (grid - 1)
// Every block in the column is centred as an element (not only its text), so it sits on the frame's centre line.
const centred: React.CSSProperties = { width: "100%", maxWidth: s(colW), marginInline: "auto", alignSelf: "center", textAlign: "center", boxSizing: "border-box" }
return (
<VideoStage format={format} tone={tone}>
{scene
? <StagePhoto src={scene} frame={f} dur={live} push={square ? [1.03, 1.09] : [1.02, 1.09]} treatment={treatment} side="center" tone={tone} position={focus} />
: <>
<StageField tone={tone} texture={noise} opacity={tone === "band" ? 0.16 : 0.09} frame={f} />
<StageLight x="50%" strength={tone === "band" ? 0.18 : 0.12} tone={tone === "band" ? "band-ink" : "accent-fill"} floor={false} />
</>}
<SafeArea style={{ alignItems: "center", justifyContent: "center", textAlign: "center" }}>
<div data-countdown={state} style={{ display: "flex", flexDirection: "column", alignItems: "center", width: "100%" }}>
{headline && (
<h2 ref={head} style={{ ...display(size, { lineHeight: 1.04 }), margin: 0, ...centred, color: colors.ink }}>
{timed.flatMap((x, i) => {
const k = springAt(f, x.at, fps, RISE)
const w = <span key={i} style={{ display: "inline-block", opacity: Math.min(1, k * 3), transform: `translateY(${(1 - k) * s(30)}px)` }}>{x.w}</span>
return i ? [" ", w] : [w]
})}
</h2>
)}
{n > 0 && (
<div style={{
display: "grid", gridTemplateColumns: `repeat(${grid}, ${s(tileW)}px)`, gap: s(gap), justifyContent: "center",
width: s(rowW), marginInline: "auto", alignSelf: "center", marginTop: headline ? s(lineGap) : 0,
}}>
{tiles.map((t, i) => {
const at = tilesAt + i * stagger
const k = springAt(f, at, fps, RISE)
// The last (ticking) tile is the one featured thing: solid accent fill with its own text colour.
const hot = i === n - 1
const roll = f - at > 10 ? progress(t.since, 0, 8) : 1
const beat = i === lead ? 1 + 0.06 * bump : 1
return (
<div key={i} style={{
height: s(tileH), borderRadius: radius, overflow: "hidden", boxSizing: "border-box",
background: hot ? T.accentFill : T.card, color: hot ? T.accentFillInk : T.ink,
border: `${s(2)}px solid ${hot ? "transparent" : T.cardBorder}`, boxShadow: hot ? hotShadow : tileShadow,
display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center",
opacity: Math.min(1, k * 4), transform: `translateY(${(1 - k) * s(36)}px)`,
}}>
<div style={{
...display(s(num), { lineHeight: 1, letterSpacing: "-0.03em", textWrap: "nowrap" }),
flex: "none", height: s(num),
// Lining figures: a serif theme's old-style 3, 6 and 9 would drop into the unit label below.
fontVariantNumeric: "tabular-nums lining-nums",
transform: `translateY(${-(1 - roll) * s(num * 0.16)}px) scale(${beat})`,
}}>{t.text}</div>
<div style={{ flex: "none", marginTop: s(numGap), fontSize: s(label), fontWeight: 700, lineHeight: 1.2, color: hot ? T.accentFillInk : T.muted }}>{t.label}</div>
</div>
)
})}
</div>
)}
{dateText && (
<Rise at={dateAt} y={24} style={{ marginTop: s(dateGap), ...centred }}>
<p style={{ margin: 0, width: "100%", fontSize: s(dateSize), fontWeight: 700, lineHeight: 1.3, color: colors.ink, textWrap: stacked ? "balance" : "pretty", textAlign: "center" }}>
<CalendarClock aria-hidden size={s(dateSize * 0.9)} strokeWidth={2.5} style={{ display: "inline-block", verticalAlign: "-0.12em", marginInlineEnd: "0.4em" }} />
{dateText}
</p>
</Rise>
)}
</div>
</SafeArea>
</VideoStage>
)
}
export default CountdownDeadline
/** The close written out in full in its own zone ("Closes Friday 12 March, 11:59 p.m. ET"). Formats the given instant only. */
function written(ms: number, template: string, locale: string, timeZone: string, zone: string, am: string, pm: string) {
const parts = (o: Intl.DateTimeFormatOptions) => {
try { return new Intl.DateTimeFormat(locale, { ...o, timeZone }).formatToParts(ms) }
catch { return new Intl.DateTimeFormat("en-US", { ...o, timeZone: "UTC" }).formatToParts(ms) }
}
const pick = (p: Intl.DateTimeFormatPart[], type: string) => p.find((x) => x.type === type)?.value ?? ""
const dp = parts({ weekday: "long", day: "numeric", month: "long", year: "numeric" })
const tp = parts({ hour: "numeric", minute: "2-digit", hour12: true })
const period = pick(tp, "dayPeriod").toLowerCase().startsWith("p") ? pm : am
const values: Record<string, string> = {
weekday: pick(dp, "weekday"), day: pick(dp, "day"), month: pick(dp, "month"), year: pick(dp, "year"),
time: `${pick(tp, "hour")}:${pick(tp, "minute")} ${period}`, zone,
}
let out = template
for (const k of Object.keys(values)) out = out.split(`{${k}}`).join(values[k])
return out.split(" ").filter(Boolean).join(" ").split(" ,").join(",").trim()
}
pieces/video/countdown-deadline/specimen.tsx 31 lines
import __studioImage22d700bd from "../assets/7f5245e984ea539c.webp";
import * as React from "react"
import { slot } from "../../slots"
import { VideoPreview, type VideoFormat } from "../../fx/video-kit"
import { CountdownDeadline, video, type CountdownDeadlineProps } from "../countdown-deadline"
export const states = ["landscape", "vertical", "square"]
/** The line readable with the tiles arriving, every tile in and ticking with the written close, final hold. */
export const keyframes = [18, 70, 149]
// The designed still. It stays out of `sample` (which must be serialisable props) and reaches the frame only
// through the scene slot inside the render, so the renderer never resolves it against a dev-server URL.
const designedScene = __studioImage22d700bd
// Fictional sample: Studio Ledger, a bookkeeping course for small studios, closing its spring cohort enrolment.
// asOf is pinned, so the specimen always renders the open state (3 days, 09:36:19 left, ticking down by frame).
export const sample: CountdownDeadlineProps = {
line: "Spring cohort enrolment closes in",
closes: "2027-03-12T23:59:00-05:00",
asOf: "2027-03-09T14:22:41-05:00",
timeZone: "America/New_York",
zone: "ET",
focus: "50% 55%",
}
/** The sample business in its own colours and type (sample-palettes.md: evergreen · friendly); Original and every preset stay one click away. */
export const sampleBrand = { name: "Studio Ledger", theme: "light", background: "#f7f5ff", colors: ["#6a3df0", "#1fbf8f"], fonts: ["Fraunces", "Nunito Sans"] }
export default function CountdownDeadlineSpecimen({ state = "landscape" }: { state?: string }) {
return <VideoPreview component={CountdownDeadline} props={{ ...sample, scene: slot("scene", designedScene) }} format={state as VideoFormat} meta={video} />
}
| Name | Type | Details |
|---|---|---|
format OptionalCountdownDeadline |
VideoFormat |
Default "landscape"
|
durationInFrames OptionalCountdownDeadline |
number |
Default video.durationInFrames
|
line OptionalCountdownDeadline |
string |
Default ""
|
closes OptionalCountdownDeadline |
string |
Default ""
|
asOf OptionalCountdownDeadline |
string |
|
renderedAt OptionalCountdownDeadline |
string |
|
showSeconds OptionalCountdownDeadline |
boolean |
Default true
|
timeZone OptionalCountdownDeadline |
string |
Default "America/New_York"
|
zone OptionalCountdownDeadline |
string |
Default "ET"
|
locale OptionalCountdownDeadline |
string |
Default "en-US"
|
closesText OptionalCountdownDeadline |
string |
Default ""
|
copy OptionalCountdownDeadline |
Partial<CountdownCopy> |
|
words OptionalCountdownDeadline |
Word[] |
|
tone OptionalCountdownDeadline |
"band" | "surface" |
Default "band"
|
scene OptionalCountdownDeadline |
string |
Default ""
|
treatment OptionalCountdownDeadline |
BackdropTreatment |
Default "natural"
|
focus OptionalCountdownDeadline |
string |
Default "50% 50%"
|
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.
scene- A wide atmosphere photo behind or beside the copy.
-
7f5245e984ea539c.webp
image/webp · 39.6 KB
-
bec2a41897a3364d.webp
image/webp · 51.2 KB