Photo Mask Type Hero 1
Photo-masked type hero: a photo plays inside one giant word, breaks out to fill the frame, then lands the promise, a short letter and a huge action as the final beat of a video-ad style edit.
Use it in a prompt
Use hero/photo-mask-type-hero from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details 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/hero/photo-mask-type-hero.tsx. - Import it and pass your copy and images (Props tab):
import { PhotoMaskTypeHero } from "@/components/funneldna/hero/photo-mask-type-hero"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/hero/photo-mask-type-hero/component.tsx 648 lines
// layout: bento-grid
// Photo-masked type hero: a photo plays inside one giant word, breaks out to fill the frame, then lands the promise, a short letter and a huge action as the final beat of a video-ad style edit.
import * as React from "react";
import { CalendarDays, Check, Clock, Gift, Leaf, MapPin, Pause, Play, RotateCcw, Users } from "lucide-react";
import type { LucideIcon } from "lucide-react";
import { Divider, FX_HOST, Glow } from "../fx/fx";
export type PhotoMaskFactIcon = "calendar" | "pin" | "clock" | "gift" | "check" | "users" | "leaf";
export type PhotoMaskFact = {
text: string;
/** Inline lucide icon shown before the line. */
icon?: PhotoMaskFactIcon;
};
export type PhotoMaskTypeHeroProps = {
/** The giant word (or two) the photo plays inside. Keep it short. */
word?: string;
/** Photo for the word and the full frame (scene slot). Without it the word is a solid accent fill. */
image?: string;
imageAlt?: string;
/** Headline, one entry per kinetic line (1 to 3 lines). */
headline?: string[];
lead?: string;
/** Primary button label. */
label?: string;
href?: string;
onAction?: (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;
/** The one plain line under the button. */
secondaryText?: string;
secondaryHref?: string;
/** Letter tile: salutation, short paragraphs and the sign-off. */
salutation?: string;
letter?: string[];
signoffName?: string;
signoffRole?: string;
/** Sign-off portrait (presenter slot). */
signoffImage?: string;
signoffImageAlt?: string;
/** Facts tile: a selling title, today's price beside its alternative, and fact lines. */
factsTitle?: string;
price?: string;
/** What the supplied alternative costs, e.g. "vs. hiring a copywriter". */
priceAlternative?: string;
facts?: PhotoMaskFact[];
disabled?: boolean;
state?: "default" | "hover" | "active" | "disabled";
/** Accessible labels for the motion control. */
copy?: { pause?: string; play?: string; replay?: string };
className?: string;
};
export function PhotoMaskTypeHero(props: PhotoMaskTypeHeroProps) {
const {
word = "NOW",
image,
imageAlt = "",
headline = DEFAULT_HEADLINE,
lead = DEFAULT_LEAD,
label = "Get started",
href,
onAction,
secondaryText = "or keep reading to see what's inside",
secondaryHref,
salutation = "Dear friend,",
letter = DEFAULT_LETTER,
signoffName,
signoffRole,
signoffImage,
signoffImageAlt,
factsTitle,
price,
priceAlternative,
facts = [],
disabled = false,
state = "default",
copy,
className,
} = props;
const uid = React.useId().replace(/[^a-zA-Z0-9_-]/g, "");
const clipId = `cf-pmth-clip-${uid}`;
const headId = `cf-pmth-h-${uid}`;
const rootRef = React.useRef<HTMLElement>(null);
const stageRef = React.useRef<HTMLDivElement>(null);
const gridRef = React.useRef<HTMLDivElement>(null);
const wordRef = React.useRef<HTMLDivElement>(null);
const mainRef = React.useRef<HTMLDivElement>(null);
const landRef = React.useRef<HTMLDivElement>(null);
const measureRef = React.useRef<SVGTextElement>(null);
const armed = React.useRef(true);
const reduceRef = React.useRef(false);
const [box, setBox] = React.useState<Box>(() => guessBox(word));
const [mv, setMv] = React.useState<MotionVars>(START_VARS);
const [run, setRun] = React.useState(0);
const [paused, setPaused] = React.useState(false);
const [done, setDone] = React.useState(false);
const [reduce, setReduce] = React.useState(false);
const hasImage = Boolean(image);
const filtered = headline.filter((line) => line && line.trim());
const lines = filtered.length ? filtered : [word];
const paragraphs = letter.filter((p) => p && p.trim());
const hasLetter = paragraphs.length > 0 || Boolean(signoffName);
const hasFacts = facts.length > 0 || Boolean(price) || Boolean(factsTitle);
const hasSide = hasLetter || hasFacts;
const isDisabled = disabled || state === "disabled";
const playing = run > 0 && !done && !reduce;
// Fit the giant word: measure its real glyph box in the theme's display face.
const measure = React.useCallback(() => {
const node = measureRef.current;
if (!node) return;
let b: { x: number; y: number; width: number; height: number };
try {
b = node.getBBox();
} catch {
return;
}
if (!(b.width > 0) || !(b.height > 0)) return;
const next = fitBox(b, word);
setBox((prev) => (sameBox(prev, next) ? prev : next));
}, [word]);
// Motion geometry from layout (offset* ignores transforms): where the word starts, where the mask opens, safe slam scales.
const computeVars = React.useCallback(() => {
const stage = stageRef.current;
const grid = gridRef.current;
const wrap = wordRef.current;
if (!stage || !grid || !wrap) return;
const sw = stage.offsetWidth;
const sh = stage.offsetHeight;
if (!sw || !sh) return;
const ww = wrap.offsetWidth;
const wh = wrap.offsetHeight;
const aspect = box.w / box.h || 1;
const cw = Math.min(ww, wh * aspect);
const ch = cw / aspect;
const left = grid.offsetLeft + wrap.offsetLeft;
const top = grid.offsetTop + wrap.offsetTop + (wh - ch) / 2;
const vh = window.innerHeight || sh;
const drop = Math.min(sh, vh) / 2 - (top + ch / 2);
const dropx = sw / 2 - (left + cw / 2);
const narrow = sw < 640;
const t = clampN(top + drop, 0, sh);
const bt = clampN(sh - (t + ch), 0, sh);
const l = narrow ? 0 : clampN(left + dropx, 0, sw);
const r = narrow ? 0 : clampN(sw - (l + cw), 0, sw);
const s0 = clampN((sw - 12) / Math.max(cw, 1), 1, 1.4);
let sl = 1.15;
let sx = 24;
let bl = 1.15;
const main = mainRef.current;
if (main) {
const ml = grid.offsetLeft + main.offsetLeft;
const mw = main.offsetWidth || 1;
sl = clampN((sw - ml - 6) / mw, 1, 1.25);
sx = clampN(sw - (ml + mw) - 6, 8, 120);
}
const land = landRef.current;
if (land) {
const bLeft = grid.offsetLeft + land.offsetLeft;
const bw = land.offsetWidth || 1;
bl = clampN((sw - bLeft - 6) / bw, 1, 1.3);
}
const next: MotionVars = {
drop: r1(drop), dropx: r1(dropx), ox: r1(cw / 2),
t: r1(t), r: r1(r), b: r1(bt), l: r1(l),
s0: r2(s0), sl: r2(sl), sx: r1(sx), bl: r2(bl),
};
setMv((prev) => (sameVars(prev, next) ? prev : next));
}, [box]);
const latest = React.useRef({ measure, computeVars });
useIso(() => {
latest.current = { measure, computeVars };
});
useIso(() => {
measure();
}, [measure, run, hasImage]);
useIso(() => {
computeVars();
}, [computeVars, run, hasImage, hasSide, lines.length]);
const start = React.useCallback(() => {
armed.current = false;
setPaused(false);
setDone(false);
setRun((n) => n + 1);
}, []);
// Reduced motion shows the finished composition; otherwise play at once if the hero is already on screen.
useIso(() => {
const mq = typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)") : null;
const apply = () => {
reduceRef.current = Boolean(mq && mq.matches);
setReduce(reduceRef.current);
};
apply();
const el = rootRef.current;
if (!reduceRef.current && el) {
const rect = el.getBoundingClientRect();
const vh = window.innerHeight || 0;
if (rect.top < vh * 0.85 && rect.bottom > vh * 0.15) start();
}
mq?.addEventListener?.("change", apply);
return () => mq?.removeEventListener?.("change", apply);
}, [start]);
// Plays when the block enters view, re-arms when it fully leaves, so scrolling back replays it.
React.useEffect(() => {
const el = rootRef.current;
if (!el || typeof IntersectionObserver === "undefined") return;
const io = new IntersectionObserver(
(entries) => {
for (const entry of entries) {
if (!entry.isIntersecting) {
armed.current = true;
} else if (
armed.current &&
!reduceRef.current &&
(entry.intersectionRatio >= 0.2 || entry.intersectionRect.height >= window.innerHeight * 0.5)
) {
start();
}
}
},
{ threshold: [0, 0.2, 0.4] },
);
io.observe(el);
return () => io.disconnect();
}, [start]);
// Refit when fonts arrive or the stage resizes.
React.useEffect(() => {
const update = () => {
latest.current.measure();
latest.current.computeVars();
};
let alive = true;
const fonts = typeof document !== "undefined" ? document.fonts : undefined;
fonts?.ready
.then(() => {
if (alive) update();
})
.catch(() => undefined);
fonts?.addEventListener?.("loadingdone", update);
const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(update) : null;
if (stageRef.current) ro?.observe(stageRef.current);
return () => {
alive = false;
fonts?.removeEventListener?.("loadingdone", update);
ro?.disconnect();
};
}, []);
const onAnimEnd = (event: React.AnimationEvent<HTMLDivElement>) => {
if (event.animationName === "cf-pmth-land") setDone(true);
};
const handleAction = (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {
if (isDisabled) {
event.preventDefault();
return;
}
onAction?.(event);
};
const ctrlLabel = playing
? paused
? (copy?.play ?? "Play animation")
: (copy?.pause ?? "Pause animation")
: (copy?.replay ?? "Replay animation");
const onCtrl = () => {
if (playing) setPaused((p) => !p);
else start();
};
const stageStyle = vars({
"--drop": `${mv.drop}px`,
"--dropx": `${mv.dropx}px`,
"--ox": `${mv.ox}px`,
"--mt": `${mv.t}px`,
"--mr": `${mv.r}px`,
"--mb": `${mv.b}px`,
"--ml": `${mv.l}px`,
"--s0": mv.s0,
"--sl": mv.sl,
"--sx": `${mv.sx}px`,
"--bl": mv.bl,
});
const cta =
href && !isDisabled ? (
<a className="cf-pmth__cta" href={href} onClick={handleAction} data-state={state}>
{label}
</a>
) : (
<button type="button" className="cf-pmth__cta" onClick={handleAction} disabled={isDisabled} data-state={state}>
{label}
</button>
);
return (
<section
ref={rootRef}
className={["cf-pmth", className].filter(Boolean).join(" ")}
style={FX_HOST}
aria-labelledby={headId}
>
<style>{CSS}</style>
<div
ref={stageRef}
className="cf-pmth__stage"
data-play={run > 0 && !reduce ? "on" : "off"}
data-paused={paused ? "true" : "false"}
data-image={hasImage ? "yes" : "no"}
style={stageStyle}
onAnimationEnd={onAnimEnd}
>
<div className="cf-pmth__glow cf-pmth__glow--a" aria-hidden="true">
<Glow />
</div>
<div className="cf-pmth__glow cf-pmth__glow--b" aria-hidden="true">
<Glow />
</div>
<div className="cf-pmth__reel" key={run}>
{hasImage ? (
<div className="cf-pmth__photo">
<img src={image} alt={imageAlt} decoding="async" />
</div>
) : null}
{hasImage ? <div className="cf-pmth__scrim" aria-hidden="true" /> : null}
<div ref={gridRef} className={hasSide ? "cf-pmth__grid has-side" : "cf-pmth__grid"} style={vars({ "--n": lines.length })}>
<div ref={wordRef} className="cf-pmth__word" aria-hidden="true">
<svg
className="cf-pmth__wordsvg"
viewBox={`${box.x} ${box.y} ${box.w} ${box.h}`}
preserveAspectRatio="xMinYMid meet"
aria-hidden="true"
focusable="false"
>
{hasImage ? (
<>
<defs>
<clipPath id={clipId}>
<text x={0} y={0}>
{word}
</text>
</clipPath>
</defs>
<g className="cf-pmth__fill" clipPath={`url(#${clipId})`}>
<rect className="cf-pmth__base" x={box.x - box.w * 0.2} y={box.y - box.h * 0.4} width={box.w * 1.4} height={box.h * 1.8} />
<image
className="cf-pmth__inimg"
href={image}
x={box.x - box.w * 0.15}
y={box.y - box.h * 0.3}
width={box.w * 1.3}
height={box.h * 1.6}
preserveAspectRatio="xMidYMid slice"
/>
</g>
<text className="cf-pmth__ghost" x={0} y={0}>
{word}
</text>
</>
) : (
<text className="cf-pmth__solid" x={0} y={0}>
{word}
</text>
)}
<text ref={measureRef} className="cf-pmth__measure" x={0} y={0}>
{word}
</text>
</svg>
</div>
<div ref={mainRef} className="cf-pmth__main">
<h1 id={headId} className="cf-pmth__h1">
{lines.map((line, i) => (
<span key={i} className={`cf-pmth__line cf-pmth__line--${KINDS[i % KINDS.length]}`} style={vars({ "--i": i })}>
{line}
{i < lines.length - 1 ? " " : null}
</span>
))}
</h1>
{lead ? <p className="cf-pmth__lead">{lead}</p> : null}
<div ref={landRef} className="cf-pmth__land">
{cta}
</div>
{secondaryText ? (
<p className="cf-pmth__more">{secondaryHref ? <a href={secondaryHref}>{secondaryText}</a> : secondaryText}</p>
) : null}
</div>
{hasSide ? (
<div className="cf-pmth__side">
{hasLetter ? (
<div className="cf-pmth__tile cf-pmth__letter" style={vars({ "--t": 0 })}>
{salutation ? <p className="cf-pmth__sal">{salutation}</p> : null}
{paragraphs.map((p, i) => (
<p key={i}>{p}</p>
))}
{signoffName ? (
<div className="cf-pmth__sign">
{signoffImage ? (
<img src={signoffImage} alt={signoffImageAlt ?? signoffName} width={56} height={56} loading="lazy" decoding="async" />
) : null}
<div className="cf-pmth__signtext">
<p className="cf-pmth__sname">{signoffName}</p>
{signoffRole ? <p className="cf-pmth__srole">{signoffRole}</p> : null}
</div>
</div>
) : null}
</div>
) : null}
{hasFacts ? (
<div className="cf-pmth__tile cf-pmth__factcard" style={vars({ "--t": hasLetter ? 1 : 0 })}>
{factsTitle ? <h2 className="cf-pmth__ftitle">{factsTitle}</h2> : null}
{price ? (
<p className="cf-pmth__price">
<span className="cf-pmth__pnum">{price}</span>
{priceAlternative ? <span className="cf-pmth__palt">{priceAlternative}</span> : null}
</p>
) : null}
{facts.length ? (
<ul className="cf-pmth__facts">
{facts.map((fact, i) => {
const Icon = ICONS[fact.icon ?? "check"];
return (
<li key={i}>
<Icon size={18} strokeWidth={2.5} aria-hidden="true" />
<span>{fact.text}</span>
</li>
);
})}
</ul>
) : null}
</div>
) : null}
</div>
) : null}
</div>
</div>
{!reduce ? (
<button type="button" className="cf-pmth__ctrl" onClick={onCtrl} aria-label={ctrlLabel} title={ctrlLabel}>
{playing ? (
paused ? (
<Play size={18} strokeWidth={2.5} aria-hidden="true" />
) : (
<Pause size={18} strokeWidth={2.5} aria-hidden="true" />
)
) : (
<RotateCcw size={18} strokeWidth={2.5} aria-hidden="true" />
)}
</button>
) : null}
<div className="cf-pmth__edge" aria-hidden="true">
<Divider shape="angle" tone="surface" height={48} />
</div>
</div>
</section>
);
}
export default PhotoMaskTypeHero;
type Box = { x: number; y: number; w: number; h: number };
type MotionVars = {
drop: number; dropx: number; ox: number;
t: number; r: number; b: number; l: number;
s0: number; sl: number; sx: number; bl: number;
};
const FS = 100;
const KINDS = ["slam", "slide", "reveal"] as const;
const DEFAULT_HEADLINE = ["Your next step", "starts with one yes."];
const DEFAULT_LEAD = "One clear step today. Everything you need to begin is on the other side of this button.";
const DEFAULT_LETTER = [
"If you've been waiting for the right moment, this is it.",
"Take the first step today. I'll walk you through what comes next.",
];
const START_VARS: MotionVars = { drop: 0, dropx: 0, ox: 0, t: 0, r: 0, b: 0, l: 0, s0: 1.3, sl: 1.15, sx: 24, bl: 1.15 };
const ICONS: Record<PhotoMaskFactIcon, LucideIcon> = {
calendar: CalendarDays,
pin: MapPin,
clock: Clock,
gift: Gift,
check: Check,
users: Users,
leaf: Leaf,
};
const useIso = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect;
function vars(map: Record<string, string | number>): React.CSSProperties {
return map as React.CSSProperties;
}
function guessBox(word: string): Box {
return { x: 0, y: -FS * 0.95, w: Math.max(1, Array.from(word).length) * FS * 0.62, h: FS * 0.99 };
}
// All-caps words get a cap-height box so the ghost sits tight above the headline; mixed case keeps the font box.
function fitBox(b: { x: number; y: number; width: number; height: number }, word: string): Box {
const pad = FS * 0.03;
const caps = word === word.toLocaleUpperCase();
return caps
? { x: b.x - pad, y: -FS * 0.95, w: b.width + pad * 2, h: FS * 0.99 }
: { x: b.x - pad, y: b.y, w: b.width + pad * 2, h: b.height };
}
function sameBox(a: Box, b: Box) {
return Math.abs(a.x - b.x) < 0.5 && Math.abs(a.y - b.y) < 0.5 && Math.abs(a.w - b.w) < 0.5 && Math.abs(a.h - b.h) < 0.5;
}
function sameVars(a: MotionVars, b: MotionVars) {
return (Object.keys(a) as (keyof MotionVars)[]).every((k) =>
Math.abs(a[k] - b[k]) < (k === "s0" || k === "sl" || k === "bl" ? 0.01 : 0.5),
);
}
function clampN(n: number, min: number, max: number) {
return Math.min(max, Math.max(min, n));
}
function r1(n: number) {
return Math.round(n * 10) / 10;
}
function r2(n: number) {
return Math.round(n * 100) / 100;
}
// The band wraps its content exactly: house section padding top and bottom (plus the 48px angled edge), no viewport min-height.
const CSS = `
.cf-pmth{--signature-font:var(--signature-face, var(--font-display));position:relative;isolation:isolate;overflow:clip;background:var(--band);color:var(--band-ink);font-family:var(--font-body)}
.cf-pmth *,.cf-pmth *::before,.cf-pmth *::after{box-sizing:border-box}
.cf-pmth__stage{position:relative;overflow:clip;container-type:inline-size;isolation:isolate}
.cf-pmth__reel{display:contents}
.cf-pmth__glow{position:absolute;z-index:0;pointer-events:none}
.cf-pmth__glow--a{inset:-15% 40% 30% -20%}
.cf-pmth__glow--b{inset:30% -20% -10% 45%}
.cf-pmth__photo{position:absolute;inset:0;z-index:1;overflow:clip}
.cf-pmth__photo img{display:block;inline-size:100%;block-size:100%;object-fit:cover;object-position:50% 45%}
.cf-pmth__scrim{position:absolute;inset:0;z-index:2;pointer-events:none;background:linear-gradient(90deg,oklch(from var(--band) l c h / .9) 0%,oklch(from var(--band) l c h / .86) 56%,oklch(from var(--band) l c h / .5) 100%)}
.cf-pmth__grid{position:relative;z-index:3;display:grid;grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);grid-template-areas:'word word' 'main side';column-gap:clamp(32px,5cqi,72px);row-gap:clamp(16px,2.2cqi,28px);align-content:start;align-items:start;max-inline-size:1240px;margin-inline:auto;padding:clamp(56px,8cqi,112px) clamp(16px,5cqi,48px) calc(clamp(64px,8.5cqi,120px) + 48px)}
.cf-pmth__grid:not(.has-side){grid-template-columns:minmax(0,1fr);grid-template-areas:'word' 'main'}
.cf-pmth__word{grid-area:word;position:relative;min-width:0;transform-origin:var(--ox,50%) 50%}
.cf-pmth__wordsvg{display:block;inline-size:100%;block-size:auto;max-block-size:clamp(104px,36vh,380px);max-block-size:clamp(104px,36svh,380px);overflow:visible}
.cf-pmth__wordsvg text{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:100px;letter-spacing:-0.02em}
.cf-pmth__measure{opacity:0;pointer-events:none}
.cf-pmth__base{fill:oklch(from var(--band) calc(l + .12) c h)}
.cf-pmth__inimg{transform-box:fill-box;transform-origin:50% 50%}
.cf-pmth__fill{opacity:0}
.cf-pmth__ghost{fill:none;stroke:var(--band-ink);stroke-opacity:.85;stroke-width:2px;stroke-linejoin:round;vector-effect:non-scaling-stroke}
.cf-pmth__solid{fill:var(--accent-fill, var(--accent));stroke:var(--band-ink);stroke-width:1.5px;stroke-linejoin:round;vector-effect:non-scaling-stroke;paint-order:stroke}
.cf-pmth__main{grid-area:main;min-width:0}
.cf-pmth__h1{margin:0 0 clamp(32px,3cqi,42px);font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2.5rem,1.1rem + 5.2cqi,4.875rem);line-height:1.04;color:var(--band-ink);text-wrap:balance;overflow-wrap:anywhere;hyphens:auto}
.cf-pmth__line{display:block;transform-origin:0 60%}
.cf-pmth__lead{margin:0 0 clamp(28px,2.6cqi,36px);max-inline-size:34em;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.45;font-weight:500;color:var(--band-ink);text-wrap:pretty;overflow-wrap:anywhere}
.cf-pmth__land{display:inline-block;max-inline-size:100%;transform-origin:0 50%}
.cf-pmth__cta{--pmth-btn:var(--button-bg, var(--cta));--pmth-btn2:var(--button-bg-2, var(--cta-2));position:relative;display:inline-flex;align-items:center;justify-content:center;gap:8px;max-inline-size:100%;min-block-size:clamp(72px,1.2rem + 5cqi,92px);padding:14px clamp(28px,3.4cqi,52px);border:0;border-radius:var(--button-radius, var(--radius,12px));font-family:var(--button-font, var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.25rem,.85rem + 1.5cqi,1.875rem);line-height:1.12;letter-spacing:-0.005em;text-align:center;text-wrap:balance;text-decoration:none;color:var(--button-ink, var(--cta-ink));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--pmth-btn) calc(l + .04) c h),oklch(from var(--pmth-btn2) calc(l - .02) c h));box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--pmth-btn) calc(l + .14) c h / .7), inset 0 -3px 0 oklch(from var(--pmth-btn) calc(l - .16) c h), 0 1px 2px oklch(from var(--shadow, oklch(.22 .03 260)) l c h / .45), 0 10px 20px -6px oklch(from var(--shadow, oklch(.22 .03 260)) l c h / .55));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease;-webkit-tap-highlight-color:transparent}
.cf-pmth__cta:hover:not(:disabled),.cf-pmth__cta[data-state=hover]{background:linear-gradient(oklch(from var(--pmth-btn) calc(l - .01) c h),oklch(from var(--pmth-btn2) calc(l - .07) c h));transform:translateY(-1px);box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--pmth-btn) calc(l + .12) c h / .7), inset 0 -3px 0 oklch(from var(--pmth-btn) calc(l - .2) c h), 0 1px 2px oklch(from var(--shadow, oklch(.22 .03 260)) l c h / .5), 0 14px 24px -8px oklch(from var(--shadow, oklch(.22 .03 260)) l c h / .62))}
.cf-pmth__cta:active:not(:disabled),.cf-pmth__cta[data-state=active]{background:linear-gradient(oklch(from var(--pmth-btn) calc(l - .04) c h),oklch(from var(--pmth-btn2) calc(l - .09) c h));transform:translateY(2px);box-shadow:inset 0 2px 5px oklch(from var(--pmth-btn) calc(l - .22) c h / .55), inset 0 -2px 0 oklch(from var(--pmth-btn) calc(l - .16) c h), 0 1px 2px oklch(from var(--shadow, oklch(.22 .03 260)) l c h / .4)}
.cf-pmth__cta:focus-visible{outline:3px solid var(--band-ink);outline-offset:4px}
.cf-pmth__cta:disabled{cursor:not-allowed;transform:none;background:var(--button-2-bg, var(--secondary));color:var(--button-2-ink, var(--secondary-ink));text-shadow:none;box-shadow:var(--button-2-shadow, var(--shadow-sm))}
.cf-pmth__more{margin:16px 0 0;font-size:1rem;font-weight:600;line-height:1.4;color:var(--band-ink);text-wrap:pretty;overflow-wrap:anywhere}
.cf-pmth__more a{color:var(--band-ink);text-decoration:underline;text-decoration-thickness:1px;text-decoration-color:oklch(from var(--band-ink) l c h / .55);text-underline-offset:.18em;border-radius:4px;transition:text-decoration-color .16s ease}
.cf-pmth__more a:hover{text-decoration-color:var(--band-ink)}
.cf-pmth__more a:focus-visible{outline:2px solid var(--band-ink);outline-offset:3px}
.cf-pmth__side{grid-area:side;min-width:0;display:flex;flex-direction:column;gap:16px}
.cf-pmth__tile{min-width:0;background:var(--card);color:var(--ink);border:1px solid var(--card-border, oklch(from var(--ink) l c h / .12));border-radius:var(--card-radius, var(--radius,14px));box-shadow:var(--card-shadow, var(--shadow-md, 0 1px 2px oklch(.22 .03 260 / .22), 0 4px 10px -2px oklch(.22 .03 260 / .2)));padding:clamp(20px,2.4cqi,28px)}
.cf-pmth__sal{margin:0 0 12px;font-size:1.0625rem;font-weight:700;line-height:1.4}
.cf-pmth__letter > p{margin:0 0 12px;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty;overflow-wrap:anywhere}
.cf-pmth__letter > p:last-child{margin-bottom:0}
.cf-pmth__sign{display:flex;align-items:center;gap:12px;margin-top:16px}
.cf-pmth__sign img{flex:none;inline-size:56px;block-size:56px;border-radius:8px;object-fit:cover;object-position:50% 30%}
.cf-pmth__signtext{min-width:0}
.cf-pmth__sname{margin:0;font-family:var(--signature-font);font-weight:700;font-size:1.5rem;line-height:1.1;color:var(--ink);overflow-wrap:anywhere}
.cf-pmth__srole{margin:4px 0 0;font-size:.9375rem;font-weight:500;line-height:1.4;color:var(--muted)}
.cf-pmth__ftitle{margin:0 0 24px;font-family:var(--font-display);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);letter-spacing:-0.01em;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;color:var(--ink);text-wrap:balance}
.cf-pmth__price{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px;margin:0 0 20px;padding-block-end:20px;border-block-end:1px solid oklch(from var(--ink) l c h / .12)}
.cf-pmth__pnum{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1.1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums;color:var(--ink)}
.cf-pmth__palt{flex:1 1 14ch;min-width:0;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-pmth__facts{list-style:none;margin:0;padding:0;display:grid;gap:12px}
.cf-pmth__facts li{display:flex;align-items:flex-start;gap:12px;min-width:0;font-size:1rem;font-weight:500;line-height:1.45;text-wrap:pretty}
.cf-pmth__facts svg{flex:none;margin-top:2px;color:var(--accent)}
.cf-pmth__facts span{min-width:0;overflow-wrap:anywhere}
.cf-pmth__factcard > :last-child{margin-bottom:0}
.cf-pmth__ctrl{position:absolute;z-index:6;inset-block-start:clamp(12px,1.6cqi,20px);inset-inline-end:clamp(12px,1.6cqi,20px);inline-size:44px;block-size:44px;display:inline-grid;place-items:center;padding:0;border-radius:999px;border:1px solid oklch(from var(--band-ink) l c h / .35);background:oklch(from var(--band) l c h / .72);color:var(--band-ink);cursor:pointer;transition:background .16s ease,transform .16s ease}
.cf-pmth__ctrl:hover{background:oklch(from var(--band) calc(l + .06) c h / .92)}
.cf-pmth__ctrl:active{transform:scale(.94)}
.cf-pmth__ctrl:focus-visible{outline:3px solid var(--band-ink);outline-offset:2px}
.cf-pmth__edge{position:absolute;inset-inline:0;inset-block-end:0;block-size:48px;z-index:5;pointer-events:none}
@container (max-width: 900px){
.cf-pmth__grid{grid-template-columns:minmax(0,1fr);grid-template-areas:'word' 'main' 'side'}
.cf-pmth__scrim{background:oklch(from var(--band) l c h / .86)}
}
@container (min-width: 600px) and (max-width: 900px){
.cf-pmth__side{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr));align-items:start}
}
@container (max-width: 560px){
.cf-pmth__land{display:block}
.cf-pmth__cta{inline-size:100%}
}
@media (prefers-reduced-motion: no-preference){
.cf-pmth__stage[data-play=on] .cf-pmth__word{animation:cf-pmth-word 2.45s .1s both}
.cf-pmth__stage[data-play=on] .cf-pmth__inimg{animation:cf-pmth-pan 1.85s .1s cubic-bezier(.25,.6,.3,1) both}
.cf-pmth__stage[data-play=on] .cf-pmth__fill{animation:cf-pmth-fillout 1.85s linear both}
.cf-pmth__stage[data-play=on] .cf-pmth__ghost{animation:cf-pmth-fade .3s 1.62s ease-out both}
.cf-pmth__stage[data-play=on] .cf-pmth__photo{animation:cf-pmth-open .75s 1.55s cubic-bezier(.75,0,.2,1) both}
.cf-pmth__stage[data-play=on] .cf-pmth__photo img{animation:cf-pmth-zoom 1.6s 1.55s cubic-bezier(.2,.7,.2,1) both}
.cf-pmth__stage[data-play=on] .cf-pmth__scrim{animation:cf-pmth-fade .5s 1.9s ease-out both}
.cf-pmth__stage[data-play=on] .cf-pmth__line--slam{animation:cf-pmth-slam .42s calc(2.3s + var(--i) * .22s) cubic-bezier(.2,.9,.25,1) both}
.cf-pmth__stage[data-play=on] .cf-pmth__line--slide{animation:cf-pmth-slide .38s calc(2.3s + var(--i) * .22s) cubic-bezier(.2,.8,.2,1) both}
.cf-pmth__stage[data-play=on] .cf-pmth__line--reveal{animation:cf-pmth-reveal .45s calc(2.3s + var(--i) * .22s) cubic-bezier(.7,0,.2,1) both}
.cf-pmth__stage[data-play=on] .cf-pmth__lead{animation:cf-pmth-rise .45s calc(2.4s + var(--n) * .22s) cubic-bezier(.2,.7,.2,1) both}
.cf-pmth__stage[data-play=on] .cf-pmth__tile{animation:cf-pmth-rise .45s calc(2.85s + var(--t) * .08s) cubic-bezier(.2,.7,.2,1) both}
.cf-pmth__stage[data-play=on] .cf-pmth__more{animation:cf-pmth-fade .4s 3.05s ease-out both}
.cf-pmth__stage[data-play=on] .cf-pmth__land{animation:cf-pmth-land .55s 3.2s cubic-bezier(.2,.7,.2,1) both}
.cf-pmth__stage[data-play=on][data-paused=true] *{animation-play-state:paused}
}
@keyframes cf-pmth-word{
0%{opacity:0;transform:translate3d(var(--dropx),var(--drop),0) scale(var(--s0,1.3))}
11%{opacity:1;transform:translate3d(var(--dropx),var(--drop),0) scale(.965)}
19%{transform:translate3d(var(--dropx),var(--drop),0) scale(1)}
80%{opacity:1;transform:translate3d(var(--dropx),var(--drop),0) scale(1);animation-timing-function:cubic-bezier(.7,0,.2,1)}
100%{opacity:1;transform:translate3d(0,0,0) scale(1)}
}
@keyframes cf-pmth-pan{0%{transform:scale(1.5) translate3d(-7%,2%,0)}100%{transform:scale(1.12) translate3d(4%,0,0)}}
@keyframes cf-pmth-fillout{0%,87%{opacity:1}100%{opacity:0}}
@keyframes cf-pmth-fade{0%{opacity:0}100%{opacity:1}}
@keyframes cf-pmth-open{0%{opacity:0;clip-path:inset(var(--mt) var(--mr) var(--mb) var(--ml) round 10px)}10%{opacity:1}100%{opacity:1;clip-path:inset(0 0 0 0 round 0)}}
@keyframes cf-pmth-zoom{0%{transform:scale(1.22)}100%{transform:scale(1)}}
@keyframes cf-pmth-slam{0%{opacity:0;transform:scale(var(--sl,1.15))}60%{opacity:1;transform:scale(.97)}100%{opacity:1;transform:scale(1)}}
@keyframes cf-pmth-slide{0%{opacity:0;transform:translate3d(var(--sx,24px),0,0)}100%{opacity:1;transform:translate3d(0,0,0)}}
@keyframes cf-pmth-reveal{0%{clip-path:inset(-25% 100% -25% -4%)}100%{clip-path:inset(-25% -4% -25% -4%)}}
@keyframes cf-pmth-rise{0%{opacity:0;transform:translate3d(0,24px,0)}100%{opacity:1;transform:translate3d(0,0,0)}}
@keyframes cf-pmth-land{0%{opacity:0;transform:scale(var(--bl,1.15))}55%{opacity:1;transform:scale(.96)}78%{transform:scale(calc(1 + (var(--bl,1.15) - 1) * .12))}100%{opacity:1;transform:scale(1)}}
`;
pieces/hero/photo-mask-type-hero/specimen.tsx 50 lines
import __studioImage61b7c7ff from "../assets/98992b2a643d6701.webp";
import __studioImage5663c358 from "../assets/b4a35d6c212ba2f4.webp";
// Specimen: the fictional Riverkeep Collective volunteer drive on the photo-masked type hero.
import { PhotoMaskTypeHero } from "../photo-mask-type-hero";
import { slot } from "../../slots";
export const states = ["default", "hover", "active", "disabled"];
type SpecimenState = "default" | "hover" | "active" | "disabled";
export default function PhotoMaskTypeHeroSpecimen({ state = "default" }: { state?: SpecimenState }) {
return (
<PhotoMaskTypeHero
word="RIVERS"
image={slot(
"scene",
__studioImage61b7c7ff,
)}
imageAlt="A clear river bending through a misty green valley at dawn"
headline={["Give one Saturday.", "Get your river back."]}
lead="Riverkeep Collective volunteers clear trash from the banks of the Millrace every second Saturday morning. No experience, no gear, no sign-up fee."
label="Join a cleanup"
onAction={() => undefined}
secondaryText="or see this month's cleanup sites"
secondaryHref="#sites"
salutation="Dear neighbor,"
letter={[
"Last spring, fourteen of us pulled 380 pounds of trash out of one bend of the Millrace in a single morning.",
"You don't need experience. You need two hours and shoes you don't mind getting muddy. Come once. I think you'll come back.",
]}
signoffName="Mara Ellis"
signoffRole="Volunteer lead, Riverkeep Collective"
signoffImage={slot(
"presenter",
__studioImage5663c358,
)}
signoffImageAlt="Mara Ellis on the riverbank"
factsTitle="Bring yourself. We bring the rest."
price="Free"
priceAlternative="vs. $35 for a guided paddle on the same stretch"
facts={[
{ icon: "calendar", text: "Second Saturday of every month, 8 to 11 am" },
{ icon: "pin", text: "Meet at the Millrace footbridge on Ferry Road" },
{ icon: "gift", text: "Gloves, grabbers and hot coffee provided" },
{ icon: "users", text: "Bring a friend. Ages 12 and up with an adult" },
]}
state={state}
/>
);
}
| Name | Type | Details |
|---|---|---|
word OptionalPhotoMaskTypeHero |
string |
|
image OptionalPhotoMaskTypeHero |
string |
|
imageAlt OptionalPhotoMaskTypeHero |
string |
|
headline OptionalPhotoMaskTypeHero |
string[] |
|
lead OptionalPhotoMaskTypeHero |
string |
|
label OptionalPhotoMaskTypeHero |
string |
|
href OptionalPhotoMaskTypeHero |
string |
|
onAction OptionalPhotoMaskTypeHero |
(event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void |
|
secondaryText OptionalPhotoMaskTypeHero |
string |
|
secondaryHref OptionalPhotoMaskTypeHero |
string |
|
salutation OptionalPhotoMaskTypeHero |
string |
|
letter OptionalPhotoMaskTypeHero |
string[] |
|
signoffName OptionalPhotoMaskTypeHero |
string |
|
signoffRole OptionalPhotoMaskTypeHero |
string |
|
signoffImage OptionalPhotoMaskTypeHero |
string |
|
signoffImageAlt OptionalPhotoMaskTypeHero |
string |
|
factsTitle OptionalPhotoMaskTypeHero |
string |
|
price OptionalPhotoMaskTypeHero |
string |
|
priceAlternative OptionalPhotoMaskTypeHero |
string |
|
facts OptionalPhotoMaskTypeHero |
PhotoMaskFact[] |
|
disabled OptionalPhotoMaskTypeHero |
boolean |
|
state OptionalPhotoMaskTypeHero |
"default" | "hover" | "active" | "disabled" |
|
copy OptionalPhotoMaskTypeHero |
{ pause?: string; play?: string; replay?: string } |
|
className OptionalPhotoMaskTypeHero |
string |
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.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-ink--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
presenter- A photo of the host, coach or founder.
scene- A wide atmosphere photo behind or beside the copy.
-
98992b2a643d6701.webp
image/webp · 188 KB
-
b4a35d6c212ba2f4.webp
image/webp · 117 KB