Outline Fill Statement 1
Outline to solid: a huge outlined statement fills in with solid colour as it is read, line by line, and lands on
Use it in a prompt
Use content/outline-fill-statement 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/content/outline-fill-statement.tsx. - Import it and pass your copy and images (Props tab):
import { OutlineFillStatement } from "@/components/funneldna/content/outline-fill-statement"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/content/outline-fill-statement/component.tsx 261 lines
// layout: split-contrast
// Outline to solid: a huge outlined statement fills in with solid colour as it is read, line by line, and lands on
// the key phrase in the accent colour. The old belief and the new one sit on two sides of the band, so the turn sticks before the offer.
import React from "react";
import { Mesh, Divider, FX_HOST } from "../fx/fx";
export type OutlineFillStatementProps = {
/** Two or three short lines. Each fills in turn; the last line is the turn and carries the key phrase. */
lines?: string[];
/** Key phrase inside a line that finishes in the accent colour. Missing or not found: the whole last line. */
accentPhrase?: string;
/** Optional one-sentence line under the statement. */
note?: React.ReactNode;
/** Dark mesh band (default) or light mesh band. */
tone?: "dark" | "light";
/** Token name of the section below, for the wave edge ("surface", "band"). null hides the edge. */
edgeTone?: string | null;
/** Pins the fill between 0 and 1 instead of reading scroll (previews, screenshots). */
fill?: number;
className?: string;
};
type Word = { text: string; accent: boolean; a: number; s: number };
const useIsoLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
export function OutlineFillStatement({
lines = ["You don't need to work harder.", "You need a better vehicle."],
accentPhrase = "a better vehicle.",
note,
tone = "dark",
edgeTone,
fill,
className,
}: OutlineFillStatementProps) {
const sig = lines.join("\n") + "|" + (accentPhrase ?? "");
const model = React.useMemo(() => buildModel(lines, accentPhrase), [sig]);
const innerRef = React.useRef<HTMLDivElement>(null);
const statementRef = React.useRef<HTMLHeadingElement>(null);
const headingId = React.useId();
const edge = edgeTone === undefined ? (tone === "dark" ? "surface" : null) : edgeTone;
useIsoLayoutEffect(() => {
const host = innerRef.current;
const st = statementRef.current;
if (!host || !st) return;
const words = Array.from(st.querySelectorAll<HTMLElement>(".cf-ofs__w"));
const ranges = words.map((w) => [Number(w.dataset.a), Number(w.dataset.s)] as const);
const mq = typeof window.matchMedia === "function" ? window.matchMedia("(prefers-reduced-motion: reduce)") : null;
let raf = 0;
let visible = true;
let current = -1;
let active = false;
let io: IntersectionObserver | null = null;
const mark = (idx: number) => {
if (idx === current) return;
if (current >= 0) words[current]?.classList.remove("is-live");
if (idx >= 0) words[idx]?.classList.add("is-live");
current = idx;
};
const paint = (p: number) => {
host.style.setProperty("--p", p.toFixed(4));
let idx = -1;
for (let i = 0; i < ranges.length; i++) {
const [a, s] = ranges[i];
if (p > a && p < a + s) {
idx = i;
break;
}
}
mark(idx);
};
const read = () => {
raf = 0;
const r = st.getBoundingClientRect();
const vh = window.innerHeight || 1;
const from = vh * 0.86;
const to = vh * 0.42;
paint(clamp01((from - r.top) / (from - to + r.height)));
};
const schedule = () => {
if (!raf && visible) raf = requestAnimationFrame(read);
};
const stop = () => {
if (!active) return;
active = false;
document.removeEventListener("scroll", schedule, true);
window.removeEventListener("resize", schedule);
io?.disconnect();
io = null;
if (raf) cancelAnimationFrame(raf);
raf = 0;
mark(-1);
host.removeAttribute("data-live");
host.style.removeProperty("--p");
};
const start = () => {
stop();
if (mq?.matches) return;
active = true;
host.setAttribute("data-live", "");
if (typeof fill === "number") {
paint(clamp01(fill));
return;
}
document.addEventListener("scroll", schedule, { passive: true, capture: true });
window.addEventListener("resize", schedule, { passive: true });
if ("IntersectionObserver" in window) {
io = new IntersectionObserver(
(entries) => {
visible = entries.some((e) => e.isIntersecting);
if (visible) schedule();
},
{ rootMargin: "25% 0px" },
);
io.observe(st);
}
read();
};
start();
const onMotionChange = () => start();
mq?.addEventListener?.("change", onMotionChange);
return () => {
mq?.removeEventListener?.("change", onMotionChange);
stop();
};
}, [sig, fill]);
if (!model.length) return null;
const last = model.length - 1;
return (
<section
className={["cf-ofs", className].filter(Boolean).join(" ")}
data-tone={tone}
data-edge={edge ? "" : undefined}
style={FX_HOST}
aria-labelledby={headingId}
>
<style>{CSS}</style>
<Mesh variant={tone} />
<div className="cf-ofs__inner" ref={innerRef}>
<h2 className="cf-ofs__statement" id={headingId} ref={statementRef}>
{model.map((line, li) => (
<span key={li} className={"cf-ofs__line" + (li === last && last > 0 ? " is-turn" : "")}>
{line.map((w, wi) => (
<React.Fragment key={wi}>
{wi > 0 ? " " : null}
<span
className={"cf-ofs__w" + (w.accent ? " is-acc" : "")}
data-a={w.a}
data-s={w.s}
style={{ "--a": String(w.a), "--s": String(w.s) } as React.CSSProperties}
>
{w.text}
</span>
</React.Fragment>
))}
{li < last ? " " : null}
</span>
))}
</h2>
<div className="cf-ofs__foot">
<span className="cf-ofs__meter" aria-hidden="true">
<i />
</span>
{note ? <p className="cf-ofs__note">{note}</p> : null}
</div>
</div>
{edge ? (
<Divider shape="wave" tone={edge as React.ComponentProps<typeof Divider>["tone"]} height={56} />
) : null}
</section>
);
}
export default OutlineFillStatement;
function clamp01(n: number) {
return Number.isFinite(n) ? Math.min(1, Math.max(0, n)) : 1;
}
// Splits the lines into words, marks the accent phrase and gives each word its share of the read (by characters).
function buildModel(lines: string[], accentPhrase?: string): Word[][] {
const clean = (lines || []).map((l) => (l || "").trim()).filter(Boolean);
if (!clean.length) return [];
let accLine = clean.length - 1;
let accStart = 0;
let accEnd = clean[accLine].length;
const phrase = accentPhrase?.trim();
if (phrase) {
for (let i = clean.length - 1; i >= 0; i--) {
const at = clean[i].lastIndexOf(phrase);
if (at >= 0) {
accLine = i;
accStart = at;
accEnd = at + phrase.length;
break;
}
}
}
const raw = clean.map((line, li) => {
const out: { text: string; accent: boolean }[] = [];
const re = /\S+/g;
let m: RegExpExecArray | null;
while ((m = re.exec(line))) {
const s = m.index;
const e = s + m[0].length;
out.push({ text: m[0], accent: li === accLine && s < accEnd && e > accStart });
}
return out;
});
const total = raw.reduce((n, line) => n + line.reduce((k, w) => k + w.text.length + 1, 0), 0) || 1;
let cum = 0;
return raw.map((line) =>
line.map((w) => {
const len = w.text.length + 1;
const word: Word = { ...w, a: Number((cum / total).toFixed(4)), s: Number((len / total).toFixed(4)) };
cum += len;
return word;
}),
);
}
const CSS = `
.cf-ofs{position:relative;overflow:hidden;isolation:isolate;box-sizing:border-box;background:var(--ofs-bg);color:var(--ofs-ink);padding-block:clamp(72px,11vw,160px) calc(clamp(72px,10vw,144px) + var(--ofs-edge,0px));padding-inline:clamp(16px,5vw,48px)}
.cf-ofs *,.cf-ofs *::before,.cf-ofs *::after{box-sizing:border-box}
.cf-ofs[data-edge]{--ofs-edge:56px}
.cf-ofs[data-tone="dark"]{--ofs-bg:var(--band,oklch(0.27 0.067 256));--ofs-ink:var(--band-ink,oklch(1 0 0));--ofs-acc:oklch(from var(--accent-fill,var(--accent,oklch(0.5 0.17 257))) max(l,0.8) min(c,0.16) h);--ofs-glow:oklch(from var(--accent-fill,var(--accent,oklch(0.5 0.17 257))) max(l,0.84) c h);--ofs-acc-glow:oklch(from var(--ofs-acc) calc(l + 0.12) calc(c * 0.45) h);--ofs-track:color-mix(in oklch,var(--band-ink,oklch(1 0 0)) 20%,transparent)}
.cf-ofs[data-tone="light"]{--ofs-bg:var(--surface,oklch(1 0 0));--ofs-ink:var(--ink,oklch(0.21 0.034 263));--ofs-acc:var(--accent,oklch(0.5 0.17 257));--ofs-glow:var(--accent-fill,var(--accent,oklch(0.5 0.17 257)));--ofs-acc-glow:oklch(from var(--accent,oklch(0.5 0.17 257)) calc(l + 0.24) c h);--ofs-track:color-mix(in oklch,var(--ink,oklch(0.21 0.034 263)) 14%,transparent)}
.cf-ofs__inner{position:relative;z-index:1;max-inline-size:1120px;margin-inline:auto;min-width:0;container-type:inline-size}
.cf-ofs__statement{margin:0;min-width:0;color:var(--ofs-ink);font-family:var(--font-display);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);letter-spacing:calc(var(--display-tracking,-0.025em) + 0.01em);font-size:clamp(2.5rem,9.4vw,8.75rem);font-size:clamp(2.5rem,10.4cqi,8.75rem);line-height:1.02;overflow-wrap:anywhere;hyphens:auto;--stroke:clamp(1.25px,0.021em,3px)}
.cf-ofs__line{display:block;min-width:0;text-wrap:balance}
.cf-ofs__line + .cf-ofs__line{margin-top:0.1em}
@container (min-width: 46rem){
.cf-ofs__line:not(.is-turn){padding-inline-end:7cqi}
.cf-ofs__line.is-turn{padding-inline-start:7cqi;text-align:end}
.cf-ofs__foot{justify-content:space-between}
}
.cf-ofs__w{display:inline-block;max-inline-size:100%;padding:0.2em 0.06em;margin:-0.2em -0.06em;--ofs-f:var(--ofs-ink);--ofs-o:var(--ofs-ink);--ofs-g:var(--ofs-glow);color:var(--ofs-f)}
.cf-ofs__w.is-acc{--ofs-f:var(--ofs-acc);--ofs-o:var(--ofs-acc);--ofs-g:var(--ofs-acc-glow)}
@supports ((-webkit-background-clip: text) or (background-clip: text)){
.cf-ofs__inner[data-live] .cf-ofs__w{-webkit-text-fill-color:transparent;-webkit-text-stroke:var(--stroke) var(--ofs-o);background-image:linear-gradient(var(--ofs-f),var(--ofs-f));background-repeat:no-repeat;background-position:0 0;background-size:calc(clamp(0, (var(--p,1) - var(--a,0)) / var(--s,1), 1) * 100%) 100%;-webkit-background-clip:text;background-clip:text}
.cf-ofs__inner[data-live] .cf-ofs__w.is-live{background-image:linear-gradient(90deg,var(--ofs-f) 0,var(--ofs-f) calc(100% - 0.55em),var(--ofs-g) calc(100% - 0.16em),transparent 100%)}
}
.cf-ofs__foot{display:flex;flex-wrap:wrap;align-items:center;gap:16px 24px;min-width:0}
.cf-ofs__foot > *{margin-top:clamp(32px,5cqi,56px)}
.cf-ofs__meter{display:none;flex:0 1 clamp(6rem,22cqi,14rem);min-width:0;height:3px;border-radius:999px;background:var(--ofs-track);overflow:hidden}
.cf-ofs__inner[data-live] .cf-ofs__meter{display:block}
.cf-ofs__meter > i{display:block;height:100%;border-radius:inherit;background:var(--ofs-acc);transform-origin:0 50%;transform:scaleX(var(--p,1))}
.cf-ofs__note{margin:0;flex:1 1 18rem;min-width:0;max-inline-size:46ch;font-family:var(--font-body);font-size:clamp(1.125rem,1.5vw,1.375rem);font-weight:500;line-height:1.4;color:var(--ofs-ink);text-wrap:pretty}
@media (prefers-reduced-motion: reduce){
.cf-ofs__inner[data-live] .cf-ofs__w,.cf-ofs__inner[data-live] .cf-ofs__w.is-live{-webkit-text-fill-color:currentColor;-webkit-text-stroke:0;background:none}
.cf-ofs__inner[data-live] .cf-ofs__meter{display:none}
}
@media (forced-colors: active){
.cf-ofs .cf-ofs__inner .cf-ofs__w.cf-ofs__w,.cf-ofs .cf-ofs__inner[data-live] .cf-ofs__w.cf-ofs__w{-webkit-text-fill-color:CanvasText;-webkit-text-stroke:0;background:none}
}
`;
pieces/content/outline-fill-statement/specimen.tsx 13 lines
import OutlineFillStatement from "../outline-fill-statement";
export const states = ["default"];
// Fictional sample business: Morrow Greens.
export default function OutlineFillStatementSpecimen(_props: { state?: string }) {
return (
<OutlineFillStatement
lines={["Most greens taste like lawn.", "Ours taste like breakfast."]}
accentPhrase="like breakfast."
/>
);
}
| Name | Type | Details |
|---|---|---|
lines OptionalOutlineFillStatement |
string[] |
Default ["You don't need to work harder.", "You need a better vehicle."]
|
accentPhrase OptionalOutlineFillStatement |
string |
Default "a better vehicle."
|
note OptionalOutlineFillStatement |
React.ReactNode |
|
tone OptionalOutlineFillStatement |
"dark" | "light" |
Default "dark"
|
edgeTone OptionalOutlineFillStatement |
string | null |
|
fill OptionalOutlineFillStatement |
number |
|
className OptionalOutlineFillStatement |
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.
--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.
This piece reads no image slots.