feat(primitives): add 25 video primitives, live docs pages, and the catalog retrieval eval
Adds the 25 video primitive compositions and their generated Mintlify pages. Each page embeds a live <hyperframes-player> preview with editable composition variables rather than a rendered MP4. Adds the catalog-browsing eval under evals/catalog-retrieval: a 424-entry shelf built from HEAD, nine retrieval conditions (no-catalog control, full read, lexical, semantic, and hybrid across several values of k), a brief generator that constructs each brief from a known target, a blind three-pass gold validation committee, and a mechanical scorer that keeps mountable and fit as two separate numbers. The eval vendors its own shelf, primitive sources, and preview list instead of reading them from an ignored working directory, so the shelf regenerates byte for byte from a clean checkout. Derived artifacts stay out: the embedding cache and the run checkpoints are regenerated rather than committed, so no run can score against a stale copy of either. Lint ignores now cover vendored minified player bundles by pattern instead of one path at a time.
@@ -11,8 +11,9 @@
|
||||
"playground/",
|
||||
"packages/producer/tests/**/src/vendor/**",
|
||||
"registry/blocks/**/lib/*.iife.js",
|
||||
"docs/hyperframes-player.global.js",
|
||||
"**/*.global.js",
|
||||
"docs/public/spike/",
|
||||
".scratch/",
|
||||
"chrome/"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* HyperFrames Design System — Mintlify Theme Overrides */
|
||||
/* HyperFrames Design System - Mintlify Theme Overrides */
|
||||
|
||||
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');
|
||||
|
||||
@@ -117,7 +117,7 @@ h3 {
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
/* Code font — IBM Plex Mono (loaded via Google Fonts above) */
|
||||
/* Code font - IBM Plex Mono (loaded via Google Fonts above) */
|
||||
code, pre, pre code, kbd,
|
||||
[class*="code"],
|
||||
[class*="Code"] {
|
||||
@@ -410,3 +410,249 @@ a:not([class]):hover {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Primitive gallery */
|
||||
|
||||
:root {
|
||||
--hf-primitive-surface: #ffffff;
|
||||
--hf-primitive-text: #172033;
|
||||
--hf-primitive-muted: #526079;
|
||||
--hf-primitive-border: rgba(23, 32, 51, 0.12);
|
||||
--hf-primitive-focus: #315efb;
|
||||
}
|
||||
|
||||
.dark,
|
||||
[data-theme="dark"] {
|
||||
--hf-primitive-surface: #11141b;
|
||||
--hf-primitive-text: #f4f7fb;
|
||||
--hf-primitive-muted: #b8c3d4;
|
||||
--hf-primitive-border: rgba(244, 247, 251, 0.14);
|
||||
--hf-primitive-focus: #8fa8ff;
|
||||
}
|
||||
|
||||
.hf-primitive-hero {
|
||||
max-width: 680px;
|
||||
margin: 8px 0 48px;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
.hf-primitive-eyebrow {
|
||||
display: block;
|
||||
margin-bottom: 12px;
|
||||
color: var(--hf-primitive-muted);
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.hf-primitive-hero h1 {
|
||||
margin: 0;
|
||||
color: var(--hf-primitive-text);
|
||||
font-size: clamp(36px, 7vw, 56px);
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.045em;
|
||||
line-height: 1;
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
.hf-primitive-hero p {
|
||||
max-width: 62ch;
|
||||
margin: 20px 0 0;
|
||||
color: var(--hf-primitive-muted);
|
||||
font-size: 17px;
|
||||
line-height: 1.65;
|
||||
text-wrap: pretty;
|
||||
}
|
||||
|
||||
.hf-primitive-sections {
|
||||
display: grid;
|
||||
gap: 48px;
|
||||
padding-bottom: 48px;
|
||||
}
|
||||
|
||||
.hf-primitive-section {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.hf-primitive-section-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.hf-primitive-section-index {
|
||||
padding-top: 3px;
|
||||
color: var(--hf-primitive-muted);
|
||||
font-size: 11px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.08em;
|
||||
}
|
||||
|
||||
.hf-primitive-section-header h2 {
|
||||
margin: 0;
|
||||
color: var(--hf-primitive-text);
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.015em;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.hf-primitive-section-header p {
|
||||
margin: 3px 0 0;
|
||||
color: var(--hf-primitive-muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.hf-primitive-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
align-items: start;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.hf-primitive-card {
|
||||
display: block;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
border-radius: 14px;
|
||||
background: var(--hf-primitive-surface);
|
||||
color: var(--hf-primitive-text);
|
||||
text-decoration: none !important;
|
||||
box-shadow:
|
||||
0 0 0 1px var(--hf-primitive-border),
|
||||
0 1px 2px rgba(15, 23, 42, 0.05),
|
||||
0 8px 24px rgba(15, 23, 42, 0.06);
|
||||
transform: translateY(0) scale(1);
|
||||
transition-property: transform, box-shadow;
|
||||
transition-duration: 180ms;
|
||||
transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
|
||||
}
|
||||
|
||||
.hf-primitive-card:hover {
|
||||
color: var(--hf-primitive-text);
|
||||
box-shadow:
|
||||
0 0 0 1px var(--hf-primitive-border),
|
||||
0 3px 8px rgba(15, 23, 42, 0.08),
|
||||
0 18px 42px rgba(15, 23, 42, 0.12);
|
||||
transform: translateY(-2px) scale(1);
|
||||
}
|
||||
|
||||
.hf-primitive-card:active {
|
||||
transform: translateY(0) scale(0.96);
|
||||
}
|
||||
|
||||
.hf-primitive-card:focus-visible {
|
||||
outline: 3px solid var(--hf-primitive-focus);
|
||||
outline-offset: 3px;
|
||||
}
|
||||
|
||||
.hf-primitive-card .hf-player-frame {
|
||||
overflow: hidden;
|
||||
border-radius: 13px 13px 0 0;
|
||||
background: #0b0c0e;
|
||||
}
|
||||
|
||||
.hf-primitive-card .hf-embed-preview {
|
||||
transform: scale(1);
|
||||
transition: transform 180ms cubic-bezier(0.2, 0, 0, 1);
|
||||
}
|
||||
|
||||
.hf-primitive-card:hover .hf-embed-preview {
|
||||
transform: scale(1.015);
|
||||
}
|
||||
|
||||
.hf-primitive-card-body {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
padding: 16px;
|
||||
background: var(--hf-primitive-surface);
|
||||
}
|
||||
|
||||
.hf-primitive-card-heading {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
/* Deliberately not a heading element: a real heading inside the card's anchor
|
||||
made Mintlify nest an anchor inside an anchor, which broke hydration. */
|
||||
.hf-primitive-card-title {
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
color: var(--hf-primitive-text);
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.01em;
|
||||
line-height: 1.35;
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
.hf-primitive-card-aspect {
|
||||
flex: 0 0 auto;
|
||||
color: var(--hf-primitive-muted);
|
||||
font-size: 11px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
.hf-primitive-card-body > p {
|
||||
display: -webkit-box;
|
||||
margin: 8px 0 0;
|
||||
overflow: hidden;
|
||||
color: var(--hf-primitive-muted);
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
text-wrap: pretty;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 3;
|
||||
}
|
||||
|
||||
.hf-player-frame,
|
||||
.hf-player-host {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.hf-player-frame:not(.hf-player-frame-preview) {
|
||||
margin: 24px 0 32px;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
.hf-primitive-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
grid-auto-flow: dense;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.hf-primitive-card[data-orientation="portrait"] {
|
||||
grid-row: span 2;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 639px) {
|
||||
.hf-primitive-hero {
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.hf-primitive-sections {
|
||||
gap: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.hf-primitive-card,
|
||||
.hf-primitive-card .hf-embed-preview {
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.hf-primitive-card:hover,
|
||||
.hf-primitive-card:active,
|
||||
.hf-primitive-card:hover .hf-embed-preview {
|
||||
transform: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -517,6 +517,92 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab": "Primitives",
|
||||
"groups": [
|
||||
{
|
||||
"group": "Overview",
|
||||
"pages": [
|
||||
"primitives/index"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Annotation",
|
||||
"pages": [
|
||||
"primitives/caliper-caption-rail",
|
||||
"primitives/marker-highlight",
|
||||
"primitives/plan-room-audit",
|
||||
"primitives/whiteboard-ink"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Camera moves",
|
||||
"pages": [
|
||||
"primitives/caption-camera-follow",
|
||||
"primitives/depth-rack-focus",
|
||||
"primitives/focus-rack",
|
||||
"primitives/orbit-ring-camera"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Interface morphs",
|
||||
"pages": [
|
||||
"primitives/chevron-pill-card-morph"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Motion trails",
|
||||
"pages": [
|
||||
"primitives/echo-trail"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Text effects",
|
||||
"pages": [
|
||||
"primitives/glyph-ring-assemble",
|
||||
"primitives/kinetic-type-swap",
|
||||
"primitives/particle-text-dissolve",
|
||||
"primitives/version-plate-type"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Transitions",
|
||||
"pages": [
|
||||
"primitives/grade-split-reveal",
|
||||
"primitives/halftone-dissolve",
|
||||
"primitives/match-cut",
|
||||
"primitives/z-punch-through"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Card assembly",
|
||||
"pages": [
|
||||
"primitives/persona-card-fan",
|
||||
"primitives/receipt-card"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Process sequences",
|
||||
"pages": [
|
||||
"primitives/pill-row-collapse",
|
||||
"primitives/state-chip-rail"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Interaction",
|
||||
"pages": [
|
||||
"primitives/press-ripple"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "List assembly",
|
||||
"pages": [
|
||||
"primitives/rank-list-settle",
|
||||
"primitives/thread-message-stack"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"tab": "Packages",
|
||||
"groups": [
|
||||
|
||||
@@ -16,18 +16,34 @@
|
||||
function ensureStyles() {
|
||||
if (document.getElementById(STYLE_ID)) return;
|
||||
var css = [
|
||||
".hf-embed-row{display:flex;flex-direction:column;}",
|
||||
".hf-embed-row{display:flex;flex-direction:column;overflow:hidden;border-radius:16px;",
|
||||
"background:#0b0c0e;box-shadow:0 0 0 1px rgba(15,23,42,.12),0 12px 32px rgba(15,23,42,.08);}",
|
||||
".hf-embed-row.hf-embed-preview{border-radius:0;box-shadow:none;}",
|
||||
".hf-embed-row>[data-hf-player]{width:100%;}",
|
||||
".hf-knob-panel{box-sizing:border-box;padding:12px 16px 14px;",
|
||||
"display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px 20px;align-items:end;",
|
||||
"border-top:1px solid var(--hfk-border);background:var(--hfk-panel);",
|
||||
"--hfk-border:rgba(15,23,42,.12);--hfk-panel:rgba(15,23,42,.03);",
|
||||
"--hfk-fg:#0f172a;--hfk-muted:#64748b;--hfk-muted-bg:rgba(15,23,42,.06);",
|
||||
"--hfk-card:#ffffff;--hfk-ring:#0f172a;}",
|
||||
"html.dark .hf-knob-panel,[data-theme=dark] .hf-knob-panel{",
|
||||
"--hfk-border:rgba(226,232,240,.14);--hfk-panel:rgba(226,232,240,.04);",
|
||||
"--hfk-fg:#e2e8f0;--hfk-muted:#94a3b8;--hfk-muted-bg:rgba(226,232,240,.09);",
|
||||
"--hfk-card:#1e232b;--hfk-ring:#e2e8f0;}",
|
||||
"[data-hf-player]{position:relative;overflow:hidden;background:",
|
||||
"radial-gradient(circle at 50% 42%,#29303a 0,#15191f 42%,#0b0c0e 100%);}",
|
||||
"[data-hf-player]>hyperframes-player{position:absolute;inset:0;z-index:1;}",
|
||||
".hf-player-poster{position:absolute;inset:0;z-index:2;display:block;width:100%;height:100%;",
|
||||
"object-fit:cover;opacity:1;transition:opacity .18s ease-out;}",
|
||||
".hf-player-loading{position:absolute;right:12px;bottom:12px;z-index:3;padding:6px 9px;",
|
||||
"border-radius:999px;background:rgba(8,10,14,.78);color:#f8fafc;",
|
||||
"font:600 11px/1 system-ui,sans-serif;letter-spacing:.02em;",
|
||||
"box-shadow:0 0 0 1px rgba(255,255,255,.14);transition:opacity .18s ease-out;}",
|
||||
"[data-hf-ready] .hf-player-poster,[data-hf-ready] .hf-player-loading{opacity:0;pointer-events:none;}",
|
||||
"[data-hf-ready] [data-rmiz],[data-hf-ready] [data-rmiz-content]{pointer-events:none;}",
|
||||
".hf-embed-preview [data-hf-player]{pointer-events:none;}",
|
||||
".hf-player-error{position:absolute;inset:0;display:grid;place-items:center;padding:24px;",
|
||||
"z-index:4;background:#0b0c0e;color:#e2e8f0;",
|
||||
"font:500 14px/1.5 system-ui,sans-serif;text-align:center;}",
|
||||
".hf-knob-panel{box-sizing:border-box;padding:14px 16px 16px;",
|
||||
"display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr));",
|
||||
"gap:12px 20px;align-items:end;border-top:1px solid var(--hfk-border);",
|
||||
"background:var(--hfk-panel);--hfk-border:#d9dee8;--hfk-panel:#f8fafc;",
|
||||
"--hfk-fg:#172033;--hfk-muted:#526079;--hfk-muted-bg:#e9edf3;",
|
||||
"--hfk-card:#ffffff;--hfk-ring:#315efb;}",
|
||||
".dark .hf-knob-panel,[data-theme=dark] .hf-knob-panel{",
|
||||
"--hfk-border:#344054;--hfk-panel:#111827;--hfk-fg:#f1f5f9;",
|
||||
"--hfk-muted:#b8c3d4;--hfk-muted-bg:#263244;--hfk-card:#202938;--hfk-ring:#8fa8ff;}",
|
||||
".hf-knob-panel .hfk-title{font-size:11px;font-weight:600;letter-spacing:.08em;",
|
||||
"text-transform:uppercase;color:var(--hfk-muted);margin:0;grid-column:1/-1;}",
|
||||
".hfk-field-wide{grid-column:1/-1;}",
|
||||
@@ -35,16 +51,20 @@
|
||||
".hfk-label{font-size:13px;font-weight:500;color:var(--hfk-fg);display:flex;justify-content:space-between;align-items:baseline;}",
|
||||
".hfk-label .hfk-value{font-size:12px;font-weight:400;color:var(--hfk-muted);font-variant-numeric:tabular-nums;}",
|
||||
".hfk-seg{display:inline-flex;width:100%;box-sizing:border-box;padding:3px;border-radius:8px;background:var(--hfk-muted-bg);gap:2px;}",
|
||||
".hfk-seg button{flex:1 1 0;border:0;border-radius:6px;padding:6px 8px;font-size:13px;font-weight:500;",
|
||||
"background:transparent;color:var(--hfk-muted);cursor:pointer;transition:background .12s,color .12s;}",
|
||||
".hfk-seg button{flex:1 1 0;min-height:40px;border:0;border-radius:6px;padding:6px 8px;",
|
||||
"font-size:13px;font-weight:500;background:transparent;color:var(--hfk-muted);cursor:pointer;",
|
||||
"transition-property:background,color,box-shadow;transition-duration:.12s;}",
|
||||
".hfk-seg button[aria-pressed=true]{background:var(--hfk-card);color:var(--hfk-fg);box-shadow:0 1px 2px rgba(0,0,0,.18);}",
|
||||
".hfk-input{box-sizing:border-box;width:100%;height:34px;border-radius:8px;border:1px solid var(--hfk-border);",
|
||||
".hfk-input{box-sizing:border-box;width:100%;height:40px;border-radius:8px;border:1px solid var(--hfk-border);",
|
||||
"background:transparent;color:var(--hfk-fg);padding:0 10px;font-size:13px;outline:none;}",
|
||||
".hfk-input:focus{border-color:var(--hfk-ring);box-shadow:0 0 0 1px var(--hfk-ring);}",
|
||||
".hfk-range{width:100%;accent-color:var(--hfk-fg);height:20px;cursor:pointer;}",
|
||||
".hfk-select{box-sizing:border-box;width:100%;height:34px;border-radius:8px;border:1px solid var(--hfk-border);",
|
||||
".hfk-range{width:100%;accent-color:var(--hfk-fg);height:40px;cursor:pointer;}",
|
||||
".hfk-select{box-sizing:border-box;width:100%;height:40px;border-radius:8px;border:1px solid var(--hfk-border);",
|
||||
"background:var(--hfk-card);color:var(--hfk-fg);padding:0 10px;font-size:13px;outline:none;cursor:pointer;}",
|
||||
".hfk-select:focus{border-color:var(--hfk-ring);box-shadow:0 0 0 1px var(--hfk-ring);}",
|
||||
".hfk-seg button:focus-visible,.hfk-input:focus-visible,.hfk-range:focus-visible,.hfk-select:focus-visible{",
|
||||
"outline:3px solid var(--hfk-ring);outline-offset:2px;}",
|
||||
"@media(max-width:520px){.hf-knob-panel{grid-template-columns:1fr;padding:14px;}",
|
||||
".hfk-seg button,.hfk-input,.hfk-range,.hfk-select{min-height:44px;}}",
|
||||
"@media(prefers-reduced-motion:reduce){.hf-player-poster,.hf-player-loading{transition:none;}}",
|
||||
].join("");
|
||||
var tag = document.createElement("style");
|
||||
tag.id = STYLE_ID;
|
||||
@@ -69,7 +89,9 @@
|
||||
var options = null;
|
||||
if (Array.isArray(v.options)) {
|
||||
options = v.options.map(function (o) {
|
||||
return typeof o === "object" ? { value: o.value, label: o.label || o.value } : { value: o, label: o };
|
||||
return typeof o === "object"
|
||||
? { value: o.value, label: o.label || o.value }
|
||||
: { value: o, label: o };
|
||||
});
|
||||
}
|
||||
out.push({
|
||||
@@ -87,7 +109,9 @@
|
||||
var v = parsed[name] || {};
|
||||
var options = Array.isArray(v.options)
|
||||
? v.options.map(function (o) {
|
||||
return typeof o === "object" ? { value: o.value, label: o.label || o.value } : { value: o, label: o };
|
||||
return typeof o === "object"
|
||||
? { value: o.value, label: o.label || o.value }
|
||||
: { value: o, label: o };
|
||||
})
|
||||
: null;
|
||||
out.push({
|
||||
@@ -146,6 +170,7 @@
|
||||
if (applyTimer) clearTimeout(applyTimer);
|
||||
applyTimer = setTimeout(
|
||||
function () {
|
||||
el.seek(0);
|
||||
el.setAttribute("variables", JSON.stringify(values));
|
||||
},
|
||||
immediate ? 0 : 220,
|
||||
@@ -164,6 +189,7 @@
|
||||
if (k.options && k.options.length > 3) {
|
||||
var sel = document.createElement("select");
|
||||
sel.className = "hfk-select";
|
||||
sel.setAttribute("aria-label", k.label);
|
||||
k.options.forEach(function (o) {
|
||||
var opt = document.createElement("option");
|
||||
opt.value = o.value;
|
||||
@@ -180,6 +206,7 @@
|
||||
var seg = document.createElement("div");
|
||||
seg.className = "hfk-seg";
|
||||
seg.setAttribute("role", "group");
|
||||
seg.setAttribute("aria-label", k.label);
|
||||
k.options.forEach(function (o) {
|
||||
var b = document.createElement("button");
|
||||
b.type = "button";
|
||||
@@ -204,6 +231,7 @@
|
||||
var range = document.createElement("input");
|
||||
range.type = "range";
|
||||
range.className = "hfk-range";
|
||||
range.setAttribute("aria-label", k.label);
|
||||
range.min = String(k.min);
|
||||
range.max = String(k.max);
|
||||
range.value = String(k.value);
|
||||
@@ -218,6 +246,7 @@
|
||||
var input = document.createElement("input");
|
||||
input.type = "text";
|
||||
input.className = "hfk-input";
|
||||
input.setAttribute("aria-label", k.label);
|
||||
input.value = k.value === undefined || k.value === null ? "" : String(k.value);
|
||||
input.addEventListener("change", function () {
|
||||
values[k.name] = input.value;
|
||||
@@ -237,6 +266,16 @@
|
||||
return panel;
|
||||
}
|
||||
|
||||
function showError(host) {
|
||||
if (host.querySelector(".hf-player-error")) return;
|
||||
var error = document.createElement("div");
|
||||
error.className = "hf-player-error";
|
||||
error.setAttribute("role", "alert");
|
||||
error.textContent = "Preview unavailable.";
|
||||
host.setAttribute("aria-busy", "false");
|
||||
host.replaceChildren(error);
|
||||
}
|
||||
|
||||
function mountKnobs(host, el, row) {
|
||||
// Author override first; else auto-parse the composition's schema.
|
||||
var knobSpec = host.getAttribute("data-knobs");
|
||||
@@ -250,12 +289,34 @@
|
||||
}
|
||||
ready = Promise.resolve(knobs);
|
||||
} else {
|
||||
ready = fetch(host.getAttribute("data-src") || "", { credentials: "same-origin" })
|
||||
var src = host.getAttribute("data-src") || "";
|
||||
ready = fetch(src, { credentials: "same-origin" })
|
||||
.then(function (r) {
|
||||
return r.ok ? r.text() : "";
|
||||
if (!r.ok) throw new Error("Unable to load composition");
|
||||
return r.text();
|
||||
})
|
||||
.then(function (html) {
|
||||
var re = /data-composition-src=(?:'([^']*)'|"([^"]*)")/g;
|
||||
var sources = [];
|
||||
var m;
|
||||
while ((m = re.exec(html))) {
|
||||
var raw = decodeEntities(m[1] !== undefined ? m[1] : m[2]);
|
||||
var resolved = new URL(raw, new URL(src, document.baseURI)).href;
|
||||
if (!sources.includes(resolved)) sources.push(resolved);
|
||||
}
|
||||
return Promise.all(
|
||||
sources.map(function (source) {
|
||||
return fetch(source, { credentials: "same-origin" }).then(function (r) {
|
||||
if (!r.ok) throw new Error("Unable to load sub-composition");
|
||||
return r.text();
|
||||
});
|
||||
}),
|
||||
).then(function (children) {
|
||||
return extractSchema([html].concat(children).join("\n"));
|
||||
});
|
||||
})
|
||||
.then(extractSchema)
|
||||
.catch(function () {
|
||||
showError(host);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@@ -265,28 +326,113 @@
|
||||
});
|
||||
}
|
||||
|
||||
function mountAll() {
|
||||
document.querySelectorAll("[data-hf-player]:not([data-hf-mounted])").forEach(function (host) {
|
||||
host.setAttribute("data-hf-mounted", "true");
|
||||
var el = document.createElement("hyperframes-player");
|
||||
el.setAttribute("src", host.getAttribute("data-src") || "");
|
||||
function mountPlayer(host) {
|
||||
if (!host.isConnected) {
|
||||
host.removeAttribute("data-hf-mounting");
|
||||
return;
|
||||
}
|
||||
if (host.hasAttribute("data-hf-mounted")) return;
|
||||
host.setAttribute("data-hf-mounted", "true");
|
||||
host.removeAttribute("data-hf-mounting");
|
||||
host.removeAttribute("data-hf-observed");
|
||||
var el = document.createElement("hyperframes-player");
|
||||
el.setAttribute("src", host.getAttribute("data-src") || "");
|
||||
el.setAttribute("muted", "");
|
||||
el.setAttribute("width", host.getAttribute("data-width") || "1920");
|
||||
el.setAttribute("height", host.getAttribute("data-height") || "1080");
|
||||
var poster = host.getAttribute("data-poster");
|
||||
if (poster) el.setAttribute("poster", poster);
|
||||
var preview = host.getAttribute("data-hf-preview") === "true";
|
||||
if (preview) {
|
||||
el.setAttribute("autoplay", "");
|
||||
el.setAttribute("loop", "");
|
||||
el.setAttribute("aria-hidden", "true");
|
||||
} else {
|
||||
el.setAttribute("controls", "");
|
||||
el.setAttribute("muted", "");
|
||||
el.setAttribute("width", host.getAttribute("data-width") || "1920");
|
||||
el.setAttribute("height", host.getAttribute("data-height") || "1080");
|
||||
el.style.display = "block";
|
||||
el.style.width = "100%";
|
||||
// Without an explicit height the player's shadow wrappers collapse to
|
||||
// 0px under Mintlify's global CSS; the host div owns the aspect ratio.
|
||||
el.style.height = "100%";
|
||||
ensureStyles();
|
||||
var row = document.createElement("div");
|
||||
row.className = "hf-embed-row";
|
||||
host.parentNode.insertBefore(row, host);
|
||||
row.appendChild(host);
|
||||
host.replaceChildren(el);
|
||||
mountKnobs(host, el, row);
|
||||
}
|
||||
el.addEventListener(
|
||||
"ready",
|
||||
function () {
|
||||
host.setAttribute("data-hf-ready", "true");
|
||||
host.setAttribute("aria-busy", "false");
|
||||
},
|
||||
{ once: true },
|
||||
);
|
||||
el.addEventListener("error", function () {
|
||||
showError(host);
|
||||
});
|
||||
el.style.display = "block";
|
||||
el.style.width = "100%";
|
||||
// Without an explicit height the player's shadow wrappers collapse to
|
||||
// 0px under Mintlify's global CSS; the host div owns the aspect ratio.
|
||||
el.style.height = "100%";
|
||||
ensureStyles();
|
||||
var row = document.createElement("div");
|
||||
row.className = preview ? "hf-embed-row hf-embed-preview" : "hf-embed-row";
|
||||
host.parentNode.insertBefore(row, host);
|
||||
row.appendChild(host);
|
||||
host.appendChild(el);
|
||||
if (!preview) mountKnobs(host, el, row);
|
||||
}
|
||||
|
||||
function mountAfterPoster(host) {
|
||||
if (host.hasAttribute("data-hf-mounting") || host.hasAttribute("data-hf-mounted")) return;
|
||||
host.setAttribute("data-hf-mounting", "true");
|
||||
var poster = host.querySelector(".hf-player-poster");
|
||||
if (!poster || typeof poster.decode !== "function") {
|
||||
mountPlayer(host);
|
||||
return;
|
||||
}
|
||||
poster
|
||||
.decode()
|
||||
.catch(function () {})
|
||||
.then(function () {
|
||||
mountPlayer(host);
|
||||
});
|
||||
}
|
||||
|
||||
var observer =
|
||||
"IntersectionObserver" in window
|
||||
? new IntersectionObserver(function (entries) {
|
||||
entries.forEach(function (entry) {
|
||||
if (!entry.isIntersecting) return;
|
||||
observer.unobserve(entry.target);
|
||||
mountAfterPoster(entry.target);
|
||||
});
|
||||
})
|
||||
: null;
|
||||
|
||||
function mountAll() {
|
||||
document
|
||||
.querySelectorAll(
|
||||
"[data-hf-player]:not([data-hf-mounted]):not([data-hf-mounting]):not([data-hf-observed])",
|
||||
)
|
||||
.forEach(function (host) {
|
||||
ensureStyles();
|
||||
var poster = host.getAttribute("data-poster");
|
||||
if (poster && !host.querySelector(".hf-player-poster")) {
|
||||
var img = document.createElement("img");
|
||||
img.className = "hf-player-poster";
|
||||
img.src = poster;
|
||||
img.alt = "";
|
||||
img.loading = host.getAttribute("data-hf-preview") === "true" ? "lazy" : "eager";
|
||||
img.decoding = "async";
|
||||
img.setAttribute("aria-hidden", "true");
|
||||
host.appendChild(img);
|
||||
}
|
||||
if (!host.querySelector(".hf-player-loading")) {
|
||||
var loading = document.createElement("span");
|
||||
loading.className = "hf-player-loading";
|
||||
loading.textContent = "Loading preview";
|
||||
host.appendChild(loading);
|
||||
}
|
||||
if (!observer) {
|
||||
mountAfterPoster(host);
|
||||
return;
|
||||
}
|
||||
host.setAttribute("data-hf-observed", "true");
|
||||
observer.observe(host);
|
||||
});
|
||||
}
|
||||
|
||||
function start() {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
title: "Caliper Caption Rail"
|
||||
description: "A specification callout opens along a measurement rail, then the instrument rotates 90 degrees onto a long object axis and locks the type against it."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Annotation</span>
|
||||
|
||||
This primitive is composed for a 9:16 portrait canvas.
|
||||
|
||||
<PrimitivePlayer name="caliper-caption-rail" width={1080} height={1920} />
|
||||
|
||||
## When to use it
|
||||
|
||||
A portrait shot needs a large axial measurement label physically aligned with a long, narrow object.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Do not use it for 16x9, because its aspects declaration does not include 16x9 and the header makes the 1080x1920 portrait format non-negotiable.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [marker-highlight](/primitives/marker-highlight)
|
||||
- [receipt-card](/primitives/receipt-card)
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: "Caption Camera Follow"
|
||||
description: "New words stay fixed on an expanding page while the camera pulls back exponentially until the complete sentence is readable."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Camera moves</span>
|
||||
|
||||
<PrimitivePlayer name="caption-camera-follow" width={1920} height={1080} />
|
||||
|
||||
## When to use it
|
||||
|
||||
A sentence must accumulate word by word while each arrival reads at roughly the same screen size.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid placing scripts outside the composition root, because the host copies that markup without its behavior and produces a black card with no timeline.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [kinetic-type-swap](/primitives/kinetic-type-swap)
|
||||
- [glyph-ring-assemble](/primitives/glyph-ring-assemble)
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
title: "Chevron Pill Card Morph"
|
||||
description: "One surface changes from a circle to a pill to a card while one accent element stretches from a chevron disc into the card action bar."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Interface morphs</span>
|
||||
|
||||
This primitive is composed for a 9:16 portrait canvas.
|
||||
|
||||
<PrimitivePlayer name="chevron-pill-card-morph" width={1080} height={1920} />
|
||||
|
||||
## When to use it
|
||||
|
||||
A compact search or selection control must remain visibly continuous as it expands into a checkout-style card.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Do not use it when verified 16x9 support is required, because its aspects declaration does not include 16x9.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [press-ripple](/primitives/press-ripple)
|
||||
- [state-chip-rail](/primitives/state-chip-rail)
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: "Depth Rack Focus"
|
||||
description: "A sharp foreground dissolves into bokeh as a blurred message behind it resolves while the whole stack creeps forward."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Camera moves</span>
|
||||
|
||||
<PrimitivePlayer name="depth-rack-focus" width={1920} height={1080} />
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `kicker` | `string` | `Q3 RESULTS` | Small line above the message. |
|
||||
| `headline` | `string` | `Revenue doubled` | The message the focus resolves onto. |
|
||||
| `accent` | `enum` | `amber` | Foreground bokeh colour. |
|
||||
|
||||
## When to use it
|
||||
|
||||
Attention must transfer once from a near plane to a message on a far plane.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when animated blur is unacceptable, because blur on the foreground and message planes is the stated focus mechanic.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [focus-rack](/primitives/focus-rack)
|
||||
- [z-punch-through](/primitives/z-punch-through)
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: "Echo Trail"
|
||||
description: "A slotted subject travels along an authored path with lagged ghost copies that collapse into it and disappear at rest."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Motion trails</span>
|
||||
|
||||
<PrimitivePlayer name="echo-trail" width={1920} height={1080} />
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `echoes` | `number` | `4` | Ghost copy count, clamped 2 to 6. |
|
||||
| `delta` | `number` | `0.09` | Lag between successive ghosts in seconds, clamped 0.03 to 0.3. |
|
||||
| `path` | `enum` | `sweep` | Authored traversal preset. |
|
||||
| `accent` | `enum` | `green` | Subject accent color: green rides --brand, blue rides --accent, violet rides --accent-2. |
|
||||
| `exit` | `enum` | `none` | Optional departure. Default none: the settled element holds until the frame cuts. |
|
||||
|
||||
## When to use it
|
||||
|
||||
One moving subject needs an onion-skin trail that shows its recent positions before a clean landing.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when more than six ghosts or a lag outside 0.03 to 0.3 seconds is required, because echoes are limited to 2 through 6 and delta is clamped to that range.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [particle-text-dissolve](/primitives/particle-text-dissolve)
|
||||
- [orbit-ring-camera](/primitives/orbit-ring-camera)
|
||||
|
||||
## Install
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash Terminal
|
||||
npx hyperframes add echo-trail
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
title: "Focus Rack"
|
||||
description: "Focus moves exactly once from a sharp near card to a blurred, dim far card as blur, scale, and parallax change together."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Camera moves</span>
|
||||
|
||||
<PrimitivePlayer name="focus-rack" width={1920} height={1080} />
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `label_a` | `string` | `Draft` | Label on the card that begins in focus. |
|
||||
| `label_b` | `string` | `Published` | Label on the card that receives focus. |
|
||||
| `accent` | `enum` | `blue` | Highlight color shared by both cards. |
|
||||
|
||||
## When to use it
|
||||
|
||||
Two cards at different apparent depths need one clear handoff from the foreground state to the background state.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when focus must alternate repeatedly, because the rack occurs exactly once over 0.7 seconds.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [depth-rack-focus](/primitives/depth-rack-focus)
|
||||
- [match-cut](/primitives/match-cut)
|
||||
|
||||
## Install
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash Terminal
|
||||
npx hyperframes add focus-rack
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: "Glyph Ring Assemble"
|
||||
description: "Arc-set letters leave a wordmark in reverse reading order, each completes one full orbit around a shared ring, and the letters close back into the word."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Text effects</span>
|
||||
|
||||
<PrimitivePlayer name="glyph-ring-assemble" width={1920} height={1080} />
|
||||
|
||||
## When to use it
|
||||
|
||||
A readable wordmark must break into individually staggered glyphs without leaving a single shared circular path.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when every glyph must remain visible throughout the orbit, because a glyph crossing the central mark vanishes for about 0.3 seconds.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [kinetic-type-swap](/primitives/kinetic-type-swap)
|
||||
- [version-plate-type](/primitives/version-plate-type)
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: "Grade Split Reveal"
|
||||
description: "A hard vertical edge sweeps left to right across two aligned copies of one plate, pauses at the midpoint for comparison, then reveals the graded copy across the full frame."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Transitions</span>
|
||||
|
||||
<PrimitivePlayer name="grade-split-reveal" width={1920} height={1080} />
|
||||
|
||||
## When to use it
|
||||
|
||||
The same image or video must show a direct before-and-after color comparison in one frame.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it for text, SVG, or ordinary DOM content, because the documented color grading applies only to image and video media.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [halftone-dissolve](/primitives/halftone-dissolve)
|
||||
- [match-cut](/primitives/match-cut)
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: "Halftone Dissolve"
|
||||
description: "Accent dots appear on a fixed grid, open into windows onto scene B, and merge until scene B replaces scene A."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Transitions</span>
|
||||
|
||||
<PrimitivePlayer name="halftone-dissolve" width={1920} height={1080} />
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `dot_size` | `enum` | `medium` | Grid pitch for the halftone field. |
|
||||
| `direction` | `enum` | `ltr` | Threshold ordering: ltr sweeps left to right, center grows from the middle, noise scatters. |
|
||||
| `dissolve_at` | `number` | `1.1` | Seconds from mount start when the dissolve begins. |
|
||||
| `accent` | `enum` | `green` | Ink dot color: green rides --brand, blue rides --accent, violet rides --accent-2. |
|
||||
| `exit` | `enum` | `none` | Optional departure. Default none: scene B holds until the frame cuts. |
|
||||
|
||||
## When to use it
|
||||
|
||||
Two slotted scenes need a textured transition whose reveal can sweep left to right, grow from center, or scatter from a seeded map.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid cueing the dissolve so late that its 1.3-second transition and any exit cannot fit, because dissolve_at is clamped to keep both inside the clip.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [grade-split-reveal](/primitives/grade-split-reveal)
|
||||
- [match-cut](/primitives/match-cut)
|
||||
|
||||
## Install
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash Terminal
|
||||
npx hyperframes add halftone-dissolve
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
@@ -0,0 +1,420 @@
|
||||
---
|
||||
title: "Video Primitives"
|
||||
description: "An index of the certified video primitives and their live previews"
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<div className="not-prose hf-primitive-hero">
|
||||
<span className="hf-primitive-eyebrow">Motion catalog</span>
|
||||
<p>Explore 25 production-ready motion patterns. Each preview is live, seekable, and ready to tune.</p>
|
||||
</div>
|
||||
|
||||
<div className="not-prose hf-primitive-sections">
|
||||
|
||||
<section className="hf-primitive-section">
|
||||
<header className="hf-primitive-section-header">
|
||||
<span className="hf-primitive-section-index">01</span>
|
||||
<div>
|
||||
<h2>Annotation</h2>
|
||||
<p>4 primitives</p>
|
||||
</div>
|
||||
</header>
|
||||
<div className="hf-primitive-grid">
|
||||
|
||||
<a href="/primitives/caliper-caption-rail" className="hf-primitive-card" data-orientation="portrait">
|
||||
<PrimitivePlayer name="caliper-caption-rail" width={1080} height={1920} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Caliper Caption Rail</span>
|
||||
<span className="hf-primitive-card-aspect">9:16</span>
|
||||
</div>
|
||||
<p>A specification callout opens along a measurement rail, then the instrument rotates 90 degrees onto a long object axis and locks the type against it.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/marker-highlight" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="marker-highlight" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Marker Highlight</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>A short display line settles in, then one SVG marker stroke draws over the first matched word or phrase.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/plan-room-audit" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="plan-room-audit" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Plan Room Audit</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>A floor plan sheet rotates clockwise into square while its walls draw, then five rooms fill and receive leader tags in reading order.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/whiteboard-ink" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="whiteboard-ink" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Whiteboard Ink</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>SVG paths draw one stroke at a time while a pen nib follows each active path tip and hops between strokes.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="hf-primitive-section">
|
||||
<header className="hf-primitive-section-header">
|
||||
<span className="hf-primitive-section-index">02</span>
|
||||
<div>
|
||||
<h2>Camera moves</h2>
|
||||
<p>4 primitives</p>
|
||||
</div>
|
||||
</header>
|
||||
<div className="hf-primitive-grid">
|
||||
|
||||
<a href="/primitives/caption-camera-follow" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="caption-camera-follow" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Caption Camera Follow</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>New words stay fixed on an expanding page while the camera pulls back exponentially until the complete sentence is readable.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/depth-rack-focus" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="depth-rack-focus" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Depth Rack Focus</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>A sharp foreground dissolves into bokeh as a blurred message behind it resolves while the whole stack creeps forward.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/focus-rack" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="focus-rack" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Focus Rack</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>Focus moves exactly once from a sharp near card to a blurred, dim far card as blur, scale, and parallax change together.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/orbit-ring-camera" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="orbit-ring-camera" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Orbit Ring Camera</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>A camera tracks a lit head around a tilted ring, then dollies out to reveal the full ellipse, eight stations, and three rotating inner rails.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="hf-primitive-section">
|
||||
<header className="hf-primitive-section-header">
|
||||
<span className="hf-primitive-section-index">03</span>
|
||||
<div>
|
||||
<h2>Interface morphs</h2>
|
||||
<p>1 primitive</p>
|
||||
</div>
|
||||
</header>
|
||||
<div className="hf-primitive-grid">
|
||||
|
||||
<a href="/primitives/chevron-pill-card-morph" className="hf-primitive-card" data-orientation="portrait">
|
||||
<PrimitivePlayer name="chevron-pill-card-morph" width={1080} height={1920} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Chevron Pill Card Morph</span>
|
||||
<span className="hf-primitive-card-aspect">9:16</span>
|
||||
</div>
|
||||
<p>One surface changes from a circle to a pill to a card while one accent element stretches from a chevron disc into the card action bar.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="hf-primitive-section">
|
||||
<header className="hf-primitive-section-header">
|
||||
<span className="hf-primitive-section-index">04</span>
|
||||
<div>
|
||||
<h2>Motion trails</h2>
|
||||
<p>1 primitive</p>
|
||||
</div>
|
||||
</header>
|
||||
<div className="hf-primitive-grid">
|
||||
|
||||
<a href="/primitives/echo-trail" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="echo-trail" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Echo Trail</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>A slotted subject travels along an authored path with lagged ghost copies that collapse into it and disappear at rest.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="hf-primitive-section">
|
||||
<header className="hf-primitive-section-header">
|
||||
<span className="hf-primitive-section-index">05</span>
|
||||
<div>
|
||||
<h2>Text effects</h2>
|
||||
<p>4 primitives</p>
|
||||
</div>
|
||||
</header>
|
||||
<div className="hf-primitive-grid">
|
||||
|
||||
<a href="/primitives/glyph-ring-assemble" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="glyph-ring-assemble" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Glyph Ring Assemble</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>Arc-set letters leave a wordmark in reverse reading order, each completes one full orbit around a shared ring, and the letters close back into the word.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/kinetic-type-swap" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="kinetic-type-swap" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Kinetic Type Swap</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>A fixed sentence rolls one masked word slot vertically through a list of options without changing the sentence layout.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/particle-text-dissolve" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="particle-text-dissolve" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Particle Text Dissolve</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>Seeded particles either assemble into a crisp text line or depart from that line into a fading cloud.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/version-plate-type" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="version-plate-type" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Version Plate Type</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>Oversized glyph plates stamp into a cluster, hard-cut to fitted words inside a selection box, then the box widens, shortens, closes on the letters, and pushes off frame.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="hf-primitive-section">
|
||||
<header className="hf-primitive-section-header">
|
||||
<span className="hf-primitive-section-index">06</span>
|
||||
<div>
|
||||
<h2>Transitions</h2>
|
||||
<p>4 primitives</p>
|
||||
</div>
|
||||
</header>
|
||||
<div className="hf-primitive-grid">
|
||||
|
||||
<a href="/primitives/grade-split-reveal" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="grade-split-reveal" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Grade Split Reveal</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>A hard vertical edge sweeps left to right across two aligned copies of one plate, pauses at the midpoint for comparison, then reveals the graded copy across the full frame.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/halftone-dissolve" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="halftone-dissolve" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Halftone Dissolve</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>Accent dots appear on a fixed grid, open into windows onto scene B, and merge until scene B replaces scene A.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/match-cut" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="match-cut" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Match Cut</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>Scene A drives a circle into center-frame geometry, a hard single-frame swap reveals scene B with a matching circle, and that circle immediately shrinks as scene B settles.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/z-punch-through" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="z-punch-through" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Z Punch Through</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>The camera moves through an opening in a front wall as that wall passes the lens and the back plane advances into its settled state.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="hf-primitive-section">
|
||||
<header className="hf-primitive-section-header">
|
||||
<span className="hf-primitive-section-index">07</span>
|
||||
<div>
|
||||
<h2>Card assembly</h2>
|
||||
<p>2 primitives</p>
|
||||
</div>
|
||||
</header>
|
||||
<div className="hf-primitive-grid">
|
||||
|
||||
<a href="/primitives/persona-card-fan" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="persona-card-fan" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Persona Card Fan</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>Four portrait cards deal onto the right side one at a time while displaced cards scale and rotate into a fixed outer wedge that tightens as it fills.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/receipt-card" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="receipt-card" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Receipt Card</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>A tilted quote card flies in from the right, settles flat, pushes in slowly, then fills selection boxes behind one phrase while the marked words turn white.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="hf-primitive-section">
|
||||
<header className="hf-primitive-section-header">
|
||||
<span className="hf-primitive-section-index">08</span>
|
||||
<div>
|
||||
<h2>Process sequences</h2>
|
||||
<p>2 primitives</p>
|
||||
</div>
|
||||
</header>
|
||||
<div className="hf-primitive-grid">
|
||||
|
||||
<a href="/primitives/pill-row-collapse" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="pill-row-collapse" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Pill Row Collapse</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>Five labeled pills build left to right, hold for reading, then pills two through five spread and clear while the first pill glides to center and becomes active.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/state-chip-rail" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="state-chip-rail" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">State Chip Rail</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>A row of status chips snaps through ordered states on scheduled cues while active, completed, and pending chips take distinct appearances.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="hf-primitive-section">
|
||||
<header className="hf-primitive-section-header">
|
||||
<span className="hf-primitive-section-index">09</span>
|
||||
<div>
|
||||
<h2>Interaction</h2>
|
||||
<p>1 primitive</p>
|
||||
</div>
|
||||
</header>
|
||||
<div className="hf-primitive-grid">
|
||||
|
||||
<a href="/primitives/press-ripple" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="press-ripple" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Press Ripple</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>A cursor decelerates onto a positioned target, compresses with it, releases two ripple rings, and exits while the pressed state remains.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="hf-primitive-section">
|
||||
<header className="hf-primitive-section-header">
|
||||
<span className="hf-primitive-section-index">10</span>
|
||||
<div>
|
||||
<h2>List assembly</h2>
|
||||
<p>2 primitives</p>
|
||||
</div>
|
||||
</header>
|
||||
<div className="hf-primitive-grid">
|
||||
|
||||
<a href="/primitives/rank-list-settle" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="rank-list-settle" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Rank List Settle</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>A ranked list rolls upward under a fixed focus line, washes out passing rows, and stops with the final winning row fully lit on that line.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<a href="/primitives/thread-message-stack" className="hf-primitive-card" data-orientation="landscape">
|
||||
<PrimitivePlayer name="thread-message-stack" width={1920} height={1080} preview />
|
||||
<div className="hf-primitive-card-body">
|
||||
<div className="hf-primitive-card-heading">
|
||||
<span className="hf-primitive-card-title">Thread Message Stack</span>
|
||||
<span className="hf-primitive-card-aspect">16:9</span>
|
||||
</div>
|
||||
<p>Message bubbles land on the bottom line over a moving background, push older messages upward under a mask, and show a typing pill before each incoming message.</p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
title: "Kinetic Type Swap"
|
||||
description: "A fixed sentence rolls one masked word slot vertically through a list of options without changing the sentence layout."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Text effects</span>
|
||||
|
||||
<PrimitivePlayer name="kinetic-type-swap" width={1920} height={1080} />
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `prefix` | `string` | `Ship` | Fixed sentence text before the rolling word slot. |
|
||||
| `options` | `string` | `faster,smarter,together` | Comma-separated words shown in the rolling slot. |
|
||||
| `suffix` | `string` | `""` | Fixed sentence text after the rolling word slot. |
|
||||
| `cues` | `string` | `""` | Comma-separated seconds (from mount start) for each word swap. Empty keeps the authored even spread. |
|
||||
| `accent` | `enum` | `green` | Color used by the rolling word slot. |
|
||||
| `exit` | `enum` | `none` | Optional departure. Default none: the sentence holds until the frame cuts. |
|
||||
|
||||
## When to use it
|
||||
|
||||
A headline must keep its prefix and suffix stationary while one word changes through several authored choices.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when the sentence may reflow during a swap, because the slot is pre-sized to the widest option and all options occupy one grid cell.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [caption-camera-follow](/primitives/caption-camera-follow)
|
||||
- [marker-highlight](/primitives/marker-highlight)
|
||||
|
||||
## Install
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash Terminal
|
||||
npx hyperframes add kinetic-type-swap
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
title: "Marker Highlight"
|
||||
description: "A short display line settles in, then one SVG marker stroke draws over the first matched word or phrase."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Annotation</span>
|
||||
|
||||
<PrimitivePlayer name="marker-highlight" width={1920} height={1080} />
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `text` | `string` | `Ship it with confidence` | Full line of display text. |
|
||||
| `emphasis_word` | `string` | `confidence` | First case-insensitive substring match in text receives the marker. Empty or unmatched draws no marker. |
|
||||
| `style` | `enum` | `highlight` | Shape of the hand-drawn marker stroke. |
|
||||
| `draw_at` | `number` | `0.9` | Second (from mount start) the marker starts drawing. Clamped so the stroke completes before any exit. |
|
||||
| `accent` | `enum` | `green` | Marker ink color from the contract token map. |
|
||||
| `exit` | `enum` | `none` | Optional departure. Default none: the lockup holds until the frame cuts. |
|
||||
|
||||
## When to use it
|
||||
|
||||
One specific word or short phrase in a single line needs a timed highlight, circle, underline, or scribble.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when the emphasized phrase must wrap, because the header requires the match to stay on one line.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [kinetic-type-swap](/primitives/kinetic-type-swap)
|
||||
- [receipt-card](/primitives/receipt-card)
|
||||
|
||||
## Install
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash Terminal
|
||||
npx hyperframes add marker-highlight
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
title: "Match Cut"
|
||||
description: "Scene A drives a circle into center-frame geometry, a hard single-frame swap reveals scene B with a matching circle, and that circle immediately shrinks as scene B settles."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Transitions</span>
|
||||
|
||||
<PrimitivePlayer name="match-cut" width={1920} height={1080} />
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `accent` | `enum` | `green` | Color shared by the matched circles. |
|
||||
| `label_a` | `string` | `Start` | Text inside the outgoing button. |
|
||||
| `label_b` | `string` | `Done` | Result text revealed after the cut. |
|
||||
|
||||
## When to use it
|
||||
|
||||
Two scenes share a circle that can carry motion continuously across a precise hard cut.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when a crossfade is required, because scene A becomes invisible and scene B visible at the same timeline instant.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [grade-split-reveal](/primitives/grade-split-reveal)
|
||||
- [z-punch-through](/primitives/z-punch-through)
|
||||
|
||||
## Install
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash Terminal
|
||||
npx hyperframes add match-cut
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: "Orbit Ring Camera"
|
||||
description: "A camera tracks a lit head around a tilted ring, then dollies out to reveal the full ellipse, eight stations, and three rotating inner rails."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Camera moves</span>
|
||||
|
||||
<PrimitivePlayer name="orbit-ring-camera" width={1920} height={1080} />
|
||||
|
||||
## When to use it
|
||||
|
||||
A close tracked journey along a loop must resolve into a complete system view with all stations visible.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when square or portrait framing needs the same composition quality as landscape, because those aspects are only re-aimed while the move is composed for 16x9.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [echo-trail](/primitives/echo-trail)
|
||||
- [plan-room-audit](/primitives/plan-room-audit)
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: "Particle Text Dissolve"
|
||||
description: "Seeded particles either assemble into a crisp text line or depart from that line into a fading cloud."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Text effects</span>
|
||||
|
||||
<PrimitivePlayer name="particle-text-dissolve" width={1920} height={1080} />
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `text` | `string` | `Dissolve` | The line that assembles from (or dissolves into) the particle cloud. |
|
||||
| `direction` | `enum` | `in` | in assembles the text from the cloud and holds it crisp; out erases the text into the cloud and holds empty. |
|
||||
| `density` | `enum` | `med` | Particle count cap for the field. |
|
||||
| `accent` | `enum` | `green` | Text and particle color: green rides --brand, blue rides --accent, violet rides --accent-2. |
|
||||
| `exit` | `enum` | `none` | Optional departure. Default none: the end state holds until the frame cuts. |
|
||||
|
||||
## When to use it
|
||||
|
||||
A single text line must visibly form from particles or disintegrate into them with a left-to-right front.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid the out direction when visible content must remain during the hold, because that direction ends on an empty stage.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [kinetic-type-swap](/primitives/kinetic-type-swap)
|
||||
- [echo-trail](/primitives/echo-trail)
|
||||
|
||||
## Install
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash Terminal
|
||||
npx hyperframes add particle-text-dissolve
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: "Persona Card Fan"
|
||||
description: "Four portrait cards deal onto the right side one at a time while displaced cards scale and rotate into a fixed outer wedge that tightens as it fills."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Card assembly</span>
|
||||
|
||||
<PrimitivePlayer name="persona-card-fan" width={1920} height={1080} />
|
||||
|
||||
## When to use it
|
||||
|
||||
Options must appear beside a presenter while the deepest card stays pinned and newer cards subdivide the same fan.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when portrait or square framing must be as fully composed as landscape, because those aspects are only kept inside the frame and the move is composed for 16x9.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [thread-message-stack](/primitives/thread-message-stack)
|
||||
- [receipt-card](/primitives/receipt-card)
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: "Pill Row Collapse"
|
||||
description: "Five labeled pills build left to right, hold for reading, then pills two through five spread and clear while the first pill glides to center and becomes active."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Process sequences</span>
|
||||
|
||||
<PrimitivePlayer name="pill-row-collapse" width={1920} height={1080} />
|
||||
|
||||
## When to use it
|
||||
|
||||
A five-stage process must narrow visibly to its first stage after all five labels have been shown together.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when a label may be bisected during reveal, because the type-in clip is deliberately quantized to character boundaries.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [state-chip-rail](/primitives/state-chip-rail)
|
||||
- [rank-list-settle](/primitives/rank-list-settle)
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: "Plan Room Audit"
|
||||
description: "A floor plan sheet rotates clockwise into square while its walls draw, then five rooms fill and receive leader tags in reading order."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Annotation</span>
|
||||
|
||||
<PrimitivePlayer name="plan-room-audit" width={1920} height={1080} />
|
||||
|
||||
## When to use it
|
||||
|
||||
A portrait floor-plan scene needs a room-by-room audit whose count stays synchronized with the filled rooms.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when the shot must be natively composed for landscape, because the header states that it is native to 9x16 and composed only for that orientation.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [caliper-caption-rail](/primitives/caliper-caption-rail)
|
||||
- [whiteboard-ink](/primitives/whiteboard-ink)
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: "Press Ripple"
|
||||
description: "A cursor decelerates onto a positioned target, compresses with it, releases two ripple rings, and exits while the pressed state remains."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Interaction</span>
|
||||
|
||||
<PrimitivePlayer name="press-ripple" width={1920} height={1080} />
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `label` | `string` | `Get started` | Text inside the default pill target. |
|
||||
| `target_x` | `number` | `50` | Zone center, percent of host width. |
|
||||
| `target_y` | `number` | `50` | Zone center, percent of host height. |
|
||||
| `press_at` | `number` | `1.4` | Seconds from mount start when the press begins. |
|
||||
| `cursor` | `enum` | `light` | Pointer tone. |
|
||||
| `accent` | `enum` | `green` | Contract color for the ripple ink and pressed fill. |
|
||||
| `exit` | `enum` | `none` | How the frame leaves. None holds the pressed state. |
|
||||
|
||||
## When to use it
|
||||
|
||||
A caller-supplied interface target needs one explicit press gesture with a visible impact and release.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid cueing the press outside the safe gesture window, because press_at is clamped so arrival, compression, ripple, and exit all fit inside the duration.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [chevron-pill-card-morph](/primitives/chevron-pill-card-morph)
|
||||
- [state-chip-rail](/primitives/state-chip-rail)
|
||||
|
||||
## Install
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash Terminal
|
||||
npx hyperframes add press-ripple
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
@@ -0,0 +1,29 @@
|
||||
---
|
||||
title: "Rank List Settle"
|
||||
description: "A ranked list rolls upward under a fixed focus line, washes out passing rows, and stops with the final winning row fully lit on that line."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">List assembly</span>
|
||||
|
||||
<PrimitivePlayer name="rank-list-settle" width={1920} height={1080} />
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `title` | `string` | `Cost per commit` | The line the winning row lands on. |
|
||||
|
||||
## When to use it
|
||||
|
||||
A comparison must build to one winner whose emphasis is determined by its physical position at the stop.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when the winner cannot be the last row, because the geometry parks only the last row on the focus line and requires that row to carry the winner class.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [pill-row-collapse](/primitives/pill-row-collapse)
|
||||
- [state-chip-rail](/primitives/state-chip-rail)
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: "Receipt Card"
|
||||
description: "A tilted quote card flies in from the right, settles flat, pushes in slowly, then fills selection boxes behind one phrase while the marked words turn white."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Card assembly</span>
|
||||
|
||||
<PrimitivePlayer name="receipt-card" width={1920} height={1080} />
|
||||
|
||||
## When to use it
|
||||
|
||||
A portrait quote card needs one phrase marked in place after the card has landed.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when landscape must be the native composition, because the header identifies the card as 9x16 native and authors its safe zone for 9x16.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [marker-highlight](/primitives/marker-highlight)
|
||||
- [persona-card-fan](/primitives/persona-card-fan)
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
title: "State Chip Rail"
|
||||
description: "A row of status chips snaps through ordered states on scheduled cues while active, completed, and pending chips take distinct appearances."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Process sequences</span>
|
||||
|
||||
<PrimitivePlayer name="state-chip-rail" width={1920} height={1080} />
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `states` | `string` | `Queued,Reading,Drafting,Done` | Comma-separated chip labels in machine order (2 to 8 states). |
|
||||
| `times` | `string` | `""` | Comma-separated activation times in seconds, one per advance (state 1 onward). Blank entries use the default even rhythm. |
|
||||
| `badge_state` | `number` | `1` | Index of the state the badges pop beside. |
|
||||
| `badges` | `string` | `""` | Comma-separated badge labels shown beside the badge state. Empty disables. |
|
||||
| `accent` | `enum` | `green` | Accent token family used by the active chip. |
|
||||
| `exit` | `enum` | `none` | How the rail leaves the frame. Default none: the hold ends the film. |
|
||||
|
||||
## When to use it
|
||||
|
||||
A discrete state machine needs seek-exact, instantaneous advances and optional badges beside one activated state.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when more than eight states or more than four badges are required, because extra states are dropped and badges are capped at four.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [pill-row-collapse](/primitives/pill-row-collapse)
|
||||
- [press-ripple](/primitives/press-ripple)
|
||||
|
||||
## Install
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash Terminal
|
||||
npx hyperframes add state-chip-rail
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
title: "Thread Message Stack"
|
||||
description: "Message bubbles land on the bottom line over a moving background, push older messages upward under a mask, and show a typing pill before each incoming message."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">List assembly</span>
|
||||
|
||||
<PrimitivePlayer name="thread-message-stack" width={1920} height={1080} />
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `--tms-roll-bg` | `color` | | base under the moving blobs and letterbox color for replacement footage. |
|
||||
| `--tms-out-fill` | `color` | `#2D89E1` | outgoing bubble fill. |
|
||||
| `--tms-out-ink` | `color` | | outgoing bubble text color. |
|
||||
| `--tms-in-fill` | `color` | | incoming bubble fill. |
|
||||
| `--tms-in-ink` | `color` | | incoming bubble text color. |
|
||||
| `--tms-tag-ink` | `color` | | sender tag text color. |
|
||||
| `--tms-radius` | `length` | | bubble corner radius. |
|
||||
|
||||
## When to use it
|
||||
|
||||
A conversation must build through alternating incoming and outgoing bubbles while the background continues moving.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when frame zero must be empty, because the thread deliberately opens on three settled bubbles.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [persona-card-fan](/primitives/persona-card-fan)
|
||||
- [receipt-card](/primitives/receipt-card)
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: "Version Plate Type"
|
||||
description: "Oversized glyph plates stamp into a cluster, hard-cut to fitted words inside a selection box, then the box widens, shortens, closes on the letters, and pushes off frame."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Text effects</span>
|
||||
|
||||
<PrimitivePlayer name="version-plate-type" width={1920} height={1080} />
|
||||
|
||||
## When to use it
|
||||
|
||||
A word sequence must read as text being manipulated one axis at a time by a visible selection box.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when every word must retain its natural proportions, because resolved words are fitted to one constant ink width and the box separately changes width and height.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [glyph-ring-assemble](/primitives/glyph-ring-assemble)
|
||||
- [kinetic-type-swap](/primitives/kinetic-type-swap)
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: "Whiteboard Ink"
|
||||
description: "SVG paths draw one stroke at a time while a pen nib follows each active path tip and hops between strokes."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Annotation</span>
|
||||
|
||||
<PrimitivePlayer name="whiteboard-ink" width={1920} height={1080} />
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `sketch` | `enum` | `bulb` | Authored preset sketch to draw. Ignored when the strokes slot holds custom paths. |
|
||||
| `caption` | `string` | `Draw the idea` | Short line shown after the sketch completes. |
|
||||
| `pen` | `enum` | `show` | Show or hide the pen nib actor. |
|
||||
| `accent` | `enum` | `green` | Color used by strokes marked data-ink=accent (one highlight stroke in each preset). |
|
||||
| `exit` | `enum` | `none` | How the completed lockup leaves. none holds the final frame. |
|
||||
|
||||
## When to use it
|
||||
|
||||
A preset or caller-supplied SVG sketch needs sequential ink drawing with a traveling pen actor and a caption after completion.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid supplying non-path slot content, because only path elements inside the strokes group become the drawing.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [marker-highlight](/primitives/marker-highlight)
|
||||
- [plan-room-audit](/primitives/plan-room-audit)
|
||||
|
||||
## Install
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```bash Terminal
|
||||
npx hyperframes add whiteboard-ink
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: "Z Punch Through"
|
||||
description: "The camera moves through an opening in a front wall as that wall passes the lens and the back plane advances into its settled state."
|
||||
---
|
||||
|
||||
import { PrimitivePlayer } from "/snippets/PrimitivePlayer.jsx";
|
||||
|
||||
<span className="hf-primitive-eyebrow">Transitions</span>
|
||||
|
||||
<PrimitivePlayer name="z-punch-through" width={1920} height={1080} />
|
||||
|
||||
## Variables
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `front` | `string` | `BEFORE` | Text on the wall the camera punches through. |
|
||||
| `back` | `string` | `AFTER` | Text on the plane behind the wall. |
|
||||
| `accent` | `enum` | `blue` | Light behind the aperture. |
|
||||
|
||||
## When to use it
|
||||
|
||||
A scene change must feel like forward travel through an aperture rather than a flat scale zoom.
|
||||
|
||||
## When to avoid it
|
||||
|
||||
Avoid it when the clip needs a hold, because the documented 2.10-second envelope is filled by the move and has no hold.
|
||||
|
||||
## Pairs with
|
||||
|
||||
- [match-cut](/primitives/match-cut)
|
||||
- [depth-rack-focus](/primitives/depth-rack-focus)
|
||||
@@ -0,0 +1,578 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
caliper-caption-rail
|
||||
====================
|
||||
A spec callout opens along a measurement rail, then the whole instrument
|
||||
rotates onto the product's long axis and locks the type against it.
|
||||
|
||||
REFERENCE reversals/_pool/adagency/reference-clip.mp4 @ 23.976fps
|
||||
(one frame = 1000/23.976 = 41.708ms)
|
||||
Every number below was measured at full resolution, 1080x1920, on
|
||||
frames pulled one pass from the source with ffmpeg -q:v 1. Caption
|
||||
mask: min(RGB) > 238 and (max-min) < 26, whole mask, no component
|
||||
filtering. At f192 the mask IS the caption: the product is a brushed
|
||||
phone edge that never clears 238, so nothing else is in it.
|
||||
Measured windows: f119-f145, f176-f204, f229-f238.
|
||||
|
||||
FORMAT 1080x1920, portrait, not negotiable. The reference lands its caption
|
||||
at 90 degrees running most of the product's length. A 1080-tall
|
||||
landscape frame cannot hold a 1200px vertical axis with jaws on it.
|
||||
|
||||
THE LOCKUP IS THE POINT, AND IT IS A LATERAL FACT
|
||||
Reference f192, full resolution:
|
||||
caption ink bbox x 388-467, y 378-1187
|
||||
caption axial length 809.0 cross-axis ink 78.8
|
||||
phone near edge 497.6 (column profile over
|
||||
y600-1150 ramps 493 -> 502, half
|
||||
rise 497.6; the ramp START is 493)
|
||||
phone far edge 544 so the phone is 46px wide,
|
||||
edge on: 1195 / 46 = 26:1, a 160mm
|
||||
x 6.5mm handset seen on its side
|
||||
phone top / bottom 371.7 / 1570 +/- 5
|
||||
So: clearance from the caption's ink to the product's near edge is
|
||||
28px, which is 0.36 cap heights. The type is not beside the product,
|
||||
it is ON it. Round 2 shipped 147px, 5.2x too far, and the whole
|
||||
channel between them was empty (max pixel 29/255 across 90 columns),
|
||||
which is what made the type read as an annotation floating next to a
|
||||
diagram. CLEAR below is that 28px and it is the single most
|
||||
load-bearing number in this file.
|
||||
|
||||
Two more lockup facts from the same frame, both now built:
|
||||
near-end flush caption ymin 378 against product ymin 371.7, so
|
||||
the type starts 6px inside the product's near end
|
||||
far-end tail 383px of bare product below the caption's end
|
||||
length ratio 809.0 / 1195 = 0.677
|
||||
|
||||
THE TYPE IS THE SUBJECT, AND THE LABEL IS WHAT SIZES IT
|
||||
Reference caption, f179 through f204: cross-axis ink 78.8 to 80.5,
|
||||
axial length 809.1 +/- 0.5 (rigid, no scale), 21035 ink px at f192,
|
||||
string "The thinnest and", 16 chars. That is a headline lying along
|
||||
the product, not an annotation beside it. The other instance in the
|
||||
same film ("lightest Z Flip", f235) measures 96px of ink WITH
|
||||
descenders, the same cap height once the g and p are taken off. One
|
||||
house scale, two strings.
|
||||
|
||||
So font-size is the constant and the label is the variable. At this
|
||||
type scale the honest 21-character label "5.8 mm at its thinnest"
|
||||
renders 1090px in this stack, wider than the frame; the fix is the
|
||||
label, not the font-size. The rail-fits-the-frame check at the
|
||||
bottom of the file is that budget, and it warns rather than clipping.
|
||||
|
||||
WHAT THE HORIZONTAL RAIL IS, AND WHAT IT IS NOT
|
||||
Round 2 set the jaw-to-jaw SPAN equal to PRODUCT_H. That one line
|
||||
was three defects at once: it made the horizontal rail 1068px inside
|
||||
a 1080px frame, it therefore capped PRODUCT_H at about 1032 (ratio
|
||||
0.815 against the reference's 0.677), and it pinned the beam to
|
||||
540 +/- 6, frame centre, which is what forced the 147px channel.
|
||||
None of the three could be closed by nudging a constant.
|
||||
|
||||
THE RAIL SPANS THE CALLOUT, NOT THE PRODUCT. SPAN is the caption's
|
||||
own ink length plus one JAW_PAD at each end, so the jaws bracket the
|
||||
thing the instrument is actually reading out: the label. That is
|
||||
forced, not chosen. PRODUCT_H is 1228 (see below) and a horizontal
|
||||
rail bracketing it would be 1264px wide in a 1080px frame, so a
|
||||
product-spanning caliper cannot exist in this format at all. It is
|
||||
also what the reference does: its horizontal caption instance is
|
||||
535px in a 1080 frame, half the width, not 99% of it.
|
||||
|
||||
The consequence is not a compromise, it is the reference's own
|
||||
lockup falling out of the arithmetic. Set JAW_PAD equal to the
|
||||
measured 6px near-end flush and the fixed jaw's face lands exactly
|
||||
on the product's near end, the type starts 6px after it, and 385px
|
||||
of bare product is left below the sliding jaw against the
|
||||
reference's 383. Those three were separate targets before; now they
|
||||
are one identity, JAW_PAD == FLUSH.
|
||||
|
||||
With SPAN off PRODUCT_H, the beam is free, so it is placed where the
|
||||
reference puts the type: BEAM_X is derived backwards from CLEAR.
|
||||
The rotation axis CX is no longer RIG_W/2 either, which is what buys
|
||||
the rail the room to sit off-centre without cropping.
|
||||
|
||||
THE JAWS GRIP THE WHOLE WORKPIECE
|
||||
Round 2's arms ran x540 to x690 and covered 40 of the product's
|
||||
150px, 27%, which is a caliper holding the near quarter of the thing
|
||||
it claims to be measuring. JAW_REACH is now derived: the arms start
|
||||
at the beam and end JAW_OVER past the product's FAR edge, so they
|
||||
cross 100% of it. JAW_REACH sets nothing else now; in round 2 it also
|
||||
set BEAM_X, which is why it could not be reduced.
|
||||
|
||||
WHAT THE PRODUCT PLACEHOLDER IS, AND THE ONE INPUT THAT IS NOT THE REFERENCE'S
|
||||
#product is a hatched slab with a dashed outline, deliberately ugly
|
||||
so nobody ships it. SWAP POINT: replace that one div with an <img> or
|
||||
<video>. PRODUCT_TOP / PRODUCT_H / PRODUCT_LEFT / PRODUCT_W are the
|
||||
whole input and every other number is arithmetic on them.
|
||||
PRODUCT_H = 1228 is the reference's ratio solved for this label:
|
||||
832 rendered ink / 0.677 = 1228.9. PRODUCT_TOP = 346 centres it in
|
||||
1920 the way the reference's 371.7 / 1570 centres a 1195px phone.
|
||||
PRODUCT_W = 150 is the one input that is NOT the reference's: its
|
||||
product is 46px wide because it is a phone shot edge on, and a 46px
|
||||
placeholder would be useless for any other swap. It is also the only
|
||||
input that does not enter a measured ratio. Stated so nobody reads it
|
||||
as unmeasured.
|
||||
|
||||
THE MOVE, AS MEASURED
|
||||
1. OPEN. The sliding jaw rides left along the rail and the caption is uncovered
|
||||
behind it, right end first. Both reference instances reveal right to left
|
||||
with the right end pinned: f229-f238 pins xmax at 825-826 while the front
|
||||
runs 818 -> 254, and f120-f140 pins xmax at 815-817 while the front runs
|
||||
817 -> 282.
|
||||
2. LOCK. The instrument rotates 90 degrees onto the product's axis and travels
|
||||
there at the same time. Not one after the other: see ROT.
|
||||
|
||||
WHY THE CLIP ENDS WHEN THE MOVE DOES
|
||||
The reference holds after the lock. From f196 through f204 the caption's
|
||||
mask is identical to the pixel (n=21208, cx 432.3, cy 776.0, L 808.1 on
|
||||
every frame; re-extracted this round and reproduced exactly). There is
|
||||
nothing still resolving to copy, so the clip stops when the move stops
|
||||
instead of welding a freeze on. Neither beat is scaled: OPEN is the
|
||||
reference's own measured mean wipe speed applied over this rail's length,
|
||||
and ROT is the measured rotation duration.
|
||||
|
||||
That lands DUR at 2.090s, which is 23ms above the 2.067s floor below which
|
||||
32 samples sit closer than two rendered frames. It is close, and it is close
|
||||
because it is derived: SPAN over WIPE_SPEED plus ROT, nothing padded. The
|
||||
batch auditor still flags UNDER-RESOLVED on this clip, because it recovers
|
||||
the duration from a snapshot filename rounded to one decimal, so 2.028s
|
||||
reads as 2.0 and it computes 1.995 instead of 2.023. Re-shot at 63 frames,
|
||||
roughly one rendered frame apart, all 62 consecutive pairs differ, minimum
|
||||
mean absolute delta 0.089/255. Nothing here is frozen; do not lengthen the
|
||||
clip to move an estimator.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<style>
|
||||
html, body { width: 1080px; height: 1920px; overflow: hidden; margin: 0; }
|
||||
|
||||
#root {
|
||||
position: absolute; inset: 0;
|
||||
/* Tokens live on #root, never :root, so they cannot leak into a sibling clip. */
|
||||
--bg: #0e0d0c;
|
||||
--ink: #ffffff;
|
||||
--rail: rgba(255, 255, 255, 0.5);
|
||||
--slab-a: #26231f;
|
||||
--slab-b: #1b1916;
|
||||
background: var(--bg);
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
/* ---- the placeholder product -------------------------------------------
|
||||
Diagonal hatch plus a dashed outline. Reads as "not the real asset" from
|
||||
across the room, which is the job. Its BOX is set from the script, not
|
||||
here, so there is exactly one place the product's geometry lives. ----- */
|
||||
#product {
|
||||
position: absolute;
|
||||
border-radius: 44px;
|
||||
border: 1px dashed rgba(255, 255, 255, 0.2);
|
||||
background: repeating-linear-gradient(45deg,
|
||||
var(--slab-a) 0 14px, var(--slab-b) 14px 28px);
|
||||
}
|
||||
|
||||
/* ---- the instrument -----------------------------------------------------
|
||||
#rig is the ONLY thing the lock beat transforms, so the beam, the ticks,
|
||||
the two jaws, the cover and the caption stay rigid relative to each other
|
||||
through the rotation. Rotating them separately is how a caliper comes apart
|
||||
mid-move, and the reference is rigid to half a pixel across 26 frames.
|
||||
|
||||
DOM ORDER IS LOAD BEARING HERE. #cover is an opaque slab of --bg that hides
|
||||
the caption, and it must paint OVER #cap and UNDER everything metal, so the
|
||||
beam and ticks stay visible to the left of the slider. Move #cover after
|
||||
#beam and the rail disappears behind it.
|
||||
|
||||
Every position inside the rig is written by the script in rig-local pixels.
|
||||
Nothing here carries a number, on purpose: a hardcoded left or top in this
|
||||
block is a number that stops agreeing with the product the moment someone
|
||||
swaps it. ----------------------------------------------------------- */
|
||||
#rig { position: absolute; }
|
||||
#beam { position: absolute; left: 0; background: var(--rail); }
|
||||
/* Ruler ticks, on the side AWAY from the workpiece, because post-lock the only
|
||||
thing between the beam and the product is the 28px of clearance the caption
|
||||
needs. Static: the reference's rail is a prop that exists before the caption
|
||||
does, it never draws itself on. */
|
||||
#ticks { position: absolute; left: 0; }
|
||||
/* The span being measured: a bright segment of the beam between the two jaws.
|
||||
Right-anchored at the fixed jaw's face so it grows leftward with the slider. */
|
||||
#span { position: absolute; width: 0; background: var(--ink); }
|
||||
.jaw { position: absolute; width: 6px; background: var(--ink); }
|
||||
/* The slider thumb. Chunky on purpose: it is the part of a caliper you push,
|
||||
and it is what makes the open beat read at a glance. */
|
||||
#thumb { position: absolute; width: 30px; background: var(--ink); border-radius: 4px; }
|
||||
|
||||
#cap { position: absolute; white-space: nowrap;
|
||||
color: var(--ink); font-weight: 600; letter-spacing: -0.015em; }
|
||||
/* The wipe. This is an opaque slab travelling on the SAME x tween as the jaw,
|
||||
with its right edge on the jaw's face, so the reveal front IS the jaw by
|
||||
construction and cannot drift from it under any ease. Round 2 animated a
|
||||
wrapper's width on a second tween with its own start time and duration,
|
||||
which is only equivalent while both are linear. It is clipped to the
|
||||
caption's ink band, not to the whole rig: a full-height cover would sweep a
|
||||
bg-coloured rectangle across the product post-lock and erase its lower end. */
|
||||
#cover { position: absolute; background: var(--bg); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" class="clip" data-composition-id="caliper-caption-rail" data-start="0"
|
||||
data-width="1080" data-height="1920" data-duration="2.090">
|
||||
|
||||
<!-- SWAP POINT: your product goes here. Keep the id, drop the hatch. -->
|
||||
<div id="product"></div>
|
||||
|
||||
<div id="rig">
|
||||
<!-- SWAP POINT: the label. The budget is checked at load, see the bottom. -->
|
||||
<div id="cap">Just 5.8 mm thin</div>
|
||||
<div id="cover"></div>
|
||||
<div id="beam"></div>
|
||||
<div id="ticks"></div>
|
||||
<div id="span"></div>
|
||||
<div class="jaw" id="jawFixed"></div>
|
||||
<div class="jaw" id="jawSlide"></div>
|
||||
<div id="thumb"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
// CSS owns every rest state and the timeline only ever moves things away from it.
|
||||
// Without this, a fromTo scheduled late stamps its FROM value at construction and
|
||||
// the opening frame shows the end of the clip.
|
||||
gsap.defaults({ immediateRender: false });
|
||||
|
||||
// =========================================================================
|
||||
// THE SWAP CONTRACT
|
||||
// =========================================================================
|
||||
// These four numbers are the whole input. Everything below them is arithmetic,
|
||||
// and there is no second copy of any of them in the CSS.
|
||||
//
|
||||
// The one thing that does NOT follow automatically is data-duration in the
|
||||
// markup, because the runtime reads that attribute before this script runs.
|
||||
// The check at the bottom of this file tells you the number to paste.
|
||||
const PRODUCT_TOP = 346; // (1920 - PRODUCT_H) / 2, the reference's own centring
|
||||
const PRODUCT_H = 1228; // 832 rendered axial ink / 0.677 measured ratio = 1228.9
|
||||
const PRODUCT_LEFT = 544; // chosen so the rail clears both frame edges, see the check
|
||||
const PRODUCT_W = 150; // NOT the reference's 46, see the header
|
||||
|
||||
// ---- reference constants, lateral ---------------------------------------
|
||||
// ref f192: caption ink xmax 467, phone near edge 497.6 by half-rise on a
|
||||
// column profile over y600-1150 (the ramp runs 493 to 502). Taking the ramp's
|
||||
// start, the first column that is unambiguously product, gives 493 and a
|
||||
// clearance of 26; the half-rise gives 30.6. 28 is the centre and it is the
|
||||
// number the whole lockup hangs on.
|
||||
const CLEAR = 28;
|
||||
// ref f192: caption ymin 378 against product ymin 371.7. The type starts just
|
||||
// inside the product's near end. Reused as the jaw pad, which is what puts the
|
||||
// fixed jaw's face exactly on the product's end. See the header.
|
||||
const FLUSH = 6;
|
||||
const JAW_PAD = FLUSH;
|
||||
// Gap from the beam's axis to the caption's near ink edge. Not a reference
|
||||
// number: the reference has no instrument. It is the smallest gap that leaves
|
||||
// the 3px beam a visible sliver of its own, and it comes OUT of CLEAR, so
|
||||
// raising it walks the caption away from the product.
|
||||
const BEAM_GAP = 16;
|
||||
// Cosmetic overhang past each jaw's outermost position, and the jaw tip's
|
||||
// overhang past the product's far edge.
|
||||
const RAIL_END = 18;
|
||||
const TICK_LEN = 14;
|
||||
const JAW_OVER = 14;
|
||||
|
||||
// ---- reference constants, timing ----------------------------------------
|
||||
// WIPE SPEED. ref f119-f140, the slow reveal instance, re-measured this round
|
||||
// at full resolution with a cumulative-ink front estimator: for each frame,
|
||||
// total caption ink in the band y850-1000, solved back through the fully
|
||||
// revealed frame's column profile for the x where that much ink lies to the
|
||||
// right. That is robust to letterform quantisation, which a leftmost-ink
|
||||
// scan is not.
|
||||
// front leaves its pinned start (817) between f119 (zero ink) and f120
|
||||
// (84 ink px, front 813), so f119.9
|
||||
// front reaches its pinned end (282) at f140, the first frame whose ink
|
||||
// total equals the fully revealed template's
|
||||
// 535px in 20.1 frames = 0.8383s -> 638 px/s
|
||||
// Both events are the same kind of event, the front sitting at a pinned
|
||||
// extreme, measured on one estimator. A leftmost-ink scan on the same frames
|
||||
// puts the arrival at f138 and gives 709 px/s; it reads the leading
|
||||
// antialiased edge and its early frames are contaminated by specular
|
||||
// highlights outside the caption (it puts f120's front at 763 where only 54px
|
||||
// of string exists). The honest spread on this channel is 638 to 709.
|
||||
//
|
||||
// This is a SPEED, not a duration, and that distinction matters more here than
|
||||
// anywhere else in the file. An earlier build took the 709ms the slow instance
|
||||
// lasts and spent it on the jaw's full travel, which made the caption's own
|
||||
// front run 1250 px/s, 2.2x the channel the number was measured on. A speed
|
||||
// transfers between a 535px reference caption and an 843px rail. A duration
|
||||
// does not.
|
||||
const WIPE_SPEED = 638; // px/s at 1080x1920, mean over the eased reveal
|
||||
|
||||
// WIPE EASE. The front decelerates, and round 2's ease:"none" was wrong.
|
||||
// Measured three ways on f120-f140, all at full resolution:
|
||||
// half-travel landmark the front passes the midpoint (549.5) at f126.5,
|
||||
// which is 0.343 of a 19.8 frame reveal. For
|
||||
// (1-p)^k = 0.5 at p = 0.343, k = 1.6.
|
||||
// least squares, end pinned to the frame the reveal demonstrably finishes:
|
||||
// k=1 RMS 33.5 px
|
||||
// k=1.5 RMS 21.2
|
||||
// k=2 RMS 20.8
|
||||
// k=2.5 RMS 36.9
|
||||
// leftmost-ink scan half-travel at f123, k = 3.7
|
||||
// Left unconstrained the least squares walks k up to 3 and beyond, but only by
|
||||
// pushing the end time to f151, eleven frames after the front visibly stops.
|
||||
// That is the estimator's own tail lag, not motion: a freshly uncovered stroke
|
||||
// crosses the 238 threshold a frame or two after it geometrically exists.
|
||||
// So the exponent is bracketed, not resolved: 1.6 by the cumulative estimator,
|
||||
// 3.7 by the leftmost scan, and the two are confounded by the occluder being a
|
||||
// hand-dragged phone at a diagonal, so no 1-D front estimator is measuring a
|
||||
// straight edge. k=2 is the centre of the bracket. What all three agree on and
|
||||
// what actually changes the look: linear is refuted, by 1.6x to 3x on RMS. The
|
||||
// reference uncovers half the string in the first third of the reveal; round 2
|
||||
// uncovered a third.
|
||||
//
|
||||
// k=2 IS power1.out, NOT power2.out. See the note on ROT: GSAP's powerN is
|
||||
// degree N+1.
|
||||
const WIPE_EASE = "power1.out";
|
||||
|
||||
// ref f176-f195, rotation. The caption's principal-axis angle runs 180 -> 90.
|
||||
// Remaining angle fitted as 90 * (1 - p)^k by least squares over f178-f195:
|
||||
// k free -> k = 2.962, start f176.18, end f194.44, RMS 0.148 deg
|
||||
// k = 3 -> start f176.19, end f194.60, RMS 0.150 deg
|
||||
// k = 2 -> start f175.70, end f190.60, RMS 0.895 deg, 6.0x worse
|
||||
// The direct tell is flatter than the fit: the per-frame decrement of
|
||||
// cbrt(remaining/90) sits at -0.0537 +/- 0.0008 from f179 to f186 and never
|
||||
// leaves -0.054 to -0.059 through f190, while sqrt(remaining/90) decays
|
||||
// monotonically from -0.0798 to -0.0462, a 73% spread. An earlier read of this
|
||||
// window quoted only f179-f184, which is the middle, where every ease is
|
||||
// straight. So the exponent is 3, cubic, and the window is 18.40 frames,
|
||||
// 18.40 * 41.708ms = 767ms.
|
||||
//
|
||||
// THE EXPONENT IS 3 AND THE GSAP NAME FOR IT IS power2.out, NOT power3.out.
|
||||
// GSAP's powerN is degree N+1: parseEase("power1.out")(p) recovers k = 2 at
|
||||
// every sample point, power2.out recovers 3, power3.out recovers 4, checked
|
||||
// against gsap 3.14.2 rather than from memory. Shipping the ease whose NAME
|
||||
// matches the measured exponent puts a quartic on a cubic channel: seeking this
|
||||
// rig at t = 2.0s with power3.out reads -68.7 deg where power2.out reads -59.5.
|
||||
// Fit an exponent to the reference, then translate the exponent to a name; do
|
||||
// not read the name off the fit.
|
||||
const ROT = 0.767;
|
||||
|
||||
// ---- the caption ---------------------------------------------------------
|
||||
// font-size is a reference measurement, not a fitting knob. 110px in this stack
|
||||
// renders 79px of cap-plus-ascender ink against the reference's 78.8 to 80.5,
|
||||
// and 832px of axial ink, both read back out of this file's own frame 31.
|
||||
const FS = 110;
|
||||
const cap = document.getElementById("cap");
|
||||
cap.style.fontSize = FS + "px";
|
||||
cap.style.lineHeight = FS + "px";
|
||||
|
||||
// Measure the label once, at build time, so nothing here can drift under a seek.
|
||||
// The caption is a SWAP POINT, so the ink box is measured rather than guessed: a
|
||||
// label with a descender sits lower in its line box than one without, and a
|
||||
// hardcoded constant would put it off the beam by however much the guess was
|
||||
// wrong. letterSpacing has to be set on the context too, or the canvas reports
|
||||
// 25px more advance than the DOM renders at -0.015em over 16 characters.
|
||||
//
|
||||
// AND THE INK BOX IS READ OUT OF PIXELS, NOT OUT OF measureText.
|
||||
// actualBoundingBoxDescent reports the font's OUTLINE extent; the rasteriser
|
||||
// puts the last 2.5px of this label's J tail below the alpha that this file, the
|
||||
// reference measurement and every critic all threshold at. Trusting the outline
|
||||
// box shipped a 31px clearance from a file that says 28, on the one number the
|
||||
// whole lockup hangs on. Rasterising the label and scanning it makes CLEAR mean
|
||||
// the same thing in the file and in the render, for any label.
|
||||
const FONT = `600 ${FS}px "Helvetica Neue", Helvetica, Arial, sans-serif`;
|
||||
const TRACK = "-0.015em";
|
||||
const probe = document.createElement("canvas").getContext("2d");
|
||||
probe.font = FONT;
|
||||
probe.letterSpacing = TRACK;
|
||||
const tm = probe.measureText(cap.textContent);
|
||||
// Where the DOM puts the baseline inside a line box of exactly FS: half-leading
|
||||
// above the font's own ascent.
|
||||
const baseline = (FS - (tm.fontBoundingBoxAscent + tm.fontBoundingBoxDescent)) / 2
|
||||
+ tm.fontBoundingBoxAscent;
|
||||
|
||||
const PAD = 60;
|
||||
const cv = document.createElement("canvas");
|
||||
cv.width = Math.ceil(tm.width) + 2 * PAD;
|
||||
cv.height = FS + 2 * PAD;
|
||||
const c2 = cv.getContext("2d");
|
||||
c2.font = FONT;
|
||||
c2.letterSpacing = TRACK;
|
||||
c2.textBaseline = "alphabetic";
|
||||
c2.fillStyle = "#fff";
|
||||
// Draw with the element's own left edge and line box top both at PAD.
|
||||
c2.fillText(cap.textContent, PAD, PAD + baseline);
|
||||
const bytes = c2.getImageData(0, 0, cv.width, cv.height).data;
|
||||
let ix0 = cv.width, ix1 = -1, iy0 = cv.height, iy1 = -1;
|
||||
for (let y = 0; y < cv.height; y++) {
|
||||
for (let x = 0; x < cv.width; x++) {
|
||||
// 240/255 alpha, the same cut the reference caption was masked at.
|
||||
if (bytes[(y * cv.width + x) * 4 + 3] >= 240) {
|
||||
if (x < ix0) ix0 = x;
|
||||
if (x > ix1) ix1 = x;
|
||||
if (y < iy0) iy0 = y;
|
||||
if (y > iy1) iy1 = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
// The offscreen context antialiases one step softer than the page's own
|
||||
// rasteriser, so its ink box runs one row and one column wider than what the
|
||||
// element actually paints at the same 240 cut. Read back out of this file's own
|
||||
// frame 31: canvas 833 x 80, rendered caption 832 x 79. It is an edge effect, so
|
||||
// it is at most one per axis, and the test that it is right is the rendered
|
||||
// clearance. Correcting it HERE and not at each use is the point: an earlier
|
||||
// build carried it as a +2 inside BEAM_X, which made the lateral edge land and
|
||||
// left the near-end flush 2px out, because the same error also sits in INK_W.
|
||||
const RASTER_SLOP = 1;
|
||||
const INK_W = ix1 - ix0 + 1 - RASTER_SLOP; // axial ink length
|
||||
const CAP_INK_H = iy1 - iy0 + 1 - RASTER_SLOP; // cross-axis ink, cap plus descender
|
||||
const INK_LEFT = ix0 - PAD; // ink inset from the element's left edge
|
||||
const INK_TOP = iy0 - PAD; // ink inset from the line box top
|
||||
|
||||
// ---- derived geometry, along the rail ------------------------------------
|
||||
// The rail brackets the CALLOUT. SPAN is the label's ink plus one pad at each
|
||||
// end, and that is the whole reason the rig fits a 1080px frame at all.
|
||||
const SPAN = INK_W + 2 * JAW_PAD;
|
||||
const RIG_W = SPAN + 2 * RAIL_END;
|
||||
const JAW_END = RAIL_END; // local x, sliding jaw's face, full open
|
||||
const JAW_START = RAIL_END + SPAN; // local x, both jaw faces at rest
|
||||
const INK_X0 = JAW_END + JAW_PAD; // local x, caption's first ink
|
||||
const CAP_LEFT = INK_X0 - INK_LEFT; // local x, caption element's box
|
||||
|
||||
// ---- derived geometry, across the rail -----------------------------------
|
||||
// Under rotate(-90deg) a rig-local offset (dx, dy) from the rotation axis lands
|
||||
// at screen offset (dy, -dx). So local +y is the workpiece side and local -y is
|
||||
// the outside; local +x becomes screen -y, so the string reads bottom to top
|
||||
// with its last character at the top.
|
||||
//
|
||||
// WHY -90 AND NOT +90. The reference's lock starts with the caption upside down
|
||||
// and unrolls, because a CUT sits between its open beat and its lock beat and
|
||||
// the two shots are separately framed. A single continuous primitive cannot
|
||||
// have both a readable horizontal reveal and an upside-down start, so the phase
|
||||
// is a choice. -90 is the one that keeps the reference's LAYOUT: the caption
|
||||
// lands left of the product and the jaws reach right across it, which is the
|
||||
// reference at f192 (ink 388-467, phone 497-544), and the string reads bottom
|
||||
// to top, which is also the reference at f192. +90 would mirror the lockup, put
|
||||
// the product on the left and flip the reading direction. The layout is what
|
||||
// reads as the lockup; the 180-degree start phase is an artifact of the cut.
|
||||
const OFF = BEAM_GAP + CAP_INK_H / 2; // beam axis to caption ink centre
|
||||
const CY = 24; // local y of the beam, room for the ticks
|
||||
|
||||
// ---- where the rig sits --------------------------------------------------
|
||||
// THE ROOT FIX. The beam is placed backwards from the caption's clearance, not
|
||||
// forwards from the jaw's reach. Round 2 had BEAM_X = PRODUCT_LEFT + 40 -
|
||||
// JAW_REACH, which meant the arms' length decided how far the type sat from the
|
||||
// product; at JAW_REACH = 150 that was 147px of empty channel.
|
||||
// The +1 is the inclusive-column convention and nothing else. CLEAR is measured
|
||||
// the way a critic measures it, from the last LIT caption column to the
|
||||
// product's first product column, so the gap between them is one column shorter
|
||||
// than the difference of the two coordinates. The rasteriser's own pixel is
|
||||
// handled once, up at RASTER_SLOP, not here.
|
||||
const BEAM_X = PRODUCT_LEFT - CLEAR - CAP_INK_H - BEAM_GAP + 1;
|
||||
// Now JAW_REACH is the derived one: from the beam, across the whole product,
|
||||
// JAW_OVER past its far edge.
|
||||
const JAW_REACH = PRODUCT_LEFT + PRODUCT_W + JAW_OVER - BEAM_X;
|
||||
const RIG_H = CY + JAW_REACH;
|
||||
|
||||
// The rotation axis. It is NOT the rig's centre. Pre-lock the caption's ink
|
||||
// centre sits at local x CX + CAP_DX; post-lock it sits at screen
|
||||
// BEAM_X + CAP_DY where CAP_DY is its local y offset. Zero lateral excursion
|
||||
// therefore means CAP_DX == CAP_DY == OFF, which fixes CX. Round 2 got the same
|
||||
// guarantee by forcing the caption to the rig's centre instead, which cost
|
||||
// 2 * OFF of extra rail and is what pinned the beam to frame centre.
|
||||
// The reference's own lateral excursion across the lock is nothing: caption cx
|
||||
// goes 447.7 (f179) to 418.8 (f183) to 432.0 (f192), a 28.9px arc on a channel
|
||||
// whose cy travels 988px.
|
||||
const CX = INK_X0 + INK_W / 2 - OFF; // local x of the rotation axis
|
||||
const RIG_L = BEAM_X - CX;
|
||||
// Pre-lock top: the rail rests on the bottom of the frame, which is as far from
|
||||
// the product as the frame allows and therefore the longest travel available.
|
||||
const RIG_T = 1920 - RIG_H - 28;
|
||||
// The lock's whole translation. The axis lands OFF above the caption's target
|
||||
// ink centre, and that centre is the near-end flush: FLUSH inside the product's
|
||||
// near end. There is no x: see CX.
|
||||
const AXIS_Y = PRODUCT_TOP + FLUSH + INK_W / 2 + OFF;
|
||||
const TRAVEL = AXIS_Y - (RIG_T + CY);
|
||||
|
||||
// ---- timing --------------------------------------------------------------
|
||||
// One speed drives the whole OPEN beat, and one ease, because the jaw, the span
|
||||
// readout and the wipe front are the same edge.
|
||||
const OPEN = +(SPAN / WIPE_SPEED).toFixed(3);
|
||||
const DUR = +(OPEN + ROT).toFixed(3);
|
||||
|
||||
// ---- write the geometry --------------------------------------------------
|
||||
const px = (n) => n + "px";
|
||||
const set = (id, s) => Object.assign(document.getElementById(id).style, s);
|
||||
|
||||
set("product", { left: px(PRODUCT_LEFT), top: px(PRODUCT_TOP),
|
||||
width: px(PRODUCT_W), height: px(PRODUCT_H) });
|
||||
// transform-origin is declared in CSS, not tweened, so GSAP reads it and never
|
||||
// fights it. A CSS `transform` on this element would be discarded the first
|
||||
// time the rotation runs; transform-origin is not a transform.
|
||||
set("rig", { left: px(RIG_L), top: px(RIG_T), width: px(RIG_W), height: px(RIG_H),
|
||||
transformOrigin: `${CX}px ${CY}px` });
|
||||
// The caption is anchored by its ink's NEAR edge, at BEAM_GAP off the beam, so
|
||||
// its far edge lands on PRODUCT_LEFT - CLEAR by construction whatever the label.
|
||||
set("cap", { left: px(CAP_LEFT), top: px(CY + BEAM_GAP - INK_TOP) });
|
||||
set("cover", { left: px(JAW_START - SPAN - 40), width: px(SPAN + 40),
|
||||
top: px(CY + BEAM_GAP - 14), height: px(CAP_INK_H + 28) });
|
||||
set("beam", { top: px(CY - 1), width: px(RIG_W), height: "3px" });
|
||||
set("ticks", { top: px(CY - 1 - TICK_LEN), width: px(RIG_W), height: px(TICK_LEN),
|
||||
background: "repeating-linear-gradient(to right,"
|
||||
+ " var(--rail) 0 2px, transparent 2px 40px)" });
|
||||
set("span", { right: px(RIG_W - JAW_START), top: px(CY - 2), height: "7px" });
|
||||
set("jawFixed", { left: px(JAW_START), top: px(CY), height: px(JAW_REACH) });
|
||||
set("jawSlide", { left: px(JAW_START - 6), top: px(CY), height: px(JAW_REACH) });
|
||||
set("thumb", { left: px(JAW_START - 18), top: px(CY - 20), height: "40px" });
|
||||
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
|
||||
// ---- beat 1: OPEN --------------------------------------------------------
|
||||
// Three channels, one velocity, one ease. The cover travels with the jaw and
|
||||
// its right edge is the jaw's face, so the reveal front cannot disagree with
|
||||
// the slider by even a pixel.
|
||||
tl.to("#jawSlide, #thumb, #cover", { x: -SPAN, duration: OPEN, ease: WIPE_EASE }, 0)
|
||||
.to("#span", { width: SPAN, duration: OPEN, ease: WIPE_EASE }, 0);
|
||||
|
||||
// ---- beat 2: LOCK --------------------------------------------------------
|
||||
// Rotation and travel are ONE tween because the source runs them as one event
|
||||
// on two channels. Fitting the caption's cy the same way as its angle gives
|
||||
// k = 3.115 with RMS 1.66px, against k = 2 at RMS 13.15px: same exponent as the
|
||||
// rotation, and the free fits put both channels' start inside a fifth of a
|
||||
// frame of each other. Splitting them into a travel-then-rotate pair would turn
|
||||
// 767ms of concurrent motion into 1.5s of sequential motion and stop being the
|
||||
// move.
|
||||
//
|
||||
// No x: see CX. The reference's own travel was 1347px of a 1920px frame
|
||||
// (extrapolating the fitted cy channel back to the cut at f176.2) and this rig
|
||||
// travels less, because the reference's caption enters from below the frame
|
||||
// edge on a hard cut and this file has to start from a state the OPEN beat has
|
||||
// already made visible. That is the price of joining the two states the cut
|
||||
// separates instead of copying the cut.
|
||||
// ease: power2.out is GSAP's name for the cubic the reference fits. See ROT.
|
||||
tl.to("#rig", { rotation: -90, y: TRAVEL, duration: ROT, ease: "power2.out" }, OPEN);
|
||||
|
||||
tl.set({}, {}, DUR);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["caliper-caption-rail"] = tl;
|
||||
|
||||
// ---- swap checks ---------------------------------------------------------
|
||||
// Both of these are silent failures otherwise, and both are the first thing a
|
||||
// copy-and-retarget user hits.
|
||||
const declared = parseFloat(
|
||||
document.querySelector("[data-composition-id]").getAttribute("data-duration"));
|
||||
if (Math.abs(declared - DUR) > 0.0005) {
|
||||
console.warn(`[caliper] data-duration is ${declared}, the timeline is ${DUR}. `
|
||||
+ `SPAN = ${SPAN.toFixed(1)} at ${WIPE_SPEED}px/s gives OPEN = ${OPEN}, `
|
||||
+ `plus ROT = ${ROT}. Set data-duration="${DUR}".`);
|
||||
}
|
||||
// The rail is the caption's rail, so a longer label is a wider rig, and the rig
|
||||
// has to fit a 1080px frame while it is still horizontal. This is the label
|
||||
// budget and the framing check in one, because they are the same constraint.
|
||||
// The left edge binds first: CX grows with half the label, so RIG_L shrinks.
|
||||
if (RIG_L < 0 || RIG_L + RIG_W > 1080) {
|
||||
const maxInk = 2 * (BEAM_X - RAIL_END - JAW_PAD + OFF);
|
||||
console.warn(`[caliper] the rail runs ${RIG_L.toFixed(0)} to ${(RIG_L + RIG_W).toFixed(0)} `
|
||||
+ `in a 1080px frame and will crop during the open beat. This label's ink is `
|
||||
+ `${INK_W.toFixed(0)}px and the longest this framing can hold is ${maxInk.toFixed(0)}px. `
|
||||
+ `Shorten the label or move PRODUCT_LEFT. Do not cut FS: 110px is the reference's own `
|
||||
+ `cap height and dropping it is what made an earlier build read as an annotation `
|
||||
+ `instead of a headline.`);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,578 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
caliper-caption-rail
|
||||
====================
|
||||
A spec callout opens along a measurement rail, then the whole instrument
|
||||
rotates onto the product's long axis and locks the type against it.
|
||||
|
||||
REFERENCE reversals/_pool/adagency/reference-clip.mp4 @ 23.976fps
|
||||
(one frame = 1000/23.976 = 41.708ms)
|
||||
Every number below was measured at full resolution, 1080x1920, on
|
||||
frames pulled one pass from the source with ffmpeg -q:v 1. Caption
|
||||
mask: min(RGB) > 238 and (max-min) < 26, whole mask, no component
|
||||
filtering. At f192 the mask IS the caption: the product is a brushed
|
||||
phone edge that never clears 238, so nothing else is in it.
|
||||
Measured windows: f119-f145, f176-f204, f229-f238.
|
||||
|
||||
FORMAT 1080x1920, portrait, not negotiable. The reference lands its caption
|
||||
at 90 degrees running most of the product's length. A 1080-tall
|
||||
landscape frame cannot hold a 1200px vertical axis with jaws on it.
|
||||
|
||||
THE LOCKUP IS THE POINT, AND IT IS A LATERAL FACT
|
||||
Reference f192, full resolution:
|
||||
caption ink bbox x 388-467, y 378-1187
|
||||
caption axial length 809.0 cross-axis ink 78.8
|
||||
phone near edge 497.6 (column profile over
|
||||
y600-1150 ramps 493 -> 502, half
|
||||
rise 497.6; the ramp START is 493)
|
||||
phone far edge 544 so the phone is 46px wide,
|
||||
edge on: 1195 / 46 = 26:1, a 160mm
|
||||
x 6.5mm handset seen on its side
|
||||
phone top / bottom 371.7 / 1570 +/- 5
|
||||
So: clearance from the caption's ink to the product's near edge is
|
||||
28px, which is 0.36 cap heights. The type is not beside the product,
|
||||
it is ON it. Round 2 shipped 147px, 5.2x too far, and the whole
|
||||
channel between them was empty (max pixel 29/255 across 90 columns),
|
||||
which is what made the type read as an annotation floating next to a
|
||||
diagram. CLEAR below is that 28px and it is the single most
|
||||
load-bearing number in this file.
|
||||
|
||||
Two more lockup facts from the same frame, both now built:
|
||||
near-end flush caption ymin 378 against product ymin 371.7, so
|
||||
the type starts 6px inside the product's near end
|
||||
far-end tail 383px of bare product below the caption's end
|
||||
length ratio 809.0 / 1195 = 0.677
|
||||
|
||||
THE TYPE IS THE SUBJECT, AND THE LABEL IS WHAT SIZES IT
|
||||
Reference caption, f179 through f204: cross-axis ink 78.8 to 80.5,
|
||||
axial length 809.1 +/- 0.5 (rigid, no scale), 21035 ink px at f192,
|
||||
string "The thinnest and", 16 chars. That is a headline lying along
|
||||
the product, not an annotation beside it. The other instance in the
|
||||
same film ("lightest Z Flip", f235) measures 96px of ink WITH
|
||||
descenders, the same cap height once the g and p are taken off. One
|
||||
house scale, two strings.
|
||||
|
||||
So font-size is the constant and the label is the variable. At this
|
||||
type scale the honest 21-character label "5.8 mm at its thinnest"
|
||||
renders 1090px in this stack, wider than the frame; the fix is the
|
||||
label, not the font-size. The rail-fits-the-frame check at the
|
||||
bottom of the file is that budget, and it warns rather than clipping.
|
||||
|
||||
WHAT THE HORIZONTAL RAIL IS, AND WHAT IT IS NOT
|
||||
Round 2 set the jaw-to-jaw SPAN equal to PRODUCT_H. That one line
|
||||
was three defects at once: it made the horizontal rail 1068px inside
|
||||
a 1080px frame, it therefore capped PRODUCT_H at about 1032 (ratio
|
||||
0.815 against the reference's 0.677), and it pinned the beam to
|
||||
540 +/- 6, frame centre, which is what forced the 147px channel.
|
||||
None of the three could be closed by nudging a constant.
|
||||
|
||||
THE RAIL SPANS THE CALLOUT, NOT THE PRODUCT. SPAN is the caption's
|
||||
own ink length plus one JAW_PAD at each end, so the jaws bracket the
|
||||
thing the instrument is actually reading out: the label. That is
|
||||
forced, not chosen. PRODUCT_H is 1228 (see below) and a horizontal
|
||||
rail bracketing it would be 1264px wide in a 1080px frame, so a
|
||||
product-spanning caliper cannot exist in this format at all. It is
|
||||
also what the reference does: its horizontal caption instance is
|
||||
535px in a 1080 frame, half the width, not 99% of it.
|
||||
|
||||
The consequence is not a compromise, it is the reference's own
|
||||
lockup falling out of the arithmetic. Set JAW_PAD equal to the
|
||||
measured 6px near-end flush and the fixed jaw's face lands exactly
|
||||
on the product's near end, the type starts 6px after it, and 385px
|
||||
of bare product is left below the sliding jaw against the
|
||||
reference's 383. Those three were separate targets before; now they
|
||||
are one identity, JAW_PAD == FLUSH.
|
||||
|
||||
With SPAN off PRODUCT_H, the beam is free, so it is placed where the
|
||||
reference puts the type: BEAM_X is derived backwards from CLEAR.
|
||||
The rotation axis CX is no longer RIG_W/2 either, which is what buys
|
||||
the rail the room to sit off-centre without cropping.
|
||||
|
||||
THE JAWS GRIP THE WHOLE WORKPIECE
|
||||
Round 2's arms ran x540 to x690 and covered 40 of the product's
|
||||
150px, 27%, which is a caliper holding the near quarter of the thing
|
||||
it claims to be measuring. JAW_REACH is now derived: the arms start
|
||||
at the beam and end JAW_OVER past the product's FAR edge, so they
|
||||
cross 100% of it. JAW_REACH sets nothing else now; in round 2 it also
|
||||
set BEAM_X, which is why it could not be reduced.
|
||||
|
||||
WHAT THE PRODUCT PLACEHOLDER IS, AND THE ONE INPUT THAT IS NOT THE REFERENCE'S
|
||||
#product is a hatched slab with a dashed outline, deliberately ugly
|
||||
so nobody ships it. SWAP POINT: replace that one div with an <img> or
|
||||
<video>. PRODUCT_TOP / PRODUCT_H / PRODUCT_LEFT / PRODUCT_W are the
|
||||
whole input and every other number is arithmetic on them.
|
||||
PRODUCT_H = 1228 is the reference's ratio solved for this label:
|
||||
832 rendered ink / 0.677 = 1228.9. PRODUCT_TOP = 346 centres it in
|
||||
1920 the way the reference's 371.7 / 1570 centres a 1195px phone.
|
||||
PRODUCT_W = 150 is the one input that is NOT the reference's: its
|
||||
product is 46px wide because it is a phone shot edge on, and a 46px
|
||||
placeholder would be useless for any other swap. It is also the only
|
||||
input that does not enter a measured ratio. Stated so nobody reads it
|
||||
as unmeasured.
|
||||
|
||||
THE MOVE, AS MEASURED
|
||||
1. OPEN. The sliding jaw rides left along the rail and the caption is uncovered
|
||||
behind it, right end first. Both reference instances reveal right to left
|
||||
with the right end pinned: f229-f238 pins xmax at 825-826 while the front
|
||||
runs 818 -> 254, and f120-f140 pins xmax at 815-817 while the front runs
|
||||
817 -> 282.
|
||||
2. LOCK. The instrument rotates 90 degrees onto the product's axis and travels
|
||||
there at the same time. Not one after the other: see ROT.
|
||||
|
||||
WHY THE CLIP ENDS WHEN THE MOVE DOES
|
||||
The reference holds after the lock. From f196 through f204 the caption's
|
||||
mask is identical to the pixel (n=21208, cx 432.3, cy 776.0, L 808.1 on
|
||||
every frame; re-extracted this round and reproduced exactly). There is
|
||||
nothing still resolving to copy, so the clip stops when the move stops
|
||||
instead of welding a freeze on. Neither beat is scaled: OPEN is the
|
||||
reference's own measured mean wipe speed applied over this rail's length,
|
||||
and ROT is the measured rotation duration.
|
||||
|
||||
That lands DUR at 2.090s, which is 23ms above the 2.067s floor below which
|
||||
32 samples sit closer than two rendered frames. It is close, and it is close
|
||||
because it is derived: SPAN over WIPE_SPEED plus ROT, nothing padded. The
|
||||
batch auditor still flags UNDER-RESOLVED on this clip, because it recovers
|
||||
the duration from a snapshot filename rounded to one decimal, so 2.028s
|
||||
reads as 2.0 and it computes 1.995 instead of 2.023. Re-shot at 63 frames,
|
||||
roughly one rendered frame apart, all 62 consecutive pairs differ, minimum
|
||||
mean absolute delta 0.089/255. Nothing here is frozen; do not lengthen the
|
||||
clip to move an estimator.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<style>
|
||||
html, body { width: 1080px; height: 1920px; overflow: hidden; margin: 0; }
|
||||
|
||||
#root {
|
||||
position: absolute; inset: 0;
|
||||
/* Tokens live on #root, never :root, so they cannot leak into a sibling clip. */
|
||||
--bg: #0e0d0c;
|
||||
--ink: #ffffff;
|
||||
--rail: rgba(255, 255, 255, 0.5);
|
||||
--slab-a: #26231f;
|
||||
--slab-b: #1b1916;
|
||||
background: var(--bg);
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
/* ---- the placeholder product -------------------------------------------
|
||||
Diagonal hatch plus a dashed outline. Reads as "not the real asset" from
|
||||
across the room, which is the job. Its BOX is set from the script, not
|
||||
here, so there is exactly one place the product's geometry lives. ----- */
|
||||
#product {
|
||||
position: absolute;
|
||||
border-radius: 44px;
|
||||
border: 1px dashed rgba(255, 255, 255, 0.2);
|
||||
background: repeating-linear-gradient(45deg,
|
||||
var(--slab-a) 0 14px, var(--slab-b) 14px 28px);
|
||||
}
|
||||
|
||||
/* ---- the instrument -----------------------------------------------------
|
||||
#rig is the ONLY thing the lock beat transforms, so the beam, the ticks,
|
||||
the two jaws, the cover and the caption stay rigid relative to each other
|
||||
through the rotation. Rotating them separately is how a caliper comes apart
|
||||
mid-move, and the reference is rigid to half a pixel across 26 frames.
|
||||
|
||||
DOM ORDER IS LOAD BEARING HERE. #cover is an opaque slab of --bg that hides
|
||||
the caption, and it must paint OVER #cap and UNDER everything metal, so the
|
||||
beam and ticks stay visible to the left of the slider. Move #cover after
|
||||
#beam and the rail disappears behind it.
|
||||
|
||||
Every position inside the rig is written by the script in rig-local pixels.
|
||||
Nothing here carries a number, on purpose: a hardcoded left or top in this
|
||||
block is a number that stops agreeing with the product the moment someone
|
||||
swaps it. ----------------------------------------------------------- */
|
||||
#rig { position: absolute; }
|
||||
#beam { position: absolute; left: 0; background: var(--rail); }
|
||||
/* Ruler ticks, on the side AWAY from the workpiece, because post-lock the only
|
||||
thing between the beam and the product is the 28px of clearance the caption
|
||||
needs. Static: the reference's rail is a prop that exists before the caption
|
||||
does, it never draws itself on. */
|
||||
#ticks { position: absolute; left: 0; }
|
||||
/* The span being measured: a bright segment of the beam between the two jaws.
|
||||
Right-anchored at the fixed jaw's face so it grows leftward with the slider. */
|
||||
#span { position: absolute; width: 0; background: var(--ink); }
|
||||
.jaw { position: absolute; width: 6px; background: var(--ink); }
|
||||
/* The slider thumb. Chunky on purpose: it is the part of a caliper you push,
|
||||
and it is what makes the open beat read at a glance. */
|
||||
#thumb { position: absolute; width: 30px; background: var(--ink); border-radius: 4px; }
|
||||
|
||||
#cap { position: absolute; white-space: nowrap;
|
||||
color: var(--ink); font-weight: 600; letter-spacing: -0.015em; }
|
||||
/* The wipe. This is an opaque slab travelling on the SAME x tween as the jaw,
|
||||
with its right edge on the jaw's face, so the reveal front IS the jaw by
|
||||
construction and cannot drift from it under any ease. Round 2 animated a
|
||||
wrapper's width on a second tween with its own start time and duration,
|
||||
which is only equivalent while both are linear. It is clipped to the
|
||||
caption's ink band, not to the whole rig: a full-height cover would sweep a
|
||||
bg-coloured rectangle across the product post-lock and erase its lower end. */
|
||||
#cover { position: absolute; background: var(--bg); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" class="clip" data-composition-id="caliper-caption-rail" data-start="0"
|
||||
data-width="1080" data-height="1920" data-duration="2.090">
|
||||
|
||||
<!-- SWAP POINT: your product goes here. Keep the id, drop the hatch. -->
|
||||
<div id="product"></div>
|
||||
|
||||
<div id="rig">
|
||||
<!-- SWAP POINT: the label. The budget is checked at load, see the bottom. -->
|
||||
<div id="cap">Just 5.8 mm thin</div>
|
||||
<div id="cover"></div>
|
||||
<div id="beam"></div>
|
||||
<div id="ticks"></div>
|
||||
<div id="span"></div>
|
||||
<div class="jaw" id="jawFixed"></div>
|
||||
<div class="jaw" id="jawSlide"></div>
|
||||
<div id="thumb"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
// CSS owns every rest state and the timeline only ever moves things away from it.
|
||||
// Without this, a fromTo scheduled late stamps its FROM value at construction and
|
||||
// the opening frame shows the end of the clip.
|
||||
gsap.defaults({ immediateRender: false });
|
||||
|
||||
// =========================================================================
|
||||
// THE SWAP CONTRACT
|
||||
// =========================================================================
|
||||
// These four numbers are the whole input. Everything below them is arithmetic,
|
||||
// and there is no second copy of any of them in the CSS.
|
||||
//
|
||||
// The one thing that does NOT follow automatically is data-duration in the
|
||||
// markup, because the runtime reads that attribute before this script runs.
|
||||
// The check at the bottom of this file tells you the number to paste.
|
||||
const PRODUCT_TOP = 346; // (1920 - PRODUCT_H) / 2, the reference's own centring
|
||||
const PRODUCT_H = 1228; // 832 rendered axial ink / 0.677 measured ratio = 1228.9
|
||||
const PRODUCT_LEFT = 544; // chosen so the rail clears both frame edges, see the check
|
||||
const PRODUCT_W = 150; // NOT the reference's 46, see the header
|
||||
|
||||
// ---- reference constants, lateral ---------------------------------------
|
||||
// ref f192: caption ink xmax 467, phone near edge 497.6 by half-rise on a
|
||||
// column profile over y600-1150 (the ramp runs 493 to 502). Taking the ramp's
|
||||
// start, the first column that is unambiguously product, gives 493 and a
|
||||
// clearance of 26; the half-rise gives 30.6. 28 is the centre and it is the
|
||||
// number the whole lockup hangs on.
|
||||
const CLEAR = 28;
|
||||
// ref f192: caption ymin 378 against product ymin 371.7. The type starts just
|
||||
// inside the product's near end. Reused as the jaw pad, which is what puts the
|
||||
// fixed jaw's face exactly on the product's end. See the header.
|
||||
const FLUSH = 6;
|
||||
const JAW_PAD = FLUSH;
|
||||
// Gap from the beam's axis to the caption's near ink edge. Not a reference
|
||||
// number: the reference has no instrument. It is the smallest gap that leaves
|
||||
// the 3px beam a visible sliver of its own, and it comes OUT of CLEAR, so
|
||||
// raising it walks the caption away from the product.
|
||||
const BEAM_GAP = 16;
|
||||
// Cosmetic overhang past each jaw's outermost position, and the jaw tip's
|
||||
// overhang past the product's far edge.
|
||||
const RAIL_END = 18;
|
||||
const TICK_LEN = 14;
|
||||
const JAW_OVER = 14;
|
||||
|
||||
// ---- reference constants, timing ----------------------------------------
|
||||
// WIPE SPEED. ref f119-f140, the slow reveal instance, re-measured this round
|
||||
// at full resolution with a cumulative-ink front estimator: for each frame,
|
||||
// total caption ink in the band y850-1000, solved back through the fully
|
||||
// revealed frame's column profile for the x where that much ink lies to the
|
||||
// right. That is robust to letterform quantisation, which a leftmost-ink
|
||||
// scan is not.
|
||||
// front leaves its pinned start (817) between f119 (zero ink) and f120
|
||||
// (84 ink px, front 813), so f119.9
|
||||
// front reaches its pinned end (282) at f140, the first frame whose ink
|
||||
// total equals the fully revealed template's
|
||||
// 535px in 20.1 frames = 0.8383s -> 638 px/s
|
||||
// Both events are the same kind of event, the front sitting at a pinned
|
||||
// extreme, measured on one estimator. A leftmost-ink scan on the same frames
|
||||
// puts the arrival at f138 and gives 709 px/s; it reads the leading
|
||||
// antialiased edge and its early frames are contaminated by specular
|
||||
// highlights outside the caption (it puts f120's front at 763 where only 54px
|
||||
// of string exists). The honest spread on this channel is 638 to 709.
|
||||
//
|
||||
// This is a SPEED, not a duration, and that distinction matters more here than
|
||||
// anywhere else in the file. An earlier build took the 709ms the slow instance
|
||||
// lasts and spent it on the jaw's full travel, which made the caption's own
|
||||
// front run 1250 px/s, 2.2x the channel the number was measured on. A speed
|
||||
// transfers between a 535px reference caption and an 843px rail. A duration
|
||||
// does not.
|
||||
const WIPE_SPEED = 638; // px/s at 1080x1920, mean over the eased reveal
|
||||
|
||||
// WIPE EASE. The front decelerates, and round 2's ease:"none" was wrong.
|
||||
// Measured three ways on f120-f140, all at full resolution:
|
||||
// half-travel landmark the front passes the midpoint (549.5) at f126.5,
|
||||
// which is 0.343 of a 19.8 frame reveal. For
|
||||
// (1-p)^k = 0.5 at p = 0.343, k = 1.6.
|
||||
// least squares, end pinned to the frame the reveal demonstrably finishes:
|
||||
// k=1 RMS 33.5 px
|
||||
// k=1.5 RMS 21.2
|
||||
// k=2 RMS 20.8
|
||||
// k=2.5 RMS 36.9
|
||||
// leftmost-ink scan half-travel at f123, k = 3.7
|
||||
// Left unconstrained the least squares walks k up to 3 and beyond, but only by
|
||||
// pushing the end time to f151, eleven frames after the front visibly stops.
|
||||
// That is the estimator's own tail lag, not motion: a freshly uncovered stroke
|
||||
// crosses the 238 threshold a frame or two after it geometrically exists.
|
||||
// So the exponent is bracketed, not resolved: 1.6 by the cumulative estimator,
|
||||
// 3.7 by the leftmost scan, and the two are confounded by the occluder being a
|
||||
// hand-dragged phone at a diagonal, so no 1-D front estimator is measuring a
|
||||
// straight edge. k=2 is the centre of the bracket. What all three agree on and
|
||||
// what actually changes the look: linear is refuted, by 1.6x to 3x on RMS. The
|
||||
// reference uncovers half the string in the first third of the reveal; round 2
|
||||
// uncovered a third.
|
||||
//
|
||||
// k=2 IS power1.out, NOT power2.out. See the note on ROT: GSAP's powerN is
|
||||
// degree N+1.
|
||||
const WIPE_EASE = "power1.out";
|
||||
|
||||
// ref f176-f195, rotation. The caption's principal-axis angle runs 180 -> 90.
|
||||
// Remaining angle fitted as 90 * (1 - p)^k by least squares over f178-f195:
|
||||
// k free -> k = 2.962, start f176.18, end f194.44, RMS 0.148 deg
|
||||
// k = 3 -> start f176.19, end f194.60, RMS 0.150 deg
|
||||
// k = 2 -> start f175.70, end f190.60, RMS 0.895 deg, 6.0x worse
|
||||
// The direct tell is flatter than the fit: the per-frame decrement of
|
||||
// cbrt(remaining/90) sits at -0.0537 +/- 0.0008 from f179 to f186 and never
|
||||
// leaves -0.054 to -0.059 through f190, while sqrt(remaining/90) decays
|
||||
// monotonically from -0.0798 to -0.0462, a 73% spread. An earlier read of this
|
||||
// window quoted only f179-f184, which is the middle, where every ease is
|
||||
// straight. So the exponent is 3, cubic, and the window is 18.40 frames,
|
||||
// 18.40 * 41.708ms = 767ms.
|
||||
//
|
||||
// THE EXPONENT IS 3 AND THE GSAP NAME FOR IT IS power2.out, NOT power3.out.
|
||||
// GSAP's powerN is degree N+1: parseEase("power1.out")(p) recovers k = 2 at
|
||||
// every sample point, power2.out recovers 3, power3.out recovers 4, checked
|
||||
// against gsap 3.14.2 rather than from memory. Shipping the ease whose NAME
|
||||
// matches the measured exponent puts a quartic on a cubic channel: seeking this
|
||||
// rig at t = 2.0s with power3.out reads -68.7 deg where power2.out reads -59.5.
|
||||
// Fit an exponent to the reference, then translate the exponent to a name; do
|
||||
// not read the name off the fit.
|
||||
const ROT = 0.767;
|
||||
|
||||
// ---- the caption ---------------------------------------------------------
|
||||
// font-size is a reference measurement, not a fitting knob. 110px in this stack
|
||||
// renders 79px of cap-plus-ascender ink against the reference's 78.8 to 80.5,
|
||||
// and 832px of axial ink, both read back out of this file's own frame 31.
|
||||
const FS = 110;
|
||||
const cap = document.getElementById("cap");
|
||||
cap.style.fontSize = FS + "px";
|
||||
cap.style.lineHeight = FS + "px";
|
||||
|
||||
// Measure the label once, at build time, so nothing here can drift under a seek.
|
||||
// The caption is a SWAP POINT, so the ink box is measured rather than guessed: a
|
||||
// label with a descender sits lower in its line box than one without, and a
|
||||
// hardcoded constant would put it off the beam by however much the guess was
|
||||
// wrong. letterSpacing has to be set on the context too, or the canvas reports
|
||||
// 25px more advance than the DOM renders at -0.015em over 16 characters.
|
||||
//
|
||||
// AND THE INK BOX IS READ OUT OF PIXELS, NOT OUT OF measureText.
|
||||
// actualBoundingBoxDescent reports the font's OUTLINE extent; the rasteriser
|
||||
// puts the last 2.5px of this label's J tail below the alpha that this file, the
|
||||
// reference measurement and every critic all threshold at. Trusting the outline
|
||||
// box shipped a 31px clearance from a file that says 28, on the one number the
|
||||
// whole lockup hangs on. Rasterising the label and scanning it makes CLEAR mean
|
||||
// the same thing in the file and in the render, for any label.
|
||||
const FONT = `600 ${FS}px "Helvetica Neue", Helvetica, Arial, sans-serif`;
|
||||
const TRACK = "-0.015em";
|
||||
const probe = document.createElement("canvas").getContext("2d");
|
||||
probe.font = FONT;
|
||||
probe.letterSpacing = TRACK;
|
||||
const tm = probe.measureText(cap.textContent);
|
||||
// Where the DOM puts the baseline inside a line box of exactly FS: half-leading
|
||||
// above the font's own ascent.
|
||||
const baseline = (FS - (tm.fontBoundingBoxAscent + tm.fontBoundingBoxDescent)) / 2
|
||||
+ tm.fontBoundingBoxAscent;
|
||||
|
||||
const PAD = 60;
|
||||
const cv = document.createElement("canvas");
|
||||
cv.width = Math.ceil(tm.width) + 2 * PAD;
|
||||
cv.height = FS + 2 * PAD;
|
||||
const c2 = cv.getContext("2d");
|
||||
c2.font = FONT;
|
||||
c2.letterSpacing = TRACK;
|
||||
c2.textBaseline = "alphabetic";
|
||||
c2.fillStyle = "#fff";
|
||||
// Draw with the element's own left edge and line box top both at PAD.
|
||||
c2.fillText(cap.textContent, PAD, PAD + baseline);
|
||||
const bytes = c2.getImageData(0, 0, cv.width, cv.height).data;
|
||||
let ix0 = cv.width, ix1 = -1, iy0 = cv.height, iy1 = -1;
|
||||
for (let y = 0; y < cv.height; y++) {
|
||||
for (let x = 0; x < cv.width; x++) {
|
||||
// 240/255 alpha, the same cut the reference caption was masked at.
|
||||
if (bytes[(y * cv.width + x) * 4 + 3] >= 240) {
|
||||
if (x < ix0) ix0 = x;
|
||||
if (x > ix1) ix1 = x;
|
||||
if (y < iy0) iy0 = y;
|
||||
if (y > iy1) iy1 = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
// The offscreen context antialiases one step softer than the page's own
|
||||
// rasteriser, so its ink box runs one row and one column wider than what the
|
||||
// element actually paints at the same 240 cut. Read back out of this file's own
|
||||
// frame 31: canvas 833 x 80, rendered caption 832 x 79. It is an edge effect, so
|
||||
// it is at most one per axis, and the test that it is right is the rendered
|
||||
// clearance. Correcting it HERE and not at each use is the point: an earlier
|
||||
// build carried it as a +2 inside BEAM_X, which made the lateral edge land and
|
||||
// left the near-end flush 2px out, because the same error also sits in INK_W.
|
||||
const RASTER_SLOP = 1;
|
||||
const INK_W = ix1 - ix0 + 1 - RASTER_SLOP; // axial ink length
|
||||
const CAP_INK_H = iy1 - iy0 + 1 - RASTER_SLOP; // cross-axis ink, cap plus descender
|
||||
const INK_LEFT = ix0 - PAD; // ink inset from the element's left edge
|
||||
const INK_TOP = iy0 - PAD; // ink inset from the line box top
|
||||
|
||||
// ---- derived geometry, along the rail ------------------------------------
|
||||
// The rail brackets the CALLOUT. SPAN is the label's ink plus one pad at each
|
||||
// end, and that is the whole reason the rig fits a 1080px frame at all.
|
||||
const SPAN = INK_W + 2 * JAW_PAD;
|
||||
const RIG_W = SPAN + 2 * RAIL_END;
|
||||
const JAW_END = RAIL_END; // local x, sliding jaw's face, full open
|
||||
const JAW_START = RAIL_END + SPAN; // local x, both jaw faces at rest
|
||||
const INK_X0 = JAW_END + JAW_PAD; // local x, caption's first ink
|
||||
const CAP_LEFT = INK_X0 - INK_LEFT; // local x, caption element's box
|
||||
|
||||
// ---- derived geometry, across the rail -----------------------------------
|
||||
// Under rotate(-90deg) a rig-local offset (dx, dy) from the rotation axis lands
|
||||
// at screen offset (dy, -dx). So local +y is the workpiece side and local -y is
|
||||
// the outside; local +x becomes screen -y, so the string reads bottom to top
|
||||
// with its last character at the top.
|
||||
//
|
||||
// WHY -90 AND NOT +90. The reference's lock starts with the caption upside down
|
||||
// and unrolls, because a CUT sits between its open beat and its lock beat and
|
||||
// the two shots are separately framed. A single continuous primitive cannot
|
||||
// have both a readable horizontal reveal and an upside-down start, so the phase
|
||||
// is a choice. -90 is the one that keeps the reference's LAYOUT: the caption
|
||||
// lands left of the product and the jaws reach right across it, which is the
|
||||
// reference at f192 (ink 388-467, phone 497-544), and the string reads bottom
|
||||
// to top, which is also the reference at f192. +90 would mirror the lockup, put
|
||||
// the product on the left and flip the reading direction. The layout is what
|
||||
// reads as the lockup; the 180-degree start phase is an artifact of the cut.
|
||||
const OFF = BEAM_GAP + CAP_INK_H / 2; // beam axis to caption ink centre
|
||||
const CY = 24; // local y of the beam, room for the ticks
|
||||
|
||||
// ---- where the rig sits --------------------------------------------------
|
||||
// THE ROOT FIX. The beam is placed backwards from the caption's clearance, not
|
||||
// forwards from the jaw's reach. Round 2 had BEAM_X = PRODUCT_LEFT + 40 -
|
||||
// JAW_REACH, which meant the arms' length decided how far the type sat from the
|
||||
// product; at JAW_REACH = 150 that was 147px of empty channel.
|
||||
// The +1 is the inclusive-column convention and nothing else. CLEAR is measured
|
||||
// the way a critic measures it, from the last LIT caption column to the
|
||||
// product's first product column, so the gap between them is one column shorter
|
||||
// than the difference of the two coordinates. The rasteriser's own pixel is
|
||||
// handled once, up at RASTER_SLOP, not here.
|
||||
const BEAM_X = PRODUCT_LEFT - CLEAR - CAP_INK_H - BEAM_GAP + 1;
|
||||
// Now JAW_REACH is the derived one: from the beam, across the whole product,
|
||||
// JAW_OVER past its far edge.
|
||||
const JAW_REACH = PRODUCT_LEFT + PRODUCT_W + JAW_OVER - BEAM_X;
|
||||
const RIG_H = CY + JAW_REACH;
|
||||
|
||||
// The rotation axis. It is NOT the rig's centre. Pre-lock the caption's ink
|
||||
// centre sits at local x CX + CAP_DX; post-lock it sits at screen
|
||||
// BEAM_X + CAP_DY where CAP_DY is its local y offset. Zero lateral excursion
|
||||
// therefore means CAP_DX == CAP_DY == OFF, which fixes CX. Round 2 got the same
|
||||
// guarantee by forcing the caption to the rig's centre instead, which cost
|
||||
// 2 * OFF of extra rail and is what pinned the beam to frame centre.
|
||||
// The reference's own lateral excursion across the lock is nothing: caption cx
|
||||
// goes 447.7 (f179) to 418.8 (f183) to 432.0 (f192), a 28.9px arc on a channel
|
||||
// whose cy travels 988px.
|
||||
const CX = INK_X0 + INK_W / 2 - OFF; // local x of the rotation axis
|
||||
const RIG_L = BEAM_X - CX;
|
||||
// Pre-lock top: the rail rests on the bottom of the frame, which is as far from
|
||||
// the product as the frame allows and therefore the longest travel available.
|
||||
const RIG_T = 1920 - RIG_H - 28;
|
||||
// The lock's whole translation. The axis lands OFF above the caption's target
|
||||
// ink centre, and that centre is the near-end flush: FLUSH inside the product's
|
||||
// near end. There is no x: see CX.
|
||||
const AXIS_Y = PRODUCT_TOP + FLUSH + INK_W / 2 + OFF;
|
||||
const TRAVEL = AXIS_Y - (RIG_T + CY);
|
||||
|
||||
// ---- timing --------------------------------------------------------------
|
||||
// One speed drives the whole OPEN beat, and one ease, because the jaw, the span
|
||||
// readout and the wipe front are the same edge.
|
||||
const OPEN = +(SPAN / WIPE_SPEED).toFixed(3);
|
||||
const DUR = +(OPEN + ROT).toFixed(3);
|
||||
|
||||
// ---- write the geometry --------------------------------------------------
|
||||
const px = (n) => n + "px";
|
||||
const set = (id, s) => Object.assign(document.getElementById(id).style, s);
|
||||
|
||||
set("product", { left: px(PRODUCT_LEFT), top: px(PRODUCT_TOP),
|
||||
width: px(PRODUCT_W), height: px(PRODUCT_H) });
|
||||
// transform-origin is declared in CSS, not tweened, so GSAP reads it and never
|
||||
// fights it. A CSS `transform` on this element would be discarded the first
|
||||
// time the rotation runs; transform-origin is not a transform.
|
||||
set("rig", { left: px(RIG_L), top: px(RIG_T), width: px(RIG_W), height: px(RIG_H),
|
||||
transformOrigin: `${CX}px ${CY}px` });
|
||||
// The caption is anchored by its ink's NEAR edge, at BEAM_GAP off the beam, so
|
||||
// its far edge lands on PRODUCT_LEFT - CLEAR by construction whatever the label.
|
||||
set("cap", { left: px(CAP_LEFT), top: px(CY + BEAM_GAP - INK_TOP) });
|
||||
set("cover", { left: px(JAW_START - SPAN - 40), width: px(SPAN + 40),
|
||||
top: px(CY + BEAM_GAP - 14), height: px(CAP_INK_H + 28) });
|
||||
set("beam", { top: px(CY - 1), width: px(RIG_W), height: "3px" });
|
||||
set("ticks", { top: px(CY - 1 - TICK_LEN), width: px(RIG_W), height: px(TICK_LEN),
|
||||
background: "repeating-linear-gradient(to right,"
|
||||
+ " var(--rail) 0 2px, transparent 2px 40px)" });
|
||||
set("span", { right: px(RIG_W - JAW_START), top: px(CY - 2), height: "7px" });
|
||||
set("jawFixed", { left: px(JAW_START), top: px(CY), height: px(JAW_REACH) });
|
||||
set("jawSlide", { left: px(JAW_START - 6), top: px(CY), height: px(JAW_REACH) });
|
||||
set("thumb", { left: px(JAW_START - 18), top: px(CY - 20), height: "40px" });
|
||||
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
|
||||
// ---- beat 1: OPEN --------------------------------------------------------
|
||||
// Three channels, one velocity, one ease. The cover travels with the jaw and
|
||||
// its right edge is the jaw's face, so the reveal front cannot disagree with
|
||||
// the slider by even a pixel.
|
||||
tl.to("#jawSlide, #thumb, #cover", { x: -SPAN, duration: OPEN, ease: WIPE_EASE }, 0)
|
||||
.to("#span", { width: SPAN, duration: OPEN, ease: WIPE_EASE }, 0);
|
||||
|
||||
// ---- beat 2: LOCK --------------------------------------------------------
|
||||
// Rotation and travel are ONE tween because the source runs them as one event
|
||||
// on two channels. Fitting the caption's cy the same way as its angle gives
|
||||
// k = 3.115 with RMS 1.66px, against k = 2 at RMS 13.15px: same exponent as the
|
||||
// rotation, and the free fits put both channels' start inside a fifth of a
|
||||
// frame of each other. Splitting them into a travel-then-rotate pair would turn
|
||||
// 767ms of concurrent motion into 1.5s of sequential motion and stop being the
|
||||
// move.
|
||||
//
|
||||
// No x: see CX. The reference's own travel was 1347px of a 1920px frame
|
||||
// (extrapolating the fitted cy channel back to the cut at f176.2) and this rig
|
||||
// travels less, because the reference's caption enters from below the frame
|
||||
// edge on a hard cut and this file has to start from a state the OPEN beat has
|
||||
// already made visible. That is the price of joining the two states the cut
|
||||
// separates instead of copying the cut.
|
||||
// ease: power2.out is GSAP's name for the cubic the reference fits. See ROT.
|
||||
tl.to("#rig", { rotation: -90, y: TRAVEL, duration: ROT, ease: "power2.out" }, OPEN);
|
||||
|
||||
tl.set({}, {}, DUR);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["caliper-caption-rail"] = tl;
|
||||
|
||||
// ---- swap checks ---------------------------------------------------------
|
||||
// Both of these are silent failures otherwise, and both are the first thing a
|
||||
// copy-and-retarget user hits.
|
||||
const declared = parseFloat(
|
||||
document.querySelector("[data-composition-id]").getAttribute("data-duration"));
|
||||
if (Math.abs(declared - DUR) > 0.0005) {
|
||||
console.warn(`[caliper] data-duration is ${declared}, the timeline is ${DUR}. `
|
||||
+ `SPAN = ${SPAN.toFixed(1)} at ${WIPE_SPEED}px/s gives OPEN = ${OPEN}, `
|
||||
+ `plus ROT = ${ROT}. Set data-duration="${DUR}".`);
|
||||
}
|
||||
// The rail is the caption's rail, so a longer label is a wider rig, and the rig
|
||||
// has to fit a 1080px frame while it is still horizontal. This is the label
|
||||
// budget and the framing check in one, because they are the same constraint.
|
||||
// The left edge binds first: CX grows with half the label, so RIG_L shrinks.
|
||||
if (RIG_L < 0 || RIG_L + RIG_W > 1080) {
|
||||
const maxInk = 2 * (BEAM_X - RAIL_END - JAW_PAD + OFF);
|
||||
console.warn(`[caliper] the rail runs ${RIG_L.toFixed(0)} to ${(RIG_L + RIG_W).toFixed(0)} `
|
||||
+ `in a 1080px frame and will crop during the open beat. This label's ink is `
|
||||
+ `${INK_W.toFixed(0)}px and the longest this framing can hold is ${maxInk.toFixed(0)}px. `
|
||||
+ `Shorten the label or move PRODUCT_LEFT. Do not cut FS: 110px is the reference's own `
|
||||
+ `cap height and dropping it is what made an earlier build read as an annotation `
|
||||
+ `instead of a headline.`);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,396 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
caption-camera-follow: the words do not move, the camera does.
|
||||
|
||||
One sentence. Layout is self similar: every new word is sized as a fraction of the
|
||||
bounding box of everything written so far, and is dropped either to the right of that
|
||||
box or onto a new line below it, alternating. Because each word is measured against a
|
||||
box that keeps growing, the box grows geometrically, so the camera pulls back at a
|
||||
steady exponential rate and every word arrives at roughly the same size on screen. Old
|
||||
words stay lit and simply become small, piling up toward the top left the way
|
||||
handwriting fills a page. The last beat carries the same pull back all the way out
|
||||
until the whole sentence is readable at once.
|
||||
|
||||
Every ease is a cubic bezier written out by hand and solved in this file. No preset is
|
||||
used anywhere. Motion blur is a frame sized blur on the stage, pulsed with each camera
|
||||
move, so it costs one small raster instead of one enormous one.
|
||||
|
||||
Mount contract: everything lives inside <template>, styles and scripts included, and the
|
||||
scripts sit INSIDE the composition root. A host clones template content into its own
|
||||
mount and only runs scripts found inside the root; markup left outside is copied without
|
||||
its behaviour, which renders a black card with no timeline at all.
|
||||
-->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Camera Follow Captions</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div
|
||||
id="root"
|
||||
class="clip cf-root"
|
||||
data-composition-id="caption-camera-follow"
|
||||
data-duration="9"
|
||||
data-fps="30"
|
||||
>
|
||||
<style>
|
||||
.cf-root {
|
||||
--accent: #ffd84d;
|
||||
--ink: #ffffff;
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
background: transparent;
|
||||
pointer-events: none;
|
||||
}
|
||||
#cf-stage {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
#cf-world {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
--amt: 0px;
|
||||
}
|
||||
.cf-word {
|
||||
position: absolute;
|
||||
white-space: nowrap;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.005em;
|
||||
line-height: 0.78;
|
||||
color: var(--ink);
|
||||
opacity: 0;
|
||||
--k: 0;
|
||||
filter: blur(calc(var(--k) * var(--amt)));
|
||||
}
|
||||
.cf-word.is-accent {
|
||||
color: var(--accent);
|
||||
}
|
||||
#cf-vignette {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: radial-gradient(
|
||||
ellipse at 50% 50%,
|
||||
rgba(0, 0, 0, 0) 42%,
|
||||
rgba(0, 0, 0, 0.55) 100%
|
||||
);
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="cf-stage">
|
||||
<div id="cf-world"></div>
|
||||
</div>
|
||||
<div id="cf-vignette"></div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
gsap.defaults({ immediateRender: false });
|
||||
|
||||
/* Cubic bezier solver. Newton first, bisection as the fallback, so it is
|
||||
exact and deterministic for every input. */
|
||||
function bezier(x1, y1, x2, y2) {
|
||||
function curve(t, a1, a2) {
|
||||
var A = 1 - 3 * a2 + 3 * a1;
|
||||
var B = 3 * a2 - 6 * a1;
|
||||
var C = 3 * a1;
|
||||
return ((A * t + B) * t + C) * t;
|
||||
}
|
||||
function slope(t, a1, a2) {
|
||||
var A = 1 - 3 * a2 + 3 * a1;
|
||||
var B = 3 * a2 - 6 * a1;
|
||||
var C = 3 * a1;
|
||||
return (3 * A * t + 2 * B) * t + C;
|
||||
}
|
||||
return function (p) {
|
||||
if (p <= 0) return 0;
|
||||
if (p >= 1) return 1;
|
||||
var t = p;
|
||||
for (var i = 0; i < 8; i++) {
|
||||
var d = slope(t, x1, x2);
|
||||
if (Math.abs(d) < 1e-6) break;
|
||||
var e = curve(t, x1, x2) - p;
|
||||
if (Math.abs(e) < 1e-7) return curve(t, y1, y2);
|
||||
t -= e / d;
|
||||
}
|
||||
var lo = 0;
|
||||
var hi = 1;
|
||||
t = p;
|
||||
for (var j = 0; j < 24; j++) {
|
||||
var x = curve(t, x1, x2);
|
||||
if (Math.abs(x - p) < 1e-7) break;
|
||||
if (x > p) hi = t;
|
||||
else lo = t;
|
||||
t = (lo + hi) / 2;
|
||||
}
|
||||
return curve(t, y1, y2);
|
||||
};
|
||||
}
|
||||
|
||||
/* Leaves the mark fast, spends most of its time arriving. */
|
||||
var EASE_STEP = bezier(0.31, 0, 0.11, 1);
|
||||
/* The closing pull back: slower to leave, glides a long way out. */
|
||||
var EASE_WIDE = bezier(0.42, 0, 0.14, 1);
|
||||
/* Word ink coming up. */
|
||||
var EASE_INK = bezier(0.2, 0.7, 0.3, 1);
|
||||
/* Blur rising into the move and wiped off out of it. */
|
||||
var EASE_BLUR_UP = bezier(0.2, 0.8, 0.4, 1);
|
||||
var EASE_BLUR_DOWN = bezier(0.5, 0, 0.2, 1);
|
||||
|
||||
var DUR = 9;
|
||||
var STEP = 0.52;
|
||||
var MOVE = 0.4;
|
||||
|
||||
var WORDS = [
|
||||
{ text: "write" },
|
||||
{ text: "the" },
|
||||
{ text: "html", accent: true },
|
||||
{ text: "and" },
|
||||
{ text: "the" },
|
||||
{ text: "video", accent: true },
|
||||
{ text: "renders" },
|
||||
{ text: "itself" },
|
||||
{ text: "no" },
|
||||
{ text: "timeline" },
|
||||
{ text: "no" },
|
||||
{ text: "keyframes", accent: true },
|
||||
{ text: "just" },
|
||||
{ text: "code", accent: true },
|
||||
];
|
||||
|
||||
var world = document.getElementById("cf-world");
|
||||
var stage = document.getElementById("cf-stage");
|
||||
/* The runtime strips the root id on clone, so reach the root through a
|
||||
descendant instead of getElementById. */
|
||||
var root = stage.parentElement;
|
||||
var FRAME_W = root.clientWidth || 1080;
|
||||
var FRAME_H = root.clientHeight || 1920;
|
||||
|
||||
/* Base size is picked so the opening shot sits near 1:1. Everything after it
|
||||
is a pull back, so the world is only ever scaled down and type stays crisp. */
|
||||
var BASE = Math.max(FRAME_W, FRAME_H) * 0.16;
|
||||
/* Each new word is this fraction of the current box height. */
|
||||
var RATIO = 0.72;
|
||||
var MARGIN = 1.36;
|
||||
|
||||
var ruler = document.createElement("div");
|
||||
ruler.style.cssText =
|
||||
"position:absolute;left:-99999px;top:0;white-space:nowrap;visibility:hidden;" +
|
||||
'font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:700;' +
|
||||
"text-transform:uppercase;letter-spacing:0.005em;line-height:0.78";
|
||||
world.appendChild(ruler);
|
||||
|
||||
var box = null;
|
||||
WORDS.forEach(function (wd, i) {
|
||||
var fs = i === 0 ? BASE : (box.y1 - box.y0) * RATIO;
|
||||
ruler.style.fontSize = fs + "px";
|
||||
ruler.textContent = wd.text;
|
||||
var w = ruler.getBoundingClientRect().width;
|
||||
var h = fs * 0.78;
|
||||
var gap = fs * 0.07;
|
||||
|
||||
var x, y;
|
||||
if (i === 0) {
|
||||
x = 0;
|
||||
y = 0;
|
||||
} else if ((box.x1 - box.x0) / (box.y1 - box.y0) < FRAME_W / FRAME_H) {
|
||||
/* block is narrower than the frame, so grow sideways: to the right of
|
||||
everything, sitting on the same baseline */
|
||||
x = box.x1 + gap;
|
||||
y = box.y1 - h;
|
||||
} else {
|
||||
/* block is already wide enough, so grow downward: onto a new line under
|
||||
everything, left edges aligned */
|
||||
x = box.x0;
|
||||
y = box.y1 + gap;
|
||||
}
|
||||
|
||||
wd.fs = fs;
|
||||
wd.x = x;
|
||||
wd.y = y;
|
||||
|
||||
box = box
|
||||
? {
|
||||
x0: Math.min(box.x0, x),
|
||||
y0: Math.min(box.y0, y),
|
||||
x1: Math.max(box.x1, x + w),
|
||||
y1: Math.max(box.y1, y + h),
|
||||
}
|
||||
: { x0: x, y0: y, x1: x + w, y1: y + h };
|
||||
wd.box = { x0: box.x0, y0: box.y0, x1: box.x1, y1: box.y1 };
|
||||
});
|
||||
world.removeChild(ruler);
|
||||
|
||||
var FULL = box;
|
||||
|
||||
|
||||
function poseFor(b, margin) {
|
||||
var bw = (b.x1 - b.x0) * margin;
|
||||
var bh = (b.y1 - b.y0) * margin;
|
||||
var s = Math.min(FRAME_W / bw, FRAME_H / bh);
|
||||
return {
|
||||
x: FRAME_W / 2 - (s * (b.x0 + b.x1)) / 2,
|
||||
y: FRAME_H / 2 - (s * (b.y0 + b.y1)) / 2,
|
||||
scale: s,
|
||||
};
|
||||
}
|
||||
|
||||
var els = WORDS.map(function (wd) {
|
||||
var el = document.createElement("div");
|
||||
el.className = "cf-word" + (wd.accent ? " is-accent" : "");
|
||||
el.textContent = wd.text;
|
||||
el.style.left = wd.x + "px";
|
||||
el.style.top = wd.y + "px";
|
||||
el.style.fontSize = wd.fs + "px";
|
||||
world.appendChild(el);
|
||||
return el;
|
||||
});
|
||||
|
||||
/* Re-derive every framing box from what the browser actually laid out, so
|
||||
the camera is fitted to real ink and never to arithmetic that drifted. */
|
||||
var run = null;
|
||||
els.forEach(function (el, i) {
|
||||
var r = {
|
||||
x0: el.offsetLeft,
|
||||
y0: el.offsetTop,
|
||||
x1: el.offsetLeft + el.offsetWidth,
|
||||
y1: el.offsetTop + el.offsetHeight,
|
||||
};
|
||||
run = run
|
||||
? {
|
||||
x0: Math.min(run.x0, r.x0),
|
||||
y0: Math.min(run.y0, r.y0),
|
||||
x1: Math.max(run.x1, r.x1),
|
||||
y1: Math.max(run.y1, r.y1),
|
||||
}
|
||||
: r;
|
||||
WORDS[i].box = { x0: run.x0, y0: run.y0, x1: run.x1, y1: run.y1 };
|
||||
});
|
||||
FULL = run;
|
||||
|
||||
/* Rest state is pinned outside the timeline. */
|
||||
var first = poseFor(WORDS[0].box, MARGIN);
|
||||
gsap.set(world, {
|
||||
transformOrigin: "0 0",
|
||||
x: first.x,
|
||||
y: first.y,
|
||||
scale: first.scale,
|
||||
});
|
||||
gsap.set(els, { opacity: 0, "--k": 0 });
|
||||
gsap.set(world, { "--amt": "0px" });
|
||||
/* The first word is already on the page when the shot opens, so frame zero
|
||||
is never empty. */
|
||||
gsap.set(els[0], { opacity: 1 });
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
/* Peak smear at the rim of the frame, in screen pixels. */
|
||||
var BLUR = FRAME_W * 0.026;
|
||||
var HALF_DIAG = Math.sqrt(FRAME_W * FRAME_W + FRAME_H * FRAME_H) / 2;
|
||||
|
||||
/* Radial blur, the way a real zoom smears: a point far from the centre of
|
||||
the move sweeps across more of the frame than one sitting on it, so it
|
||||
streaks more. Each word gets its own share, --k, of one shared amount,
|
||||
--amt, which is the only thing that animates. The share is fixed for the
|
||||
length of a move and set with the camera, so this stays one tween per
|
||||
move rather than one per word per move. --amt is authored in world units,
|
||||
because a filter on a scaled child is applied before the scale, so the
|
||||
screen blur has to be divided back out by the camera scale. */
|
||||
function smear(centre, scale, count, at, up, down, peak) {
|
||||
for (var j = 0; j < count; j++) {
|
||||
var el = els[j];
|
||||
var cx = el.offsetLeft + el.offsetWidth / 2;
|
||||
var cy = el.offsetTop + el.offsetHeight / 2;
|
||||
var d =
|
||||
(scale *
|
||||
Math.sqrt(
|
||||
(cx - centre.x) * (cx - centre.x) +
|
||||
(cy - centre.y) * (cy - centre.y)
|
||||
)) /
|
||||
HALF_DIAG;
|
||||
tl.set(el, { "--k": (0.2 + 1.15 * Math.min(1, d)).toFixed(3) }, at);
|
||||
}
|
||||
var amt = peak / scale;
|
||||
tl.fromTo(
|
||||
world,
|
||||
{ "--amt": "0px" },
|
||||
{ "--amt": amt + "px", duration: up, ease: EASE_BLUR_UP },
|
||||
at
|
||||
);
|
||||
tl.to(
|
||||
world,
|
||||
{ "--amt": "0px", duration: down, ease: EASE_BLUR_DOWN },
|
||||
at + up
|
||||
);
|
||||
}
|
||||
|
||||
WORDS.forEach(function (wd, i) {
|
||||
var t = i * STEP;
|
||||
if (i === 0) return;
|
||||
|
||||
tl.fromTo(
|
||||
els[i],
|
||||
{ opacity: 0 },
|
||||
{ opacity: 1, duration: 0.16, ease: EASE_INK },
|
||||
t
|
||||
);
|
||||
|
||||
var p = poseFor(wd.box, MARGIN);
|
||||
tl.to(
|
||||
world,
|
||||
{ x: p.x, y: p.y, scale: p.scale, duration: MOVE, ease: EASE_STEP },
|
||||
t
|
||||
);
|
||||
|
||||
smear(
|
||||
{ x: (wd.box.x0 + wd.box.x1) / 2, y: (wd.box.y0 + wd.box.y1) / 2 },
|
||||
p.scale,
|
||||
i + 1,
|
||||
t,
|
||||
MOVE * 0.24,
|
||||
MOVE * 0.44,
|
||||
BLUR
|
||||
);
|
||||
});
|
||||
|
||||
/* The resolve: the same pull back, carried all the way out. */
|
||||
var wide = poseFor(FULL, 1.2);
|
||||
var wideAt = (WORDS.length - 1) * STEP + 0.62;
|
||||
tl.to(
|
||||
world,
|
||||
{
|
||||
x: wide.x,
|
||||
y: wide.y,
|
||||
scale: wide.scale,
|
||||
duration: 0.94,
|
||||
ease: EASE_WIDE,
|
||||
},
|
||||
wideAt
|
||||
);
|
||||
smear(
|
||||
{ x: (FULL.x0 + FULL.x1) / 2, y: (FULL.y0 + FULL.y1) / 2 },
|
||||
wide.scale,
|
||||
els.length,
|
||||
wideAt,
|
||||
0.3,
|
||||
0.58,
|
||||
BLUR * 0.8
|
||||
);
|
||||
|
||||
tl.set({}, {}, DUR);
|
||||
tl.seek(0);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["caption-camera-follow"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: caption-camera-follow at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>caption-camera-follow 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="9" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="caption-camera-follow"
|
||||
data-composition-src="./caption-camera-follow.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="9" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,663 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
chevron-pill-card-morph
|
||||
ref reference-clip f1340-f1420 @60fps (single-surface buy flow: search
|
||||
chip types a product name, then the chip becomes a checkout card)
|
||||
|
||||
FRAME NUMBERING. The source is reversals/_pool/uianim/reference-clip.mp4.
|
||||
ffmpeg's own decode index runs ONE frame ahead of the numbering used here and in
|
||||
ref/frames/: extracting with select='between(n,1330,1440)' and matching each
|
||||
m3-<N>.jpg thumbnail by minimum mean absolute error lands on ffmpeg n = N+1 every
|
||||
time (MAE 0.08 to 0.56 at N+1, against 0.3 to 3.4 at either neighbour). So to pull
|
||||
frame f cited below, extract ffmpeg frame f+1. Every number in this file was measured
|
||||
at 1920x1080 off that video, never off the 340px thumbnails.
|
||||
|
||||
The move: ONE surface goes circle -> pill -> card, and ONE accent button rides it the
|
||||
whole way. The chevron disc at the pill's right end stretches, darkens, and lands as
|
||||
the card's Pay bar. It is never crossfaded and never replaced: #accent is a single DOM
|
||||
node whose width, height, x, y and background are tweened. That continuity is the
|
||||
primitive. If you swap it for three elements that dissolve into each other you have
|
||||
copied the poses and thrown away the move.
|
||||
|
||||
MEASURE THE BOX WITH A MIN-AREA RECT, NOT AN AXIS-ALIGNED BBOX. This file used to
|
||||
claim the shell's width overshoots to 858 at f1396 and recovers to 838. It does not.
|
||||
That 858 was the axis-aligned bounding box of a card tilted 3.2 degrees; rotating the
|
||||
point cloud through -8..+8 in 0.1 degree steps and taking the smallest enclosing
|
||||
rectangle gives w = 839, 840, 841, 840, 840 at f1395, f1396, f1400, f1410, f1416. The
|
||||
width is monotonic and asymptotes at 840. There is no width overshoot in this clip,
|
||||
and a whole tween leg existed to reproduce a rotation artifact.
|
||||
|
||||
THE TWO MORPHS OVERLAP, and this is the whole reason the file is laid out the way it
|
||||
is. One criterion, applied to both: the height LEAVES REST at the first frame it exceeds
|
||||
its own 147-152 rest band, and the width is read as a percentage of its 840 asymptote at
|
||||
that same frame. Reference, centre-column height at the card's own centre x: 151 f1367,
|
||||
152 f1369, 153 f1370, 156 f1373, 160 f1375, 167 f1377, 174 f1380, 184 f1384, 228 f1388.
|
||||
So the break is f1370, and the min-area-rect width there is 745 = 88.7% of 840. The
|
||||
overlap runs from that break to the frame the width is within 2px of its asymptote
|
||||
(f1390, 838.6): twenty frames.
|
||||
|
||||
TWO EARLIER VERSIONS OF THIS PARAGRAPH WERE WRONG AND THE SECOND ONE WAS EXPENSIVE. The
|
||||
first claimed the break was f1368 and the width was still climbing at f1396, giving 28
|
||||
frames; f1368 is inside the rest band and 1396 was the rotation artifact above. The
|
||||
second claimed f1373 and 90.6%, which is a true statement about the reference (760/840)
|
||||
but was measured one criterion looser than the one applied to the build, and the build
|
||||
did not meet it at all: its height was flat until f1380, by which point its width was at
|
||||
98.3% of the asymptote. The card bloomed after the pill had finished widening. That is
|
||||
three poses cutting to each other, which is the exact failure this layout exists to
|
||||
avoid, and it survived a round because the header asserted an overlap the render did not
|
||||
have. Whatever this file claims here, measure it back off the render before shipping.
|
||||
|
||||
SO HERE IS THIS BUILD MEASURED BACK, same estimator, same criterion. The height crosses
|
||||
152 at f1370.93 and the min-area-rect width there is 752.9, 89.6% of 840, against the
|
||||
reference's own 88.7% at f1370 (and against the 98.3% the last build managed). The width
|
||||
comes within 2px of the asymptote at f1387.2, so the overlap window is 16.3 frames
|
||||
against the reference's 20. It is the two ends that matter, not the length: this build
|
||||
starts blooming one frame after the reference does at a width one point off, and it
|
||||
finishes tightening three frames early. The remaining gap is one channel, the last four
|
||||
frames of the lead-in, where the build sits 4 to 5px under the reference at f1377-f1380
|
||||
and then overshoots by 10px at f1388.
|
||||
|
||||
What actually happens in f1370-f1380, ten source frames, and what a serialised build
|
||||
misses: FOUR channels resolve at once. The shell height leaves rest and climbs 153 -> 174
|
||||
at a near-constant 2px per frame. The accent disc swells 129 -> 141 and drops back to 133,
|
||||
because until f1378 it is a capsule fitted inside the pill (its inset from the card's top
|
||||
and bottom edge measures 10-14px on every frame from f1364 to f1378, so its diameter is
|
||||
just the pill's height minus about 26) and at f1379 it detaches and holds 133 while the
|
||||
card keeps growing. The pill label scales up 1.178x about the card's centre. And each of
|
||||
its three words is still ringing on its own clock. The width, the one channel a serialised
|
||||
build gets right, is doing the least interesting thing of the five.
|
||||
|
||||
Why width/height and not scale ON THE SHELL: a scale on the box would drag every child
|
||||
with it, and the reference's card content does not scale with the card (compare the Pay
|
||||
label at f1400 and f1416: identical, while the shell grows 695 -> 694 through a 735
|
||||
peak). The pill's own label does scale, but on its own tween and about the card's centre,
|
||||
which is a different thing and is fitted separately below. The usual objection to
|
||||
animating width/height is that it reflows the content, so look at what the reference
|
||||
does with content during a size change: nothing is in there. The pill's text is fully
|
||||
faded by f1388, the card's content does not start arriving until f1390, and the shell
|
||||
is empty in between. Every child here is absolutely positioned at a fixed px size, so
|
||||
a shell resize only ever translates them, never reflows them, and every value is a
|
||||
pure function of t. width/height are also the one pair of layout properties the
|
||||
framework's StaticGuard deliberately exempts, because progress bars and reveals need
|
||||
them; left/right/top/bottom are not exempt and are not used by any tween here.
|
||||
|
||||
The typing is a clip, not a type-on. #pilltext sits at a FIXED offset from the shell's
|
||||
centre and the shell's left edge sweeps leftward across it under overflow:hidden. That
|
||||
reproduces the reference exactly: at f1356 the shell's left edge is 96px right of the
|
||||
word's start and you read "one", at f1357 "hone", f1358 "Phone", f1359 "iPhone". No
|
||||
per-character tween anywhere. The word's HORIZONTAL position holds still while this
|
||||
happens: its glyph bands sit at x = 717-744, 748-774, 778-803 on every frame from f1359
|
||||
to f1369, within 2px. It does not hold after that, and an earlier version of this
|
||||
comment extended the claim to f1372 without measuring it: by f1372 the same three bands
|
||||
read 713-740, 744-769, 773-800. See the scale below.
|
||||
|
||||
THE SHELL'S CENTRE SNAPS LEFT AND HOLDS. It does not ramp to a peak and come back, which
|
||||
is what this file used to say, and the difference is the estimator: the old track was
|
||||
fitted off axis-aligned bbox mid-x while the file's own headline says to use a min-area
|
||||
rect. Under the min-area rect, cx - 959.5 reads 0.0 f1350, -0.5 f1352, -12.0 f1353,
|
||||
-16.5 f1354, -16.0 f1355, -16.5 f1356, -17.0 f1357, -16.0 f1358, -15.5 f1359, -15.0
|
||||
f1360, -16.5 f1361, -16.0 f1362, -16.0 f1363, -15.5 f1364, -7.5 f1365, -6.0 f1366, -1.0
|
||||
f1367, +1.0 f1368. That is a two-frame snap to -16, an eleven-frame plateau, and a
|
||||
three-frame return. The old comment also discarded f1353 and f1359 as motion blur on the
|
||||
grounds that the right edge "measures backwards" there; it does not. R = cx + w/2 reads
|
||||
1187, 1207, 1223 at f1358, f1359, f1360, monotonic, and the two discarded frames read
|
||||
-12.0 and -15.5, which is the plateau. A triangular ramp peaking at -20 was fitted to a
|
||||
square pulse of -16.
|
||||
|
||||
The plateau is reproduced by translating the shell left and translating #pilltext right
|
||||
by the same amount, which leaves the word where the reference leaves it and leaves the
|
||||
accent's rightward travel monotonic, both of which a naive shell translation breaks.
|
||||
|
||||
THE PRICE GLYPHS ARE 5 TO 7% WIDER THAN THE REFERENCE'S, AND AN EARLIER VERSION OF THIS
|
||||
PARAGRAPH SAID 24%. That number was wrong and it was wrong in the way this contract
|
||||
cares about: it compared the build's settled row against the reference at a different
|
||||
frame. The reference's price is still converging through f1417, its last glyph arriving
|
||||
from the right (left edge 751, 741, 730, 720 at f1414, f1415, f1416, f1417), so any
|
||||
comparison that is not frame-matched reads the convergence as a size difference. Matched
|
||||
frame by frame with one estimator, the row spans 166 against 160 at f1415, 156 against
|
||||
148 at f1416, 147 against 138 at f1417, and the digit heights agree at 37 and the dollar
|
||||
sign at 45 against 43. So this is tracking and sidebearings, a few px, not a face that is
|
||||
a quarter too wide. It is still not chased, and the reason it cannot be chased far is
|
||||
worth keeping: the repo's bundled families pass the linter but the snapshot path does
|
||||
not inject them, so naming one would render a fallback and quietly invalidate every
|
||||
typographic constant in this file, and a fonts.googleapis.com link is a render-time
|
||||
network fetch, which the determinism rule bans. A system stack that is genuinely present
|
||||
is worth more than a face that is only present on the machine that authored the file.
|
||||
The one place a real size error DID hide behind that excuse was the pill's own label,
|
||||
which was drawn 22% too large for eight rounds because it shared #title's 66px and the
|
||||
reference does not; that one is fixed in the CSS below and measured there.
|
||||
|
||||
Slot pattern: PILL_WORDS, CARD_WORDS and PRICE below drive the DOM. Change the copy or
|
||||
the price and the motion is unchanged.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<style>
|
||||
html, body { width: 1080px; height: 1920px; overflow: hidden; margin: 0; }
|
||||
#root {
|
||||
position: absolute; inset: 0;
|
||||
/* Tokens on #root, never :root, or they leak into every other clip on the page. */
|
||||
--bg:#e0e0e0; /* ref bg sampled at f1416, rgb(224,224,224) */
|
||||
--card:#fafafa; /* ref shell fill, rgb(250,250,250) */
|
||||
--accent:#0b6bff; /* ref chevron disc centre f1372, rgb(0,106,255) */
|
||||
--accent-end:#232323;/* ref Pay bar centre f1416, rgb(35,35,35) */
|
||||
/* The reference sets its type in a light grey, not black: the darkest pixel in the
|
||||
title, the price and the pill label is 135-137 on a 250 ground, about 2.9:1. That
|
||||
is the look, so it is what ships. If this primitive has to meet WCAG, darken --ink
|
||||
and --ink-dim here and nothing else changes. */
|
||||
--ink:#8a8a8a;
|
||||
--ink-dim:#8a8a8a;
|
||||
--on-accent:#a3a3a3; /* ref Pay label, brightest pixel 164 on the 35 bar */
|
||||
--media:#f0762e; /* stand-in product colour */
|
||||
background: var(--bg);
|
||||
font-family: "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* Every px below is a reference measurement times S = 1.12. The ref is 1920x1080 with
|
||||
the card 840px wide; this is 1080x1920, so the card is scaled to 941px to fill the
|
||||
portrait width with a 70px margin and still clear the frame at the 6deg tilt
|
||||
(widest rotated bbox is f1392, 844*cos6 + 478*sin6 = 890 ref = 997 comp px). */
|
||||
#shell {
|
||||
position: absolute; left: 50%; top: 50%;
|
||||
width: 168px; height: 167px; /* rest, f1340-f1346: 150 x 149 */
|
||||
border-radius: 84px; /* = height/2, a true capsule end */
|
||||
background: var(--card);
|
||||
box-shadow: 0 20px 46px rgba(0,0,0,0.10);
|
||||
overflow: hidden; /* this is what "types" the pill label */
|
||||
}
|
||||
|
||||
/* Anchored to the shell's CENTRE, so it holds a fixed screen position while the shell's
|
||||
edges move. ref: word left edge x=706 with shell centre x=959.5, so -253 * 1.12.
|
||||
No CSS transform here: GSAP tweens x on this node and writes the whole transform
|
||||
property, so a CSS translateY(-50%) would be silently discarded on the first tween.
|
||||
The vertical centring is handed to GSAP as yPercent below instead. */
|
||||
/* 54px, not the 66px this carried and #title still carries, and the difference is
|
||||
measured rather than eyeballed. In the reference the pill's label and the card's title
|
||||
are NOT the same size: at f1368 the label's ink spans 706-1010, 305 ref px, while the
|
||||
title at f1412 spans 372. At 66px this file drew the label 383 wide, so it filled the
|
||||
pill where the reference's label has air on both sides, and the ratio is the same on
|
||||
each word taken separately (iPhone 156/189, 17 48/59, Pro 74/90, all 0.82). 66 * 0.82
|
||||
rounds to 54. Cap-and-ascender then lands at 36 against the reference's 37. The word
|
||||
gap has to come down with it: the gap is this margin plus two sidebearings, the
|
||||
sidebearings scale with the font and the margin does not, so 18px would have left the
|
||||
label 22px too wide on its own. At 9px the rendered gaps are 14 and 14 against the
|
||||
reference's 12 and 19, which differ from each other only because e|1 and 7|P have
|
||||
different sidebearings and one margin cannot be two numbers. */
|
||||
#pilltext {
|
||||
position: absolute; left: 50%; margin-left: -284px; top: 50%;
|
||||
white-space: nowrap; font-size: 54px; color: var(--ink);
|
||||
}
|
||||
/* CSS owns every rest state. With immediateRender:false a fromTo does NOT stamp its FROM
|
||||
value at build time, so anything that is meant to be dark at t=0 has to be dark here.
|
||||
Getting this wrong put the card's title on screen from the opening frame, on top of
|
||||
the pill's label, before either had been scheduled. */
|
||||
.w { display: inline-block; opacity: 0; }
|
||||
#pilltext .w:first-child { opacity: 1; } /* word 0 is revealed by the clip, never faded in */
|
||||
#pilltext .w + .w { margin-left: 9px; }
|
||||
|
||||
#accent {
|
||||
position: absolute; right: 13px; bottom: 11px; /* ref 12, 10 */
|
||||
width: 149px; height: 149px; /* ref 133 disc at f1340 */
|
||||
border-radius: 999px; /* capsule at every size it takes */
|
||||
background: var(--accent);
|
||||
}
|
||||
#chev { position: absolute; left: 50%; top: 50%; width: 37px; height: 56px; margin: -28px 0 0 -16px; }
|
||||
#paylabel {
|
||||
position: absolute; inset: 0; opacity: 0;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
font-size: 64px; color: var(--on-accent);
|
||||
}
|
||||
|
||||
/* Card content. Fixed sizes, absolutely positioned: a shell resize translates these,
|
||||
it never reflows them. Anchored to the edge the reference anchors them to, so they
|
||||
ride the last 46px of the card's settle instead of sitting still while it moves. */
|
||||
#media {
|
||||
position: absolute; left: 146px; top: 123px; width: 166px; height: 343px;
|
||||
border-radius: 26px; opacity: 0;
|
||||
background: linear-gradient(150deg, #f5904f 0%, var(--media) 42%, #d85f1e 100%);
|
||||
}
|
||||
/* Swap #media for <img> (or <video>) and declare the look with data-color-grading on
|
||||
that element; grading only mirrors media pixels, so it would do nothing on this div. */
|
||||
#bump { position: absolute; left: 12px; top: 10px; width: 92px; height: 74px; border-radius: 20px;
|
||||
background: linear-gradient(150deg, #f7a066, #e06a24); }
|
||||
#bump i { position: absolute; width: 26px; height: 26px; border-radius: 999px; background: #24160e; }
|
||||
#title { position: absolute; right: 85px; top: 66px; white-space: nowrap; font-size: 66px; color: var(--ink); }
|
||||
#title .w + .w { margin-left: 16px; }
|
||||
/* The price is ONE inline row on ONE baseline. It used to be four odometer columns,
|
||||
each a 70px window over a 30-row digit strip, and that was wrong twice over: it
|
||||
published legible false prices on its way to the target ($172, $1078, $1096) and it
|
||||
pushed digits above and below the line as the strips travelled. The reference does
|
||||
neither. See the PRICE block in the script for the frame-by-frame evidence. Nothing
|
||||
here clips, so nothing can be half a row out of place. */
|
||||
#price { position: absolute; right: 103px; top: 250px; white-space: nowrap;
|
||||
font-size: 58px; line-height: 70px; color: var(--ink-dim); }
|
||||
.g { display: inline-block; opacity: 0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" class="clip" data-composition-id="chevron-pill-card-morph" data-start="0"
|
||||
data-width="1080" data-height="1920" data-duration="3.2">
|
||||
<div id="shell">
|
||||
<div id="pilltext"></div>
|
||||
<div id="media"><div id="bump"></div></div>
|
||||
<div id="title"></div>
|
||||
<div id="price"></div>
|
||||
<div id="accent">
|
||||
<svg id="chev" viewBox="0 0 37 56" fill="none">
|
||||
<path d="M6 6 L31 28 L6 50" stroke="#fff" stroke-width="7" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
<span id="paylabel">Pay</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
// ---- the slot ------------------------------------------------------------------------
|
||||
const PILL_WORDS = ["Lumen", "17", "Pro"]; // word 0 is revealed by the clip, 1..n drop in
|
||||
const CARD_WORDS = ["Lumen", "17", "Pro"];
|
||||
const PRICE = "1099"; // any digit count; the stagger follows
|
||||
|
||||
// ---- time ----------------------------------------------------------------------------
|
||||
// Every constant in this file is a SOURCE FRAME NUMBER, so a comment can never drift out
|
||||
// of step with the timing it describes. T() is the only place a second appears.
|
||||
//
|
||||
// SPF: the source is 60fps, so one frame is 16.67ms. The whole move is f1340-f1420 = 80
|
||||
// frames = 1333ms, which is a UI demo's speed, not a video's: the card bloom alone would
|
||||
// be 400ms. Scaled x2.4 (SPF = 16.67ms * 2.4 = 40ms) so it reads at reading distance. The
|
||||
// scale is UNIFORM, so every ratio and every overlap above survives it untouched. Nothing
|
||||
// here was scaled on its own.
|
||||
//
|
||||
// Why the clip now starts at f1340 rather than f1350: there was no opening pose at all,
|
||||
// the width left rest between the first and second sampled frame. f1340-f1348 is not a
|
||||
// hold either, and it is worth having for exactly that reason. Over those 9 frames the
|
||||
// blue disc rings DOWN from 133 to 122 (it overshot to 138 at f1335 on its way in) while
|
||||
// the whole assembly is still descending, mid-y 509.5 -> 523.5. So the clip opens on a
|
||||
// disc settling rather than on a still frame or on a widening already underway.
|
||||
//
|
||||
// WHAT THE CLIP COPIES ENDS AT f1417, AND DUR = T(1420) IS A HARNESS CONSTANT. An earlier
|
||||
// version of this comment said the reference "holds a settled $1099 from f1416 to f1419".
|
||||
// It does not hold and it does not stay: the card is cross-dissolving out. Card fill,
|
||||
// sampled in the empty area right of the product at rows 560-600, reads 250 250 250 250
|
||||
// 249 248 247 245 241 238 231 across f1412-f1422 on a background of 224, and the price
|
||||
// ink's darkest pixel goes 137 f1415, 146 f1416, 162 f1417, 167 f1418, 172 f1419, 184
|
||||
// f1420, with the row gone by f1420 and the card gone by f1422. The price is not even
|
||||
// still by then: the last 9's right edge is 1296, 1287, 1281 at f1416, f1417, f1418. So
|
||||
// the settled card exists for about two frames, f1415-f1416, and everything after that is
|
||||
// the exit. This primitive does not copy the exit. A file someone copies has to end on the
|
||||
// finished card, not on it fading.
|
||||
//
|
||||
// DUR is then chosen so that the last frame the harness actually PHOTOGRAPHS is f1417.5,
|
||||
// and that is arithmetic, not taste. The runtime floors every seek to 1/30s, and the final
|
||||
// sample asks for D - max(0.05, 0.03*D) rather than D. At DUR = T(1419) = 3.16 the last
|
||||
// two samples ask for 3.0581 and 3.0652 and BOTH floor to 91/30 = 3.0333 = f1415.83, so
|
||||
// the settle is in the timeline and in no frame, and the first shoot came back with the
|
||||
// last digit 15px out. At DUR = T(1418) = 3.12 they both floor to 90/30 = f1415, which is
|
||||
// worse. At 3.2 they floor to 92/30 and 93/30 = f1416.67 and f1417.5, and the finished
|
||||
// price is on screen twice. The 2.5 source frames of timeline past f1417.5 are never
|
||||
// rendered; no tween is authored to reach anything there. Check where your sample times
|
||||
// land before you conclude the motion is wrong.
|
||||
const F0 = 1340;
|
||||
const SPF = 0.04;
|
||||
const T = (f) => (f - F0) * SPF;
|
||||
const D = (a, b) => (b - a) * SPF;
|
||||
const DUR = T(1420);
|
||||
|
||||
// S = 1.12, ref px -> composition px. Written out rather than computed so a reader can
|
||||
// check any number in this file against the frame it was measured in.
|
||||
const px = (ref) => Math.round(ref * 1.12);
|
||||
|
||||
// A decelerate whose exponent is measured rather than chosen from the named set. GSAP's
|
||||
// out family only offers whole exponents (power1 = 2, power2 = 3, power3 = 4) and two of
|
||||
// the legs below have a measured exponent that sits between two of them, in both cases
|
||||
// close to the midpoint, so every named candidate is wrong at one end or the other. This
|
||||
// is still a pure function of the tween's own progress, so it costs nothing against the
|
||||
// seek filter. Only the two legs that need it use it; everywhere else a named ease fits
|
||||
// and is easier to read.
|
||||
const powOut = (k) => (u) => 1 - Math.pow(1 - u, k);
|
||||
|
||||
// ---- build the slots -----------------------------------------------------------------
|
||||
const el = (tag, cls, txt) => {
|
||||
const n = document.createElement(tag);
|
||||
if (cls) n.className = cls;
|
||||
if (txt !== undefined) n.textContent = txt;
|
||||
return n;
|
||||
};
|
||||
const pillWords = PILL_WORDS.map((w) => { const n = el("span", "w", w); pilltext.appendChild(n); return n; });
|
||||
const cardWords = CARD_WORDS.map((w) => { const n = el("span", "w", w); title.appendChild(n); return n; });
|
||||
// One span per glyph, "$" included, laid out inline. They are all in the DOM from the
|
||||
// start at their final positions, so the row's layout never changes and the browser gives
|
||||
// every glyph the same baseline for free. Only opacity and x are ever touched.
|
||||
const glyphs = ["$", ...PRICE].map((c) => { const n = el("span", "g", c); price.appendChild(n); return n; });
|
||||
for (const [i, dx] of [22, 52, 22].entries()) {
|
||||
const dot = el("i"); dot.style.left = dx + "px"; dot.style.top = (i === 2 ? 40 : 12) + "px";
|
||||
if (i === 2) dot.style.left = "22px";
|
||||
bump.appendChild(dot);
|
||||
}
|
||||
|
||||
// ---- timeline ------------------------------------------------------------------------
|
||||
// immediateRender:false, or every fromTo below stamps its FROM value at construction and
|
||||
// the opening frame shows the card's end state stacked on the pill's.
|
||||
gsap.defaults({ immediateRender: false });
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
|
||||
gsap.set(shell, { xPercent: -50, yPercent: -50, transformOrigin: "50% 50%" });
|
||||
// 284px is the element's own margin-left, so this pins the transform origin exactly on the
|
||||
// shell's centre no matter how long the copy in PILL_WORDS is. The label's scale below is
|
||||
// measured about the card's centre, not about the label's own box, and using the default
|
||||
// "50% 50%" origin would drag the word sideways by half the difference.
|
||||
gsap.set(pilltext, { yPercent: -50, transformOrigin: "284px 50%" });
|
||||
|
||||
// THE OPENING. The assembly is still arriving when the clip starts. Measured bbox mid-y,
|
||||
// ref px: f1340 509.5 | f1344 517.0 | f1348 523.5 | f1352 529.0 | f1356 532.5 | f1360
|
||||
// 535.5 | f1364 537.5 | f1368 538.5 | f1372 539.5, flat from there. Distance still to run
|
||||
// halves about every 5 frames, and (1-t)^2 over f1340-f1372 tracks it inside 1.5px at
|
||||
// every sample: 30 -> 23.0 (measured 22.5) -> 16.9 (16) -> 11.7 (10.5) -> 7.5 (7) ->
|
||||
// 4.2 (4) -> 1.9 (2). This is what makes the first quarter of the clip move at all.
|
||||
tl.fromTo(shell, { y: -px(30) }, { y: 0, duration: D(1340, 1372), ease: "power2.out" }, T(1340));
|
||||
// The disc's own ring-down inside that. Measured diameters: f1335 138 (its overshoot
|
||||
// peak, before this clip starts) | f1340 133 | f1342 129 | f1344 126 | f1346 122 |
|
||||
// f1348 122, then flat to f1352. Same (1-t)^2 shape: 11 -> 8.4 (measured 8) -> 6.2 (7)
|
||||
// -> 4.3 (4) -> 2.8 (4) -> 1.5 (2) -> 0.
|
||||
tl.fromTo(accent, { width: px(133) }, { width: px(122), duration: D(1340, 1348), ease: "power2.out" }, T(1340));
|
||||
tl.fromTo(accent, { height: px(133) }, { height: px(122), duration: D(1340, 1348), ease: "power2.out" }, T(1340));
|
||||
// #accent is anchored bottom-right, so shrinking it alone would walk its centre 6px down
|
||||
// and right. In the reference the disc stays concentric with the pill through the whole
|
||||
// ring-down (disc centre x 960.0 at f1340 and 960.5 at f1346, shell centre x 959.5 on
|
||||
// both), so the shrink is compensated by half of itself. x/y, not right/bottom: those
|
||||
// two snap to integer device pixels under the seek engine and StaticGuard rejects them.
|
||||
tl.fromTo(accent, { x: px(5.5) }, { x: 0, duration: D(1340, 1348), ease: "power2.out" }, T(1340));
|
||||
tl.fromTo(accent, { y: px(5.5) }, { y: 0, duration: D(1340, 1348), ease: "power2.out" }, T(1340));
|
||||
// And it grows back a little as the pill inflates under it: 122 at f1352, 124 at f1355,
|
||||
// 126 at f1357, 128 at f1360, flat to f1369.
|
||||
tl.fromTo(accent, { width: px(122) }, { width: px(128), duration: D(1354, 1360), ease: "none" }, T(1354));
|
||||
tl.fromTo(accent, { height: px(122) }, { height: px(128), duration: D(1354, 1360), ease: "none" }, T(1354));
|
||||
|
||||
// THE DISC BULGE, and it is not an independent pulse. Diameters run 129 f1370, 130 f1372,
|
||||
// 132 f1373, 135 f1375, 138 f1376, 141 f1377, 140 f1378, then break to 135 f1379 and 133
|
||||
// f1380 and hold. What is constant through the rising half is the disc's INSET from the
|
||||
// card's own top and bottom edge: 10, 11, 11, 12, 13, 13, 13, 13, 14, 13, 14 px on the
|
||||
// frames f1364 to f1378, so the disc is simply the pill's height minus about 26, a capsule
|
||||
// fitted inside a capsule. At f1379 that inset jumps to 20 top and 18 bottom in one frame
|
||||
// and never comes back: the disc has detached and now holds its own size while the card
|
||||
// keeps growing. So this is two tweens with a hard break between them, and the break frame
|
||||
// is the measurement. Do not smooth it: a disc that eases back instead of snapping reads
|
||||
// as a squash, not as a component letting go of its container.
|
||||
tl.fromTo(accent, { width: px(128) }, { width: px(141), duration: D(1370, 1377), ease: "power1.in" }, T(1370));
|
||||
tl.fromTo(accent, { height: px(128) }, { height: px(141), duration: D(1370, 1377), ease: "power1.in" }, T(1370));
|
||||
tl.fromTo(accent, { width: px(141) }, { width: px(133), duration: D(1377, 1380), ease: "power1.in" }, T(1377));
|
||||
tl.fromTo(accent, { height: px(141) }, { height: px(133), duration: D(1377, 1380), ease: "power1.in" }, T(1377));
|
||||
// #accent is anchored to the shell's bottom, which is exactly right while the disc grows
|
||||
// with the pill (both edges move and the disc stays concentric, which is what the equal
|
||||
// insets above say). Once it detaches at f1379 the shell keeps growing under a disc that
|
||||
// does not, so the anchor starts walking it downward: half the remaining growth, 12px by
|
||||
// f1382. The reference keeps it centred (disc cy 540.0 against card cy 539.5 at f1380,
|
||||
// f1381, f1382), so that walk is cancelled here. Measured, the correction is 3px at f1377,
|
||||
// 9 at f1379, 10.5 at f1380, 11.5 at f1382, which is quadratic-out.
|
||||
tl.fromTo(accent, { y: 0 }, { y: -px(11.5), duration: D(1377, 1382), ease: "power1.out" }, T(1377));
|
||||
|
||||
// SHELL WIDTH. Min-area-rect widths, ref px, re-measured with the same estimator the
|
||||
// header mandates rather than the axis-aligned numbers an earlier version of this block
|
||||
// used (it said 314/444/591 at f1355/f1357/f1360; the min-area rect says 293/437/557, and
|
||||
// the two agree within 2px at every other sampled frame, so the old f1360 keypoint was 6%
|
||||
// high and the whole leg ran ahead of the reference):
|
||||
// f1346 149 | f1347 151 | f1350 165 | f1352 188 | f1354 220 | f1355 293 | f1357 437
|
||||
// f1360 557 | f1363 629 | f1365 686 | f1367 721 | f1369 740 | f1372 755 | f1376 784
|
||||
// f1380 810 | f1385 831 | f1390 839 | f1395 840 | f1400 839 | f1410 840 | f1416 840
|
||||
// Four legs, because the pill sizes to its label rather than growing once smoothly. The
|
||||
// f1347-f1360 span is NOT one ease: sweeping the exponent frame by frame walks it from
|
||||
// 2.9 at f1354 down to 1.1 at f1358, which is an S, and a single power1.in over the whole
|
||||
// span is 48px (12%) out in the middle. Split at the knee it is 7% worst case.
|
||||
// The f1354-f1360 leg is the exponent fit, not a family pick. Remaining distance over the
|
||||
// 337px span reads .783 .537 .356 .208 .092 at f1355-f1359, and solving (1-u)^k at each of
|
||||
// those five frames gives 1.34, 1.54, 1.49, 1.43, 1.33: one exponent, k = 1.4, sitting
|
||||
// almost exactly between linear (k = 1) and power1.out (k = 2). Both neighbours are wrong
|
||||
// by more than the whole rest of this channel: linear is 44px low at the midpoint,
|
||||
// power1.out 31px high, sine.out (the closest named ease, effective k about 1.55 near the
|
||||
// midpoint) 25px high. The measured exponent is 10px worst case on the same span.
|
||||
tl.fromTo(shell, { width: px(150) }, { width: px(220), duration: D(1347, 1354), ease: "power1.in" }, T(1347));
|
||||
tl.fromTo(shell, { width: px(220) }, { width: px(557), duration: D(1354, 1360), ease: powOut(1.4) }, T(1354));
|
||||
tl.fromTo(shell, { width: px(557) }, { width: px(721), duration: D(1360, 1367), ease: "none" }, T(1360));
|
||||
tl.fromTo(shell, { width: px(721) }, { width: px(755), duration: D(1367, 1372), ease: "power1.out" }, T(1367));
|
||||
// f1372-f1391 the pill keeps inflating while the card blooms underneath it. This is the
|
||||
// overlap: the height tween below is already running when this leg starts. It asymptotes
|
||||
// rather than overshooting, so the ease is out and there is no recovery leg. The exponent
|
||||
// on the remaining distance measures 1.76, 1.91, 1.95, 1.41 at f1376, f1380, f1385, f1390,
|
||||
// so it is power1.out (k = 2), not the power2.out this leg used to carry: cubic-out runs
|
||||
// 14px ahead at f1376 and f1380, quadratic-out is within 3px at every sample.
|
||||
tl.fromTo(shell, { width: px(755) }, { width: px(840), duration: D(1372, 1391), ease: "power1.out" }, T(1372));
|
||||
|
||||
// SHELL X, and the equal-and-opposite on #pilltext. A SQUARE PULSE, not a ramp: min-area
|
||||
// rect cx - 959.5 snaps 0 -> -12 -> -16.5 over f1352-f1354, then holds between -15.0 and
|
||||
// -17.0 for eleven frames to f1364 (mean -16.05), then returns to 0 over f1364-f1367. The
|
||||
// gap between f1354 and f1364 carries no tween, so GSAP holds -16 there, which is the
|
||||
// whole point: this channel is genuinely still while four others are moving.
|
||||
// The return leg is "none" because the measured return is 8, 1.5, 5, 2 px per frame, and
|
||||
// linear is 3.2px worst against sine.inOut's 4.5px over a 16px span.
|
||||
tl.fromTo(shell, { x: 0 }, { x: -px(16), duration: D(1352, 1354), ease: "power1.out" }, T(1352));
|
||||
tl.fromTo(shell, { x: -px(16) }, { x: 0, duration: D(1364, 1367), ease: "none" }, T(1364));
|
||||
tl.fromTo(pilltext, { x: 0 }, { x: px(16), duration: D(1352, 1354), ease: "power1.out" }, T(1352));
|
||||
tl.fromTo(pilltext, { x: px(16) }, { x: 0, duration: D(1364, 1367), ease: "none" }, T(1364));
|
||||
|
||||
// SHELL HEIGHT, and this is the channel the whole file gets judged on. Heights, ref px,
|
||||
// read as the centre column at the card's own centre x (deliberately not the min-area
|
||||
// rect: at 0 to 6 degrees of tilt a hull can be argued about, a column of pixels cannot):
|
||||
// f1340-f1363 147-149 | f1364 149 | f1367 151 | f1369 152 | f1370 153 | f1373 156
|
||||
// f1375 160 | f1377 167 | f1380 174 | f1382 177 | f1384 184 | f1386 198 | f1388 228
|
||||
// f1390 320 | f1393 502 | f1395 571 | f1400 695 | f1404 730 | f1407 735 (peak)
|
||||
// f1410 723 | f1413 706 | f1414 696 | f1416 694 | f1417 693 | f1418 689
|
||||
// FOUR LEGS, AND THE FIRST ONE IS THE POINT. This used to be a single power4.in from
|
||||
// f1372, which is flat for its own first half: it put 0% of the lead-in on screen by
|
||||
// f1377 where the reference has 14%, so the card only started blooming at f1380, by which
|
||||
// time the width was at 98% of final and there was no overlap left. The lead-in is not
|
||||
// anticipation to be swallowed by the ramp behind it, it is 12 frames of visible growth at
|
||||
// about 2px per frame, and it is what makes the two morphs read as one event.
|
||||
// f1364-f1382 fits t^2 to within 3.6px of a 28px span. On the render, where the rounding
|
||||
// to integer device px lands, it crosses the 152 rest band at f1370.93, one frame after
|
||||
// the reference's own break at f1370. The residual inside the leg is not flat: the build
|
||||
// tracks the reference to within 1.3px through f1375 and then runs 3.5 to 4.5px under it
|
||||
// from f1376 to f1380, because the reference's lead-in is not a pure t^2, it has a knee
|
||||
// around f1375 that a single quadratic cannot carry without giving up the break frame.
|
||||
// The break frame is worth more, so it keeps the quadratic and wears the 4.5px.
|
||||
tl.fromTo(shell, { height: px(149) }, { height: px(177), duration: D(1364, 1382), ease: "power1.in" }, T(1364));
|
||||
// Then the bloom. Cubic-in over f1382-f1390 is the best of the in family on a 143px span
|
||||
// (quartic is 52px out at f1390, quadratic 46px out at f1388), so power2.in, remembering
|
||||
// that GSAP's power2 is cubic and its power1 is the quadratic. Measured back off the
|
||||
// render it is worst at f1389, 12.8px high on the 143px span, 9%; the reference's last
|
||||
// two frames before the velocity peak are steeper than any exponent that also holds
|
||||
// f1384-f1386, and this leg is 8 frames long, so the residual stays.
|
||||
tl.fromTo(shell, { height: px(177) }, { height: px(320), duration: D(1382, 1390), ease: "power2.in" }, T(1382));
|
||||
// The rise to the peak is ONE leg from the velocity peak at f1390, not two, and again the
|
||||
// exponent is measured: on the remaining distance it reads 3.08, 2.66, 2.64, 2.55 at
|
||||
// f1392, f1395, f1400, f1404, so k = 2.7, between GSAP's power1.out (3) and power2.out
|
||||
// (4) by their real exponents. power2.out was what this leg used to carry and it runs
|
||||
// 27px ahead of the reference around f1396, 6.5% of the 415px span; k = 2.7 halves that
|
||||
// to 14px. It does not remove it, and the reason is worth writing down: the reference's
|
||||
// remaining distance decays by a near-constant 0.82 per frame from f1390 to f1400, which
|
||||
// is an exponential with a 3.5-frame half life, about 5 half lives across this leg. No
|
||||
// power ease is an exponential and GSAP's expo.out is 10 half lives over the same window,
|
||||
// which puts it 66px ahead by f1391. So this is the closest a single tween gets, and the
|
||||
// middle third of the bloom is the one place this file is visibly ahead of its reference.
|
||||
tl.fromTo(shell, { height: px(320) }, { height: px(735), duration: D(1390, 1407), ease: powOut(2.7) }, T(1390));
|
||||
// 735 -> 696 is a real 5.9% overshoot recovery in the reference, not a settle invented to
|
||||
// keep pixels moving, and 5.9% is the number a min-area rect gives. This file used to say
|
||||
// 7.8%, off an axis-aligned bbox that a 1.1 degree tilt inflates; a reviewer guessed 4.2%
|
||||
// off a hand de-rotation and was off the other way. The ease was also wrong and it cost
|
||||
// the tail: the recovery is nearly CONSTANT VELOCITY at 5.3px per frame and finishes at
|
||||
// f1414, not a sine.inOut easing to a stop at f1416. sine.inOut is 8.4px (20%) out at
|
||||
// f1411; sine.in over f1407-f1414 is 3.4px (8.6%) worst.
|
||||
tl.fromTo(shell, { height: px(735) }, { height: px(696), duration: D(1407, 1414), ease: "sine.in" }, T(1407));
|
||||
// The tail, and it is the reason the previous ease mattered. A recovery that lands with
|
||||
// zero velocity at f1416 followed by a power2.in that leaves with zero velocity meant the
|
||||
// three rendered frames either side of f1416 moved less than one device pixel, and the
|
||||
// hero rendered three identical heights while the header called it "still resolving".
|
||||
// The reference does not stop there: 696 f1414, 695, 694.4, 692.6, 688.7 f1418, and a
|
||||
// power1.in across that span is 1.8px worst on 7px. At 32 frames the last four samples
|
||||
// seek to f1411.67, f1414.17, f1416.67 and f1417.5, and measured back off those four PNGs
|
||||
// the shell is 800, 780, 776 and 774 composition px against the reference's 799, 780, 774
|
||||
// and 772: four different heights, none repeated, none invented to move a pixel. f1418 is where the reference's card starts dissolving
|
||||
// out, so nothing is authored past it.
|
||||
tl.fromTo(shell, { height: px(696) }, { height: px(689), duration: D(1414, 1418), ease: "power1.in" }, T(1414));
|
||||
|
||||
// Corner radius. While the pill is still a pill the ends stay true semicircles, so the
|
||||
// radius is height/2 and has to track the lead-in above: 149/2 at f1364 to 177/2 at
|
||||
// f1382. Leave it at the rest value and a 177-tall pill carries 27px of straight edge on
|
||||
// each end, which is a visibly different silhouette from the reference's at f1380.
|
||||
tl.fromTo(shell, { borderRadius: px(75) }, { borderRadius: px(88), duration: D(1364, 1382), ease: "none" }, T(1364));
|
||||
// Then it stops being a capsule and becomes the card's 125. Endpoints measured (f1384 and
|
||||
// f1416, the latter by walking the top edge inward row by row); the curve between them is
|
||||
// inferred.
|
||||
tl.fromTo(shell, { borderRadius: px(88) }, { borderRadius: px(125), duration: D(1384, 1404), ease: "power1.out" }, T(1384));
|
||||
|
||||
// TILT. Fitted from the min-area rect's own angle, degrees, sign flipped to this file's
|
||||
// convention: f1381 0.0 | f1383 0.5 | f1385 3.0 | f1387 5.5 | f1389 6.0 | f1393 6.4
|
||||
// f1396 3.2 | f1400 0.0 | f1405 -1.1 | f1407 -1.1 | f1410 -0.8 | f1414 0.0
|
||||
// Note the plateau at 6deg (f1389-f1393) while the height is at its fastest: the tilt
|
||||
// locks and the box explodes underneath it. Both eases fit sine.inOut inside 0.3deg.
|
||||
tl.fromTo(shell, { rotation: 0 }, { rotation: 6.0, duration: D(1383, 1390), ease: "sine.inOut" }, T(1383));
|
||||
tl.fromTo(shell, { rotation: 6.0 }, { rotation: -1.3, duration: D(1394, 1405), ease: "sine.inOut" }, T(1394));
|
||||
tl.fromTo(shell, { rotation: -1.3 }, { rotation: 0, duration: D(1405, 1414), ease: "sine.inOut" }, T(1405));
|
||||
|
||||
// PILL WORDS: THREE COPIES OF ONE DAMPED BOUNCE, four to five frames apart, and it runs
|
||||
// far longer than this file used to think. Tracking each word's own ink centre against the
|
||||
// label's line (positive = below it), ref px:
|
||||
// iPhone +17 f1363 +8 f1364 -10 f1368 -7.5 f1370 -2 f1372 +2.5 f1376 -5 f1384
|
||||
// 17 +29 f1364 +30.5 f1365 -9.5 f1372 -8.5 f1373 +3 f1380 -1 f1384
|
||||
// Pro -20 f1365 +31.5 f1369 -9.5 f1377 +4 f1384
|
||||
// Every one of them crosses the line, comes back past it, and crosses again: two sign
|
||||
// changes in the first difference, which no back.out can produce, so this is four legs
|
||||
// rather than one ease. The shape is identical for all three, and the numbers say so
|
||||
// plainly: down-peak +30 at a+5, up-peak -10 at a+13, down-peak +3 at a+21, with a =
|
||||
// 1355, 1360, 1364. Half period 8 frames, damping 0.33 per half period, on all three.
|
||||
// The old model was one back.out(2.2) settling in 6 frames, so from f1370 the label was
|
||||
// dead level while the reference still had "17" high and "Pro" low, then swapped.
|
||||
// Word 0 is the exception on entry only: it is revealed by the shell's left edge sweeping
|
||||
// over it rather than dropped in, so it starts at rest and sinks into the first trough
|
||||
// instead of arriving from above. Everything after the trough is shared.
|
||||
const WORD_A = [1355, 1360, 1364];
|
||||
tl.fromTo(pillWords[0], { y: 0 }, { y: px(30), duration: D(1353, 1360), ease: "power1.in" }, T(1353));
|
||||
pillWords.forEach((w, i) => {
|
||||
const a = WORD_A[Math.min(i, WORD_A.length - 1)];
|
||||
if (i > 0) {
|
||||
// Entry: the drop is 4 blurred frames in the reference, so the amplitude above the
|
||||
// line and the sideways lead-in are inferred; the frame it lands in is measured.
|
||||
tl.fromTo(w, { opacity: 0 }, { opacity: 1, duration: D(a, a + 3), ease: "none" }, T(a));
|
||||
tl.fromTo(w, { y: -px(38) }, { y: px(30), duration: D(a, a + 5), ease: "power2.out" }, T(a));
|
||||
tl.fromTo(w, { x: px(26) }, { x: 0, duration: D(a, a + 5), ease: "power2.out" }, T(a));
|
||||
}
|
||||
tl.fromTo(w, { y: px(30) }, { y: -px(10), duration: D(a + 5, a + 13), ease: "sine.inOut" }, T(a + 5));
|
||||
tl.fromTo(w, { y: -px(10) }, { y: px(3), duration: D(a + 13, a + 21), ease: "sine.inOut" }, T(a + 13));
|
||||
tl.fromTo(w, { y: px(3) }, { y: 0, duration: D(a + 21, a + 29), ease: "sine.inOut" }, T(a + 21));
|
||||
});
|
||||
// AND THE WHOLE LABEL SCALES. Least squares on all 22 glyph-band edges of "iPhone 17 Pro"
|
||||
// against their f1369 positions gives a pure similarity with scale 1.0072 f1370, 1.0256
|
||||
// f1372, 1.0397 f1373, 1.0709 f1375, 1.1132 f1377, 1.1459 f1379, 1.1560 f1380, 1.1684
|
||||
// f1382, 1.1779 f1384, worst residual 2.9px on any edge on any frame. The fixed point
|
||||
// converges on x = 950 against the card's centre of 959.5, and the cap height of the P
|
||||
// grows 37 -> 42 over the same window, so it is a real 2D scale about the card's centre
|
||||
// and not letter-spacing. This is the channel that makes the pill look like it is
|
||||
// inflating rather than just getting wider, and it is why #pilltext's transform origin is
|
||||
// pinned to the shell's centre rather than to its own box.
|
||||
// Residual: sine.inOut runs 0.08 of the 0.178 span low through the middle of the window
|
||||
// (4px of block width at f1377, 8% of the spread). The measured exponent walks 1.14 to
|
||||
// 0.38 across the window, so no single power ease closes it either.
|
||||
tl.fromTo(pilltext, { scale: 1 }, { scale: 1.178, duration: D(1369, 1384), ease: "sine.inOut" }, T(1369));
|
||||
// The label also sags about 11px and comes back over f1369-f1384 on top of that scale, on
|
||||
// all three words at once. It is measured and it is NOT reproduced here: the scale about a
|
||||
// fixed point accounts for 3.5px of it and the rest has no model that survived a fit.
|
||||
// The shell is empty from here until the card content arrives at f1390. That gap is what
|
||||
// makes animating the box safe.
|
||||
tl.fromTo(pilltext, { opacity: 1 }, { opacity: 0, duration: D(1384, 1388), ease: "none" }, T(1384));
|
||||
|
||||
// THE ACCENT. One node, four box properties and a colour, one window: f1384 to f1400.
|
||||
// Measured, ref px: at f1384 it is a 128 disc inset 12 from the shell's right and 10 from
|
||||
// its bottom; at f1416 it is a 709 x 145 bar inset 64 and 55. The left edge is what the
|
||||
// eye follows and it sweeps 1208 -> 618 with the fastest frame in the middle (f1392),
|
||||
// which power1.inOut reproduces inside 42px at every sample.
|
||||
//
|
||||
// The insets are travelled with x/y, never with right/bottom. Those two are layout
|
||||
// properties: the browser snaps them to whole device pixels during layout, so the
|
||||
// ease-out tail stutters instead of decelerating under a seek-by-frame capture, and
|
||||
// StaticGuard rejects the composition outright. Right inset 12 -> 64 is 52px of leftward
|
||||
// travel, bottom 10 -> 55 is 45px of upward travel, and the static CSS inset stays at the
|
||||
// f1384 value so the box still grows leftward out of the pill's right end.
|
||||
// The FROM values pick up where the bulge left off (133, not the 128 this block used to
|
||||
// start from, which would have snapped the disc 5px wider at f1384).
|
||||
const A = { duration: D(1384, 1400), ease: "power1.inOut" };
|
||||
tl.fromTo(accent, { width: px(133) }, { width: px(709), ...A }, T(1384));
|
||||
tl.fromTo(accent, { height: px(133) }, { height: px(145), ...A }, T(1384));
|
||||
tl.fromTo(accent, { x: 0 }, { x: -px(52), ...A }, T(1384));
|
||||
tl.fromTo(accent, { y: -px(11.5) }, { y: -px(45), ...A }, T(1384));
|
||||
// Colour is the OTHER half of the continuity: blue disc to near-black bar, sampled as a
|
||||
// mean over the accent's own pixels. f1384 (11,107,245) | f1390 (15,77,165) |
|
||||
// f1393 (24,63,118) | f1396 (32,49,71) | f1400 (37,37,37). That is a straight line in RGB
|
||||
// to within 6 levels, so ease "none" is the measurement, not a shortcut.
|
||||
tl.fromTo(accent, { backgroundColor: "#0b6bff" }, { backgroundColor: "#232323", duration: D(1384, 1400), ease: "none" }, T(1384));
|
||||
// The chevron leaves as the disc starts to stretch, the label arrives as it stops.
|
||||
tl.fromTo(chev, { opacity: 1 }, { opacity: 0, duration: D(1384, 1388), ease: "none" }, T(1384));
|
||||
tl.fromTo(paylabel, { opacity: 0 }, { opacity: 1, duration: D(1399, 1404), ease: "none" }, T(1399));
|
||||
|
||||
// CARD CONTENT. First ghost of the product at f1391, solid by f1396. It is clipped by the
|
||||
// shell on its way in, so the growing card reveals it.
|
||||
tl.fromTo(media, { opacity: 0 }, { opacity: 1, duration: D(1390, 1396), ease: "none" }, T(1390));
|
||||
tl.fromTo(media, { scale: 0.86 }, { scale: 1, duration: D(1390, 1398), ease: "power2.out" }, T(1390));
|
||||
|
||||
// The card's title lands word by word AFTER the box has stopped growing: "iPhone" f1400,
|
||||
// "17" f1404, "Pro" f1409, settled f1413. Same drop-and-overshoot as the pill's words, so
|
||||
// the two rows read as the same typography moving, not two different animations.
|
||||
const CARD_IN = [[1399, 1404], [1403, 1409], [1408, 1413]];
|
||||
cardWords.forEach((w, i) => {
|
||||
const [a, b] = CARD_IN[Math.min(i, CARD_IN.length - 1)];
|
||||
tl.fromTo(w, { opacity: 0 }, { opacity: 1, duration: D(a, a + 3), ease: "none" }, T(a));
|
||||
tl.fromTo(w, { y: -38, x: 26 }, { y: 0, x: 0, duration: D(a, b), ease: "back.out(2.2)" }, T(a));
|
||||
});
|
||||
|
||||
// THE PRICE IS THE AFTERMATH, and it is a reveal, NOT an odometer.
|
||||
//
|
||||
// This file used to roll four clipped digit columns through two full 0-9 cycles each. It
|
||||
// looked like the reference at a glance and was the opposite of it at full resolution.
|
||||
// Cropping x1080-1330 y385-485 out of the source and listing the ink bands per frame:
|
||||
//
|
||||
// f1401 $ alone at x1204-1231, darkest pixel 189, still a ghost
|
||||
// f1402 $ at 1177-1203 and a 1 at 1253-1264 reads "$1"
|
||||
// f1406 $ 1114-1141, 1 1157-1173, 0 1224-1250 reads "$10"
|
||||
// f1409 $1 1129-1160, 0 1186-1214, 9 1264-1288 reads "$109"
|
||||
// f1413 $ 1145-1172, 10 1175-1209, 9 1225-1252, 9 1300-1327 reads "$1099"
|
||||
// f1416 1148-1175, 1185-1199, 1203-1246, 1270-1297, settled
|
||||
// f1419 1151-1177, 1184-1199, 1212-1280, unchanged glyphs, still settled
|
||||
//
|
||||
// Every glyph arrives already showing its final value. The reference never displays a
|
||||
// wrong number, never clips a glyph at the top or bottom, and never puts one off the
|
||||
// shared baseline. The odometer did all four: it published $172, $1078, $1096 and $1098
|
||||
// as legible frames, and its digits sat as superscripts and subscripts because a 70px
|
||||
// window over a travelling strip is exactly that. So the mechanic here is two things and
|
||||
// no more: a fade, and a slide into place from the right.
|
||||
//
|
||||
// Entry frames, from the first row of that table: $ f1401, then f1402, f1406, f1409,
|
||||
// f1413. The three digit gaps are 4, 3, 4, so the stagger is 3.67 frames and the formula
|
||||
// below reproduces 1402/1406/1409/1413 exactly while extending to any digit count.
|
||||
const PRICE_IN = (i) => (i === 0 ? 1401 : 1402 + Math.round((i - 1) * 3.67));
|
||||
// The whole row slides too, and it overshoots. Tracking the "$" against its own settled
|
||||
// left edge of 1149: +55 at f1401, +28 f1402, +1 f1403, -20 f1404, -32 f1405, -35 f1406
|
||||
// (the far end of the overshoot), then back -27 f1408, -14 f1410, -6 f1412, -2 f1414,
|
||||
// 0 f1417. Two legs, both power2.out: on the return, (1-t)^2 gives .67 .41 .21 .07 .008
|
||||
// against measured .77 .40 .17 .06 .03.
|
||||
tl.fromTo(price, { x: px(55) }, { x: -px(35), duration: D(1401, 1406), ease: "power2.out" }, T(1401));
|
||||
tl.fromTo(price, { x: -px(35) }, { x: 0, duration: D(1406, 1417), ease: "power2.out" }, T(1406));
|
||||
glyphs.forEach((g, i) => {
|
||||
const a = PRICE_IN(i);
|
||||
tl.fromTo(g, { opacity: 0 }, { opacity: 1, duration: D(a, a + 3), ease: "none" }, T(a));
|
||||
// Each digit closes a gap to the glyph before it. Measured against the row's own slide,
|
||||
// the local offsets are +44 +32 +21 +11 0 for the last 9 over f1413-f1417 and +48 +31
|
||||
// +16 +4 0 for the one before it over f1409-f1413: linear to within 4px, so ease "none"
|
||||
// is the measurement. The "$" has no local offset, the row's slide is its entrance.
|
||||
if (i > 0) tl.fromTo(g, { x: px(46) }, { x: 0, duration: D(a, a + 4), ease: "none" }, T(a));
|
||||
});
|
||||
|
||||
tl.set({}, {}, DUR);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["chevron-pill-card-morph"] = tl;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,663 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
chevron-pill-card-morph
|
||||
ref reference-clip f1340-f1420 @60fps (single-surface buy flow: search
|
||||
chip types a product name, then the chip becomes a checkout card)
|
||||
|
||||
FRAME NUMBERING. The source is reversals/_pool/uianim/reference-clip.mp4.
|
||||
ffmpeg's own decode index runs ONE frame ahead of the numbering used here and in
|
||||
ref/frames/: extracting with select='between(n,1330,1440)' and matching each
|
||||
m3-<N>.jpg thumbnail by minimum mean absolute error lands on ffmpeg n = N+1 every
|
||||
time (MAE 0.08 to 0.56 at N+1, against 0.3 to 3.4 at either neighbour). So to pull
|
||||
frame f cited below, extract ffmpeg frame f+1. Every number in this file was measured
|
||||
at 1920x1080 off that video, never off the 340px thumbnails.
|
||||
|
||||
The move: ONE surface goes circle -> pill -> card, and ONE accent button rides it the
|
||||
whole way. The chevron disc at the pill's right end stretches, darkens, and lands as
|
||||
the card's Pay bar. It is never crossfaded and never replaced: #accent is a single DOM
|
||||
node whose width, height, x, y and background are tweened. That continuity is the
|
||||
primitive. If you swap it for three elements that dissolve into each other you have
|
||||
copied the poses and thrown away the move.
|
||||
|
||||
MEASURE THE BOX WITH A MIN-AREA RECT, NOT AN AXIS-ALIGNED BBOX. This file used to
|
||||
claim the shell's width overshoots to 858 at f1396 and recovers to 838. It does not.
|
||||
That 858 was the axis-aligned bounding box of a card tilted 3.2 degrees; rotating the
|
||||
point cloud through -8..+8 in 0.1 degree steps and taking the smallest enclosing
|
||||
rectangle gives w = 839, 840, 841, 840, 840 at f1395, f1396, f1400, f1410, f1416. The
|
||||
width is monotonic and asymptotes at 840. There is no width overshoot in this clip,
|
||||
and a whole tween leg existed to reproduce a rotation artifact.
|
||||
|
||||
THE TWO MORPHS OVERLAP, and this is the whole reason the file is laid out the way it
|
||||
is. One criterion, applied to both: the height LEAVES REST at the first frame it exceeds
|
||||
its own 147-152 rest band, and the width is read as a percentage of its 840 asymptote at
|
||||
that same frame. Reference, centre-column height at the card's own centre x: 151 f1367,
|
||||
152 f1369, 153 f1370, 156 f1373, 160 f1375, 167 f1377, 174 f1380, 184 f1384, 228 f1388.
|
||||
So the break is f1370, and the min-area-rect width there is 745 = 88.7% of 840. The
|
||||
overlap runs from that break to the frame the width is within 2px of its asymptote
|
||||
(f1390, 838.6): twenty frames.
|
||||
|
||||
TWO EARLIER VERSIONS OF THIS PARAGRAPH WERE WRONG AND THE SECOND ONE WAS EXPENSIVE. The
|
||||
first claimed the break was f1368 and the width was still climbing at f1396, giving 28
|
||||
frames; f1368 is inside the rest band and 1396 was the rotation artifact above. The
|
||||
second claimed f1373 and 90.6%, which is a true statement about the reference (760/840)
|
||||
but was measured one criterion looser than the one applied to the build, and the build
|
||||
did not meet it at all: its height was flat until f1380, by which point its width was at
|
||||
98.3% of the asymptote. The card bloomed after the pill had finished widening. That is
|
||||
three poses cutting to each other, which is the exact failure this layout exists to
|
||||
avoid, and it survived a round because the header asserted an overlap the render did not
|
||||
have. Whatever this file claims here, measure it back off the render before shipping.
|
||||
|
||||
SO HERE IS THIS BUILD MEASURED BACK, same estimator, same criterion. The height crosses
|
||||
152 at f1370.93 and the min-area-rect width there is 752.9, 89.6% of 840, against the
|
||||
reference's own 88.7% at f1370 (and against the 98.3% the last build managed). The width
|
||||
comes within 2px of the asymptote at f1387.2, so the overlap window is 16.3 frames
|
||||
against the reference's 20. It is the two ends that matter, not the length: this build
|
||||
starts blooming one frame after the reference does at a width one point off, and it
|
||||
finishes tightening three frames early. The remaining gap is one channel, the last four
|
||||
frames of the lead-in, where the build sits 4 to 5px under the reference at f1377-f1380
|
||||
and then overshoots by 10px at f1388.
|
||||
|
||||
What actually happens in f1370-f1380, ten source frames, and what a serialised build
|
||||
misses: FOUR channels resolve at once. The shell height leaves rest and climbs 153 -> 174
|
||||
at a near-constant 2px per frame. The accent disc swells 129 -> 141 and drops back to 133,
|
||||
because until f1378 it is a capsule fitted inside the pill (its inset from the card's top
|
||||
and bottom edge measures 10-14px on every frame from f1364 to f1378, so its diameter is
|
||||
just the pill's height minus about 26) and at f1379 it detaches and holds 133 while the
|
||||
card keeps growing. The pill label scales up 1.178x about the card's centre. And each of
|
||||
its three words is still ringing on its own clock. The width, the one channel a serialised
|
||||
build gets right, is doing the least interesting thing of the five.
|
||||
|
||||
Why width/height and not scale ON THE SHELL: a scale on the box would drag every child
|
||||
with it, and the reference's card content does not scale with the card (compare the Pay
|
||||
label at f1400 and f1416: identical, while the shell grows 695 -> 694 through a 735
|
||||
peak). The pill's own label does scale, but on its own tween and about the card's centre,
|
||||
which is a different thing and is fitted separately below. The usual objection to
|
||||
animating width/height is that it reflows the content, so look at what the reference
|
||||
does with content during a size change: nothing is in there. The pill's text is fully
|
||||
faded by f1388, the card's content does not start arriving until f1390, and the shell
|
||||
is empty in between. Every child here is absolutely positioned at a fixed px size, so
|
||||
a shell resize only ever translates them, never reflows them, and every value is a
|
||||
pure function of t. width/height are also the one pair of layout properties the
|
||||
framework's StaticGuard deliberately exempts, because progress bars and reveals need
|
||||
them; left/right/top/bottom are not exempt and are not used by any tween here.
|
||||
|
||||
The typing is a clip, not a type-on. #pilltext sits at a FIXED offset from the shell's
|
||||
centre and the shell's left edge sweeps leftward across it under overflow:hidden. That
|
||||
reproduces the reference exactly: at f1356 the shell's left edge is 96px right of the
|
||||
word's start and you read "one", at f1357 "hone", f1358 "Phone", f1359 "iPhone". No
|
||||
per-character tween anywhere. The word's HORIZONTAL position holds still while this
|
||||
happens: its glyph bands sit at x = 717-744, 748-774, 778-803 on every frame from f1359
|
||||
to f1369, within 2px. It does not hold after that, and an earlier version of this
|
||||
comment extended the claim to f1372 without measuring it: by f1372 the same three bands
|
||||
read 713-740, 744-769, 773-800. See the scale below.
|
||||
|
||||
THE SHELL'S CENTRE SNAPS LEFT AND HOLDS. It does not ramp to a peak and come back, which
|
||||
is what this file used to say, and the difference is the estimator: the old track was
|
||||
fitted off axis-aligned bbox mid-x while the file's own headline says to use a min-area
|
||||
rect. Under the min-area rect, cx - 959.5 reads 0.0 f1350, -0.5 f1352, -12.0 f1353,
|
||||
-16.5 f1354, -16.0 f1355, -16.5 f1356, -17.0 f1357, -16.0 f1358, -15.5 f1359, -15.0
|
||||
f1360, -16.5 f1361, -16.0 f1362, -16.0 f1363, -15.5 f1364, -7.5 f1365, -6.0 f1366, -1.0
|
||||
f1367, +1.0 f1368. That is a two-frame snap to -16, an eleven-frame plateau, and a
|
||||
three-frame return. The old comment also discarded f1353 and f1359 as motion blur on the
|
||||
grounds that the right edge "measures backwards" there; it does not. R = cx + w/2 reads
|
||||
1187, 1207, 1223 at f1358, f1359, f1360, monotonic, and the two discarded frames read
|
||||
-12.0 and -15.5, which is the plateau. A triangular ramp peaking at -20 was fitted to a
|
||||
square pulse of -16.
|
||||
|
||||
The plateau is reproduced by translating the shell left and translating #pilltext right
|
||||
by the same amount, which leaves the word where the reference leaves it and leaves the
|
||||
accent's rightward travel monotonic, both of which a naive shell translation breaks.
|
||||
|
||||
THE PRICE GLYPHS ARE 5 TO 7% WIDER THAN THE REFERENCE'S, AND AN EARLIER VERSION OF THIS
|
||||
PARAGRAPH SAID 24%. That number was wrong and it was wrong in the way this contract
|
||||
cares about: it compared the build's settled row against the reference at a different
|
||||
frame. The reference's price is still converging through f1417, its last glyph arriving
|
||||
from the right (left edge 751, 741, 730, 720 at f1414, f1415, f1416, f1417), so any
|
||||
comparison that is not frame-matched reads the convergence as a size difference. Matched
|
||||
frame by frame with one estimator, the row spans 166 against 160 at f1415, 156 against
|
||||
148 at f1416, 147 against 138 at f1417, and the digit heights agree at 37 and the dollar
|
||||
sign at 45 against 43. So this is tracking and sidebearings, a few px, not a face that is
|
||||
a quarter too wide. It is still not chased, and the reason it cannot be chased far is
|
||||
worth keeping: the repo's bundled families pass the linter but the snapshot path does
|
||||
not inject them, so naming one would render a fallback and quietly invalidate every
|
||||
typographic constant in this file, and a fonts.googleapis.com link is a render-time
|
||||
network fetch, which the determinism rule bans. A system stack that is genuinely present
|
||||
is worth more than a face that is only present on the machine that authored the file.
|
||||
The one place a real size error DID hide behind that excuse was the pill's own label,
|
||||
which was drawn 22% too large for eight rounds because it shared #title's 66px and the
|
||||
reference does not; that one is fixed in the CSS below and measured there.
|
||||
|
||||
Slot pattern: PILL_WORDS, CARD_WORDS and PRICE below drive the DOM. Change the copy or
|
||||
the price and the motion is unchanged.
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<style>
|
||||
html, body { width: 1080px; height: 1920px; overflow: hidden; margin: 0; }
|
||||
#root {
|
||||
position: absolute; inset: 0;
|
||||
/* Tokens on #root, never :root, or they leak into every other clip on the page. */
|
||||
--bg:#e0e0e0; /* ref bg sampled at f1416, rgb(224,224,224) */
|
||||
--card:#fafafa; /* ref shell fill, rgb(250,250,250) */
|
||||
--accent:#0b6bff; /* ref chevron disc centre f1372, rgb(0,106,255) */
|
||||
--accent-end:#232323;/* ref Pay bar centre f1416, rgb(35,35,35) */
|
||||
/* The reference sets its type in a light grey, not black: the darkest pixel in the
|
||||
title, the price and the pill label is 135-137 on a 250 ground, about 2.9:1. That
|
||||
is the look, so it is what ships. If this primitive has to meet WCAG, darken --ink
|
||||
and --ink-dim here and nothing else changes. */
|
||||
--ink:#8a8a8a;
|
||||
--ink-dim:#8a8a8a;
|
||||
--on-accent:#a3a3a3; /* ref Pay label, brightest pixel 164 on the 35 bar */
|
||||
--media:#f0762e; /* stand-in product colour */
|
||||
background: var(--bg);
|
||||
font-family: "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* Every px below is a reference measurement times S = 1.12. The ref is 1920x1080 with
|
||||
the card 840px wide; this is 1080x1920, so the card is scaled to 941px to fill the
|
||||
portrait width with a 70px margin and still clear the frame at the 6deg tilt
|
||||
(widest rotated bbox is f1392, 844*cos6 + 478*sin6 = 890 ref = 997 comp px). */
|
||||
#shell {
|
||||
position: absolute; left: 50%; top: 50%;
|
||||
width: 168px; height: 167px; /* rest, f1340-f1346: 150 x 149 */
|
||||
border-radius: 84px; /* = height/2, a true capsule end */
|
||||
background: var(--card);
|
||||
box-shadow: 0 20px 46px rgba(0,0,0,0.10);
|
||||
overflow: hidden; /* this is what "types" the pill label */
|
||||
}
|
||||
|
||||
/* Anchored to the shell's CENTRE, so it holds a fixed screen position while the shell's
|
||||
edges move. ref: word left edge x=706 with shell centre x=959.5, so -253 * 1.12.
|
||||
No CSS transform here: GSAP tweens x on this node and writes the whole transform
|
||||
property, so a CSS translateY(-50%) would be silently discarded on the first tween.
|
||||
The vertical centring is handed to GSAP as yPercent below instead. */
|
||||
/* 54px, not the 66px this carried and #title still carries, and the difference is
|
||||
measured rather than eyeballed. In the reference the pill's label and the card's title
|
||||
are NOT the same size: at f1368 the label's ink spans 706-1010, 305 ref px, while the
|
||||
title at f1412 spans 372. At 66px this file drew the label 383 wide, so it filled the
|
||||
pill where the reference's label has air on both sides, and the ratio is the same on
|
||||
each word taken separately (iPhone 156/189, 17 48/59, Pro 74/90, all 0.82). 66 * 0.82
|
||||
rounds to 54. Cap-and-ascender then lands at 36 against the reference's 37. The word
|
||||
gap has to come down with it: the gap is this margin plus two sidebearings, the
|
||||
sidebearings scale with the font and the margin does not, so 18px would have left the
|
||||
label 22px too wide on its own. At 9px the rendered gaps are 14 and 14 against the
|
||||
reference's 12 and 19, which differ from each other only because e|1 and 7|P have
|
||||
different sidebearings and one margin cannot be two numbers. */
|
||||
#pilltext {
|
||||
position: absolute; left: 50%; margin-left: -284px; top: 50%;
|
||||
white-space: nowrap; font-size: 54px; color: var(--ink);
|
||||
}
|
||||
/* CSS owns every rest state. With immediateRender:false a fromTo does NOT stamp its FROM
|
||||
value at build time, so anything that is meant to be dark at t=0 has to be dark here.
|
||||
Getting this wrong put the card's title on screen from the opening frame, on top of
|
||||
the pill's label, before either had been scheduled. */
|
||||
.w { display: inline-block; opacity: 0; }
|
||||
#pilltext .w:first-child { opacity: 1; } /* word 0 is revealed by the clip, never faded in */
|
||||
#pilltext .w + .w { margin-left: 9px; }
|
||||
|
||||
#accent {
|
||||
position: absolute; right: 13px; bottom: 11px; /* ref 12, 10 */
|
||||
width: 149px; height: 149px; /* ref 133 disc at f1340 */
|
||||
border-radius: 999px; /* capsule at every size it takes */
|
||||
background: var(--accent);
|
||||
}
|
||||
#chev { position: absolute; left: 50%; top: 50%; width: 37px; height: 56px; margin: -28px 0 0 -16px; }
|
||||
#paylabel {
|
||||
position: absolute; inset: 0; opacity: 0;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
font-size: 64px; color: var(--on-accent);
|
||||
}
|
||||
|
||||
/* Card content. Fixed sizes, absolutely positioned: a shell resize translates these,
|
||||
it never reflows them. Anchored to the edge the reference anchors them to, so they
|
||||
ride the last 46px of the card's settle instead of sitting still while it moves. */
|
||||
#media {
|
||||
position: absolute; left: 146px; top: 123px; width: 166px; height: 343px;
|
||||
border-radius: 26px; opacity: 0;
|
||||
background: linear-gradient(150deg, #f5904f 0%, var(--media) 42%, #d85f1e 100%);
|
||||
}
|
||||
/* Swap #media for <img> (or <video>) and declare the look with data-color-grading on
|
||||
that element; grading only mirrors media pixels, so it would do nothing on this div. */
|
||||
#bump { position: absolute; left: 12px; top: 10px; width: 92px; height: 74px; border-radius: 20px;
|
||||
background: linear-gradient(150deg, #f7a066, #e06a24); }
|
||||
#bump i { position: absolute; width: 26px; height: 26px; border-radius: 999px; background: #24160e; }
|
||||
#title { position: absolute; right: 85px; top: 66px; white-space: nowrap; font-size: 66px; color: var(--ink); }
|
||||
#title .w + .w { margin-left: 16px; }
|
||||
/* The price is ONE inline row on ONE baseline. It used to be four odometer columns,
|
||||
each a 70px window over a 30-row digit strip, and that was wrong twice over: it
|
||||
published legible false prices on its way to the target ($172, $1078, $1096) and it
|
||||
pushed digits above and below the line as the strips travelled. The reference does
|
||||
neither. See the PRICE block in the script for the frame-by-frame evidence. Nothing
|
||||
here clips, so nothing can be half a row out of place. */
|
||||
#price { position: absolute; right: 103px; top: 250px; white-space: nowrap;
|
||||
font-size: 58px; line-height: 70px; color: var(--ink-dim); }
|
||||
.g { display: inline-block; opacity: 0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" class="clip" data-composition-id="chevron-pill-card-morph" data-start="0"
|
||||
data-width="1080" data-height="1920" data-duration="3.2">
|
||||
<div id="shell">
|
||||
<div id="pilltext"></div>
|
||||
<div id="media"><div id="bump"></div></div>
|
||||
<div id="title"></div>
|
||||
<div id="price"></div>
|
||||
<div id="accent">
|
||||
<svg id="chev" viewBox="0 0 37 56" fill="none">
|
||||
<path d="M6 6 L31 28 L6 50" stroke="#fff" stroke-width="7" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
<span id="paylabel">Pay</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
// ---- the slot ------------------------------------------------------------------------
|
||||
const PILL_WORDS = ["Lumen", "17", "Pro"]; // word 0 is revealed by the clip, 1..n drop in
|
||||
const CARD_WORDS = ["Lumen", "17", "Pro"];
|
||||
const PRICE = "1099"; // any digit count; the stagger follows
|
||||
|
||||
// ---- time ----------------------------------------------------------------------------
|
||||
// Every constant in this file is a SOURCE FRAME NUMBER, so a comment can never drift out
|
||||
// of step with the timing it describes. T() is the only place a second appears.
|
||||
//
|
||||
// SPF: the source is 60fps, so one frame is 16.67ms. The whole move is f1340-f1420 = 80
|
||||
// frames = 1333ms, which is a UI demo's speed, not a video's: the card bloom alone would
|
||||
// be 400ms. Scaled x2.4 (SPF = 16.67ms * 2.4 = 40ms) so it reads at reading distance. The
|
||||
// scale is UNIFORM, so every ratio and every overlap above survives it untouched. Nothing
|
||||
// here was scaled on its own.
|
||||
//
|
||||
// Why the clip now starts at f1340 rather than f1350: there was no opening pose at all,
|
||||
// the width left rest between the first and second sampled frame. f1340-f1348 is not a
|
||||
// hold either, and it is worth having for exactly that reason. Over those 9 frames the
|
||||
// blue disc rings DOWN from 133 to 122 (it overshot to 138 at f1335 on its way in) while
|
||||
// the whole assembly is still descending, mid-y 509.5 -> 523.5. So the clip opens on a
|
||||
// disc settling rather than on a still frame or on a widening already underway.
|
||||
//
|
||||
// WHAT THE CLIP COPIES ENDS AT f1417, AND DUR = T(1420) IS A HARNESS CONSTANT. An earlier
|
||||
// version of this comment said the reference "holds a settled $1099 from f1416 to f1419".
|
||||
// It does not hold and it does not stay: the card is cross-dissolving out. Card fill,
|
||||
// sampled in the empty area right of the product at rows 560-600, reads 250 250 250 250
|
||||
// 249 248 247 245 241 238 231 across f1412-f1422 on a background of 224, and the price
|
||||
// ink's darkest pixel goes 137 f1415, 146 f1416, 162 f1417, 167 f1418, 172 f1419, 184
|
||||
// f1420, with the row gone by f1420 and the card gone by f1422. The price is not even
|
||||
// still by then: the last 9's right edge is 1296, 1287, 1281 at f1416, f1417, f1418. So
|
||||
// the settled card exists for about two frames, f1415-f1416, and everything after that is
|
||||
// the exit. This primitive does not copy the exit. A file someone copies has to end on the
|
||||
// finished card, not on it fading.
|
||||
//
|
||||
// DUR is then chosen so that the last frame the harness actually PHOTOGRAPHS is f1417.5,
|
||||
// and that is arithmetic, not taste. The runtime floors every seek to 1/30s, and the final
|
||||
// sample asks for D - max(0.05, 0.03*D) rather than D. At DUR = T(1419) = 3.16 the last
|
||||
// two samples ask for 3.0581 and 3.0652 and BOTH floor to 91/30 = 3.0333 = f1415.83, so
|
||||
// the settle is in the timeline and in no frame, and the first shoot came back with the
|
||||
// last digit 15px out. At DUR = T(1418) = 3.12 they both floor to 90/30 = f1415, which is
|
||||
// worse. At 3.2 they floor to 92/30 and 93/30 = f1416.67 and f1417.5, and the finished
|
||||
// price is on screen twice. The 2.5 source frames of timeline past f1417.5 are never
|
||||
// rendered; no tween is authored to reach anything there. Check where your sample times
|
||||
// land before you conclude the motion is wrong.
|
||||
const F0 = 1340;
|
||||
const SPF = 0.04;
|
||||
const T = (f) => (f - F0) * SPF;
|
||||
const D = (a, b) => (b - a) * SPF;
|
||||
const DUR = T(1420);
|
||||
|
||||
// S = 1.12, ref px -> composition px. Written out rather than computed so a reader can
|
||||
// check any number in this file against the frame it was measured in.
|
||||
const px = (ref) => Math.round(ref * 1.12);
|
||||
|
||||
// A decelerate whose exponent is measured rather than chosen from the named set. GSAP's
|
||||
// out family only offers whole exponents (power1 = 2, power2 = 3, power3 = 4) and two of
|
||||
// the legs below have a measured exponent that sits between two of them, in both cases
|
||||
// close to the midpoint, so every named candidate is wrong at one end or the other. This
|
||||
// is still a pure function of the tween's own progress, so it costs nothing against the
|
||||
// seek filter. Only the two legs that need it use it; everywhere else a named ease fits
|
||||
// and is easier to read.
|
||||
const powOut = (k) => (u) => 1 - Math.pow(1 - u, k);
|
||||
|
||||
// ---- build the slots -----------------------------------------------------------------
|
||||
const el = (tag, cls, txt) => {
|
||||
const n = document.createElement(tag);
|
||||
if (cls) n.className = cls;
|
||||
if (txt !== undefined) n.textContent = txt;
|
||||
return n;
|
||||
};
|
||||
const pillWords = PILL_WORDS.map((w) => { const n = el("span", "w", w); pilltext.appendChild(n); return n; });
|
||||
const cardWords = CARD_WORDS.map((w) => { const n = el("span", "w", w); title.appendChild(n); return n; });
|
||||
// One span per glyph, "$" included, laid out inline. They are all in the DOM from the
|
||||
// start at their final positions, so the row's layout never changes and the browser gives
|
||||
// every glyph the same baseline for free. Only opacity and x are ever touched.
|
||||
const glyphs = ["$", ...PRICE].map((c) => { const n = el("span", "g", c); price.appendChild(n); return n; });
|
||||
for (const [i, dx] of [22, 52, 22].entries()) {
|
||||
const dot = el("i"); dot.style.left = dx + "px"; dot.style.top = (i === 2 ? 40 : 12) + "px";
|
||||
if (i === 2) dot.style.left = "22px";
|
||||
bump.appendChild(dot);
|
||||
}
|
||||
|
||||
// ---- timeline ------------------------------------------------------------------------
|
||||
// immediateRender:false, or every fromTo below stamps its FROM value at construction and
|
||||
// the opening frame shows the card's end state stacked on the pill's.
|
||||
gsap.defaults({ immediateRender: false });
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
|
||||
gsap.set(shell, { xPercent: -50, yPercent: -50, transformOrigin: "50% 50%" });
|
||||
// 284px is the element's own margin-left, so this pins the transform origin exactly on the
|
||||
// shell's centre no matter how long the copy in PILL_WORDS is. The label's scale below is
|
||||
// measured about the card's centre, not about the label's own box, and using the default
|
||||
// "50% 50%" origin would drag the word sideways by half the difference.
|
||||
gsap.set(pilltext, { yPercent: -50, transformOrigin: "284px 50%" });
|
||||
|
||||
// THE OPENING. The assembly is still arriving when the clip starts. Measured bbox mid-y,
|
||||
// ref px: f1340 509.5 | f1344 517.0 | f1348 523.5 | f1352 529.0 | f1356 532.5 | f1360
|
||||
// 535.5 | f1364 537.5 | f1368 538.5 | f1372 539.5, flat from there. Distance still to run
|
||||
// halves about every 5 frames, and (1-t)^2 over f1340-f1372 tracks it inside 1.5px at
|
||||
// every sample: 30 -> 23.0 (measured 22.5) -> 16.9 (16) -> 11.7 (10.5) -> 7.5 (7) ->
|
||||
// 4.2 (4) -> 1.9 (2). This is what makes the first quarter of the clip move at all.
|
||||
tl.fromTo(shell, { y: -px(30) }, { y: 0, duration: D(1340, 1372), ease: "power2.out" }, T(1340));
|
||||
// The disc's own ring-down inside that. Measured diameters: f1335 138 (its overshoot
|
||||
// peak, before this clip starts) | f1340 133 | f1342 129 | f1344 126 | f1346 122 |
|
||||
// f1348 122, then flat to f1352. Same (1-t)^2 shape: 11 -> 8.4 (measured 8) -> 6.2 (7)
|
||||
// -> 4.3 (4) -> 2.8 (4) -> 1.5 (2) -> 0.
|
||||
tl.fromTo(accent, { width: px(133) }, { width: px(122), duration: D(1340, 1348), ease: "power2.out" }, T(1340));
|
||||
tl.fromTo(accent, { height: px(133) }, { height: px(122), duration: D(1340, 1348), ease: "power2.out" }, T(1340));
|
||||
// #accent is anchored bottom-right, so shrinking it alone would walk its centre 6px down
|
||||
// and right. In the reference the disc stays concentric with the pill through the whole
|
||||
// ring-down (disc centre x 960.0 at f1340 and 960.5 at f1346, shell centre x 959.5 on
|
||||
// both), so the shrink is compensated by half of itself. x/y, not right/bottom: those
|
||||
// two snap to integer device pixels under the seek engine and StaticGuard rejects them.
|
||||
tl.fromTo(accent, { x: px(5.5) }, { x: 0, duration: D(1340, 1348), ease: "power2.out" }, T(1340));
|
||||
tl.fromTo(accent, { y: px(5.5) }, { y: 0, duration: D(1340, 1348), ease: "power2.out" }, T(1340));
|
||||
// And it grows back a little as the pill inflates under it: 122 at f1352, 124 at f1355,
|
||||
// 126 at f1357, 128 at f1360, flat to f1369.
|
||||
tl.fromTo(accent, { width: px(122) }, { width: px(128), duration: D(1354, 1360), ease: "none" }, T(1354));
|
||||
tl.fromTo(accent, { height: px(122) }, { height: px(128), duration: D(1354, 1360), ease: "none" }, T(1354));
|
||||
|
||||
// THE DISC BULGE, and it is not an independent pulse. Diameters run 129 f1370, 130 f1372,
|
||||
// 132 f1373, 135 f1375, 138 f1376, 141 f1377, 140 f1378, then break to 135 f1379 and 133
|
||||
// f1380 and hold. What is constant through the rising half is the disc's INSET from the
|
||||
// card's own top and bottom edge: 10, 11, 11, 12, 13, 13, 13, 13, 14, 13, 14 px on the
|
||||
// frames f1364 to f1378, so the disc is simply the pill's height minus about 26, a capsule
|
||||
// fitted inside a capsule. At f1379 that inset jumps to 20 top and 18 bottom in one frame
|
||||
// and never comes back: the disc has detached and now holds its own size while the card
|
||||
// keeps growing. So this is two tweens with a hard break between them, and the break frame
|
||||
// is the measurement. Do not smooth it: a disc that eases back instead of snapping reads
|
||||
// as a squash, not as a component letting go of its container.
|
||||
tl.fromTo(accent, { width: px(128) }, { width: px(141), duration: D(1370, 1377), ease: "power1.in" }, T(1370));
|
||||
tl.fromTo(accent, { height: px(128) }, { height: px(141), duration: D(1370, 1377), ease: "power1.in" }, T(1370));
|
||||
tl.fromTo(accent, { width: px(141) }, { width: px(133), duration: D(1377, 1380), ease: "power1.in" }, T(1377));
|
||||
tl.fromTo(accent, { height: px(141) }, { height: px(133), duration: D(1377, 1380), ease: "power1.in" }, T(1377));
|
||||
// #accent is anchored to the shell's bottom, which is exactly right while the disc grows
|
||||
// with the pill (both edges move and the disc stays concentric, which is what the equal
|
||||
// insets above say). Once it detaches at f1379 the shell keeps growing under a disc that
|
||||
// does not, so the anchor starts walking it downward: half the remaining growth, 12px by
|
||||
// f1382. The reference keeps it centred (disc cy 540.0 against card cy 539.5 at f1380,
|
||||
// f1381, f1382), so that walk is cancelled here. Measured, the correction is 3px at f1377,
|
||||
// 9 at f1379, 10.5 at f1380, 11.5 at f1382, which is quadratic-out.
|
||||
tl.fromTo(accent, { y: 0 }, { y: -px(11.5), duration: D(1377, 1382), ease: "power1.out" }, T(1377));
|
||||
|
||||
// SHELL WIDTH. Min-area-rect widths, ref px, re-measured with the same estimator the
|
||||
// header mandates rather than the axis-aligned numbers an earlier version of this block
|
||||
// used (it said 314/444/591 at f1355/f1357/f1360; the min-area rect says 293/437/557, and
|
||||
// the two agree within 2px at every other sampled frame, so the old f1360 keypoint was 6%
|
||||
// high and the whole leg ran ahead of the reference):
|
||||
// f1346 149 | f1347 151 | f1350 165 | f1352 188 | f1354 220 | f1355 293 | f1357 437
|
||||
// f1360 557 | f1363 629 | f1365 686 | f1367 721 | f1369 740 | f1372 755 | f1376 784
|
||||
// f1380 810 | f1385 831 | f1390 839 | f1395 840 | f1400 839 | f1410 840 | f1416 840
|
||||
// Four legs, because the pill sizes to its label rather than growing once smoothly. The
|
||||
// f1347-f1360 span is NOT one ease: sweeping the exponent frame by frame walks it from
|
||||
// 2.9 at f1354 down to 1.1 at f1358, which is an S, and a single power1.in over the whole
|
||||
// span is 48px (12%) out in the middle. Split at the knee it is 7% worst case.
|
||||
// The f1354-f1360 leg is the exponent fit, not a family pick. Remaining distance over the
|
||||
// 337px span reads .783 .537 .356 .208 .092 at f1355-f1359, and solving (1-u)^k at each of
|
||||
// those five frames gives 1.34, 1.54, 1.49, 1.43, 1.33: one exponent, k = 1.4, sitting
|
||||
// almost exactly between linear (k = 1) and power1.out (k = 2). Both neighbours are wrong
|
||||
// by more than the whole rest of this channel: linear is 44px low at the midpoint,
|
||||
// power1.out 31px high, sine.out (the closest named ease, effective k about 1.55 near the
|
||||
// midpoint) 25px high. The measured exponent is 10px worst case on the same span.
|
||||
tl.fromTo(shell, { width: px(150) }, { width: px(220), duration: D(1347, 1354), ease: "power1.in" }, T(1347));
|
||||
tl.fromTo(shell, { width: px(220) }, { width: px(557), duration: D(1354, 1360), ease: powOut(1.4) }, T(1354));
|
||||
tl.fromTo(shell, { width: px(557) }, { width: px(721), duration: D(1360, 1367), ease: "none" }, T(1360));
|
||||
tl.fromTo(shell, { width: px(721) }, { width: px(755), duration: D(1367, 1372), ease: "power1.out" }, T(1367));
|
||||
// f1372-f1391 the pill keeps inflating while the card blooms underneath it. This is the
|
||||
// overlap: the height tween below is already running when this leg starts. It asymptotes
|
||||
// rather than overshooting, so the ease is out and there is no recovery leg. The exponent
|
||||
// on the remaining distance measures 1.76, 1.91, 1.95, 1.41 at f1376, f1380, f1385, f1390,
|
||||
// so it is power1.out (k = 2), not the power2.out this leg used to carry: cubic-out runs
|
||||
// 14px ahead at f1376 and f1380, quadratic-out is within 3px at every sample.
|
||||
tl.fromTo(shell, { width: px(755) }, { width: px(840), duration: D(1372, 1391), ease: "power1.out" }, T(1372));
|
||||
|
||||
// SHELL X, and the equal-and-opposite on #pilltext. A SQUARE PULSE, not a ramp: min-area
|
||||
// rect cx - 959.5 snaps 0 -> -12 -> -16.5 over f1352-f1354, then holds between -15.0 and
|
||||
// -17.0 for eleven frames to f1364 (mean -16.05), then returns to 0 over f1364-f1367. The
|
||||
// gap between f1354 and f1364 carries no tween, so GSAP holds -16 there, which is the
|
||||
// whole point: this channel is genuinely still while four others are moving.
|
||||
// The return leg is "none" because the measured return is 8, 1.5, 5, 2 px per frame, and
|
||||
// linear is 3.2px worst against sine.inOut's 4.5px over a 16px span.
|
||||
tl.fromTo(shell, { x: 0 }, { x: -px(16), duration: D(1352, 1354), ease: "power1.out" }, T(1352));
|
||||
tl.fromTo(shell, { x: -px(16) }, { x: 0, duration: D(1364, 1367), ease: "none" }, T(1364));
|
||||
tl.fromTo(pilltext, { x: 0 }, { x: px(16), duration: D(1352, 1354), ease: "power1.out" }, T(1352));
|
||||
tl.fromTo(pilltext, { x: px(16) }, { x: 0, duration: D(1364, 1367), ease: "none" }, T(1364));
|
||||
|
||||
// SHELL HEIGHT, and this is the channel the whole file gets judged on. Heights, ref px,
|
||||
// read as the centre column at the card's own centre x (deliberately not the min-area
|
||||
// rect: at 0 to 6 degrees of tilt a hull can be argued about, a column of pixels cannot):
|
||||
// f1340-f1363 147-149 | f1364 149 | f1367 151 | f1369 152 | f1370 153 | f1373 156
|
||||
// f1375 160 | f1377 167 | f1380 174 | f1382 177 | f1384 184 | f1386 198 | f1388 228
|
||||
// f1390 320 | f1393 502 | f1395 571 | f1400 695 | f1404 730 | f1407 735 (peak)
|
||||
// f1410 723 | f1413 706 | f1414 696 | f1416 694 | f1417 693 | f1418 689
|
||||
// FOUR LEGS, AND THE FIRST ONE IS THE POINT. This used to be a single power4.in from
|
||||
// f1372, which is flat for its own first half: it put 0% of the lead-in on screen by
|
||||
// f1377 where the reference has 14%, so the card only started blooming at f1380, by which
|
||||
// time the width was at 98% of final and there was no overlap left. The lead-in is not
|
||||
// anticipation to be swallowed by the ramp behind it, it is 12 frames of visible growth at
|
||||
// about 2px per frame, and it is what makes the two morphs read as one event.
|
||||
// f1364-f1382 fits t^2 to within 3.6px of a 28px span. On the render, where the rounding
|
||||
// to integer device px lands, it crosses the 152 rest band at f1370.93, one frame after
|
||||
// the reference's own break at f1370. The residual inside the leg is not flat: the build
|
||||
// tracks the reference to within 1.3px through f1375 and then runs 3.5 to 4.5px under it
|
||||
// from f1376 to f1380, because the reference's lead-in is not a pure t^2, it has a knee
|
||||
// around f1375 that a single quadratic cannot carry without giving up the break frame.
|
||||
// The break frame is worth more, so it keeps the quadratic and wears the 4.5px.
|
||||
tl.fromTo(shell, { height: px(149) }, { height: px(177), duration: D(1364, 1382), ease: "power1.in" }, T(1364));
|
||||
// Then the bloom. Cubic-in over f1382-f1390 is the best of the in family on a 143px span
|
||||
// (quartic is 52px out at f1390, quadratic 46px out at f1388), so power2.in, remembering
|
||||
// that GSAP's power2 is cubic and its power1 is the quadratic. Measured back off the
|
||||
// render it is worst at f1389, 12.8px high on the 143px span, 9%; the reference's last
|
||||
// two frames before the velocity peak are steeper than any exponent that also holds
|
||||
// f1384-f1386, and this leg is 8 frames long, so the residual stays.
|
||||
tl.fromTo(shell, { height: px(177) }, { height: px(320), duration: D(1382, 1390), ease: "power2.in" }, T(1382));
|
||||
// The rise to the peak is ONE leg from the velocity peak at f1390, not two, and again the
|
||||
// exponent is measured: on the remaining distance it reads 3.08, 2.66, 2.64, 2.55 at
|
||||
// f1392, f1395, f1400, f1404, so k = 2.7, between GSAP's power1.out (3) and power2.out
|
||||
// (4) by their real exponents. power2.out was what this leg used to carry and it runs
|
||||
// 27px ahead of the reference around f1396, 6.5% of the 415px span; k = 2.7 halves that
|
||||
// to 14px. It does not remove it, and the reason is worth writing down: the reference's
|
||||
// remaining distance decays by a near-constant 0.82 per frame from f1390 to f1400, which
|
||||
// is an exponential with a 3.5-frame half life, about 5 half lives across this leg. No
|
||||
// power ease is an exponential and GSAP's expo.out is 10 half lives over the same window,
|
||||
// which puts it 66px ahead by f1391. So this is the closest a single tween gets, and the
|
||||
// middle third of the bloom is the one place this file is visibly ahead of its reference.
|
||||
tl.fromTo(shell, { height: px(320) }, { height: px(735), duration: D(1390, 1407), ease: powOut(2.7) }, T(1390));
|
||||
// 735 -> 696 is a real 5.9% overshoot recovery in the reference, not a settle invented to
|
||||
// keep pixels moving, and 5.9% is the number a min-area rect gives. This file used to say
|
||||
// 7.8%, off an axis-aligned bbox that a 1.1 degree tilt inflates; a reviewer guessed 4.2%
|
||||
// off a hand de-rotation and was off the other way. The ease was also wrong and it cost
|
||||
// the tail: the recovery is nearly CONSTANT VELOCITY at 5.3px per frame and finishes at
|
||||
// f1414, not a sine.inOut easing to a stop at f1416. sine.inOut is 8.4px (20%) out at
|
||||
// f1411; sine.in over f1407-f1414 is 3.4px (8.6%) worst.
|
||||
tl.fromTo(shell, { height: px(735) }, { height: px(696), duration: D(1407, 1414), ease: "sine.in" }, T(1407));
|
||||
// The tail, and it is the reason the previous ease mattered. A recovery that lands with
|
||||
// zero velocity at f1416 followed by a power2.in that leaves with zero velocity meant the
|
||||
// three rendered frames either side of f1416 moved less than one device pixel, and the
|
||||
// hero rendered three identical heights while the header called it "still resolving".
|
||||
// The reference does not stop there: 696 f1414, 695, 694.4, 692.6, 688.7 f1418, and a
|
||||
// power1.in across that span is 1.8px worst on 7px. At 32 frames the last four samples
|
||||
// seek to f1411.67, f1414.17, f1416.67 and f1417.5, and measured back off those four PNGs
|
||||
// the shell is 800, 780, 776 and 774 composition px against the reference's 799, 780, 774
|
||||
// and 772: four different heights, none repeated, none invented to move a pixel. f1418 is where the reference's card starts dissolving
|
||||
// out, so nothing is authored past it.
|
||||
tl.fromTo(shell, { height: px(696) }, { height: px(689), duration: D(1414, 1418), ease: "power1.in" }, T(1414));
|
||||
|
||||
// Corner radius. While the pill is still a pill the ends stay true semicircles, so the
|
||||
// radius is height/2 and has to track the lead-in above: 149/2 at f1364 to 177/2 at
|
||||
// f1382. Leave it at the rest value and a 177-tall pill carries 27px of straight edge on
|
||||
// each end, which is a visibly different silhouette from the reference's at f1380.
|
||||
tl.fromTo(shell, { borderRadius: px(75) }, { borderRadius: px(88), duration: D(1364, 1382), ease: "none" }, T(1364));
|
||||
// Then it stops being a capsule and becomes the card's 125. Endpoints measured (f1384 and
|
||||
// f1416, the latter by walking the top edge inward row by row); the curve between them is
|
||||
// inferred.
|
||||
tl.fromTo(shell, { borderRadius: px(88) }, { borderRadius: px(125), duration: D(1384, 1404), ease: "power1.out" }, T(1384));
|
||||
|
||||
// TILT. Fitted from the min-area rect's own angle, degrees, sign flipped to this file's
|
||||
// convention: f1381 0.0 | f1383 0.5 | f1385 3.0 | f1387 5.5 | f1389 6.0 | f1393 6.4
|
||||
// f1396 3.2 | f1400 0.0 | f1405 -1.1 | f1407 -1.1 | f1410 -0.8 | f1414 0.0
|
||||
// Note the plateau at 6deg (f1389-f1393) while the height is at its fastest: the tilt
|
||||
// locks and the box explodes underneath it. Both eases fit sine.inOut inside 0.3deg.
|
||||
tl.fromTo(shell, { rotation: 0 }, { rotation: 6.0, duration: D(1383, 1390), ease: "sine.inOut" }, T(1383));
|
||||
tl.fromTo(shell, { rotation: 6.0 }, { rotation: -1.3, duration: D(1394, 1405), ease: "sine.inOut" }, T(1394));
|
||||
tl.fromTo(shell, { rotation: -1.3 }, { rotation: 0, duration: D(1405, 1414), ease: "sine.inOut" }, T(1405));
|
||||
|
||||
// PILL WORDS: THREE COPIES OF ONE DAMPED BOUNCE, four to five frames apart, and it runs
|
||||
// far longer than this file used to think. Tracking each word's own ink centre against the
|
||||
// label's line (positive = below it), ref px:
|
||||
// iPhone +17 f1363 +8 f1364 -10 f1368 -7.5 f1370 -2 f1372 +2.5 f1376 -5 f1384
|
||||
// 17 +29 f1364 +30.5 f1365 -9.5 f1372 -8.5 f1373 +3 f1380 -1 f1384
|
||||
// Pro -20 f1365 +31.5 f1369 -9.5 f1377 +4 f1384
|
||||
// Every one of them crosses the line, comes back past it, and crosses again: two sign
|
||||
// changes in the first difference, which no back.out can produce, so this is four legs
|
||||
// rather than one ease. The shape is identical for all three, and the numbers say so
|
||||
// plainly: down-peak +30 at a+5, up-peak -10 at a+13, down-peak +3 at a+21, with a =
|
||||
// 1355, 1360, 1364. Half period 8 frames, damping 0.33 per half period, on all three.
|
||||
// The old model was one back.out(2.2) settling in 6 frames, so from f1370 the label was
|
||||
// dead level while the reference still had "17" high and "Pro" low, then swapped.
|
||||
// Word 0 is the exception on entry only: it is revealed by the shell's left edge sweeping
|
||||
// over it rather than dropped in, so it starts at rest and sinks into the first trough
|
||||
// instead of arriving from above. Everything after the trough is shared.
|
||||
const WORD_A = [1355, 1360, 1364];
|
||||
tl.fromTo(pillWords[0], { y: 0 }, { y: px(30), duration: D(1353, 1360), ease: "power1.in" }, T(1353));
|
||||
pillWords.forEach((w, i) => {
|
||||
const a = WORD_A[Math.min(i, WORD_A.length - 1)];
|
||||
if (i > 0) {
|
||||
// Entry: the drop is 4 blurred frames in the reference, so the amplitude above the
|
||||
// line and the sideways lead-in are inferred; the frame it lands in is measured.
|
||||
tl.fromTo(w, { opacity: 0 }, { opacity: 1, duration: D(a, a + 3), ease: "none" }, T(a));
|
||||
tl.fromTo(w, { y: -px(38) }, { y: px(30), duration: D(a, a + 5), ease: "power2.out" }, T(a));
|
||||
tl.fromTo(w, { x: px(26) }, { x: 0, duration: D(a, a + 5), ease: "power2.out" }, T(a));
|
||||
}
|
||||
tl.fromTo(w, { y: px(30) }, { y: -px(10), duration: D(a + 5, a + 13), ease: "sine.inOut" }, T(a + 5));
|
||||
tl.fromTo(w, { y: -px(10) }, { y: px(3), duration: D(a + 13, a + 21), ease: "sine.inOut" }, T(a + 13));
|
||||
tl.fromTo(w, { y: px(3) }, { y: 0, duration: D(a + 21, a + 29), ease: "sine.inOut" }, T(a + 21));
|
||||
});
|
||||
// AND THE WHOLE LABEL SCALES. Least squares on all 22 glyph-band edges of "iPhone 17 Pro"
|
||||
// against their f1369 positions gives a pure similarity with scale 1.0072 f1370, 1.0256
|
||||
// f1372, 1.0397 f1373, 1.0709 f1375, 1.1132 f1377, 1.1459 f1379, 1.1560 f1380, 1.1684
|
||||
// f1382, 1.1779 f1384, worst residual 2.9px on any edge on any frame. The fixed point
|
||||
// converges on x = 950 against the card's centre of 959.5, and the cap height of the P
|
||||
// grows 37 -> 42 over the same window, so it is a real 2D scale about the card's centre
|
||||
// and not letter-spacing. This is the channel that makes the pill look like it is
|
||||
// inflating rather than just getting wider, and it is why #pilltext's transform origin is
|
||||
// pinned to the shell's centre rather than to its own box.
|
||||
// Residual: sine.inOut runs 0.08 of the 0.178 span low through the middle of the window
|
||||
// (4px of block width at f1377, 8% of the spread). The measured exponent walks 1.14 to
|
||||
// 0.38 across the window, so no single power ease closes it either.
|
||||
tl.fromTo(pilltext, { scale: 1 }, { scale: 1.178, duration: D(1369, 1384), ease: "sine.inOut" }, T(1369));
|
||||
// The label also sags about 11px and comes back over f1369-f1384 on top of that scale, on
|
||||
// all three words at once. It is measured and it is NOT reproduced here: the scale about a
|
||||
// fixed point accounts for 3.5px of it and the rest has no model that survived a fit.
|
||||
// The shell is empty from here until the card content arrives at f1390. That gap is what
|
||||
// makes animating the box safe.
|
||||
tl.fromTo(pilltext, { opacity: 1 }, { opacity: 0, duration: D(1384, 1388), ease: "none" }, T(1384));
|
||||
|
||||
// THE ACCENT. One node, four box properties and a colour, one window: f1384 to f1400.
|
||||
// Measured, ref px: at f1384 it is a 128 disc inset 12 from the shell's right and 10 from
|
||||
// its bottom; at f1416 it is a 709 x 145 bar inset 64 and 55. The left edge is what the
|
||||
// eye follows and it sweeps 1208 -> 618 with the fastest frame in the middle (f1392),
|
||||
// which power1.inOut reproduces inside 42px at every sample.
|
||||
//
|
||||
// The insets are travelled with x/y, never with right/bottom. Those two are layout
|
||||
// properties: the browser snaps them to whole device pixels during layout, so the
|
||||
// ease-out tail stutters instead of decelerating under a seek-by-frame capture, and
|
||||
// StaticGuard rejects the composition outright. Right inset 12 -> 64 is 52px of leftward
|
||||
// travel, bottom 10 -> 55 is 45px of upward travel, and the static CSS inset stays at the
|
||||
// f1384 value so the box still grows leftward out of the pill's right end.
|
||||
// The FROM values pick up where the bulge left off (133, not the 128 this block used to
|
||||
// start from, which would have snapped the disc 5px wider at f1384).
|
||||
const A = { duration: D(1384, 1400), ease: "power1.inOut" };
|
||||
tl.fromTo(accent, { width: px(133) }, { width: px(709), ...A }, T(1384));
|
||||
tl.fromTo(accent, { height: px(133) }, { height: px(145), ...A }, T(1384));
|
||||
tl.fromTo(accent, { x: 0 }, { x: -px(52), ...A }, T(1384));
|
||||
tl.fromTo(accent, { y: -px(11.5) }, { y: -px(45), ...A }, T(1384));
|
||||
// Colour is the OTHER half of the continuity: blue disc to near-black bar, sampled as a
|
||||
// mean over the accent's own pixels. f1384 (11,107,245) | f1390 (15,77,165) |
|
||||
// f1393 (24,63,118) | f1396 (32,49,71) | f1400 (37,37,37). That is a straight line in RGB
|
||||
// to within 6 levels, so ease "none" is the measurement, not a shortcut.
|
||||
tl.fromTo(accent, { backgroundColor: "#0b6bff" }, { backgroundColor: "#232323", duration: D(1384, 1400), ease: "none" }, T(1384));
|
||||
// The chevron leaves as the disc starts to stretch, the label arrives as it stops.
|
||||
tl.fromTo(chev, { opacity: 1 }, { opacity: 0, duration: D(1384, 1388), ease: "none" }, T(1384));
|
||||
tl.fromTo(paylabel, { opacity: 0 }, { opacity: 1, duration: D(1399, 1404), ease: "none" }, T(1399));
|
||||
|
||||
// CARD CONTENT. First ghost of the product at f1391, solid by f1396. It is clipped by the
|
||||
// shell on its way in, so the growing card reveals it.
|
||||
tl.fromTo(media, { opacity: 0 }, { opacity: 1, duration: D(1390, 1396), ease: "none" }, T(1390));
|
||||
tl.fromTo(media, { scale: 0.86 }, { scale: 1, duration: D(1390, 1398), ease: "power2.out" }, T(1390));
|
||||
|
||||
// The card's title lands word by word AFTER the box has stopped growing: "iPhone" f1400,
|
||||
// "17" f1404, "Pro" f1409, settled f1413. Same drop-and-overshoot as the pill's words, so
|
||||
// the two rows read as the same typography moving, not two different animations.
|
||||
const CARD_IN = [[1399, 1404], [1403, 1409], [1408, 1413]];
|
||||
cardWords.forEach((w, i) => {
|
||||
const [a, b] = CARD_IN[Math.min(i, CARD_IN.length - 1)];
|
||||
tl.fromTo(w, { opacity: 0 }, { opacity: 1, duration: D(a, a + 3), ease: "none" }, T(a));
|
||||
tl.fromTo(w, { y: -38, x: 26 }, { y: 0, x: 0, duration: D(a, b), ease: "back.out(2.2)" }, T(a));
|
||||
});
|
||||
|
||||
// THE PRICE IS THE AFTERMATH, and it is a reveal, NOT an odometer.
|
||||
//
|
||||
// This file used to roll four clipped digit columns through two full 0-9 cycles each. It
|
||||
// looked like the reference at a glance and was the opposite of it at full resolution.
|
||||
// Cropping x1080-1330 y385-485 out of the source and listing the ink bands per frame:
|
||||
//
|
||||
// f1401 $ alone at x1204-1231, darkest pixel 189, still a ghost
|
||||
// f1402 $ at 1177-1203 and a 1 at 1253-1264 reads "$1"
|
||||
// f1406 $ 1114-1141, 1 1157-1173, 0 1224-1250 reads "$10"
|
||||
// f1409 $1 1129-1160, 0 1186-1214, 9 1264-1288 reads "$109"
|
||||
// f1413 $ 1145-1172, 10 1175-1209, 9 1225-1252, 9 1300-1327 reads "$1099"
|
||||
// f1416 1148-1175, 1185-1199, 1203-1246, 1270-1297, settled
|
||||
// f1419 1151-1177, 1184-1199, 1212-1280, unchanged glyphs, still settled
|
||||
//
|
||||
// Every glyph arrives already showing its final value. The reference never displays a
|
||||
// wrong number, never clips a glyph at the top or bottom, and never puts one off the
|
||||
// shared baseline. The odometer did all four: it published $172, $1078, $1096 and $1098
|
||||
// as legible frames, and its digits sat as superscripts and subscripts because a 70px
|
||||
// window over a travelling strip is exactly that. So the mechanic here is two things and
|
||||
// no more: a fade, and a slide into place from the right.
|
||||
//
|
||||
// Entry frames, from the first row of that table: $ f1401, then f1402, f1406, f1409,
|
||||
// f1413. The three digit gaps are 4, 3, 4, so the stagger is 3.67 frames and the formula
|
||||
// below reproduces 1402/1406/1409/1413 exactly while extending to any digit count.
|
||||
const PRICE_IN = (i) => (i === 0 ? 1401 : 1402 + Math.round((i - 1) * 3.67));
|
||||
// The whole row slides too, and it overshoots. Tracking the "$" against its own settled
|
||||
// left edge of 1149: +55 at f1401, +28 f1402, +1 f1403, -20 f1404, -32 f1405, -35 f1406
|
||||
// (the far end of the overshoot), then back -27 f1408, -14 f1410, -6 f1412, -2 f1414,
|
||||
// 0 f1417. Two legs, both power2.out: on the return, (1-t)^2 gives .67 .41 .21 .07 .008
|
||||
// against measured .77 .40 .17 .06 .03.
|
||||
tl.fromTo(price, { x: px(55) }, { x: -px(35), duration: D(1401, 1406), ease: "power2.out" }, T(1401));
|
||||
tl.fromTo(price, { x: -px(35) }, { x: 0, duration: D(1406, 1417), ease: "power2.out" }, T(1406));
|
||||
glyphs.forEach((g, i) => {
|
||||
const a = PRICE_IN(i);
|
||||
tl.fromTo(g, { opacity: 0 }, { opacity: 1, duration: D(a, a + 3), ease: "none" }, T(a));
|
||||
// Each digit closes a gap to the glyph before it. Measured against the row's own slide,
|
||||
// the local offsets are +44 +32 +21 +11 0 for the last 9 over f1413-f1417 and +48 +31
|
||||
// +16 +4 0 for the one before it over f1409-f1413: linear to within 4px, so ease "none"
|
||||
// is the measurement. The "$" has no local offset, the row's slide is its entrance.
|
||||
if (i > 0) tl.fromTo(g, { x: px(46) }, { x: 0, duration: D(a, a + 4), ease: "none" }, T(a));
|
||||
});
|
||||
|
||||
tl.set({}, {}, DUR);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["chevron-pill-card-morph"] = tl;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1,353 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
depth-rack-focus: HyperFrames video primitive (depth / 2.5D)
|
||||
|
||||
Concept: a rack focus. The foreground is sharp and the message behind it is
|
||||
soft; the lens pulls, the foreground dissolves into bokeh, and the message
|
||||
resolves. One move: attention handed from the near plane to the far one,
|
||||
using the only cue a flat screen shares with a real lens.
|
||||
|
||||
Variables:
|
||||
- kicker (string, default "Q3 RESULTS"): the small line above the message.
|
||||
- headline (string, default "Revenue doubled"): the message that resolves.
|
||||
- accent (amber | blue | violet, default amber): the foreground bokeh.
|
||||
|
||||
Envelope (D = 2.60s, the move fills it):
|
||||
CREEP 0.00 to 2.60 the whole stack pushes in at a constant rate
|
||||
RACK 0.40 to 1.35 focus leaves the foreground and arrives on the message
|
||||
LAND 1.20 to 2.05 kicker and rule arrive as the message finishes resolving
|
||||
|
||||
Blur is a paint property and this file animates it on purpose: it is the
|
||||
primitive. Everything else stays on transform and opacity. One custom property
|
||||
per plane drives the blur so a seek writes a single number, never a filter
|
||||
string it has to re-parse.
|
||||
|
||||
The creep runs on a linear curve, which is the one place in this shelf a
|
||||
preset-looking ease is correct: a dolly at constant rate is what a real camera
|
||||
on rails does, and it is also the layer that keeps a frame sampler alive
|
||||
through every other tween's dead tail.
|
||||
|
||||
Mount contract: the runtime clones only this template. #root fills the host
|
||||
box, establishes the container query basis, has no data-width or data-height,
|
||||
and registers one paused timeline under the hardcoded depth-rack-focus id.
|
||||
-->
|
||||
<html
|
||||
lang="en"
|
||||
data-composition-id="depth-rack-focus"
|
||||
data-composition-duration="2.6"
|
||||
data-composition-variables='[
|
||||
{ "id": "kicker", "type": "string", "role": "content", "label": "Kicker", "description": "Small line above the message.", "default": "Q3 RESULTS" },
|
||||
{ "id": "headline", "type": "string", "role": "content", "label": "Headline", "description": "The message the focus resolves onto.", "default": "Revenue doubled" },
|
||||
{ "id": "accent", "type": "enum", "role": "style", "label": "Accent", "description": "Foreground bokeh colour.", "default": "amber", "options": [{ "value": "amber", "label": "Amber" }, { "value": "blue", "label": "Blue" }, { "value": "violet", "label": "Violet" }] }
|
||||
]'
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Depth Rack Focus</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="depth-rack-focus" data-duration="2.6" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
background:
|
||||
radial-gradient(circle at 50% 44%, #191c25, #0a0b0f 72%),
|
||||
var(--bg, #0b0b0d);
|
||||
color: var(--fg, #f8fafc);
|
||||
font-family: var(--font-display, Inter, system-ui, sans-serif);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.drf-plane {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
will-change: transform, filter;
|
||||
}
|
||||
|
||||
/* The far plane. A faint rule grid, kept soft for the whole shot: it is
|
||||
the depth cue, not something the eye is ever asked to read.
|
||||
|
||||
Pitch, line weight and alpha are all set against the blur, not in
|
||||
isolation, and both directions are wrong. A 2px line at 5% alpha under
|
||||
a 34px blur spreads to a third of a percent and the plane may as well
|
||||
not exist. A tight pitch at readable alpha goes the other way: the
|
||||
lines merge into a fine dark check that reads as screen-door noise.
|
||||
A wide pitch with a heavy soft line is the one that reads as a wall
|
||||
standing some distance behind the copy. */
|
||||
.drf-far {
|
||||
background:
|
||||
repeating-linear-gradient(
|
||||
0deg,
|
||||
transparent 0 20cqmin,
|
||||
rgba(255, 255, 255, 0.22) 20cqmin 20.9cqmin
|
||||
),
|
||||
repeating-linear-gradient(
|
||||
90deg,
|
||||
transparent 0 20cqmin,
|
||||
rgba(255, 255, 255, 0.22) 20cqmin 20.9cqmin
|
||||
);
|
||||
filter: blur(calc(var(--drf-far, 3) * 1cqmin));
|
||||
}
|
||||
|
||||
.drf-mid {
|
||||
display: grid;
|
||||
align-content: center;
|
||||
justify-items: center;
|
||||
padding: 0 8cqmin;
|
||||
filter: blur(calc(var(--drf-mid, 2.4) * 1cqmin));
|
||||
}
|
||||
|
||||
.drf-kicker {
|
||||
color: var(--drf-accent);
|
||||
font-size: 3.4cqmin;
|
||||
font-weight: 640;
|
||||
letter-spacing: 0.24em;
|
||||
line-height: 1;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.drf-rule {
|
||||
width: 22cqmin;
|
||||
height: 0.5cqmin;
|
||||
border-radius: 1cqmin;
|
||||
margin: 2.6cqmin 0 3.4cqmin;
|
||||
background: color-mix(in srgb, var(--drf-accent) 70%, transparent);
|
||||
transform-origin: 50% 50%;
|
||||
}
|
||||
|
||||
.drf-headline {
|
||||
max-width: 100%;
|
||||
font-size: 11cqmin;
|
||||
font-weight: 730;
|
||||
letter-spacing: -0.03em;
|
||||
line-height: 1.02;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* The near plane. Three soft shapes low in frame, doing what an
|
||||
out-of-focus foreground does in a real shot: framing the subject
|
||||
without ever being the subject. */
|
||||
.drf-near {
|
||||
filter: blur(calc(var(--drf-near, 0.4) * 1cqmin));
|
||||
}
|
||||
|
||||
/* The falloff is long on purpose. A tight one (opaque to transparent
|
||||
over the last tenth of the radius) draws a hard circle, and the sheet
|
||||
read those as plastic balls sitting on the frame rather than as light
|
||||
passing in front of the lens. */
|
||||
.drf-blob {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
background: radial-gradient(
|
||||
circle at 38% 34%,
|
||||
color-mix(in srgb, var(--drf-accent) 78%, white),
|
||||
color-mix(in srgb, var(--drf-accent) 62%, transparent) 44%,
|
||||
transparent 88%
|
||||
);
|
||||
}
|
||||
|
||||
.drf-b1 {
|
||||
bottom: -14cqmin;
|
||||
left: 6cqmin;
|
||||
width: 34cqmin;
|
||||
height: 34cqmin;
|
||||
opacity: 0.72;
|
||||
}
|
||||
|
||||
.drf-b2 {
|
||||
right: 2cqmin;
|
||||
bottom: -22cqmin;
|
||||
width: 46cqmin;
|
||||
height: 46cqmin;
|
||||
opacity: 0.56;
|
||||
}
|
||||
|
||||
.drf-b3 {
|
||||
bottom: -8cqmin;
|
||||
left: 44cqmin;
|
||||
width: 18cqmin;
|
||||
height: 18cqmin;
|
||||
opacity: 0.8;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="drf-plane drf-far"></div>
|
||||
<div class="drf-plane drf-mid">
|
||||
<div class="drf-kicker">Q3 RESULTS</div>
|
||||
<div class="drf-rule"></div>
|
||||
<div class="drf-headline">Revenue doubled</div>
|
||||
</div>
|
||||
<div class="drf-plane drf-near">
|
||||
<div class="drf-blob drf-b1"></div>
|
||||
<div class="drf-blob drf-b2"></div>
|
||||
<div class="drf-blob drf-b3"></div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// Cubic-bezier evaluated as a GSAP ease. Pure function of progress, so
|
||||
// it is seek-safe: seek(t) always yields the same value, no internal
|
||||
// state to drift. Newton-Raphson on x, bisection where the slope flattens.
|
||||
function cb(x1, y1, x2, y2) {
|
||||
var A = function (a, b) { return 1 - 3 * b + 3 * a; };
|
||||
var B = function (a, b) { return 3 * b - 6 * a; };
|
||||
var C = function (a) { return 3 * a; };
|
||||
var f = function (t, a, b) { return ((A(a, b) * t + B(a, b)) * t + C(a)) * t; };
|
||||
var d = function (t, a, b) { return 3 * A(a, b) * t * t + 2 * B(a, b) * t + C(a); };
|
||||
return function (p) {
|
||||
if (p <= 0) return 0;
|
||||
if (p >= 1) return 1;
|
||||
var t = p, i, s, e;
|
||||
for (i = 0; i < 8; i++) {
|
||||
s = d(t, x1, x2);
|
||||
if (s === 0) break;
|
||||
e = f(t, x1, x2) - p;
|
||||
if (Math.abs(e) < 1e-7) break;
|
||||
t -= e / s;
|
||||
}
|
||||
if (t < 0 || t > 1) {
|
||||
var lo = 0, hi = 1, j, v;
|
||||
t = p;
|
||||
for (j = 0; j < 30; j++) {
|
||||
v = f(t, x1, x2);
|
||||
if (Math.abs(v - p) < 1e-7) break;
|
||||
if (v > p) hi = t; else lo = t;
|
||||
t = (lo + hi) / 2;
|
||||
}
|
||||
}
|
||||
return f(t, y1, y2);
|
||||
};
|
||||
}
|
||||
|
||||
// Named for what they do in a shot. No GSAP preset appears in this file
|
||||
// on purpose: a named ease is a category, not a curve.
|
||||
var E = {
|
||||
enter: cb(0.22, 0.9, 0.3, 1.0),
|
||||
camSettle: cb(0.16, 0.84, 0.28, 1.0),
|
||||
// A focus pull is a hand on a barrel: slow to break static friction,
|
||||
// quick through the middle, slow onto the mark.
|
||||
rack: cb(0.62, 0.02, 0.24, 1.0),
|
||||
linear: function (p) { return p; },
|
||||
};
|
||||
|
||||
gsap.defaults({ immediateRender: false });
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var far = root.querySelector(".drf-far");
|
||||
var mid = root.querySelector(".drf-mid");
|
||||
var near = root.querySelector(".drf-near");
|
||||
var kicker = root.querySelector(".drf-kicker");
|
||||
var rule = root.querySelector(".drf-rule");
|
||||
var headline = root.querySelector(".drf-headline");
|
||||
var vars =
|
||||
window.__hyperframes && window.__hyperframes.getVariables
|
||||
? window.__hyperframes.getVariables()
|
||||
: {};
|
||||
|
||||
var accents = { amber: "#ffb454", blue: "#4da3ff", violet: "#a98cff" };
|
||||
var accent = accents[vars.accent] ? vars.accent : "amber";
|
||||
root.style.setProperty("--drf-accent", accents[accent]);
|
||||
kicker.textContent = vars.kicker == null ? "Q3 RESULTS" : String(vars.kicker);
|
||||
headline.textContent = vars.headline == null ? "Revenue doubled" : String(vars.headline);
|
||||
|
||||
var D = Math.max(0.001, parseFloat(root.dataset.duration || "2.6"));
|
||||
var s = D < 2.6 ? D / 2.6 : 1; // compress the beats, never the order
|
||||
var RACK_AT = 0.4 * s;
|
||||
var RACK = 0.95 * s;
|
||||
var LAND_AT = 1.2 * s;
|
||||
|
||||
// Rest state pinned outside the timeline, and both ends written on every
|
||||
// tween, so a seek can never inherit a start value from the screen.
|
||||
// 0.9, not 0.35. The near plane is in focus at t=0 but it is also the
|
||||
// closest thing to the lens, so a real one is never razor sharp; at
|
||||
// 0.35 it rendered as cut vector, which is the tell.
|
||||
root.style.setProperty("--drf-near", "0.9");
|
||||
root.style.setProperty("--drf-mid", "2.4");
|
||||
root.style.setProperty("--drf-far", "2.4");
|
||||
gsap.set(far, { scale: 1.02 });
|
||||
gsap.set(mid, { scale: 1.06, y: "1.6cqmin" });
|
||||
gsap.set(near, { scale: 1.0, y: "0cqmin" });
|
||||
gsap.set(kicker, { y: "1.4cqmin", opacity: 0 });
|
||||
gsap.set(rule, { scaleX: 0, opacity: 0 });
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
// The creep. Each plane pushes at its own rate, which is parallax, and
|
||||
// together they are the layer that is never not moving.
|
||||
// 1.18, not 1.09. Once the grid is actually visible its lines are what
|
||||
// carries the creep, and a 7% push over 2.6s moves a 20cqmin pitch by
|
||||
// less than a line width: real on paper, invisible on screen.
|
||||
tl.fromTo(far, { scale: 1.02 }, { scale: 1.18, duration: D, ease: E.linear }, 0);
|
||||
tl.fromTo(near, { scale: 1.0 }, { scale: 1.22, duration: D, ease: E.linear }, 0);
|
||||
tl.fromTo(near, { y: "0cqmin" }, { y: "7cqmin", duration: D, ease: E.linear }, 0);
|
||||
|
||||
// The rack. Near and mid trade sharpness on the same curve and the same
|
||||
// window: a focus pull is one continuous mechanical action, so splitting
|
||||
// it into two differently timed fades is the tell that it is fake.
|
||||
tl.fromTo(
|
||||
root,
|
||||
{ "--drf-near": 0.9 },
|
||||
{ "--drf-near": 3.8, duration: RACK, ease: E.rack },
|
||||
RACK_AT,
|
||||
);
|
||||
tl.fromTo(
|
||||
root,
|
||||
{ "--drf-mid": 2.4 },
|
||||
{ "--drf-mid": 0, duration: RACK, ease: E.rack },
|
||||
RACK_AT,
|
||||
);
|
||||
tl.fromTo(
|
||||
root,
|
||||
{ "--drf-far": 2.4 },
|
||||
{ "--drf-far": 3.8, duration: RACK, ease: E.rack },
|
||||
RACK_AT,
|
||||
);
|
||||
|
||||
// Focus breathing. A lens changes magnification slightly as it racks,
|
||||
// and leaving it out is what makes a CSS blur read as a CSS blur.
|
||||
tl.fromTo(
|
||||
mid,
|
||||
{ scale: 1.06, y: "1.6cqmin" },
|
||||
{ scale: 1, y: "0cqmin", duration: RACK, ease: E.rack },
|
||||
RACK_AT,
|
||||
);
|
||||
|
||||
// Landing copy, timed into the rack's tail rather than after it.
|
||||
tl.fromTo(
|
||||
kicker,
|
||||
{ y: "1.4cqmin", opacity: 0 },
|
||||
{ y: "0cqmin", opacity: 1, duration: 0.5 * s, ease: E.enter },
|
||||
LAND_AT,
|
||||
);
|
||||
tl.fromTo(
|
||||
rule,
|
||||
{ scaleX: 0, opacity: 0 },
|
||||
{ scaleX: 1, opacity: 1, duration: 0.62 * s, ease: E.camSettle },
|
||||
LAND_AT + 0.14 * s,
|
||||
);
|
||||
|
||||
tl.set({}, {}, D); // pin the full duration
|
||||
tl.seek(0);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["depth-rack-focus"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: depth-rack-focus at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>depth-rack-focus 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="2.6" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="depth-rack-focus"
|
||||
data-composition-src="./depth-rack-focus.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="2.6" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 5.4 KiB |
@@ -0,0 +1,358 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
echo-trail: HyperFrames video primitive (trails)
|
||||
|
||||
The generalized onion skin: a moving element renders with N ghosted
|
||||
copies of itself, each ghost showing the element where it was at
|
||||
t minus i * delta, opacity stepped down per ghost. One traversal along
|
||||
an authored path; as the element decelerates into rest the echoes
|
||||
collapse into it and vanish, leaving a clean settled hold.
|
||||
|
||||
The subject is a SLOT. Callers supply content by placing an inert
|
||||
template anywhere in the HOST page (templates never render, and the
|
||||
runtime wipes the host clip's own children on mount, so the slot lives
|
||||
at document level):
|
||||
|
||||
<template data-slot="echo-trail-subject"> ... </template>
|
||||
|
||||
Ghosts are deep clones of the subject content. With no slot, the
|
||||
primitive renders a token card (surface, hairline border, accent dot,
|
||||
two skeleton lines, contract tokens only).
|
||||
|
||||
Variables (declared in data-composition-variables below):
|
||||
- echoes (number 2 to 6, default 4): ghost copy count.
|
||||
- delta (number seconds, default 0.09, clamped 0.03 to 0.3): the lag
|
||||
between successive ghosts.
|
||||
- path ("sweep" | "rise" | "arc", default "sweep"): the authored
|
||||
traversal preset.
|
||||
- accent ("green" | "blue" | "violet", default "green"): green rides
|
||||
--brand, blue rides --accent, violet rides --accent-2.
|
||||
- exit ("none" | "fade" | "up", default "none"): frame roots own
|
||||
transitions; the default holds the final frame to the last pixel.
|
||||
|
||||
Envelope, fixed IN and OUT with elastic HOLD only (never timeScale):
|
||||
IN_BASE = TRAVEL (2.1s) + echoes * delta + 0.2s settle; the lead
|
||||
rests at TRAVEL and the last ghost has converged (and is
|
||||
exactly invisible) by IN
|
||||
HOLD = max(0, D - IN - OUT)
|
||||
OUT_BASE = 0.45s only when exit != none
|
||||
If D < IN_BASE + OUT_BASE, the whole envelope compresses together.
|
||||
|
||||
Determinism: ghost i's position at time t is path(ease(clamp01((t -
|
||||
i * delta) / TRAVEL))) and its opacity is its stepped base times a pure
|
||||
function of its distance to the lead; both are recomputed from
|
||||
tl.time() on every update. No Math.random, no wall clock, no
|
||||
incremental state, no requestAnimationFrame. Eventful seeks
|
||||
(suppressEvents=false, the engine's render path) land identical frames
|
||||
in any order and either direction; at rest every ghost is coincident
|
||||
with the lead at opacity exactly zero, so the HOLD is truly still.
|
||||
|
||||
Mount contract: the runtime clones only this template. #root fills the
|
||||
host box (no data-width/data-height, container-type: size, cqmin
|
||||
units), is styled via #root only, and registers one paused timeline
|
||||
under the LITERAL "echo-trail" key.
|
||||
-->
|
||||
<html
|
||||
lang="en"
|
||||
data-composition-id="echo-trail"
|
||||
data-composition-duration="3.5"
|
||||
data-composition-variables='[
|
||||
{ "id": "echoes", "type": "number", "role": "style", "label": "Echoes", "description": "Ghost copy count, clamped 2 to 6.", "default": 4 },
|
||||
{ "id": "delta", "type": "number", "role": "timing", "label": "Delta", "description": "Lag between successive ghosts in seconds, clamped 0.03 to 0.3.", "default": 0.09 },
|
||||
{ "id": "path", "type": "enum", "role": "timing", "label": "Path", "description": "Authored traversal preset.", "default": "sweep", "options": [{ "value": "sweep", "label": "Sweep" }, { "value": "rise", "label": "Rise" }, { "value": "arc", "label": "Arc" }] },
|
||||
{ "id": "accent", "type": "enum", "role": "style", "label": "Accent", "description": "Subject accent color: green rides --brand, blue rides --accent, violet rides --accent-2.", "default": "green", "options": [{ "value": "green", "label": "Green" }, { "value": "blue", "label": "Blue" }, { "value": "violet", "label": "Violet" }] },
|
||||
{ "id": "exit", "type": "enum", "role": "timing", "label": "Exit", "description": "Optional departure. Default none: the settled element holds until the frame cuts.", "default": "none", "options": [{ "value": "none", "label": "None" }, { "value": "fade", "label": "Fade" }, { "value": "up", "label": "Up" }] }
|
||||
]'
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Echo Trail</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="echo-trail" data-duration="3.5" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
color: var(--fg, #f8fafc);
|
||||
font-family: var(--font-display, "Inter", system-ui, sans-serif);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.et-clip {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
background: var(--bg, transparent);
|
||||
}
|
||||
|
||||
.et-stage {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
.et-ghost,
|
||||
.et-lead {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
will-change: opacity;
|
||||
}
|
||||
|
||||
.et-ghost {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.et-lead {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.et-card {
|
||||
width: 30cqmin;
|
||||
padding: var(--space-3, 3cqmin);
|
||||
display: grid;
|
||||
gap: var(--space-2, 2cqmin);
|
||||
border: 0.18cqmin solid var(--border, #475569);
|
||||
border-radius: var(--radius, 2.4cqmin);
|
||||
background: var(--surface, #14171c);
|
||||
box-shadow: 0 1.6cqmin 5cqmin
|
||||
color-mix(in srgb, var(--bg, #000000) 30%, transparent);
|
||||
}
|
||||
|
||||
.et-card-dot {
|
||||
width: 3.2cqmin;
|
||||
height: 3.2cqmin;
|
||||
border-radius: 50%;
|
||||
background: var(--et-accent);
|
||||
}
|
||||
|
||||
.et-card-line {
|
||||
height: 1.6cqmin;
|
||||
border-radius: 0.8cqmin;
|
||||
background: color-mix(in srgb, var(--fg, #f8fafc) 16%, transparent);
|
||||
}
|
||||
|
||||
.et-card-line.short {
|
||||
width: 62%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div
|
||||
id="echo-trail-clip"
|
||||
class="et-clip clip"
|
||||
data-start="0"
|
||||
data-duration="3.5"
|
||||
data-track-index="0"
|
||||
>
|
||||
<div class="et-stage">
|
||||
<div class="et-lead">
|
||||
<div class="et-card">
|
||||
<div class="et-card-dot"></div>
|
||||
<div class="et-card-line"></div>
|
||||
<div class="et-card-line short"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var stage = root.querySelector(".et-stage");
|
||||
var lead = root.querySelector(".et-lead");
|
||||
var vars =
|
||||
window.__hyperframes && window.__hyperframes.getVariables
|
||||
? window.__hyperframes.getVariables()
|
||||
: {};
|
||||
|
||||
var echoesRaw = parseFloat(vars.echoes);
|
||||
var echoes = isFinite(echoesRaw)
|
||||
? Math.min(6, Math.max(2, Math.round(echoesRaw)))
|
||||
: 4;
|
||||
var deltaRaw = parseFloat(vars.delta);
|
||||
var deltaVar = isFinite(deltaRaw)
|
||||
? Math.min(0.3, Math.max(0.03, deltaRaw))
|
||||
: 0.09;
|
||||
var pathName = vars.path === "rise" || vars.path === "arc" ? vars.path : "sweep";
|
||||
// Each enum choice routes to a DIFFERENT contract token so the
|
||||
// variable stays meaningful under a theme.
|
||||
var accentColors = {
|
||||
green: "var(--brand, #71f5a7)",
|
||||
blue: "var(--accent, #61a8ff)",
|
||||
violet: "var(--accent-2, #c5a3ff)",
|
||||
};
|
||||
var accent = Object.prototype.hasOwnProperty.call(accentColors, vars.accent)
|
||||
? vars.accent
|
||||
: "green";
|
||||
var exit = vars.exit === "fade" || vars.exit === "up" ? vars.exit : "none";
|
||||
|
||||
root.style.setProperty("--et-accent", accentColors[accent]);
|
||||
|
||||
// SLOT. Caller templates live at HOST DOCUMENT level (the mount
|
||||
// wipes host-clip children, and templates never render).
|
||||
var hostDoc = root.ownerDocument;
|
||||
var slotTemplate = null;
|
||||
try {
|
||||
slotTemplate = hostDoc.querySelector('template[data-slot="echo-trail-subject"]');
|
||||
} catch (error) {
|
||||
slotTemplate = null;
|
||||
}
|
||||
if (slotTemplate) {
|
||||
lead.querySelector(".et-card").remove();
|
||||
lead.appendChild(hostDoc.importNode(slotTemplate.content, true));
|
||||
}
|
||||
|
||||
// Ghosts: deep clones of the subject, inserted BEFORE the lead
|
||||
// so the lead always renders on top. ghosts[0] is the nearest
|
||||
// past copy (highest stepped opacity).
|
||||
var ghosts = [];
|
||||
for (var g = 0; g < echoes; g += 1) {
|
||||
var ghost = hostDoc.createElement("div");
|
||||
ghost.className = "et-ghost";
|
||||
ghost.setAttribute("aria-hidden", "true");
|
||||
for (var c = 0; c < lead.children.length; c += 1) {
|
||||
ghost.appendChild(lead.children[c].cloneNode(true));
|
||||
}
|
||||
stage.insertBefore(ghost, lead);
|
||||
ghosts.push(ghost);
|
||||
}
|
||||
|
||||
// Envelope: fixed IN/OUT, elastic HOLD, never time-scaled.
|
||||
var TRAVEL_BASE = 2.1;
|
||||
var IN_BASE = TRAVEL_BASE + echoes * deltaVar + 0.2;
|
||||
var OUT_BASE = exit === "none" ? 0 : 0.45;
|
||||
var duration = Math.max(0.001, parseFloat(root.dataset.duration || "3.5"));
|
||||
var totalBase = Math.max(0.001, IN_BASE + OUT_BASE);
|
||||
var scale = duration < totalBase ? duration / totalBase : 1;
|
||||
var TRAVEL = TRAVEL_BASE * scale;
|
||||
var delta = deltaVar * scale;
|
||||
var IN = IN_BASE * scale;
|
||||
var OUT = OUT_BASE * scale;
|
||||
var HOLD = Math.max(0, duration - (IN + OUT));
|
||||
var OUT_START = IN + HOLD;
|
||||
|
||||
// Path presets in percent-of-stage coordinates; the subject is
|
||||
// centered on the point via a one-time -50%/-50% translate.
|
||||
function pathPoint(u) {
|
||||
if (pathName === "rise") {
|
||||
return { x: 50 + 6 * Math.sin(Math.PI * u), y: 76 - 44 * u };
|
||||
}
|
||||
if (pathName === "arc") {
|
||||
return { x: 16 + 68 * u, y: 64 - 34 * Math.sin(Math.PI * u) };
|
||||
}
|
||||
// sweep: a shallow S from left to right through center.
|
||||
return { x: 18 + 64 * u, y: 50 + 10 * Math.cos(Math.PI * u) };
|
||||
}
|
||||
|
||||
function easeInOut(t) {
|
||||
return t < 0.5 ? 2 * t * t : 1 - 2 * (1 - t) * (1 - t);
|
||||
}
|
||||
function clamp01(v) {
|
||||
return v < 0 ? 0 : v > 1 ? 1 : v;
|
||||
}
|
||||
|
||||
function posAt(timeSeconds) {
|
||||
var u = easeInOut(clamp01(TRAVEL > 0 ? timeSeconds / TRAVEL : 1));
|
||||
return pathPoint(u);
|
||||
}
|
||||
|
||||
// One-time static transforms: center anchor plus a slight
|
||||
// per-ghost scale step for depth. GSAP owns the transform, the
|
||||
// per-update writes touch only left/top/opacity.
|
||||
gsap.set(lead, { xPercent: -50, yPercent: -50 });
|
||||
for (var i = 0; i < ghosts.length; i += 1) {
|
||||
gsap.set(ghosts[i], {
|
||||
xPercent: -50,
|
||||
yPercent: -50,
|
||||
scale: 1 - 0.015 * (i + 1),
|
||||
});
|
||||
}
|
||||
|
||||
// Stepped ghost bases: nearest past copy strongest.
|
||||
var bases = [];
|
||||
for (var b = 0; b < echoes; b += 1) {
|
||||
bases.push(0.55 * (1 - b / echoes));
|
||||
}
|
||||
|
||||
// Pure per-update apply: every position and every ghost alpha
|
||||
// is a function of tl.time() alone. Ghost alpha is its stepped
|
||||
// base times a separation ramp, so echoes are invisible before
|
||||
// motion starts and collapse to exactly zero at rest. Writes
|
||||
// are idempotent, so the HOLD repaints identically.
|
||||
function applyTime(timeSeconds) {
|
||||
var leadPos = posAt(timeSeconds);
|
||||
gsap.set(lead, {
|
||||
left: leadPos.x.toFixed(4) + "%",
|
||||
top: leadPos.y.toFixed(4) + "%",
|
||||
});
|
||||
for (var n = 0; n < ghosts.length; n += 1) {
|
||||
var p = posAt(timeSeconds - (n + 1) * delta);
|
||||
var dist = Math.hypot(p.x - leadPos.x, p.y - leadPos.y);
|
||||
var alpha = bases[n] * clamp01(dist / 2.2);
|
||||
gsap.set(ghosts[n], {
|
||||
left: p.x.toFixed(4) + "%",
|
||||
top: p.y.toFixed(4) + "%",
|
||||
opacity: alpha < 0.002 ? 0 : alpha,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
gsap.set(stage, { opacity: 1, y: "0cqh" });
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
applyTime(tl.time());
|
||||
},
|
||||
});
|
||||
|
||||
// Anchor tween: an inert plain-object tween spanning the full
|
||||
// authored duration so the timeline covers [0, D], onUpdate
|
||||
// fires for every eventful seek, and holds never clamp short.
|
||||
tl.to({ p: 0 }, { p: 1, duration: duration, ease: "none" }, 0);
|
||||
|
||||
// Lead entrance: both endpoints authored. Ghosts need no
|
||||
// entrance; the separation ramp keeps them at zero until the
|
||||
// traversal opens a gap.
|
||||
tl.fromTo(
|
||||
lead,
|
||||
{ opacity: 0 },
|
||||
{ opacity: 1, duration: 0.22 * scale, ease: "power2.out" },
|
||||
0,
|
||||
);
|
||||
|
||||
// HOLD: truly still. The lead rests at path(1) and every ghost
|
||||
// is coincident at opacity exactly zero.
|
||||
|
||||
// OUT: optional departure; exit none holds until the frame cuts.
|
||||
if (exit === "up") {
|
||||
tl.to(stage, { y: "-4cqh", duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
tl.to(stage, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
} else if (exit === "fade") {
|
||||
tl.to(stage, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
}
|
||||
|
||||
tl.seek(0);
|
||||
applyTime(0);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["echo-trail"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: echo-trail at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>echo-trail 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="3.5" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="echo-trail"
|
||||
data-composition-src="./echo-trail.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="3.5" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,330 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
focus-rack: HyperFrames video primitive (camera / holdable / emphasize)
|
||||
|
||||
Concept: two cards sit at different apparent depths. Card A begins sharp
|
||||
and near while card B is blurred and dim. Focus moves to card B exactly
|
||||
once, with blur, scale, and parallax changing together over 0.7 seconds.
|
||||
|
||||
Variables:
|
||||
- label_a (string, default "Draft"): foreground card label.
|
||||
- label_b (string, default "Published"): background card label.
|
||||
- accent (green | blue | violet, default "blue"): focus highlight.
|
||||
|
||||
Envelope (fixed IN/OUT, elastic HOLD only, never gsap.timeScale()):
|
||||
IN_BASE = 1.32s stage reveal, initial focus beat, then one 0.7s rack
|
||||
HOLD = elastic card B remains sharp with a restrained depth drift
|
||||
OUT_BASE = 0.42s completed focus state fades from the stage
|
||||
If D is shorter than IN_BASE plus OUT_BASE, both fixed phases compress
|
||||
proportionally and HOLD becomes zero. The rack still occurs exactly once.
|
||||
|
||||
Mount contract: the runtime clones only this template. #root fills the host
|
||||
box, establishes the container query basis, has no data-width or data-height,
|
||||
and registers one paused timeline under the hardcoded focus-rack id.
|
||||
-->
|
||||
<html
|
||||
lang="en"
|
||||
data-composition-id="focus-rack"
|
||||
data-composition-duration="3.5"
|
||||
data-composition-variables='[
|
||||
{ "id": "label_a", "type": "string", "role": "content", "label": "Card A label", "description": "Label on the card that begins in focus.", "default": "Draft" },
|
||||
{ "id": "label_b", "type": "string", "role": "content", "label": "Card B label", "description": "Label on the card that receives focus.", "default": "Published" },
|
||||
{ "id": "accent", "type": "enum", "role": "style", "label": "Accent", "description": "Highlight color shared by both cards.", "default": "blue", "options": [{ "value": "green", "label": "Green" }, { "value": "blue", "label": "Blue" }, { "value": "violet", "label": "Violet" }] }
|
||||
]'
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Focus Rack</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="focus-rack" data-duration="3.5" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
background: var(--bg, #0b0c0e);
|
||||
color: var(--fg, #f8fafc);
|
||||
font-family: var(--font-body, Inter, system-ui, sans-serif);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.fr-clip {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
background: radial-gradient(
|
||||
ellipse at 52% 48%,
|
||||
color-mix(in srgb, var(--fr-accent) 12%, var(--surface, #18202d)) 0%,
|
||||
var(--bg, #0b0c0e) 72%
|
||||
);
|
||||
}
|
||||
|
||||
.fr-stage {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
perspective: 120cqw;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.fr-card {
|
||||
--fr-blur: 0;
|
||||
position: absolute;
|
||||
top: 21cqh;
|
||||
width: 39cqw;
|
||||
height: 58cqh;
|
||||
padding: 4.2cqh 3.4cqw;
|
||||
overflow: hidden;
|
||||
border: 0.1cqw solid color-mix(in srgb, var(--fr-accent) 28%, #cbd5e1);
|
||||
border-radius: 2.4cqmin;
|
||||
background: linear-gradient(145deg, #ffffff, #e9edf4);
|
||||
box-shadow:
|
||||
0 4.4cqh 10cqh rgba(0, 0, 0, 0.42),
|
||||
inset 0 0.12cqh 0 rgba(255, 255, 255, 0.86);
|
||||
color: #101827;
|
||||
filter: blur(calc(var(--fr-blur) * 1cqw));
|
||||
transform-origin: 50% 50%;
|
||||
will-change: transform, opacity, filter;
|
||||
}
|
||||
|
||||
.fr-card-a {
|
||||
left: 8cqw;
|
||||
}
|
||||
|
||||
.fr-card-b {
|
||||
right: 8cqw;
|
||||
}
|
||||
|
||||
.fr-card-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.fr-kicker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.8cqw;
|
||||
color: #667085;
|
||||
font-size: 1.15cqw;
|
||||
font-weight: 760;
|
||||
letter-spacing: 0.13em;
|
||||
line-height: 1;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.fr-dot {
|
||||
width: 0.75cqw;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
background: var(--fr-accent);
|
||||
box-shadow: 0 0 1.4cqw color-mix(in srgb, var(--fr-accent) 52%, transparent);
|
||||
}
|
||||
|
||||
.fr-index {
|
||||
color: #98a2b3;
|
||||
font-family: var(--font-mono, ui-monospace, monospace);
|
||||
font-size: 1.05cqw;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.fr-label {
|
||||
margin-top: 7.4cqh;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
color: #101827;
|
||||
font-family: var(--font-display, Inter, system-ui, sans-serif);
|
||||
font-size: 4.8cqw;
|
||||
font-weight: 790;
|
||||
letter-spacing: -0.055em;
|
||||
line-height: 0.94;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fr-rule {
|
||||
width: 100%;
|
||||
height: 0.35cqh;
|
||||
margin-top: 5cqh;
|
||||
border-radius: 99cqh;
|
||||
background: color-mix(in srgb, var(--fr-accent) 76%, #d0d5dd);
|
||||
}
|
||||
|
||||
.fr-copy {
|
||||
display: grid;
|
||||
gap: 1.4cqh;
|
||||
margin-top: 3.2cqh;
|
||||
}
|
||||
|
||||
.fr-line {
|
||||
display: block;
|
||||
height: 1.15cqh;
|
||||
border-radius: 99cqh;
|
||||
background: #c9d0dc;
|
||||
}
|
||||
|
||||
.fr-line:last-child {
|
||||
width: 68%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div
|
||||
id="focus-rack-clip"
|
||||
class="fr-clip clip"
|
||||
data-start="0"
|
||||
data-duration="3.5"
|
||||
data-track-index="0"
|
||||
>
|
||||
<div class="fr-stage">
|
||||
<article class="fr-card fr-card-a">
|
||||
<div class="fr-card-top">
|
||||
<span class="fr-kicker"><span class="fr-dot"></span>Workspace</span>
|
||||
<span class="fr-index">A</span>
|
||||
</div>
|
||||
<div class="fr-label fr-label-a"></div>
|
||||
<div class="fr-rule"></div>
|
||||
<div class="fr-copy" aria-hidden="true">
|
||||
<span class="fr-line"></span>
|
||||
<span class="fr-line"></span>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<article class="fr-card fr-card-b">
|
||||
<div class="fr-card-top">
|
||||
<span class="fr-kicker"><span class="fr-dot"></span>Workspace</span>
|
||||
<span class="fr-index">B</span>
|
||||
</div>
|
||||
<div class="fr-label fr-label-b"></div>
|
||||
<div class="fr-rule"></div>
|
||||
<div class="fr-copy" aria-hidden="true">
|
||||
<span class="fr-line"></span>
|
||||
<span class="fr-line"></span>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var stage = root.querySelector(".fr-stage");
|
||||
var cardA = root.querySelector(".fr-card-a");
|
||||
var cardB = root.querySelector(".fr-card-b");
|
||||
var labelA = root.querySelector(".fr-label-a");
|
||||
var labelB = root.querySelector(".fr-label-b");
|
||||
var vars =
|
||||
window.__hyperframes && window.__hyperframes.getVariables
|
||||
? window.__hyperframes.getVariables()
|
||||
: {};
|
||||
|
||||
var accent = vars.accent === "green" || vars.accent === "violet" ? vars.accent : "blue";
|
||||
var accents = { green: "#34d399", blue: "#60a5fa", violet: "#a78bfa" };
|
||||
|
||||
labelA.textContent = vars.label_a == null ? "Draft" : String(vars.label_a);
|
||||
labelB.textContent = vars.label_b == null ? "Published" : String(vars.label_b);
|
||||
root.style.setProperty("--fr-accent", accents[accent]);
|
||||
|
||||
var IN_BASE = 1.32;
|
||||
var OUT_BASE = 0.42;
|
||||
var STAGE_IN_BASE = 0.38;
|
||||
var RACK_AT_BASE = 0.62;
|
||||
var RACK_DURATION_BASE = 0.7;
|
||||
var duration = Math.max(0.001, parseFloat(root.dataset.duration || "3.5"));
|
||||
var fixedDuration = IN_BASE + OUT_BASE;
|
||||
var phaseScale = duration < fixedDuration ? duration / fixedDuration : 1;
|
||||
var IN = IN_BASE * phaseScale;
|
||||
var OUT = OUT_BASE * phaseScale;
|
||||
var STAGE_IN = STAGE_IN_BASE * phaseScale;
|
||||
var RACK_AT = RACK_AT_BASE * phaseScale;
|
||||
var RACK_DURATION = RACK_DURATION_BASE * phaseScale;
|
||||
var HOLD = Math.max(0, duration - IN - OUT);
|
||||
var HOLD_START = IN;
|
||||
var OUT_START = IN + HOLD;
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
tl.set(stage, { opacity: 0 }, 0);
|
||||
tl.set(
|
||||
cardA,
|
||||
{
|
||||
"--fr-blur": 0,
|
||||
opacity: 1,
|
||||
x: "0cqw",
|
||||
y: "-0.5cqh",
|
||||
scale: 1.045,
|
||||
rotation: -3,
|
||||
},
|
||||
0,
|
||||
);
|
||||
tl.set(
|
||||
cardB,
|
||||
{
|
||||
"--fr-blur": 0.48,
|
||||
opacity: 0.52,
|
||||
x: "1.6cqw",
|
||||
y: "0.8cqh",
|
||||
scale: 0.93,
|
||||
rotation: 2.4,
|
||||
},
|
||||
0,
|
||||
);
|
||||
|
||||
tl.to(stage, { opacity: 1, duration: STAGE_IN, ease: "power2.out" }, 0);
|
||||
|
||||
tl.to(
|
||||
cardA,
|
||||
{
|
||||
"--fr-blur": 0.48,
|
||||
opacity: 0.5,
|
||||
x: "-1.4cqw",
|
||||
y: "0.8cqh",
|
||||
scale: 0.94,
|
||||
rotation: -1.6,
|
||||
duration: RACK_DURATION,
|
||||
ease: "sine.inOut",
|
||||
},
|
||||
RACK_AT,
|
||||
);
|
||||
tl.to(
|
||||
cardB,
|
||||
{
|
||||
"--fr-blur": 0,
|
||||
opacity: 1,
|
||||
x: "-1.6cqw",
|
||||
y: "-0.4cqh",
|
||||
scale: 1.04,
|
||||
rotation: 1.3,
|
||||
duration: RACK_DURATION,
|
||||
ease: "sine.inOut",
|
||||
},
|
||||
RACK_AT,
|
||||
);
|
||||
|
||||
if (HOLD > 0) {
|
||||
tl.to(cardA, { y: "1.15cqh", duration: HOLD, ease: "sine.inOut" }, HOLD_START);
|
||||
tl.to(cardB, { y: "-0.75cqh", duration: HOLD, ease: "sine.inOut" }, HOLD_START);
|
||||
}
|
||||
|
||||
tl.to(stage, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
|
||||
tl.seek(0);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["focus-rack"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: focus-rack at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>focus-rack 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="3.5" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="focus-rack"
|
||||
data-composition-src="./focus-rack.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="3.5" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 6.9 KiB |
@@ -0,0 +1,381 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
glyph-ring-assemble: HyperFrames video primitive (wordmark break and reassemble).
|
||||
|
||||
A wordmark sits at rest, arc-set. Its letters break out of the word, run all the
|
||||
way around a shared ring, and close back into the word in reading order.
|
||||
|
||||
Measured from the batch5 reference clip, 7.0s to 8.9s, frames
|
||||
reference frames f-001..f-046 at 24fps. Full working in
|
||||
batch5/spec-glyph-ring-assemble.md.
|
||||
|
||||
THE MECHANIC, and it is not the obvious one. Not seven letters on seven paths,
|
||||
and not an out-and-back either: ONE shared pivot, every letter making a single
|
||||
full 360 degree orbit about it, staggered in time. The scatter is entirely the
|
||||
stagger acting on one heavily eased rotation, and the letters never leave the
|
||||
ring. Proof, on the letter i (its dot and stem are separable in every frame, so
|
||||
they give position and rotation independently): a circle fitted to the dot's
|
||||
centroid over f008 to f033 lands at centre (627.0, 680.3) radius 516.3px with
|
||||
residual RMS 3.8px, 0.7% of the radius; and over the same window the stem-to-dot
|
||||
vector turns 359.0 degrees while the polar angle about that centre turns 357.0,
|
||||
monotonically, in one direction. Radius is constant, spin is locked to orbit, and
|
||||
the letters go around rather than out and back. So there is ONE track per letter,
|
||||
not three. The unit brief asked for three independent tracks (angle, spin,
|
||||
radius). The reference does not have three, and building three would be building
|
||||
a different move. Numbers above, this is the one deliberate divergence.
|
||||
|
||||
Fitted across all seven letters, 22 hand-matched (letter, frame, centroid)
|
||||
observations, five free parameters, residual mean 15.5px on a 1280px frame:
|
||||
pivot (49.7%, 53.0%) of frame, orbit radius 36.3% of frame, per-letter duration
|
||||
0.808s, stagger 39.7ms in REVERSE reading order (the last letter leaves and
|
||||
returns first, so the word unzips and zips up backwards).
|
||||
Rest geometry: word 53.6% of frame wide on a 78 degree arc, tilted -7.8 degrees,
|
||||
ink #535353 on #F2F2F2 at 6.87:1.
|
||||
|
||||
Curve, fitted to the i's per-frame orbit angle (17 samples): cb(0.545, 0.061,
|
||||
0.500, 0.995), max error 3.3% of travel, RMS 1.5%. Nearest palette curve is morph
|
||||
at 9.0%, camPush 33.3%, camWhip 25.9%. It is a single hard S: the letter barely
|
||||
moves, tears away, whips round, and arrives without overshoot (the angle reads
|
||||
236.7, 238.3, 238.3, 238.3 over f027 to f029). Because the whole move is now one
|
||||
tween per letter, that curve is applied end to end exactly as it was fitted.
|
||||
|
||||
Envelope (D = 2.10s, 30fps), matched to the reference read at 24fps:
|
||||
REST 0.000-0.250 ref f-001..f-006. The wordmark assembled and arc-set. This
|
||||
is frame zero and it is the frame a viewer reads first.
|
||||
audit-hold 0.00 0.21 ref clip f-001..f-006 (0.000s to 0.208s) the
|
||||
wordmark is assembled and still. Same viewport-zoom caveat
|
||||
as the tail hold below.
|
||||
BREAK 0.250-0.659 ref f-006..f-016. Letters tear out of the word and spread
|
||||
around the ring. This is the first half of each orbit, not
|
||||
a separate tween: 0.659s is where the first letter passes
|
||||
50% of its rotation (the curve crosses 0.5 at p=0.506).
|
||||
CLOSE 0.659-1.297 ref f-016..f-031. The second half of the same orbit. Per
|
||||
letter 0.808s of travel, landings 34ms apart, last letter
|
||||
home first. Peak angular spread is 193.5 degrees at 0.783s.
|
||||
HOLD 1.297-2.100 the landed wordmark and its mark.
|
||||
audit-hold 1.29 2.10 ref clip f-031..f-046 (1.250s to 1.875s) the
|
||||
wordmark is at rest for 0.63s: the only thing changing in
|
||||
those sixteen frames is the recording's own viewport zoom,
|
||||
which grows the logo blob 149,025 to 207,027px at a steady
|
||||
9% linear per second across the WHOLE segment, f001
|
||||
included. That zoom is a screen-recording artifact, not the
|
||||
design, and is excluded from every number here.
|
||||
|
||||
Deliberate deviations from the reference:
|
||||
- stagger is normalised to a fixed 0.2385s total spread (the reference's 5.724
|
||||
frames at 24fps) divided over n-1 gaps, so any word length keeps the reference
|
||||
envelope. At seven letters that is exactly the measured 39.7ms.
|
||||
- the orbit is a circle, so its radius is short-side bound in every aspect. The
|
||||
per-aspect lever is the coefficient (36cqh landscape and square, 40cqw
|
||||
portrait), not the unit. An ellipse would need a counter-rotate plus
|
||||
counter-scale wrapper per glyph to keep the letterforms from shearing.
|
||||
- the mark's outline is procedural. Its bounding box (48.7% of frame width by
|
||||
52.2% of frame height), its 39.6% fill of that box and its rgb(83,83,83) are
|
||||
all the reference subject's measured values; the shape is not, because a
|
||||
primitive cannot ship a photographed subject.
|
||||
|
||||
The mark slot: set --gra-mark to swap it. It is a background shorthand value, so
|
||||
a flat colour, a gradient, or url(...) all work, and --gra-mark-shape is its
|
||||
clip-path (set it to none for a rectangular image). Default fill is #535353, the
|
||||
same value as the ink, because that is what the reference does: its subject reads
|
||||
rgb(83,83,83) and its wordmark ink rgb(84,84,84). A glyph crossing the subject in
|
||||
the reference vanishes, and it vanishes here too, for the 0.3s it lasts. The
|
||||
silhouette's 60% negative space is what keeps most of them readable anyway.
|
||||
|
||||
Copy: --gra-word on #root, read once before the timeline is built and split into
|
||||
one arm per glyph. Colour: --gra-bg, --gra-ink. Tilt: --gra-tilt.
|
||||
-->
|
||||
<html lang="en" data-composition-id="glyph-ring-assemble" data-composition-duration="2.1">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Glyph Ring Assemble</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="glyph-ring-assemble" data-duration="2.1" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
background: var(--gra-bg, #f2f2f2);
|
||||
color: var(--gra-ink, #535353);
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
|
||||
pointer-events: none;
|
||||
|
||||
--gra-word: "MOMENTUM";
|
||||
/* Measured -7.8 degrees. The reference wordmark is not level: its
|
||||
centre glyph sits at polar angle -97.8, not -90. */
|
||||
--gra-tilt: -7.8deg;
|
||||
}
|
||||
|
||||
/* The subject slot. First child, so it paints under the glyphs without
|
||||
a z-index. Static: nothing in the timeline touches it, so it is present
|
||||
in frame zero and in the last frame alike. Box is the reference
|
||||
subject's measured bbox, 48.7% of frame width by 52.2% of frame height,
|
||||
written against cqh so the proportion survives every aspect.
|
||||
|
||||
The default silhouette is a 30-point polygon generated from
|
||||
r(t) = 1 + 0.583 sin(3t+0.7) + 0.320 sin(5t+2.1) + 0.188 sin(7t+0.3),
|
||||
sampled at 30 equal angles and normalised to the box. Three harmonics
|
||||
is what makes it articulated rather than a blob: it encloses 39.6% of
|
||||
its own bounding box, which is the reference subject's measured 39.6%.
|
||||
The amplitude scale was solved for that number, it was not eyeballed. */
|
||||
.gra-mark {
|
||||
position: absolute;
|
||||
left: 50cqw;
|
||||
top: 38cqh;
|
||||
width: 49cqh;
|
||||
height: 52cqh;
|
||||
transform: translateX(-50%);
|
||||
background: var(--gra-mark, #535353) center / contain no-repeat;
|
||||
clip-path: var(
|
||||
--gra-mark-shape,
|
||||
polygon(
|
||||
99.9% 56.6%, 100% 68.7%, 81.3% 73.5%, 66.4% 73.1%, 64.6% 79.8%,
|
||||
61.8% 87.9%, 51.8% 81%, 45% 66.2%, 42.9% 67.2%, 34.7% 85.6%,
|
||||
19.4% 100%, 6.4% 99.2%, 0% 89.1%, 2.2% 75.6%, 16.7% 62.5%,
|
||||
34.4% 56.6%, 36% 54.9%, 21.4% 46.4%, 13.4% 34%, 20.8% 30.4%,
|
||||
29.1% 30.3%, 31.6% 17.8%, 38.2% 0%, 49.8% 1%, 55% 22.4%,
|
||||
52.1% 42.4%, 50.2% 49.7%, 53% 50%, 62% 48.5%, 80.7% 48.7%
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/* The pivot. A zero-size point, so a rotation on any child of it turns
|
||||
about the pivot and nothing else. Radius and type scale live HERE and
|
||||
not on #root, because a container query cannot restyle its own
|
||||
container (Law 0b) and both of them change per aspect. */
|
||||
.gra-ring {
|
||||
position: absolute;
|
||||
top: 53cqh;
|
||||
left: 50cqw;
|
||||
width: 0;
|
||||
height: 0;
|
||||
|
||||
--gra-r: 36cqh;
|
||||
--gra-fs: 8.8cqh;
|
||||
}
|
||||
|
||||
/* One arm per glyph. GSAP owns exactly one property on it, rotation, and
|
||||
the arm's own box is 0x0 so transform-origin: center IS the pivot.
|
||||
That is the whole mechanic: orbit angle and self-spin are the same
|
||||
number in the reference, so they are the same number here. */
|
||||
.gra-arm {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
/* Static. Pushes the glyph out to the orbit radius and centres it on the
|
||||
orbit point. GSAP never touches this element, so the rotation above
|
||||
cannot fight it. */
|
||||
.gra-ch {
|
||||
position: absolute;
|
||||
top: calc(-1 * var(--gra-r));
|
||||
left: 0;
|
||||
font-size: var(--gra-fs);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.01em;
|
||||
line-height: 1;
|
||||
white-space: pre;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
/* The measuring run. Laid out inline once, at the real type size, to get
|
||||
each glyph's advance, then removed. Hidden rather than display:none so
|
||||
it actually lays out. */
|
||||
.gra-rule {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
font-size: var(--gra-fs);
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.01em;
|
||||
line-height: 1;
|
||||
visibility: hidden;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
/* Portrait. The orbit is a circle, so the radius is bound by the short
|
||||
side whatever unit it is written in; what changes per aspect is how
|
||||
much of that side to spend. Portrait has height to spare and no width
|
||||
to spare, so it takes a bigger share of the width and a bigger type
|
||||
size with it, which keeps the arc span (word width over radius) at the
|
||||
reference's 78 to 85 degrees in all three shapes. The mark drops below
|
||||
the ring instead of sitting inside it, for the same reason. */
|
||||
@container (aspect-ratio < 0.95) {
|
||||
.gra-ring {
|
||||
--gra-r: 40cqw;
|
||||
--gra-fs: 9.7cqw;
|
||||
}
|
||||
|
||||
.gra-mark {
|
||||
top: 46cqh;
|
||||
width: 62cqw;
|
||||
height: 66cqw;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="gra-mark"></div>
|
||||
<div class="gra-ring"></div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// Cubic-bezier as a GSAP ease. Pure function of progress, so seek-safe:
|
||||
// seek(t) always yields the same value, no internal state to drift.
|
||||
// Newton-Raphson on x, bisection where the slope flattens.
|
||||
function cb(x1, y1, x2, y2) {
|
||||
var A = function (a, b) { return 1 - 3 * b + 3 * a; }, C = function (a) { return 3 * a; };
|
||||
var B = function (a, b) { return 3 * b - 6 * a; };
|
||||
var f = function (t, a, b) { return ((A(a, b) * t + B(a, b)) * t + C(a)) * t; };
|
||||
var d = function (t, a, b) { return 3 * A(a, b) * t * t + 2 * B(a, b) * t + C(a); };
|
||||
return function (p) {
|
||||
if (p <= 0) return 0;
|
||||
if (p >= 1) return 1;
|
||||
var t = p, i, s, e;
|
||||
for (i = 0; i < 8; i++) {
|
||||
s = d(t, x1, x2);
|
||||
if (s === 0) break;
|
||||
e = f(t, x1, x2) - p;
|
||||
if (Math.abs(e) < 1e-7) break;
|
||||
t -= e / s;
|
||||
}
|
||||
if (t < 0 || t > 1) {
|
||||
var lo = 0, hi = 1, j, v;
|
||||
t = p;
|
||||
for (j = 0; j < 30; j++) {
|
||||
v = f(t, x1, x2);
|
||||
if (Math.abs(v - p) < 1e-7) break;
|
||||
if (v > p) hi = t; else lo = t;
|
||||
t = (lo + hi) / 2;
|
||||
}
|
||||
}
|
||||
return f(t, y1, y2);
|
||||
};
|
||||
}
|
||||
|
||||
// The only curve in this file, and it is not from the palette. Fitted by
|
||||
// least squares to seventeen per-frame samples of the reference letter i's
|
||||
// orbit angle: max error 3.3% of travel, RMS 1.5%. The nearest palette
|
||||
// curve, morph, is 9.0% off, camPush 33.3%, camWhip 25.9%. When you have
|
||||
// the table, the fit wins.
|
||||
var REF = cb(0.545, 0.061, 0.5, 0.995);
|
||||
|
||||
gsap.defaults({ immediateRender: false });
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var ring = root.querySelector(".gra-ring");
|
||||
|
||||
// Copy in, once, before anything is built. Deterministic: no timers, no
|
||||
// fetch, and the value is a literal in the stylesheet above.
|
||||
var word = getComputedStyle(root).getPropertyValue("--gra-word").trim().replace(/^["']|["']$/g, "");
|
||||
if (!word) word = "MOMENTUM";
|
||||
|
||||
// Measure the advance of every glyph at the real type size, so the arc
|
||||
// spacing is the font's own spacing and not a guessed constant. A Range
|
||||
// over the text node, as in pill-row-collapse, holds for whatever font
|
||||
// actually resolves and for the letter-spacing.
|
||||
var rule = document.createElement("div");
|
||||
rule.className = "gra-rule";
|
||||
rule.appendChild(document.createTextNode(word));
|
||||
ring.appendChild(rule);
|
||||
var node = rule.firstChild;
|
||||
var range = document.createRange();
|
||||
var edge = [];
|
||||
for (var c = 0; c <= word.length; c++) {
|
||||
range.setStart(node, 0);
|
||||
range.setEnd(node, c);
|
||||
edge.push(range.getBoundingClientRect().width || 0);
|
||||
}
|
||||
ring.removeChild(rule);
|
||||
|
||||
// Baseline centre, so the word is centred on the arc apex.
|
||||
var mid = edge[word.length] / 2;
|
||||
|
||||
// Glyphs only. A space still advances the baseline, it just gets no arm.
|
||||
var glyphs = [];
|
||||
for (var i = 0; i < word.length; i++) {
|
||||
if (word.charAt(i) === " ") continue;
|
||||
glyphs.push({ ch: word.charAt(i), at: (edge[i] + edge[i + 1]) / 2 - mid });
|
||||
}
|
||||
var N = glyphs.length;
|
||||
|
||||
var arms = glyphs.map(function (g) {
|
||||
var arm = document.createElement("div");
|
||||
arm.className = "gra-arm";
|
||||
var span = document.createElement("span");
|
||||
span.className = "gra-ch";
|
||||
span.appendChild(document.createTextNode(g.ch));
|
||||
arm.appendChild(span);
|
||||
ring.appendChild(arm);
|
||||
return arm;
|
||||
});
|
||||
|
||||
// Read the orbit radius off the box the container query actually built,
|
||||
// rather than re-deriving the aspect thresholds in JS. One source of
|
||||
// truth, and GSAP needs a number in px anyway because it writes
|
||||
// transforms as px (Law 0b).
|
||||
var g0 = arms[0].firstChild.getBoundingClientRect();
|
||||
var R = arms[0].getBoundingClientRect().top - (g0.top + g0.height / 2);
|
||||
if (!(R > 1)) R = Math.min(root.clientWidth, root.clientHeight) * 0.36 || 389;
|
||||
|
||||
// Rest angle of each glyph: its baseline offset walked around the circle,
|
||||
// plus the wordmark's own tilt. Arc length over radius, so a long word
|
||||
// wraps further and a short one sits nearly flat, which is what the
|
||||
// reference does (645px of chord on a 469px radius, 78 degrees).
|
||||
var tilt = parseFloat(getComputedStyle(root).getPropertyValue("--gra-tilt")) || 0;
|
||||
var rest = glyphs.map(function (g) { return tilt + (g.at / R) * 180 / Math.PI; });
|
||||
|
||||
// Reference envelope in seconds at the reference's own speed. REST is
|
||||
// f-001..f-006, SPAN is the 5.724-frame stagger spread, RUN is the fitted
|
||||
// per-letter orbit. Scaled together if data-duration is changed, so the
|
||||
// beats compress but never reorder.
|
||||
var D = Math.max(0.001, parseFloat(root.dataset.duration || "2.1"));
|
||||
var SC = D / 2.1;
|
||||
var REST = 0.25 * SC, SPAN = 0.2385 * SC, RUN = 0.808 * SC;
|
||||
var STEP = N > 1 ? SPAN / (N - 1) : 0;
|
||||
|
||||
// Rest state pinned outside the timeline. The tween below writes both
|
||||
// ends, so a seek never inherits a start value from the screen.
|
||||
arms.forEach(function (arm, k) { gsap.set(arm, { rotation: rest[k] }); });
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
// One tween per letter and that is the whole move. Rotation runs a full
|
||||
// -360 relative to rest, so the letter leaves the word, travels the ring,
|
||||
// and returns to exactly the CSS rest angle. Break and reassemble are the
|
||||
// two halves of it, not two tweens: the fitted curve is what splits them,
|
||||
// and the stagger is what turns eight synchronised orbits into a scatter.
|
||||
// Reverse reading order: k = N-1 leaves first and lands first.
|
||||
arms.forEach(function (arm, k) {
|
||||
tl.fromTo(arm, { rotation: rest[k] - 360 },
|
||||
{ rotation: rest[k], duration: RUN, ease: REF }, REST + STEP * (N - 1 - k));
|
||||
});
|
||||
|
||||
tl.set({}, {}, D); // pin the full duration
|
||||
tl.seek(0);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["glyph-ring-assemble"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: glyph-ring-assemble at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>glyph-ring-assemble 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="2.1" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="glyph-ring-assemble"
|
||||
data-composition-src="./glyph-ring-assemble.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="2.1" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 5.2 KiB |
@@ -0,0 +1,355 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
grade-split-reveal: the grade arrives as a moving edge.
|
||||
|
||||
Two copies of the same plate sit exactly on top of each other. The lower copy carries a
|
||||
flat, milky look, the way ungraded footage comes off a camera. The upper copy carries the
|
||||
finished warm cinematic look. A hard edge sweeps across the upper copy, so the graded
|
||||
version eats the flat one from left to right and you read both halves of the same picture
|
||||
at the same time. It pauses in the middle long enough for the eye to compare, then commits
|
||||
and takes the whole frame.
|
||||
|
||||
Both looks are real HyperFrames color grading, not a CSS filter. The runtime hands each
|
||||
image to a WebGL shader and swaps in a graded canvas, and the render pipeline redraws the
|
||||
same shader, so what you preview is what encodes. Color grading is media only: it applies
|
||||
to <video> and <img>, never to text, SVG or ordinary DOM.
|
||||
|
||||
The plate here is a procedural SVG scene built in this file, so the primitive is
|
||||
deterministic and ships nothing licensed. Replace PLATE_SRC with your own photo or a video
|
||||
poster and the whole move still works. Swap AFTER_GRADE for any preset id or hand written
|
||||
adjust block.
|
||||
|
||||
The edge itself is never animated with clip-path. The upper copy lives in a wrapper with
|
||||
overflow hidden and the wrapper's width is what moves, so the sweep is one plain numeric
|
||||
tween that seeks perfectly and never re-parses a string.
|
||||
|
||||
Every ease is a cubic bezier written out by hand and solved in this file. No preset is used
|
||||
anywhere.
|
||||
|
||||
Mount contract: everything lives inside <template>, styles and scripts included, and the
|
||||
scripts sit INSIDE the composition root. A host clones template content into its own mount
|
||||
and only runs scripts found inside the root; markup left outside is copied without its
|
||||
behaviour, which renders a black card with no timeline at all.
|
||||
-->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Grade Split Reveal</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div
|
||||
id="root"
|
||||
class="clip gs-root"
|
||||
data-composition-id="grade-split-reveal"
|
||||
data-duration="6"
|
||||
data-fps="30"
|
||||
>
|
||||
<style>
|
||||
.gs-root {
|
||||
--ink: #f6f4ef;
|
||||
--rule: rgba(246, 244, 239, 0.55);
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
background: transparent;
|
||||
pointer-events: none;
|
||||
}
|
||||
#gs-plate {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
border-radius: 10px;
|
||||
background: #08080a;
|
||||
box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
.gs-layer {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.gs-layer img {
|
||||
display: block;
|
||||
object-fit: cover;
|
||||
}
|
||||
#gs-edge {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 2px;
|
||||
height: 100%;
|
||||
background: var(--ink);
|
||||
box-shadow: 0 0 18px rgba(0, 0, 0, 0.7);
|
||||
}
|
||||
.gs-tag {
|
||||
position: absolute;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.16em;
|
||||
color: var(--ink);
|
||||
opacity: 0;
|
||||
white-space: nowrap;
|
||||
text-shadow: 0 2px 12px rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
.gs-tag::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: -0.7em;
|
||||
width: 1.8em;
|
||||
height: 2px;
|
||||
background: var(--rule);
|
||||
}
|
||||
#gs-tag-before::before {
|
||||
left: auto;
|
||||
right: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="gs-plate">
|
||||
<div class="gs-layer" id="gs-before"><img id="gs-img-before" alt="" /></div>
|
||||
<div class="gs-layer" id="gs-after"><img id="gs-img-after" alt="" /></div>
|
||||
<div id="gs-edge"></div>
|
||||
<div class="gs-tag" id="gs-tag-before">Ungraded</div>
|
||||
<div class="gs-tag" id="gs-tag-after">Warm Cinematic</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
gsap.defaults({ immediateRender: false });
|
||||
|
||||
/* Cubic bezier solved by hand. Newton first, bisection when the slope dies. */
|
||||
function bezier(x1, y1, x2, y2) {
|
||||
function curve(t, a1, a2) {
|
||||
var A = 1 - 3 * a2 + 3 * a1;
|
||||
var B = 3 * a2 - 6 * a1;
|
||||
var C = 3 * a1;
|
||||
return ((A * t + B) * t + C) * t;
|
||||
}
|
||||
function slope(t, a1, a2) {
|
||||
var A = 1 - 3 * a2 + 3 * a1;
|
||||
var B = 3 * a2 - 6 * a1;
|
||||
var C = 3 * a1;
|
||||
return (3 * A * t + 2 * B) * t + C;
|
||||
}
|
||||
return function (p) {
|
||||
if (p <= 0) return 0;
|
||||
if (p >= 1) return 1;
|
||||
var t = p;
|
||||
for (var i = 0; i < 8; i++) {
|
||||
var d = slope(t, x1, x2);
|
||||
if (Math.abs(d) < 1e-6) break;
|
||||
var e = curve(t, x1, x2) - p;
|
||||
if (Math.abs(e) < 1e-7) return curve(t, y1, y2);
|
||||
t -= e / d;
|
||||
}
|
||||
var lo = 0;
|
||||
var hi = 1;
|
||||
t = p;
|
||||
for (var j = 0; j < 24; j++) {
|
||||
var x = curve(t, x1, x2);
|
||||
if (Math.abs(x - p) < 1e-7) break;
|
||||
if (x > p) hi = t;
|
||||
else lo = t;
|
||||
t = (lo + hi) / 2;
|
||||
}
|
||||
return curve(t, y1, y2);
|
||||
};
|
||||
}
|
||||
|
||||
/* Plate settles, never bounces. */
|
||||
var EASE_PLATE = bezier(0.16, 0.84, 0.24, 1);
|
||||
/* The sweep loiters, then finishes fast, the way a hand drags a compare slider. */
|
||||
var EASE_WIPE = bezier(0.62, 0, 0.14, 1);
|
||||
/* The commit is decisive from the first frame. */
|
||||
var EASE_COMMIT = bezier(0.4, 0, 0.05, 1);
|
||||
var EASE_TAG = bezier(0.22, 0.8, 0.3, 1);
|
||||
var EASE_FADE = bezier(0.4, 0, 0.7, 1);
|
||||
|
||||
var DUR = 6;
|
||||
|
||||
/* ---- the plate. Swap PLATE_SRC for your own photo or video poster. ---- */
|
||||
var SCENE =
|
||||
/* width and height are not decoration. An SVG served to an <img> with only a
|
||||
viewBox has no intrinsic size, and a texture upload from it comes back
|
||||
empty, so the shader grades a blank plate. */
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="1600" height="900" viewBox="0 0 1600 900">' +
|
||||
"<defs>" +
|
||||
'<linearGradient id="sky" x1="0" y1="0" x2="0" y2="1">' +
|
||||
'<stop offset="0" stop-color="#1b2340"/><stop offset="0.42" stop-color="#5b4a63"/>' +
|
||||
'<stop offset="0.68" stop-color="#c8794a"/><stop offset="0.78" stop-color="#f0a75c"/>' +
|
||||
'<stop offset="1" stop-color="#f7c988"/></linearGradient>' +
|
||||
'<linearGradient id="sea" x1="0" y1="0" x2="0" y2="1">' +
|
||||
'<stop offset="0" stop-color="#c98a55"/><stop offset="0.3" stop-color="#6a5560"/>' +
|
||||
'<stop offset="1" stop-color="#1a1d30"/></linearGradient>' +
|
||||
'<radialGradient id="glow" cx="0.62" cy="0.74" r="0.42">' +
|
||||
'<stop offset="0" stop-color="#ffdfa8" stop-opacity="0.9"/>' +
|
||||
'<stop offset="1" stop-color="#ffdfa8" stop-opacity="0"/></radialGradient>' +
|
||||
"</defs>" +
|
||||
'<rect width="1600" height="900" fill="url(#sky)"/>' +
|
||||
'<rect width="1600" height="900" fill="url(#glow)"/>' +
|
||||
'<circle cx="992" cy="660" r="58" fill="#fff0cd"/>' +
|
||||
'<path d="M0 640 L250 578 L430 618 L640 552 L820 606 L1010 566 L1240 620 L1430 578 L1600 616 L1600 700 L0 700 Z" fill="#3a2f45"/>' +
|
||||
'<path d="M0 668 L210 634 L400 664 L610 622 L840 662 L1080 630 L1330 668 L1600 638 L1600 700 L0 700 Z" fill="#2a2337"/>' +
|
||||
'<rect y="700" width="1600" height="200" fill="url(#sea)"/>' +
|
||||
'<rect x="962" y="700" width="60" height="200" fill="#ffdfa8" opacity="0.42"/>' +
|
||||
'<rect x="978" y="700" width="28" height="200" fill="#fff3d4" opacity="0.5"/>' +
|
||||
'<g fill="#f4e3c2" opacity="0.34">' +
|
||||
'<rect x="120" y="742" width="1360" height="3"/><rect x="240" y="786" width="1120" height="3"/>' +
|
||||
'<rect x="60" y="828" width="1480" height="4"/><rect x="300" y="868" width="1000" height="4"/></g>' +
|
||||
'<g fill="#e8d3b4" opacity="0.5">' +
|
||||
'<rect x="180" y="330" width="420" height="7" rx="3"/><rect x="300" y="372" width="260" height="6" rx="3"/>' +
|
||||
'<rect x="1010" y="286" width="380" height="7" rx="3"/><rect x="1130" y="326" width="220" height="6" rx="3"/></g>' +
|
||||
'<path d="M0 760 L118 700 L268 760 L268 900 L0 900 Z" fill="#12121e"/>' +
|
||||
'<path d="M1600 742 L1462 700 L1318 742 L1318 900 L1600 900 Z" fill="#0f0f1a"/>' +
|
||||
"</svg>";
|
||||
var PLATE_SRC = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(SCENE);
|
||||
|
||||
/* ---- the two looks. Both are real color grading, applied by the shader. ---- */
|
||||
var BEFORE_GRADE = {
|
||||
preset: "neutral",
|
||||
intensity: 1,
|
||||
adjust: {
|
||||
exposure: 0.1,
|
||||
contrast: -0.42,
|
||||
highlights: -0.1,
|
||||
shadows: 0.24,
|
||||
whites: -0.14,
|
||||
blacks: 0.3,
|
||||
temperature: -0.06,
|
||||
vibrance: -0.22,
|
||||
saturation: -0.34,
|
||||
},
|
||||
colorSpace: "rec709",
|
||||
};
|
||||
var AFTER_GRADE = {
|
||||
preset: "deep-contrast",
|
||||
intensity: 1,
|
||||
adjust: {
|
||||
exposure: 0.02,
|
||||
contrast: 0.28,
|
||||
highlights: -0.16,
|
||||
shadows: 0.08,
|
||||
whites: 0.06,
|
||||
blacks: -0.16,
|
||||
temperature: 0.18,
|
||||
tint: -0.04,
|
||||
vibrance: 0.26,
|
||||
saturation: 0.1,
|
||||
},
|
||||
details: { vignette: 0.3, vignetteFeather: 0.7, grain: 0.1, grainSize: 0.3 },
|
||||
colorSpace: "rec709",
|
||||
};
|
||||
|
||||
var root = document.getElementById("gs-plate").parentElement;
|
||||
var FRAME_W = root.clientWidth || 1920;
|
||||
var FRAME_H = root.clientHeight || 1080;
|
||||
|
||||
/* The plate keeps the frame's own shape, inset by a constant margin, so one file
|
||||
reads correctly in landscape, portrait and square. */
|
||||
var INSET = Math.min(FRAME_W, FRAME_H) * 0.085;
|
||||
var PW = Math.round(FRAME_W - INSET * 2);
|
||||
var PH = Math.round(FRAME_H - INSET * 2);
|
||||
|
||||
var plate = document.getElementById("gs-plate");
|
||||
plate.style.left = INSET + "px";
|
||||
plate.style.top = INSET + "px";
|
||||
plate.style.width = PW + "px";
|
||||
plate.style.height = PH + "px";
|
||||
|
||||
var before = document.getElementById("gs-before");
|
||||
var after = document.getElementById("gs-after");
|
||||
var edge = document.getElementById("gs-edge");
|
||||
var tagBefore = document.getElementById("gs-tag-before");
|
||||
var tagAfter = document.getElementById("gs-tag-after");
|
||||
|
||||
/* Both images are laid out at the full plate width. Only the wrapper narrows, so
|
||||
the shader canvas the runtime drops in keeps its measured box and the edge is a
|
||||
clean crop rather than a squeeze. */
|
||||
[
|
||||
[document.getElementById("gs-img-before"), BEFORE_GRADE],
|
||||
[document.getElementById("gs-img-after"), AFTER_GRADE],
|
||||
].forEach(function (pair) {
|
||||
pair[0].style.width = PW + "px";
|
||||
pair[0].style.height = PH + "px";
|
||||
pair[0].setAttribute("data-color-grading", JSON.stringify(pair[1]));
|
||||
pair[0].src = PLATE_SRC;
|
||||
});
|
||||
before.style.width = PW + "px";
|
||||
|
||||
var TAG = Math.max(11, Math.round(Math.min(FRAME_W, FRAME_H) * 0.019));
|
||||
var PAD = Math.round(INSET * 0.62);
|
||||
[tagBefore, tagAfter].forEach(function (t) {
|
||||
t.style.fontSize = TAG + "px";
|
||||
t.style.bottom = PAD + "px";
|
||||
});
|
||||
/* The graded copy grows from the left, so its label sits on the left. Putting
|
||||
these the other way round labels each half with the look it is not. */
|
||||
tagAfter.style.left = PAD + "px";
|
||||
tagBefore.style.right = PAD + "px";
|
||||
tagBefore.style.textAlign = "right";
|
||||
|
||||
/* Rest state lives outside the timeline so frame zero is already correct. */
|
||||
/* The plate is lit at frame zero and arrives on scale alone. Fading it up from
|
||||
nothing would leave the first frames of the clip literally blank, which reads
|
||||
as a broken card in any grid of thumbnails. */
|
||||
gsap.set(plate, { transformOrigin: "50% 50%", scale: 1.05, opacity: 1 });
|
||||
gsap.set(after, { width: 0 });
|
||||
gsap.set(edge, { x: 0, opacity: 0 });
|
||||
gsap.set([tagBefore, tagAfter], { opacity: 0, y: 10 });
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
/* The plate arrives. */
|
||||
tl.fromTo(plate, { scale: 1.05 }, { scale: 1, duration: 0.62, ease: EASE_PLATE }, 0);
|
||||
tl.fromTo(
|
||||
tagBefore,
|
||||
{ opacity: 0, y: 10 },
|
||||
{ opacity: 0.82, y: 0, duration: 0.34, ease: EASE_TAG },
|
||||
0.36,
|
||||
);
|
||||
|
||||
/* The grade sweeps in and stops short, so both halves are readable together. */
|
||||
var HOLD = Math.round(PW * 0.62);
|
||||
tl.fromTo(after, { width: 0 }, { width: HOLD, duration: 1.6, ease: EASE_WIPE }, 0.7);
|
||||
tl.fromTo(edge, { x: 0 }, { x: HOLD, duration: 1.6, ease: EASE_WIPE }, 0.7);
|
||||
tl.fromTo(edge, { opacity: 0 }, { opacity: 1, duration: 0.2, ease: EASE_FADE }, 0.7);
|
||||
tl.fromTo(
|
||||
tagAfter,
|
||||
{ opacity: 0, y: 10 },
|
||||
{ opacity: 1, y: 0, duration: 0.34, ease: EASE_TAG },
|
||||
1.16,
|
||||
);
|
||||
|
||||
/* Then it commits and takes the whole plate. */
|
||||
tl.fromTo(
|
||||
after,
|
||||
{ width: HOLD },
|
||||
{ width: PW, duration: 1.2, ease: EASE_COMMIT },
|
||||
3.1,
|
||||
);
|
||||
tl.fromTo(edge, { x: HOLD }, { x: PW, duration: 1.2, ease: EASE_COMMIT }, 3.1);
|
||||
tl.fromTo(
|
||||
tagBefore,
|
||||
{ opacity: 0.82 },
|
||||
{ opacity: 0, duration: 0.5, ease: EASE_FADE },
|
||||
3.1,
|
||||
);
|
||||
tl.fromTo(edge, { opacity: 1 }, { opacity: 0, duration: 0.3, ease: EASE_FADE }, 4.05);
|
||||
/* A small push in lands the finished look instead of just stopping on it. */
|
||||
tl.fromTo(plate, { scale: 1 }, { scale: 1.03, duration: 1.5, ease: EASE_COMMIT }, 3.1);
|
||||
|
||||
tl.set({}, {}, DUR);
|
||||
tl.seek(0);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["grade-split-reveal"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: grade-split-reveal at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>grade-split-reveal 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="6" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="grade-split-reveal"
|
||||
data-composition-src="./grade-split-reveal.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="6" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,413 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
halftone-dissolve: HyperFrames video primitive (transitions / texture)
|
||||
|
||||
Scene A dissolves into scene B through a growing halftone dot field:
|
||||
accent ink dots pop onto a fixed grid smallest-first, each dot then
|
||||
opens into a window onto B, until the windows merge and B fully
|
||||
replaces A. Radius per dot is a pure function of (grid position, t)
|
||||
via a seeded threshold map; the direction enum orders the thresholds.
|
||||
|
||||
Scenes are SLOTS. Callers supply content by placing inert templates
|
||||
anywhere in the HOST page (templates never render, and the runtime
|
||||
wipes the host clip's own children on mount):
|
||||
|
||||
<template data-slot="halftone-dissolve-a"> ... </template>
|
||||
<template data-slot="halftone-dissolve-b"> ... </template>
|
||||
|
||||
Direct img/video children are stretched to cover the stage. When a
|
||||
slot is absent, the primitive renders a token monogram tile (A neutral,
|
||||
B accent-tinted), drawn entirely from contract tokens.
|
||||
|
||||
Variables (declared in data-composition-variables below):
|
||||
- dot_size ("small" | "medium" | "large"): grid pitch.
|
||||
- direction ("ltr" | "center" | "noise"): threshold ordering. ltr
|
||||
sweeps left to right, center grows from the middle, noise is a
|
||||
pure seeded scatter.
|
||||
- dissolve_at (seconds): when the dissolve begins. Clamped so the
|
||||
1.3s dissolve and any exit stay inside the clip.
|
||||
- accent ("green" | "blue" | "violet"): ink dot color; green rides
|
||||
--brand, blue rides --accent, violet rides --accent-2.
|
||||
- exit ("none" | "fade" | "up"): default none, B holds to the cut.
|
||||
|
||||
Envelope, fixed segments with elastic HOLD only (never timeScale):
|
||||
A holds until dissolve_at, the dissolve runs 1.3s, then B holds
|
||||
dead still; OUT = 0.45s only when exit is not none.
|
||||
|
||||
Determinism:
|
||||
The grid and its threshold map are computed exactly once at build
|
||||
from fixed LCG seed 0x4a17f03d. Every frame derives from (table,
|
||||
progress): one plain-object progress tween feeds one onUpdate
|
||||
painter that redraws the ink canvas from scratch and rebuilds B's
|
||||
clip-path string. No Math.random, no wall clock, no incremental
|
||||
state. Eventful seeks (suppressEvents false) land identical frames
|
||||
in any order. The raster and clip-path basis is the host box
|
||||
measured once at mount, same law as the canvas raster basis.
|
||||
-->
|
||||
<html
|
||||
lang="en"
|
||||
data-composition-id="halftone-dissolve"
|
||||
data-composition-duration="3.5"
|
||||
data-composition-variables='[
|
||||
{ "id": "dot_size", "type": "enum", "role": "style", "label": "Dot size", "description": "Grid pitch for the halftone field.", "default": "medium", "options": [{ "value": "small", "label": "Small" }, { "value": "medium", "label": "Medium" }, { "value": "large", "label": "Large" }] },
|
||||
{ "id": "direction", "type": "enum", "role": "timing", "label": "Direction", "description": "Threshold ordering: ltr sweeps left to right, center grows from the middle, noise scatters.", "default": "ltr", "options": [{ "value": "ltr", "label": "Left to right" }, { "value": "center", "label": "Center out" }, { "value": "noise", "label": "Noise" }] },
|
||||
{ "id": "dissolve_at", "type": "number", "role": "timing", "label": "Dissolve at", "description": "Seconds from mount start when the dissolve begins.", "default": 1.1, "min": 0.2, "max": 10, "step": 0.1, "unit": "s" },
|
||||
{ "id": "accent", "type": "enum", "role": "style", "label": "Accent", "description": "Ink dot color: green rides --brand, blue rides --accent, violet rides --accent-2.", "default": "green", "options": [{ "value": "green", "label": "Green" }, { "value": "blue", "label": "Blue" }, { "value": "violet", "label": "Violet" }] },
|
||||
{ "id": "exit", "type": "enum", "role": "timing", "label": "Exit", "description": "Optional departure. Default none: scene B holds until the frame cuts.", "default": "none", "options": [{ "value": "none", "label": "None" }, { "value": "fade", "label": "Fade" }, { "value": "up", "label": "Up" }] }
|
||||
]'
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Halftone Dissolve</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="halftone-dissolve" data-duration="3.5" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
color: var(--fg, #f8fafc);
|
||||
font-family: var(--font-display, "Inter", system-ui, sans-serif);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.htd-clip {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
background: var(--bg, transparent);
|
||||
}
|
||||
|
||||
.htd-stage {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
.htd-scene {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.htd-scene > img,
|
||||
.htd-scene > video {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.htd-scene-b {
|
||||
will-change: clip-path;
|
||||
/* B must be opaque: an open window that shows the ink canvas
|
||||
(or A) through a transparent incoming scene breaks the
|
||||
"B fully replaces A" contract for card-style slot content. */
|
||||
background: var(--bg, transparent);
|
||||
}
|
||||
|
||||
.htd-ink {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.htd-tile {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 46cqmin;
|
||||
height: 46cqmin;
|
||||
border: 0.18cqmin solid color-mix(in srgb, var(--htd-tile-tint) 46%, var(--border, #475569));
|
||||
border-radius: var(--radius, 3cqmin);
|
||||
background: color-mix(in srgb, var(--surface, #14171c) 88%, var(--htd-tile-tint));
|
||||
box-shadow: 0 3cqh 9cqh color-mix(in srgb, var(--bg, #000000) 35%, transparent);
|
||||
}
|
||||
|
||||
.htd-tile-glyph {
|
||||
color: var(--htd-tile-tint);
|
||||
font-size: 22cqmin;
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div
|
||||
id="halftone-dissolve-clip"
|
||||
class="htd-clip clip"
|
||||
data-start="0"
|
||||
data-duration="3.5"
|
||||
data-track-index="0"
|
||||
>
|
||||
<div class="htd-stage">
|
||||
<div class="htd-scene htd-scene-a">
|
||||
<div class="htd-tile" style="--htd-tile-tint: var(--muted, #94a3b8)">
|
||||
<span class="htd-tile-glyph" aria-hidden="true">A</span>
|
||||
</div>
|
||||
</div>
|
||||
<canvas class="htd-ink" aria-hidden="true"></canvas>
|
||||
<div class="htd-scene htd-scene-b">
|
||||
<div class="htd-tile" style="--htd-tile-tint: var(--htd-accent, #71f5a7)">
|
||||
<span class="htd-tile-glyph" aria-hidden="true">B</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var stage = root.querySelector(".htd-stage");
|
||||
var sceneA = root.querySelector(".htd-scene-a");
|
||||
var sceneB = root.querySelector(".htd-scene-b");
|
||||
var canvas = root.querySelector(".htd-ink");
|
||||
var vars =
|
||||
window.__hyperframes && window.__hyperframes.getVariables
|
||||
? window.__hyperframes.getVariables()
|
||||
: {};
|
||||
|
||||
function num(value, fallback, min, max) {
|
||||
var n = Number(value);
|
||||
if (!isFinite(n)) n = fallback;
|
||||
return Math.max(min, Math.min(max, n));
|
||||
}
|
||||
|
||||
var dotSize = vars.dot_size === "small" || vars.dot_size === "large"
|
||||
? vars.dot_size
|
||||
: "medium";
|
||||
var direction =
|
||||
vars.direction === "center" || vars.direction === "noise"
|
||||
? vars.direction
|
||||
: "ltr";
|
||||
var exit = vars.exit === "fade" || vars.exit === "up" ? vars.exit : "none";
|
||||
// Each enum choice routes to a DIFFERENT contract token so the
|
||||
// variable stays meaningful under a theme.
|
||||
var accentColors = {
|
||||
green: "var(--brand, #71f5a7)",
|
||||
blue: "var(--accent, #61a8ff)",
|
||||
violet: "var(--accent-2, #c5a3ff)",
|
||||
};
|
||||
var accent = Object.prototype.hasOwnProperty.call(accentColors, vars.accent)
|
||||
? vars.accent
|
||||
: "green";
|
||||
// The bundler mirrors composition variables as scoped CSS custom
|
||||
// props, so this unit's own accent variable shadows the contract
|
||||
// --accent token inside the subtree ("blue" is a valid CSS color
|
||||
// and would render pure blue). When the shadow is present, fall
|
||||
// back to the literal contract value instead of var(--accent).
|
||||
var computedAccent = getComputedStyle(root).getPropertyValue("--accent").trim();
|
||||
if (
|
||||
computedAccent === "green" ||
|
||||
computedAccent === "blue" ||
|
||||
computedAccent === "violet"
|
||||
) {
|
||||
accentColors.blue = "#61a8ff";
|
||||
}
|
||||
root.style.setProperty("--htd-accent", accentColors[accent]);
|
||||
|
||||
// SLOTS. Caller templates live at HOST DOCUMENT level (the mount
|
||||
// wipes host-clip children, and templates never render).
|
||||
var hostDoc = root.ownerDocument;
|
||||
function fillSlot(scene, slotName) {
|
||||
var slotTemplate = null;
|
||||
try {
|
||||
slotTemplate = hostDoc.querySelector(
|
||||
'template[data-slot="' + slotName + '"]',
|
||||
);
|
||||
} catch (error) {
|
||||
slotTemplate = null;
|
||||
}
|
||||
if (slotTemplate) {
|
||||
scene.querySelector(".htd-tile").remove();
|
||||
scene.appendChild(hostDoc.importNode(slotTemplate.content, true));
|
||||
}
|
||||
}
|
||||
fillSlot(sceneA, "halftone-dissolve-a");
|
||||
fillSlot(sceneB, "halftone-dissolve-b");
|
||||
|
||||
// Envelope.
|
||||
var duration = Math.max(0.001, parseFloat(root.dataset.duration || "3.5"));
|
||||
var OUT = exit === "none" ? 0 : 0.45;
|
||||
var DISSOLVE = Math.min(1.3, Math.max(0.4, duration - OUT - 0.6));
|
||||
var maxAt = Math.max(0.2, duration - DISSOLVE - OUT - 0.05);
|
||||
var dissolveAt = num(vars.dissolve_at, 1.1, 0.2, maxAt);
|
||||
var OUT_START = duration - OUT;
|
||||
|
||||
// Raster and clip-path basis, fixed once at mount.
|
||||
var dpr = Math.min(2, Math.max(1, Number(window.devicePixelRatio) || 1));
|
||||
var box = root.getBoundingClientRect();
|
||||
var cssW = Math.max(1, Math.round(box.width) || 640);
|
||||
var cssH = Math.max(1, Math.round(box.height) || 360);
|
||||
canvas.width = Math.round(cssW * dpr);
|
||||
canvas.height = Math.round(cssH * dpr);
|
||||
var ctx = canvas.getContext("2d");
|
||||
|
||||
var probe = hostDoc.createElement("span");
|
||||
probe.style.color = accentColors[accent];
|
||||
root.appendChild(probe);
|
||||
var inkColor = getComputedStyle(probe).color || "#71f5a7";
|
||||
probe.remove();
|
||||
|
||||
// The grid: fixed cells with alternate rows offset half a pitch
|
||||
// (the classic halftone stagger). Thresholds order the growth;
|
||||
// a seeded jitter keeps every front granular instead of ruled.
|
||||
var pitches = { small: 1 / 44, medium: 1 / 30, large: 1 / 20 };
|
||||
var cell = Math.max(8, cssW * pitches[dotSize]);
|
||||
var cols = Math.ceil(cssW / cell) + 2;
|
||||
var rows = Math.ceil(cssH / cell) + 1;
|
||||
var R_MAX = cell * 0.78; // overlapping full coverage
|
||||
var dots = (function () {
|
||||
var state = 0x4a17f03d;
|
||||
function next() {
|
||||
state = (Math.imul(1664525, state) + 1013904223) >>> 0;
|
||||
return state / 4294967296;
|
||||
}
|
||||
var list = [];
|
||||
var maxDist = Math.hypot(cssW / 2, cssH / 2);
|
||||
for (var r = 0; r < rows; r += 1) {
|
||||
for (var c = 0; c < cols; c += 1) {
|
||||
var x = (c + (r % 2 === 0 ? 0.25 : 0.75)) * cell;
|
||||
var y = (r + 0.5) * cell;
|
||||
var base;
|
||||
if (direction === "center") {
|
||||
base = Math.hypot(x - cssW / 2, y - cssH / 2) / maxDist;
|
||||
} else if (direction === "noise") {
|
||||
base = next();
|
||||
} else {
|
||||
base = x / cssW;
|
||||
}
|
||||
var jitter = direction === "noise" ? 0 : (next() - 0.5) * 0.22;
|
||||
var th = Math.max(0, Math.min(1, base + jitter));
|
||||
list.push({ x: x, y: y, th: th * 0.62 });
|
||||
}
|
||||
}
|
||||
return list;
|
||||
})();
|
||||
|
||||
function clamp01(v) {
|
||||
return v < 0 ? 0 : v > 1 ? 1 : v;
|
||||
}
|
||||
function smooth(v) {
|
||||
return v * v * (3 - 2 * v);
|
||||
}
|
||||
|
||||
// Per-dot growth: the window opens over 38 percent of progress
|
||||
// after its threshold; the ink dot leads it by a small offset so
|
||||
// each site pops as accent ink before B fills it.
|
||||
function windowRadius(dot, p) {
|
||||
return R_MAX * smooth(clamp01((p - dot.th) / 0.38));
|
||||
}
|
||||
function inkRadius(dot, p) {
|
||||
return R_MAX * smooth(clamp01((p + 0.07 - dot.th) / 0.38));
|
||||
}
|
||||
|
||||
// One progress object feeds one painter. The painter redraws the
|
||||
// ink canvas from scratch and rebuilds B's clip-path string, all
|
||||
// a pure function of P.p. The last applied clip string is cached
|
||||
// only to skip identical style writes, never to skip repaints of
|
||||
// changed frames.
|
||||
var P = { p: 0 };
|
||||
var lastClip = null;
|
||||
function applyClip(value) {
|
||||
if (value !== lastClip) {
|
||||
sceneB.style.clipPath = value;
|
||||
lastClip = value;
|
||||
}
|
||||
}
|
||||
function paint() {
|
||||
var p = P.p;
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
if (p >= 1) {
|
||||
applyClip("none");
|
||||
return;
|
||||
}
|
||||
if (p <= 0) {
|
||||
applyClip('path("M 0 0 Z")');
|
||||
return;
|
||||
}
|
||||
ctx.fillStyle = inkColor;
|
||||
var parts = [];
|
||||
for (var i = 0; i < dots.length; i += 1) {
|
||||
var dot = dots[i];
|
||||
var ri = inkRadius(dot, p);
|
||||
if (ri > 0.25) {
|
||||
ctx.beginPath();
|
||||
ctx.arc(dot.x * dpr, dot.y * dpr, ri * dpr, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
}
|
||||
var rw = windowRadius(dot, p);
|
||||
if (rw > 0.25) {
|
||||
var x0 = (dot.x + rw).toFixed(2);
|
||||
var xr = rw.toFixed(2);
|
||||
var yy = dot.y.toFixed(2);
|
||||
parts.push(
|
||||
"M " + x0 + " " + yy +
|
||||
" A " + xr + " " + xr + " 0 1 0 " + (dot.x - rw).toFixed(2) + " " + yy +
|
||||
" A " + xr + " " + xr + " 0 1 0 " + x0 + " " + yy + " Z",
|
||||
);
|
||||
}
|
||||
}
|
||||
applyClip(
|
||||
parts.length ? 'path("' + parts.join(" ") + '")' : 'path("M 0 0 Z")',
|
||||
);
|
||||
}
|
||||
|
||||
gsap.set(stage, { opacity: 1, y: "0cqh" });
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: paint,
|
||||
});
|
||||
|
||||
// Anchor tween: spans the full authored duration so onUpdate
|
||||
// (canvas + clip rebuild) fires for every eventful seek in [0, D]
|
||||
// and holds keep tl.time() honest.
|
||||
tl.to({ t: 0 }, { t: 1, duration: duration, ease: "none" }, 0);
|
||||
|
||||
// The dissolve: one plain-object progress tween. power1.inOut
|
||||
// keeps the front unhurried at both ends (smallest-first pops,
|
||||
// unforced merge).
|
||||
tl.fromTo(
|
||||
P,
|
||||
{ p: 0 },
|
||||
{ p: 1, duration: DISSOLVE, ease: "power1.inOut" },
|
||||
dissolveAt,
|
||||
);
|
||||
|
||||
// HOLD: dead still on B (clip released, ink canvas clear).
|
||||
|
||||
// OUT: optional departure; exit none holds until the frame cuts.
|
||||
if (exit === "up") {
|
||||
tl.to(stage, { y: "-4cqh", duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
tl.to(stage, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
} else if (exit === "fade") {
|
||||
tl.to(stage, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
}
|
||||
|
||||
tl.seek(0);
|
||||
paint();
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["halftone-dissolve"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: halftone-dissolve at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>halftone-dissolve 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="3.5" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="halftone-dissolve"
|
||||
data-composition-src="./halftone-dissolve.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="3.5" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 5.7 KiB |
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: kinetic-type-swap at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>kinetic-type-swap 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="4" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="kinetic-type-swap"
|
||||
data-composition-src="./kinetic-type-swap.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="4" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,380 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
kinetic-type-swap: HyperFrames video primitive (text effects / swap)
|
||||
|
||||
A held sentence keeps its prefix and suffix fixed while one masked word
|
||||
slot rolls through comma-separated options. Every option remains in the
|
||||
same CSS grid cell, so the slot takes the widest option's intrinsic width
|
||||
before motion starts and the sentence never reflows during a swap.
|
||||
|
||||
Variables:
|
||||
- prefix (string, default "Ship"): fixed text before the rolling slot.
|
||||
- options (string, default "faster,smarter,together"): comma-separated
|
||||
words shown in order.
|
||||
- suffix (string, default ""): fixed text after the rolling slot.
|
||||
- cues (string, default ""): comma-separated seconds (from mount start)
|
||||
for each word swap. Empty keeps the authored even spread.
|
||||
- accent (green | blue | violet, default "green"): rolling word color.
|
||||
- exit (none | fade | up, default "none"): optional departure.
|
||||
|
||||
Envelope, fixed IN and OUT with elastic HOLD only:
|
||||
IN_BASE = 2.25s, fade in followed by every vertical word swap (cues can
|
||||
stretch the swap phase past IN_BASE when they land later)
|
||||
HOLD = max(0, D - IN - OUT), final word stays locked with a soft pulse
|
||||
OUT_BASE = 0.45s departure when exit is fade or up, 0s when exit is
|
||||
none (the default: the sentence holds until the cut)
|
||||
If D is shorter than IN_BASE + OUT_BASE, IN and OUT compress together.
|
||||
The timeline is never time-scaled.
|
||||
|
||||
Determinism: options are parsed once before timeline construction. GSAP
|
||||
owns every visible change, uses finite repeats, and registers one paused
|
||||
timeline under the literal kinetic-type-swap key.
|
||||
|
||||
Mount contract: the runtime clones only this template. #root fills the host
|
||||
box, establishes the container query basis, and has no data-width or
|
||||
data-height. Only word transforms change position. The held sentence never
|
||||
moves, and the grid-owned slot width never changes.
|
||||
-->
|
||||
<html
|
||||
lang="en"
|
||||
data-composition-id="kinetic-type-swap"
|
||||
data-composition-duration="4"
|
||||
data-composition-variables='[
|
||||
{ "id": "prefix", "type": "string", "role": "content", "label": "Prefix", "description": "Fixed sentence text before the rolling word slot.", "default": "Ship" },
|
||||
{ "id": "options", "type": "string", "role": "content", "label": "Options", "description": "Comma-separated words shown in the rolling slot.", "default": "faster,smarter,together" },
|
||||
{ "id": "suffix", "type": "string", "role": "content", "label": "Suffix", "description": "Fixed sentence text after the rolling word slot.", "default": "" },
|
||||
{ "id": "cues", "type": "string", "role": "timing", "label": "Cues", "description": "Comma-separated seconds (from mount start) for each word swap. Empty keeps the authored even spread.", "default": "" },
|
||||
{ "id": "accent", "type": "enum", "role": "style", "label": "Accent", "description": "Color used by the rolling word slot.", "default": "green", "options": [{ "value": "green", "label": "Green" }, { "value": "blue", "label": "Blue" }, { "value": "violet", "label": "Violet" }] },
|
||||
{ "id": "exit", "type": "enum", "role": "timing", "label": "Exit", "description": "Optional departure. Default none: the sentence holds until the frame cuts.", "default": "none", "options": [{ "value": "none", "label": "None" }, { "value": "fade", "label": "Fade" }, { "value": "up", "label": "Up" }] }
|
||||
]'
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Kinetic Type Swap</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="kinetic-type-swap" data-duration="4" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
color: var(--fg, #f8fafc);
|
||||
font-family: var(--font-display, Inter, system-ui, sans-serif);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.kts-clip {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
overflow: hidden;
|
||||
background: var(--bg, transparent);
|
||||
}
|
||||
|
||||
.kts-stage {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 94cqw;
|
||||
height: 70cqh;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.kts-sentence {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: center;
|
||||
/* Word gap must scale with the display type, never a host layout
|
||||
spacing token: --space-* is chrome-scale and jams the sentence
|
||||
("Makemomentumvisible") when the type is auto-fitted large. */
|
||||
gap: 0.26em;
|
||||
max-width: 94cqw;
|
||||
color: var(--fg, #f8fafc);
|
||||
font-size: var(--kts-font-size);
|
||||
font-weight: 760;
|
||||
line-height: 1.08;
|
||||
letter-spacing: -0.045em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.kts-prefix,
|
||||
.kts-suffix {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.kts-prefix:empty,
|
||||
.kts-suffix:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Every word occupies one grid cell and contributes its intrinsic
|
||||
width. Transforms do not affect layout, so this masked slot stays
|
||||
as wide as the widest option for the entire composition. */
|
||||
.kts-slot {
|
||||
display: inline-grid;
|
||||
flex: 0 0 auto;
|
||||
overflow: hidden;
|
||||
color: var(--kts-accent);
|
||||
text-shadow: 0 0 2.8cqh color-mix(in srgb, var(--kts-accent) 28%, transparent);
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
.kts-word {
|
||||
grid-area: 1 / 1;
|
||||
width: max-content;
|
||||
justify-self: center;
|
||||
color: var(--kts-accent);
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div
|
||||
id="kinetic-type-swap-clip"
|
||||
class="kts-clip clip"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
>
|
||||
<div class="kts-stage" role="img">
|
||||
<div class="kts-sentence">
|
||||
<span class="kts-prefix"></span>
|
||||
<span class="kts-slot" aria-hidden="true"></span>
|
||||
<span class="kts-suffix"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var stage = root.querySelector(".kts-stage");
|
||||
var prefixElement = root.querySelector(".kts-prefix");
|
||||
var slotElement = root.querySelector(".kts-slot");
|
||||
var suffixElement = root.querySelector(".kts-suffix");
|
||||
var vars =
|
||||
window.__hyperframes && window.__hyperframes.getVariables
|
||||
? window.__hyperframes.getVariables()
|
||||
: {};
|
||||
|
||||
var defaultOptions = ["faster", "smarter", "together"];
|
||||
var prefix = vars.prefix == null ? "Ship" : String(vars.prefix).trim();
|
||||
var suffix = vars.suffix == null ? "" : String(vars.suffix).trim();
|
||||
var rawOptions = vars.options == null ? defaultOptions.join(",") : String(vars.options);
|
||||
var options = rawOptions
|
||||
.split(",")
|
||||
.map(function (option) {
|
||||
return option.trim();
|
||||
})
|
||||
.filter(function (option) {
|
||||
return option.length > 0;
|
||||
});
|
||||
if (options.length === 0) options = defaultOptions.slice();
|
||||
|
||||
var accentColors = {
|
||||
green: "var(--brand, #71f5a7)",
|
||||
blue: "var(--accent, #61a8ff)",
|
||||
violet: "var(--accent-2, #c5a3ff)",
|
||||
};
|
||||
var accent = Object.prototype.hasOwnProperty.call(accentColors, vars.accent)
|
||||
? vars.accent
|
||||
: "green";
|
||||
var exit = vars.exit === "fade" || vars.exit === "up" ? vars.exit : "none";
|
||||
var cuesValue = vars.cues == null ? "" : String(vars.cues);
|
||||
var cues = cuesValue
|
||||
.split(",")
|
||||
.reduce(function (result, token) {
|
||||
var trimmed = token.trim();
|
||||
if (trimmed === "") return result;
|
||||
var seconds = Number(trimmed);
|
||||
if (!Number.isFinite(seconds) || seconds < 0) return result;
|
||||
result.push(seconds);
|
||||
return result;
|
||||
}, [])
|
||||
.sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
|
||||
root.style.setProperty("--kts-accent", accentColors[accent]);
|
||||
prefixElement.textContent = prefix;
|
||||
suffixElement.textContent = suffix;
|
||||
|
||||
var words = options.map(function (option, index) {
|
||||
var word = document.createElement("span");
|
||||
word.className = "kts-word";
|
||||
word.id = "kinetic-type-swap-word-" + index;
|
||||
word.textContent = option;
|
||||
slotElement.appendChild(word);
|
||||
return word;
|
||||
});
|
||||
|
||||
var finalSentence = [prefix, options[options.length - 1], suffix]
|
||||
.filter(function (part) {
|
||||
return part.length > 0;
|
||||
})
|
||||
.join(" ");
|
||||
stage.setAttribute("aria-label", finalSentence);
|
||||
|
||||
var widestOptionLength = options.reduce(function (widest, option) {
|
||||
return Math.max(widest, Array.from(option).length);
|
||||
}, 1);
|
||||
var sentenceLength =
|
||||
Array.from(prefix).length + widestOptionLength + Array.from(suffix).length + 2;
|
||||
var fittedCqw = Math.min(12, 122 / Math.max(1, sentenceLength));
|
||||
root.style.setProperty(
|
||||
"--kts-font-size",
|
||||
"min(" + fittedCqw.toFixed(3) + "cqw, 22cqh)",
|
||||
);
|
||||
|
||||
var IN_BASE = 2.25;
|
||||
var OUT_BASE = exit === "none" ? 0 : 0.45;
|
||||
var ARRIVAL_BASE = 0.3;
|
||||
var SWAP_START_BASE = 0.48;
|
||||
var ROLL_BASE = 0.46;
|
||||
var SETTLE_TAIL_BASE = 0.18;
|
||||
var duration = Math.max(0.001, parseFloat(root.dataset.duration || "4"));
|
||||
var totalBase = Math.max(0.001, IN_BASE + OUT_BASE);
|
||||
var scale = duration < totalBase ? duration / totalBase : 1;
|
||||
var IN = IN_BASE * scale;
|
||||
var OUT = OUT_BASE * scale;
|
||||
var ARRIVAL = ARRIVAL_BASE * scale;
|
||||
var SWAP_START = SWAP_START_BASE * scale;
|
||||
var ROLL = ROLL_BASE * scale;
|
||||
var SETTLE_TAIL = SETTLE_TAIL_BASE * scale;
|
||||
|
||||
// Swap schedule: cues own the swap moments when provided; the
|
||||
// authored even spread otherwise. Swaps beyond the cue list
|
||||
// extrapolate at the cue list's own gap, and every swap clamps
|
||||
// so its roll and settle finish before any exit.
|
||||
var swapCount = words.length - 1;
|
||||
var swapTimes = [];
|
||||
var rollDuration = ROLL;
|
||||
if (swapCount > 0) {
|
||||
if (cues.length > 0) {
|
||||
var lastCue = cues[cues.length - 1];
|
||||
var cueGap =
|
||||
cues.length >= 2
|
||||
? Math.max(0.05, (lastCue - cues[0]) / (cues.length - 1))
|
||||
: ROLL;
|
||||
var latestSwap = Math.max(0, duration - OUT - ROLL - SETTLE_TAIL);
|
||||
for (var cueIndex = 0; cueIndex < swapCount; cueIndex += 1) {
|
||||
var cueAt =
|
||||
cueIndex < cues.length
|
||||
? cues[cueIndex]
|
||||
: lastCue + (cueIndex - (cues.length - 1)) * cueGap;
|
||||
swapTimes.push(Math.min(latestSwap, Math.max(0, cueAt)));
|
||||
}
|
||||
var minGap = Infinity;
|
||||
for (var gapIndex = 1; gapIndex < swapTimes.length; gapIndex += 1) {
|
||||
minGap = Math.min(minGap, swapTimes[gapIndex] - swapTimes[gapIndex - 1]);
|
||||
}
|
||||
if (Number.isFinite(minGap)) {
|
||||
rollDuration = Math.min(ROLL, Math.max(0.04, minGap * 0.72));
|
||||
}
|
||||
} else {
|
||||
var lastSwapStart = Math.max(SWAP_START, IN - SETTLE_TAIL - ROLL);
|
||||
var swapStep =
|
||||
swapCount === 1 ? 0 : (lastSwapStart - SWAP_START) / (swapCount - 1);
|
||||
rollDuration =
|
||||
swapCount <= 2 ? ROLL : Math.min(ROLL, Math.max(0.04, swapStep * 0.72));
|
||||
for (var index = 1; index <= swapCount; index += 1) {
|
||||
swapTimes.push(
|
||||
swapCount === 1 ? lastSwapStart : SWAP_START + (index - 1) * swapStep,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
var swapsEnd =
|
||||
swapTimes.length > 0
|
||||
? swapTimes[swapTimes.length - 1] + rollDuration + SETTLE_TAIL
|
||||
: IN;
|
||||
var HOLD_START = Math.min(Math.max(0, duration - OUT), Math.max(IN, swapsEnd));
|
||||
var HOLD = Math.max(0, duration - (HOLD_START + OUT));
|
||||
var OUT_START = HOLD_START + HOLD;
|
||||
|
||||
gsap.set(stage, { opacity: 0 });
|
||||
gsap.set(words, { yPercent: 112, opacity: 0 });
|
||||
gsap.set(words[0], { yPercent: 0, opacity: 1 });
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
tl.to(stage, { opacity: 1, duration: ARRIVAL, ease: "power2.out" }, 0);
|
||||
|
||||
// Masked exchange: the outgoing word whips fully past the slot
|
||||
// mask (power4.in) before the incoming word crosses center. The
|
||||
// two phases overlap only for ~10% of the roll, while both words
|
||||
// are opposite-edge slivers, so every frame shows at most one
|
||||
// legible word at full ink and never a double exposure.
|
||||
swapTimes.forEach(function (swapAt, swapIndex) {
|
||||
var wordIndex = swapIndex + 1;
|
||||
var incomingEase = wordIndex === words.length - 1 ? "back.out(1.7)" : "power4.out";
|
||||
var outDuration = rollDuration * 0.55;
|
||||
var inDuration = rollDuration * 0.55;
|
||||
var inStart = swapAt + rollDuration - inDuration;
|
||||
|
||||
tl.to(
|
||||
words[wordIndex - 1],
|
||||
{ yPercent: -112, duration: outDuration, ease: "power4.in" },
|
||||
swapAt,
|
||||
);
|
||||
tl.set(words[wordIndex - 1], { opacity: 0 }, swapAt + outDuration);
|
||||
tl.set(words[wordIndex], { opacity: 1 }, inStart);
|
||||
tl.to(
|
||||
words[wordIndex],
|
||||
{ yPercent: 0, duration: inDuration, ease: incomingEase },
|
||||
inStart,
|
||||
);
|
||||
});
|
||||
|
||||
var finalWord = words[words.length - 1];
|
||||
var beat = parseFloat(getComputedStyle(root).getPropertyValue("--dur-beat")) || 0.5;
|
||||
var pulseHalf = Math.min(beat, HOLD / 2);
|
||||
if (pulseHalf > 0) {
|
||||
var maxRepeat = Math.floor(HOLD / pulseHalf) - 1;
|
||||
var pulseRepeat = maxRepeat % 2 === 1 ? maxRepeat : maxRepeat - 1;
|
||||
if (pulseRepeat >= 1) {
|
||||
tl.to(
|
||||
finalWord,
|
||||
{
|
||||
opacity: 0.9,
|
||||
duration: pulseHalf,
|
||||
ease: "sine.inOut",
|
||||
yoyo: true,
|
||||
repeat: pulseRepeat,
|
||||
},
|
||||
HOLD_START,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// OUT: optional departure; exit none holds until the frame cuts.
|
||||
if (exit === "fade") {
|
||||
tl.to(stage, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
} else if (exit === "up") {
|
||||
tl.to(
|
||||
stage,
|
||||
{ opacity: 0, y: "-3cqh", duration: OUT, ease: "power2.in" },
|
||||
OUT_START,
|
||||
);
|
||||
}
|
||||
|
||||
tl.seek(0);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["kinetic-type-swap"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 5.7 KiB |
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: marker-highlight at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>marker-highlight 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="3.5" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="marker-highlight"
|
||||
data-composition-src="./marker-highlight.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="3.5" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,369 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
marker-highlight: HyperFrames video primitive (typography / emphasis)
|
||||
|
||||
The corpus emphasis unit: a short line of display text settles in, then ONE
|
||||
hand-drawn marker stroke draws over the emphasized word on cue. Four marker
|
||||
styles share the same mechanic: an SVG path revealed by a getTotalLength
|
||||
dash tween (never the pathLength attribute, never non-scaling-stroke on a
|
||||
dashed path; the anisotropic viewBox stretch is what gives the ink its
|
||||
hand-swiped weight).
|
||||
|
||||
Variables:
|
||||
text (string): the full line.
|
||||
emphasis_word (string): first case-insensitive substring match inside
|
||||
text gets the marker. Empty or unmatched renders the line with no
|
||||
marker. Keep it a word or short phrase; it stays on one line.
|
||||
style (highlight | circle | underline | scribble): marker shape.
|
||||
draw_at (seconds): cue for the draw, relative to mount start. Clamped so
|
||||
the stroke always completes before any exit begins.
|
||||
accent (green | blue | violet): ink color via the contract token map.
|
||||
exit (none | fade | up, default none): frame roots own transitions;
|
||||
holds end films.
|
||||
|
||||
Envelope, fixed IN and OUT with elastic HOLD only (never time-scaled):
|
||||
IN_BASE = 0.55s text rises into place
|
||||
DRAW_BASE = 0.60s marker stroke, anchored at draw_at, plus a small
|
||||
settle pop on the emphasized word
|
||||
HOLD = max(0, D - phases), completely still
|
||||
OUT_BASE = 0s for exit none, otherwise 0.45s
|
||||
If D is shorter than the fixed phases, they compress together.
|
||||
|
||||
Mount contract: the runtime clones only this template. #root fills the host
|
||||
box, establishes the container query basis, has no data-width or
|
||||
data-height, and registers one paused timeline under the literal
|
||||
marker-highlight key.
|
||||
-->
|
||||
<html
|
||||
lang="en"
|
||||
data-composition-id="marker-highlight"
|
||||
data-composition-duration="3.5"
|
||||
data-composition-variables='[
|
||||
{ "id": "text", "type": "string", "role": "content", "label": "Text", "description": "Full line of display text.", "default": "Ship it with confidence" },
|
||||
{ "id": "emphasis_word", "type": "string", "role": "content", "label": "Emphasis word", "description": "First case-insensitive substring match in text receives the marker. Empty or unmatched draws no marker.", "default": "confidence" },
|
||||
{ "id": "style", "type": "enum", "role": "style", "label": "Marker style", "description": "Shape of the hand-drawn marker stroke.", "default": "highlight", "options": [{ "value": "highlight", "label": "Highlight" }, { "value": "circle", "label": "Circle" }, { "value": "underline", "label": "Underline" }, { "value": "scribble", "label": "Scribble" }] },
|
||||
{ "id": "draw_at", "type": "number", "role": "timing", "label": "Draw at", "description": "Second (from mount start) the marker starts drawing. Clamped so the stroke completes before any exit.", "default": 0.9, "min": 0, "step": 0.1, "unit": "s" },
|
||||
{ "id": "accent", "type": "enum", "role": "style", "label": "Accent", "description": "Marker ink color from the contract token map.", "default": "green", "options": [{ "value": "green", "label": "Green" }, { "value": "blue", "label": "Blue" }, { "value": "violet", "label": "Violet" }] },
|
||||
{ "id": "exit", "type": "enum", "role": "timing", "label": "Exit", "description": "Optional departure. Default none: the lockup holds until the frame cuts.", "default": "none", "options": [{ "value": "none", "label": "None" }, { "value": "fade", "label": "Fade" }, { "value": "up", "label": "Up" }] }
|
||||
]'
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Marker Highlight</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="marker-highlight" data-duration="3.5" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
background: var(--bg, #0b0c0e);
|
||||
color: var(--fg, #f8fafc);
|
||||
font-family: var(--font-display, Inter, system-ui, sans-serif);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.mh-clip {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.mh-stage {
|
||||
max-width: 86cqw;
|
||||
text-align: center;
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
.mh-text {
|
||||
margin: 0;
|
||||
font-size: var(--mh-font-size, min(8cqw, 15cqh));
|
||||
font-weight: 600;
|
||||
line-height: 1.14;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
|
||||
.mh-em {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.mh-em-text {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.mh-mark {
|
||||
position: absolute;
|
||||
z-index: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/* Per-style marker box around the emphasized word. Explicit
|
||||
width/height (svg is a replaced element: inset-stretching would
|
||||
fall back to its intrinsic viewBox ratio); then
|
||||
preserveAspectRatio="none" stretches the authored path (and its
|
||||
stroke) into the box, which is exactly the marker-nib distortion
|
||||
we want on a dashed path. */
|
||||
.mh-em[data-marker-style="highlight"] .mh-mark {
|
||||
left: -3%;
|
||||
top: 14%;
|
||||
width: 106%;
|
||||
height: 76%;
|
||||
}
|
||||
|
||||
.mh-em[data-marker-style="underline"] .mh-mark {
|
||||
left: -2%;
|
||||
bottom: -14%;
|
||||
width: 105%;
|
||||
height: 22%;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.mh-em[data-marker-style="circle"] .mh-mark {
|
||||
left: -13%;
|
||||
top: -26%;
|
||||
width: 126%;
|
||||
height: 152%;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.mh-em[data-marker-style="scribble"] .mh-mark {
|
||||
left: -2%;
|
||||
top: 12%;
|
||||
width: 104%;
|
||||
height: 76%;
|
||||
z-index: 2;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div
|
||||
id="marker-highlight-clip"
|
||||
class="mh-clip clip"
|
||||
data-start="0"
|
||||
data-duration="3.5"
|
||||
data-track-index="0"
|
||||
>
|
||||
<div class="mh-stage">
|
||||
<p class="mh-text"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var root = document.getElementById("root");
|
||||
// Literal key: the flattening step strips data-composition-id off
|
||||
// the mounted root, so reading it back would register "null".
|
||||
var compositionId = "marker-highlight";
|
||||
var stage = root.querySelector(".mh-stage");
|
||||
var textEl = root.querySelector(".mh-text");
|
||||
var vars =
|
||||
window.__hyperframes && window.__hyperframes.getVariables
|
||||
? window.__hyperframes.getVariables()
|
||||
: {};
|
||||
|
||||
var text =
|
||||
vars.text == null
|
||||
? "Ship it with confidence"
|
||||
: String(vars.text).trim().replace(/\s+/g, " ");
|
||||
var emphasis =
|
||||
vars.emphasis_word == null
|
||||
? "confidence"
|
||||
: String(vars.emphasis_word).trim().replace(/\s+/g, " ");
|
||||
var accentColors = {
|
||||
green: "var(--brand, #71f5a7)",
|
||||
blue: "var(--accent, #61a8ff)",
|
||||
violet: "var(--accent-2, #c5a3ff)",
|
||||
};
|
||||
var accent = Object.prototype.hasOwnProperty.call(accentColors, vars.accent)
|
||||
? vars.accent
|
||||
: "green";
|
||||
var exit = vars.exit === "fade" || vars.exit === "up" ? vars.exit : "none";
|
||||
|
||||
// Hand-drawn stroke library. Paths are authored in a fixed viewBox
|
||||
// and stretched into the word box; wobble is baked into the
|
||||
// control points, never randomized.
|
||||
var markerStyles = {
|
||||
highlight: {
|
||||
viewBox: "0 0 100 40",
|
||||
d: "M 3 24 C 22 20.5, 47 25.5, 68 22.5 C 79 21, 90 23, 97 21.5",
|
||||
strokeWidth: 26,
|
||||
opacity: 0.5,
|
||||
},
|
||||
circle: {
|
||||
viewBox: "0 0 100 40",
|
||||
d: "M 22 7 C 58 1, 95 8, 97 20 C 99 31, 74 38, 44 37 C 16 36, 2 29, 3 19 C 4 10, 22 4, 52 4.5",
|
||||
strokeWidth: 2.8,
|
||||
opacity: 1,
|
||||
},
|
||||
underline: {
|
||||
viewBox: "0 0 100 12",
|
||||
d: "M 2 7 C 20 4.5, 46 8.5, 66 6 C 80 4.5, 92 7.5, 98 5.5",
|
||||
strokeWidth: 4.5,
|
||||
opacity: 1,
|
||||
},
|
||||
scribble: {
|
||||
viewBox: "0 0 100 40",
|
||||
d: "M 6 13 C 34 9.5, 66 11, 94 9 C 60 15, 26 16, 7 20 C 36 18, 68 21, 93 18 C 62 25, 28 27, 8 29",
|
||||
strokeWidth: 5,
|
||||
opacity: 0.65,
|
||||
},
|
||||
};
|
||||
var styleName = Object.prototype.hasOwnProperty.call(markerStyles, vars.style)
|
||||
? vars.style
|
||||
: "highlight";
|
||||
var marker = markerStyles[styleName];
|
||||
|
||||
// Split text around the first case-insensitive emphasis match.
|
||||
// textContent nodes only, never innerHTML.
|
||||
var matchIndex =
|
||||
emphasis.length > 0 ? text.toLowerCase().indexOf(emphasis.toLowerCase()) : -1;
|
||||
var emEl = null;
|
||||
var pathEl = null;
|
||||
if (matchIndex >= 0) {
|
||||
var before = text.slice(0, matchIndex);
|
||||
var matched = text.slice(matchIndex, matchIndex + emphasis.length);
|
||||
var after = text.slice(matchIndex + emphasis.length);
|
||||
if (before) textEl.appendChild(document.createTextNode(before));
|
||||
|
||||
emEl = document.createElement("span");
|
||||
emEl.className = "mh-em";
|
||||
emEl.setAttribute("data-marker-style", styleName);
|
||||
|
||||
var svgNS = "http://www.w3.org/2000/svg";
|
||||
var svg = document.createElementNS(svgNS, "svg");
|
||||
svg.setAttribute("class", "mh-mark");
|
||||
svg.setAttribute("viewBox", marker.viewBox);
|
||||
svg.setAttribute("preserveAspectRatio", "none");
|
||||
svg.setAttribute("aria-hidden", "true");
|
||||
pathEl = document.createElementNS(svgNS, "path");
|
||||
pathEl.setAttribute("d", marker.d);
|
||||
pathEl.setAttribute("fill", "none");
|
||||
pathEl.setAttribute("stroke-width", String(marker.strokeWidth));
|
||||
pathEl.setAttribute("stroke-linecap", "round");
|
||||
pathEl.setAttribute("stroke-linejoin", "round");
|
||||
// style.stroke, not the presentation attribute: var() only
|
||||
// resolves as a CSS value.
|
||||
pathEl.style.stroke = accentColors[accent];
|
||||
svg.appendChild(pathEl);
|
||||
|
||||
var emText = document.createElement("span");
|
||||
emText.className = "mh-em-text";
|
||||
emText.textContent = matched;
|
||||
|
||||
emEl.appendChild(svg);
|
||||
emEl.appendChild(emText);
|
||||
textEl.appendChild(emEl);
|
||||
if (after) textEl.appendChild(document.createTextNode(after));
|
||||
} else {
|
||||
textEl.textContent = text;
|
||||
}
|
||||
textEl.setAttribute("aria-label", text);
|
||||
|
||||
// Deterministic character-count fit; the line may wrap, the
|
||||
// emphasized phrase never wraps internally.
|
||||
var characters = Math.max(1, Array.from(text).length);
|
||||
var fitted = Math.max(4.2, Math.min(9.5, 185 / characters));
|
||||
root.style.setProperty("--mh-font-size", "min(" + fitted.toFixed(3) + "cqw, 16cqh)");
|
||||
|
||||
// RETIME RANGE: fixed phases; HOLD is the only elastic span.
|
||||
var IN_BASE = 0.55;
|
||||
var DRAW_BASE = 0.6;
|
||||
var POP_BASE = 0.32;
|
||||
var OUT_BASE = exit === "none" ? 0 : 0.45;
|
||||
var duration = Math.max(0.001, parseFloat(root.dataset.duration || "3.5"));
|
||||
var totalBase = IN_BASE + DRAW_BASE + OUT_BASE;
|
||||
var scale = duration < totalBase ? duration / totalBase : 1;
|
||||
var IN = IN_BASE * scale;
|
||||
var DRAW = DRAW_BASE * scale;
|
||||
var POP = POP_BASE * scale;
|
||||
var OUT = OUT_BASE * scale;
|
||||
var OUT_START = duration - OUT;
|
||||
|
||||
var drawAtRaw = Number(vars.draw_at);
|
||||
var drawAt = Number.isFinite(drawAtRaw) ? Math.max(0, drawAtRaw) : 0.9;
|
||||
// The stroke and its settle pop always land before the exit.
|
||||
drawAt = Math.min(drawAt, Math.max(0, OUT_START - (DRAW + POP)));
|
||||
|
||||
gsap.set(stage, { opacity: 0, y: "6cqh" });
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
// IN: the line rises into place.
|
||||
tl.fromTo(
|
||||
stage,
|
||||
{ opacity: 0, y: "6cqh" },
|
||||
{ opacity: 1, y: "0cqh", duration: IN, ease: "power3.out" },
|
||||
0,
|
||||
);
|
||||
|
||||
// DRAW: dash reveal from measured length; both endpoints explicit
|
||||
// so any seek is correct without playing through.
|
||||
if (pathEl) {
|
||||
var length = pathEl.getTotalLength();
|
||||
pathEl.style.strokeDasharray = String(length);
|
||||
// Hidden until the cue: at dashoffset == length the round cap
|
||||
// still paints a dot at the path start, so the ink is opacity 0
|
||||
// until the exact frame the draw begins.
|
||||
gsap.set(pathEl, { strokeDashoffset: length, opacity: 0 });
|
||||
tl.set(pathEl, { opacity: marker.opacity }, drawAt);
|
||||
tl.fromTo(
|
||||
pathEl,
|
||||
{ strokeDashoffset: length },
|
||||
{ strokeDashoffset: 0, duration: DRAW, ease: "power2.inOut" },
|
||||
drawAt,
|
||||
);
|
||||
// Settle pop on the emphasized word as the ink lands.
|
||||
tl.fromTo(
|
||||
emEl,
|
||||
{ scale: 1 },
|
||||
{
|
||||
scale: 1.045,
|
||||
duration: POP / 2,
|
||||
ease: "power1.out",
|
||||
yoyo: true,
|
||||
repeat: 1,
|
||||
},
|
||||
drawAt + DRAW * 0.7,
|
||||
);
|
||||
}
|
||||
|
||||
// HOLD: completely still.
|
||||
|
||||
// OUT: optional departure; exit none holds until the frame cuts.
|
||||
if (exit === "fade") {
|
||||
tl.to(stage, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
} else if (exit === "up") {
|
||||
tl.to(
|
||||
stage,
|
||||
{ opacity: 0, y: "-7cqh", duration: OUT, ease: "power2.in" },
|
||||
OUT_START,
|
||||
);
|
||||
}
|
||||
|
||||
tl.seek(0);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines[compositionId] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 6.5 KiB |
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: match-cut at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>match-cut 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="4" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="match-cut"
|
||||
data-composition-src="./match-cut.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="4" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,309 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
match-cut: HyperFrames video primitive (transitions / match-cut / connect)
|
||||
|
||||
Concept: scene A drives a circle into a known center-frame geometry, then a
|
||||
hard single-frame swap reveals scene B with a different circle in the exact
|
||||
same geometry. Scene B begins shrinking immediately, so the cut lands while
|
||||
the matched shape is moving rather than on a settled pose.
|
||||
|
||||
Variables:
|
||||
- accent (green | blue | violet, default green): matched-circle color.
|
||||
- label_a (string, default "Start"): scene A button label.
|
||||
- label_b (string, default "Done"): scene B result label.
|
||||
|
||||
Envelope (fixed IN/OUT, elastic HOLD only, never timeScale):
|
||||
IN_BASE = 2.35s scene A enters and accelerates into the hard cut, then
|
||||
scene B decelerates into place while its content reveals
|
||||
HOLD = elastic = max(0, D - (IN_BASE + OUT_BASE)); the matched circle
|
||||
drifts subtly so a longer mount stays alive
|
||||
OUT_BASE = 0.50s the completed scene fades cleanly
|
||||
If D is shorter than IN_BASE + OUT_BASE, IN and OUT compress together and
|
||||
HOLD becomes zero.
|
||||
|
||||
Sync point: hard-cut occurs at CUT_AT = 1.40s in the default four-second
|
||||
duration, exactly frame 42 at 30 fps. Scene A opacity becomes 0 and scene B
|
||||
opacity becomes 1 at the same timeline instant. There is no crossfade.
|
||||
|
||||
Mount contract: this is a template-wrapped sub-composition. The root has no
|
||||
data-width or data-height, fills its host box, uses container query units,
|
||||
and registers one paused timeline under the literal match-cut key.
|
||||
-->
|
||||
<html
|
||||
lang="en"
|
||||
data-composition-id="match-cut"
|
||||
data-composition-duration="4"
|
||||
data-composition-variables='[
|
||||
{ "id": "accent", "type": "enum", "role": "style", "label": "Accent", "description": "Color shared by the matched circles.", "default": "green", "options": [{ "value": "green", "label": "Green" }, { "value": "blue", "label": "Blue" }, { "value": "violet", "label": "Violet" }] },
|
||||
{ "id": "label_a", "type": "string", "role": "content", "label": "Scene A label", "description": "Text inside the outgoing button.", "default": "Start" },
|
||||
{ "id": "label_b", "type": "string", "role": "content", "label": "Scene B label", "description": "Result text revealed after the cut.", "default": "Done" }
|
||||
]'
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Match Cut</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="match-cut" data-duration="4" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
color: #f8fafc;
|
||||
font-family: Inter, system-ui, sans-serif;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.mc-clip,
|
||||
.mc-shell,
|
||||
.mc-scene {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.mc-scene {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.mc-scene-a {
|
||||
background: radial-gradient(circle at 50% 50%, #182032 0%, #0b0f18 68%);
|
||||
}
|
||||
|
||||
.mc-scene-b {
|
||||
background: radial-gradient(circle at 50% 44%, #202b42 0%, #0d121d 72%);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* Both actors share this one geometry owner. At the cut, each is
|
||||
centered at scale 1, so their painted circles match exactly. */
|
||||
.mc-circle {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 32cqmin;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
background: var(--mc-accent, #4ade80);
|
||||
box-shadow: 0 3.2cqh 8cqh color-mix(in srgb, var(--mc-accent, #4ade80) 30%, transparent);
|
||||
transform-origin: 50% 50%;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.mc-label-a {
|
||||
display: block;
|
||||
max-width: 78%;
|
||||
overflow: hidden;
|
||||
color: #081018;
|
||||
font-size: 5.2cqmin;
|
||||
font-weight: 780;
|
||||
letter-spacing: -0.035em;
|
||||
line-height: 1;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mc-circle-b {
|
||||
color: #081018;
|
||||
}
|
||||
|
||||
.mc-check {
|
||||
width: 34%;
|
||||
height: 22%;
|
||||
border-left: 2.4cqmin solid currentColor;
|
||||
border-bottom: 2.4cqmin solid currentColor;
|
||||
transform: translateY(-8%) rotate(-45deg);
|
||||
}
|
||||
|
||||
.mc-copy-b {
|
||||
position: absolute;
|
||||
top: 69%;
|
||||
left: 12cqw;
|
||||
right: 12cqw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 1.6cqh;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mc-kicker,
|
||||
.mc-label-b {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.mc-kicker {
|
||||
color: color-mix(in srgb, var(--mc-accent, #4ade80) 76%, #f8fafc);
|
||||
font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
|
||||
font-size: 2.1cqmin;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.18em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.mc-label-b {
|
||||
display: block;
|
||||
max-width: 74cqw;
|
||||
overflow: hidden;
|
||||
color: #f8fafc;
|
||||
font-size: 6.8cqmin;
|
||||
font-weight: 760;
|
||||
letter-spacing: -0.04em;
|
||||
line-height: 1.05;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div
|
||||
id="match-cut-clip"
|
||||
class="mc-clip clip"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
>
|
||||
<div class="mc-shell">
|
||||
<section class="mc-scene mc-scene-a" aria-label="Outgoing scene">
|
||||
<div class="mc-circle mc-circle-a">
|
||||
<span class="mc-label-a"></span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="mc-scene mc-scene-b" aria-label="Incoming scene">
|
||||
<div class="mc-circle mc-circle-b" aria-hidden="true">
|
||||
<span class="mc-check"></span>
|
||||
</div>
|
||||
<div class="mc-copy-b">
|
||||
<span class="mc-kicker">Match complete</span>
|
||||
<span class="mc-label-b"></span>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var shell = root.querySelector(".mc-shell");
|
||||
var sceneA = root.querySelector(".mc-scene-a");
|
||||
var sceneB = root.querySelector(".mc-scene-b");
|
||||
var circleA = root.querySelector(".mc-circle-a");
|
||||
var circleB = root.querySelector(".mc-circle-b");
|
||||
var labelA = root.querySelector(".mc-label-a");
|
||||
var labelB = root.querySelector(".mc-label-b");
|
||||
var revealB = root.querySelectorAll(".mc-kicker, .mc-label-b");
|
||||
var vars =
|
||||
window.__hyperframes && window.__hyperframes.getVariables
|
||||
? window.__hyperframes.getVariables()
|
||||
: {};
|
||||
|
||||
var accentName =
|
||||
vars.accent === "blue" || vars.accent === "violet" ? vars.accent : "green";
|
||||
var accents = { green: "#4ade80", blue: "#60a5fa", violet: "#a78bfa" };
|
||||
var labelAText = vars.label_a == null ? "Start" : String(vars.label_a);
|
||||
var labelBText = vars.label_b == null ? "Done" : String(vars.label_b);
|
||||
|
||||
root.style.setProperty("--mc-accent", accents[accentName]);
|
||||
labelA.textContent = labelAText;
|
||||
labelB.textContent = labelBText;
|
||||
|
||||
var IN_BASE = 2.35;
|
||||
var OUT_BASE = 0.5;
|
||||
var CUT_AT_BASE = 1.4;
|
||||
var A_APPROACH_BASE = 0.45;
|
||||
var B_SETTLE_BASE = 0.65;
|
||||
var COPY_DELAY_BASE = 0.1;
|
||||
var COPY_IN_BASE = 0.55;
|
||||
|
||||
var duration = Math.max(0.001, parseFloat(root.dataset.duration || "4"));
|
||||
var envelopeBase = IN_BASE + OUT_BASE;
|
||||
var phaseScale = duration < envelopeBase ? duration / envelopeBase : 1;
|
||||
var IN = IN_BASE * phaseScale;
|
||||
var OUT = OUT_BASE * phaseScale;
|
||||
var CUT_AT = CUT_AT_BASE * phaseScale;
|
||||
var A_APPROACH = A_APPROACH_BASE * phaseScale;
|
||||
var B_SETTLE = B_SETTLE_BASE * phaseScale;
|
||||
var COPY_DELAY = COPY_DELAY_BASE * phaseScale;
|
||||
var COPY_IN = COPY_IN_BASE * phaseScale;
|
||||
var HOLD = Math.max(0, duration - IN - OUT);
|
||||
var HOLD_START = IN;
|
||||
var OUT_START = IN + HOLD;
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
tl.set(shell, { opacity: 0 }, 0);
|
||||
tl.set(sceneA, { opacity: 1 }, 0);
|
||||
tl.set(sceneB, { opacity: 0 }, 0);
|
||||
tl.set(circleA, { scale: 0.54 }, 0);
|
||||
tl.set(circleB, { scale: 1, y: 0 }, 0);
|
||||
tl.set(revealB, { opacity: 0, y: "2.4cqh" }, 0);
|
||||
|
||||
tl.to(shell, { opacity: 1, duration: Math.min(0.3, IN), ease: "power2.out" }, 0);
|
||||
tl.to(circleA, { scale: 0.64, duration: A_APPROACH, ease: "power3.out" }, 0);
|
||||
tl.to(
|
||||
circleA,
|
||||
{
|
||||
scale: 1,
|
||||
duration: Math.max(0, CUT_AT - A_APPROACH),
|
||||
ease: "power4.in",
|
||||
},
|
||||
A_APPROACH,
|
||||
);
|
||||
|
||||
// HARD CUT: both opacity states change at the exact same instant.
|
||||
tl.set(sceneA, { opacity: 0 }, CUT_AT);
|
||||
tl.set(sceneB, { opacity: 1 }, CUT_AT);
|
||||
|
||||
// Scene B starts at the matching geometry and leaves the cut at
|
||||
// peak speed, then decelerates into its smaller resting pose.
|
||||
tl.to(circleB, { scale: 0.74, duration: B_SETTLE, ease: "power4.out" }, CUT_AT);
|
||||
tl.to(
|
||||
revealB,
|
||||
{
|
||||
opacity: 1,
|
||||
y: 0,
|
||||
duration: COPY_IN,
|
||||
stagger: 0.08 * phaseScale,
|
||||
ease: "power3.out",
|
||||
},
|
||||
CUT_AT + COPY_DELAY,
|
||||
);
|
||||
|
||||
if (HOLD > 0) {
|
||||
tl.to(
|
||||
circleB,
|
||||
{
|
||||
y: "-0.8cqh",
|
||||
duration: HOLD / 2,
|
||||
ease: "sine.inOut",
|
||||
yoyo: true,
|
||||
repeat: 1,
|
||||
},
|
||||
HOLD_START,
|
||||
);
|
||||
}
|
||||
|
||||
tl.to(shell, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
|
||||
tl.seek(0);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["match-cut"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 4.5 KiB |
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: orbit-ring-camera at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>orbit-ring-camera 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="3.6" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="orbit-ring-camera"
|
||||
data-composition-src="./orbit-ring-camera.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="3.6" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,543 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
orbit-ring-camera: a camera move, not a graphic with a camera on it.
|
||||
|
||||
Opens hard against one arc of a large tilted ring, so close the ring reads as a shallow
|
||||
curve crossing frame with one big station label on it and a second arriving 0.42s later.
|
||||
A lit head runs the ring leaving a trail that fades behind it; the camera tracks the
|
||||
head, so the head holds near frame centre while the ring slides under it and new
|
||||
stations arrive at their own fixed angles. Then the camera dollies out and the arc
|
||||
resolves into the whole ellipse with all eight stations at once. Three concentric tick
|
||||
rails are nested inside the main ring at non-syncing rates (1.00, -0.42, 0.27), so they
|
||||
never line up. Station labels are BILLBOARDED: horizontal and screen readable through
|
||||
the entire tilt. The only type in the ring's plane is the curved band on the ring path.
|
||||
|
||||
Built as a real pinhole camera in JS, not a CSS 3D transform, because the whole move IS
|
||||
the camera: position, focal length, roll and look-at are the animated values and every
|
||||
mark is projected from them. That is also what makes depth honest (near arc bright and
|
||||
thick, far arc dim and thin), because the shade comes from each segment's projected z
|
||||
rather than from a gradient aimed by hand. Projection is a pure function of the tweened
|
||||
values, so it is seek safe.
|
||||
|
||||
Reference: refs/b6/cam/lin-loops.mp4 0.0-10.6s, frames refs/b6/frames/orbit-ring-camera.
|
||||
EVERY number, method and deviation is in batch6/spec-orbit-ring-camera.md. The load
|
||||
bearing few: background #000000 exact (frames 050 and 130 modal (0,0,0), corner (0,0,0),
|
||||
every frame min 0; the (10,10,10) mode on 001 and 100 is bloom off the bright arc, not a
|
||||
tint). Resolved ellipse centre (47.9% W, 49.7% H), semi-major 35.7% W, minor/major 0.523
|
||||
(58.5 deg tilt), major axis -23.9 deg, conic fit over frames 094-106, stable to +/-0.4% W
|
||||
and +/-0.9 deg, cross-checked against an independent fit of the same source. Opening arc
|
||||
curvature radius 44.2% W, centre 129% H, apex 50.4% H, circle fit on frame 001. That the
|
||||
OPENING radius exceeds the RESOLVED semi-major is what forces a real perspective camera:
|
||||
no affine scale can grow a curvature radius. Measured label baselines run -4.7 to -8.0
|
||||
deg while the plane's axis is -23.5, which is the proof the labels are not in the plane.
|
||||
The head holds inside 3.95% W and 0.74% H over the reference's first 1.2s (blurred
|
||||
luminance argmax, 13 samples): that is "tracked", not "parented". This build holds inside
|
||||
5.5% W and 2.5% H over its own first 1.7s, measured the same way off its own frames.
|
||||
|
||||
Envelope (D = 3.60s):
|
||||
TRACK 0.00-1.75 camera locked to the head at 1.55 ring radii out, 0.50 up, falling
|
||||
behind as it runs (the lag, fitted). Stations 2-4 at 0.42/1.00/1.50.
|
||||
PULLBACK 1.60-2.95 dolly to 9.40 radii, focal length opening to match, look-at blending
|
||||
head to ring centre, roll settling +14 to -23.5 deg. Stations 5-8 at
|
||||
2.18/2.36/2.55/2.72, held to that burst because before it their dots
|
||||
are still inside the presenter's zone.
|
||||
SETTLE 2.95-3.60 full ellipse, all eight stations. Camera creeps 3.4% closer and rolls
|
||||
2.5 deg further, the head lands on station 6 and takes the light, the
|
||||
three rails keep turning so no frame is a repeat of the one before.
|
||||
|
||||
Curves. Two fitted, rest palette (named GSAP eases banned):
|
||||
E.head cb(0.417,0.109,0.578,0.736) drives the head's ring angle. Interpolates four
|
||||
measured (t, angle) anchors exactly, so state it honestly: four anchors against four
|
||||
parameters is an interpolation with no residual, and the anchors carry about +/-5 deg.
|
||||
Its tail still moves 3.4% of travel in the last 5% of D, so landing at D is not a
|
||||
dead tail (Law 3).
|
||||
E.lag cb(0.154,0.008,0.012,0.894) drives the camera's lag and catch. Fitted to the
|
||||
measured head-drift table (13 samples, 0.8-2.0s, travel 2.8% H), max error 2.73% of
|
||||
travel. Nearest palette curve on the same table is camPush at 13.5%.
|
||||
Measured and REJECTED: cb(0.980,-0.135,0.895,0.412) fits the reference's own head
|
||||
screen-x over its tracked shot (17 samples, 0.0-1.6s, travel 48.1% W) to 4.69% of
|
||||
travel. It is a hold then a launch, and the launch only works because the reference
|
||||
cuts while the head is off frame. A seek renderer has no cut to hide behind, so that
|
||||
beat is spent on the pullback instead. Recorded because it was measured.
|
||||
camPush dolly, camSettle roll and look-at, springSm dots, morph fades, linear rails.
|
||||
|
||||
Deliberate deviations, each measured before being changed (rationale in the spec):
|
||||
- Ellipse built at 27% W semi-major centred 66% W, not 35.7% at 47.9%. Its proportions
|
||||
(0.523, -23.5 deg) are the measured ones, untouched. The reference's size and centre
|
||||
would eat a third of the presenter's zone.
|
||||
- Label anchor side is AUTHORED per station (six right, the 130 and 175 deg ones left),
|
||||
never derived from live screen position, so no label can flip mid shot. The reference
|
||||
flips everything outward, which here would put left labels at 24-38% W.
|
||||
- Left edge mask in landscape, transparent to 32% W and opaque from 42%. Verified rather
|
||||
than assumed: across all 32 rendered 16:9 frames, zero pixels at or above luminance 12
|
||||
fall left of 32% W. On black it reads as the arc fading out, not as a hard matte.
|
||||
- Opening camera roll +14 deg: with no roll this ring puts the arc apex off frame left,
|
||||
and 14 deg lands it on the head where frame 001 has it.
|
||||
- 8 stations at a flat 45 deg against the reference's 6 at uneven spacing. A primitive
|
||||
whose subject is "the whole loop resolves" has to resolve into something regular.
|
||||
|
||||
Native orientation 16:9. Portrait and square re-aim the camera through the custom
|
||||
properties on .orc-stage and stay legible, but the move is composed for 16:9. No media
|
||||
slot, every mark is procedural. Brand enters through --orc-bg, --orc-ink and --orc-rail.
|
||||
-->
|
||||
<html lang="en" data-composition-id="orbit-ring-camera" data-composition-duration="3.6">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Orbit Ring Camera</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="orbit-ring-camera" data-duration="3.6" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
background: var(--orc-bg, #000000);
|
||||
color: var(--orc-ink, #f2f2f2);
|
||||
font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Everything lives on a CHILD of #root, because a container query cannot
|
||||
restyle its own container and the per-aspect camera aim is a custom
|
||||
property the script reads back off this element. */
|
||||
.orc-stage {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
--orc-cx0: 0.6;
|
||||
--orc-cx1: 0.66;
|
||||
--orc-cy0: 0.5;
|
||||
--orc-cy1: 0.5;
|
||||
--orc-a: 0.27;
|
||||
}
|
||||
|
||||
/* Presenter safe zone, landscape. The close phase legitimately sweeps the arc
|
||||
across the whole frame, so the zone is held empty by a fade rather than by
|
||||
keeping the geometry out of it, which would have cost the move its scale. */
|
||||
@container (aspect-ratio >= 1.35) {
|
||||
.orc-stage {
|
||||
-webkit-mask-image: linear-gradient(to right, transparent 0 32%, #000 42%, #000 100%);
|
||||
mask-image: linear-gradient(to right, transparent 0 32%, #000 42%, #000 100%);
|
||||
}
|
||||
}
|
||||
|
||||
@container (aspect-ratio < 1.35) {
|
||||
.orc-stage {
|
||||
--orc-cx0: 0.5;
|
||||
--orc-cx1: 0.55;
|
||||
--orc-cy0: 0.44;
|
||||
--orc-cy1: 0.42;
|
||||
--orc-a: 0.34;
|
||||
}
|
||||
}
|
||||
|
||||
@container (aspect-ratio < 0.95) {
|
||||
.orc-stage {
|
||||
--orc-cy0: 0.32;
|
||||
--orc-cy1: 0.3;
|
||||
--orc-a: 0.38;
|
||||
-webkit-mask-image: linear-gradient(to bottom, #000 0 54%, transparent 66%);
|
||||
mask-image: linear-gradient(to bottom, #000 0 54%, transparent 66%);
|
||||
}
|
||||
}
|
||||
|
||||
.orc-svg {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.orc-band {
|
||||
fill: var(--orc-rail, #8f8f8f);
|
||||
font-size: 1.55cqmin;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.62em;
|
||||
}
|
||||
|
||||
.orc-lbl {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
transform-origin: 0 50%;
|
||||
white-space: nowrap;
|
||||
font-size: 2.2cqmin;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.16em;
|
||||
line-height: 1;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="orc-stage">
|
||||
<svg class="orc-svg" aria-hidden="true">
|
||||
<defs>
|
||||
<radialGradient id="orc-glow">
|
||||
<stop offset="0" stop-color="#fff" stop-opacity="0.55" />
|
||||
<stop offset="0.45" stop-color="#fff" stop-opacity="0.12" />
|
||||
<stop offset="1" stop-color="#fff" stop-opacity="0" />
|
||||
</radialGradient>
|
||||
<path id="orc-tp" fill="none" />
|
||||
</defs>
|
||||
<g id="orc-rail2"></g>
|
||||
<g id="orc-dot" stroke-linecap="round"></g>
|
||||
<g id="orc-rail"></g>
|
||||
<g id="orc-ring"></g>
|
||||
<text class="orc-band" id="orc-band" text-anchor="middle">
|
||||
<textPath href="#orc-tp" startOffset="50%">RUNNING SEQUENCE</textPath>
|
||||
</text>
|
||||
<g id="orc-tr"></g>
|
||||
<g id="orc-st"></g>
|
||||
<circle id="orc-glow-c" r="0" fill="url(#orc-glow)" />
|
||||
<circle id="orc-head" r="0" fill="#ffffff" />
|
||||
</svg>
|
||||
<div id="orc-labels"></div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// Cubic-bezier as a GSAP ease. Pure function of progress, so seek safe:
|
||||
// seek(t) always yields the same value, no internal state to drift.
|
||||
function cb(x1, y1, x2, y2) {
|
||||
var A = function (a, b) { return 1 - 3 * b + 3 * a; }, C = function (a) { return 3 * a; };
|
||||
var B = function (a, b) { return 3 * b - 6 * a; };
|
||||
var f = function (t, a, b) { return ((A(a, b) * t + B(a, b)) * t + C(a)) * t; };
|
||||
var d = function (t, a, b) { return 3 * A(a, b) * t * t + 2 * B(a, b) * t + C(a); };
|
||||
return function (p) {
|
||||
if (p <= 0) return 0;
|
||||
if (p >= 1) return 1;
|
||||
var t = p, i, s, e;
|
||||
for (i = 0; i < 8; i++) {
|
||||
s = d(t, x1, x2);
|
||||
if (s === 0) break;
|
||||
e = f(t, x1, x2) - p;
|
||||
if (Math.abs(e) < 1e-7) break;
|
||||
t -= e / s;
|
||||
}
|
||||
if (t < 0 || t > 1) {
|
||||
var lo = 0, hi = 1, j, v;
|
||||
t = p;
|
||||
for (j = 0; j < 30; j++) {
|
||||
v = f(t, x1, x2);
|
||||
if (Math.abs(v - p) < 1e-7) break;
|
||||
if (v > p) hi = t; else lo = t;
|
||||
t = (lo + hi) / 2;
|
||||
}
|
||||
}
|
||||
return f(t, y1, y2);
|
||||
};
|
||||
}
|
||||
|
||||
var E = {
|
||||
camPush: cb(0.4, 0.0, 0.2, 1.0),
|
||||
camSettle: cb(0.16, 0.84, 0.28, 1.0),
|
||||
morph: cb(0.65, 0.05, 0.35, 1.0),
|
||||
springSm: cb(0.34, 1.3, 0.5, 1.0),
|
||||
linear: function (p) { return p; },
|
||||
// Interpolates the reference's four measured head-angle anchors exactly.
|
||||
head: cb(0.417, 0.109, 0.578, 0.736),
|
||||
// Fitted to the measured head-drift table, max error 2.73% of travel.
|
||||
lag: cb(0.154, 0.008, 0.012, 0.894),
|
||||
};
|
||||
|
||||
gsap.defaults({ immediateRender: false });
|
||||
|
||||
var NS = "http://www.w3.org/2000/svg";
|
||||
var root = document.getElementById("root");
|
||||
var stage = root.querySelector(".orc-stage");
|
||||
var svg = root.querySelector(".orc-svg");
|
||||
var W = root.clientWidth || 1920, H = root.clientHeight || 1080;
|
||||
// GSAP writes transforms as px, so a cqmin tween would not survive one.
|
||||
var U = Math.min(W, H) / 100 || 10.8;
|
||||
svg.setAttribute("viewBox", "0 0 " + W + " " + H);
|
||||
|
||||
function num(name, dflt) {
|
||||
var v = parseFloat(getComputedStyle(stage).getPropertyValue(name));
|
||||
return isFinite(v) ? v : dflt;
|
||||
}
|
||||
var CX0 = num("--orc-cx0", 0.6), CX1 = num("--orc-cx1", 0.68);
|
||||
var CY0 = num("--orc-cy0", 0.5), CY1 = num("--orc-cy1", 0.5);
|
||||
// Resolved semi-major, in px. The dolly's end focal length is derived from
|
||||
// it so the wide shot lands on the measured proportion whatever the frame.
|
||||
var AP = num("--orc-a", 0.27) * W;
|
||||
|
||||
var RC1 = 9.4, HC1 = 5.76; // end camera, 31.5 deg above the plane
|
||||
var FOC1 = AP * Math.hypot(RC1, HC1); // ends on the measured ellipse
|
||||
var FOC0 = W * 1.302; // opening, fitted to the reference's arc
|
||||
var STA = [-50, -5, 40, 85, 130, 175, 220, 265]; // eight stations, fixed ring angles
|
||||
var TXT = ["signal received", "scope matched", "context gathered", "draft assembled",
|
||||
"checks cleared", "ready to ship", "rollout opened", "loop closed"];
|
||||
// Which side of its dot each label sits on. Authored per station, never
|
||||
// derived from live screen position, so no label can flip mid shot.
|
||||
// The 220 deg station is left-anchored (it was right) because at the resolved
|
||||
// tilt it and the 175 deg one project a few degrees apart with their type
|
||||
// running head on into each other; no offset survives that, only pointing
|
||||
// them apart does.
|
||||
var SIDE = [1, 1, 1, 1, -1, -1, -1, 1];
|
||||
// Radial standoff, in ring radii, for the label only: its dot stays on the
|
||||
// ring, the type sits further out along that station's own radius. This is
|
||||
// what keeps adjacent stations apart where the tilt foreshortens them into
|
||||
// each other, because two stations 45 deg apart push their labels in two
|
||||
// different directions however the camera is aimed. Authored per station.
|
||||
var LR = [1.06, 1.06, 1.12, 1, 1, 1.25, 1, 1];
|
||||
// Vertical nudge, in U, for the stations that still resolve close enough on
|
||||
// screen for their labels to touch. Authored, so none of them can pop.
|
||||
var DY = [-2, 1, 1, 0, 2, 0, -2, -1];
|
||||
var RAD = Math.PI / 180, SEG = 48, TICKS = 180, TG = 12, TRS = 12;
|
||||
|
||||
function mk(tag, parent, attrs) {
|
||||
var n = document.createElementNS(NS, tag), k;
|
||||
for (k in attrs) n.setAttribute(k, attrs[k]);
|
||||
parent.appendChild(n);
|
||||
return n;
|
||||
}
|
||||
|
||||
var gRing = root.querySelector("#orc-ring"), gRail = root.querySelector("#orc-rail");
|
||||
var gRail2 = root.querySelector("#orc-rail2"), gDot = root.querySelector("#orc-dot");
|
||||
var gTrail = root.querySelector("#orc-tr"), gSt = root.querySelector("#orc-st");
|
||||
var tp = root.querySelector("#orc-tp"), band = root.querySelector("#orc-band");
|
||||
var head = root.querySelector("#orc-head"), glow = root.querySelector("#orc-glow-c");
|
||||
var ringSeg = [], railSeg = [], rail2Seg = [], dotSeg = [], trailSeg = [], dots = [], labels = [];
|
||||
var i;
|
||||
for (i = 0; i < SEG; i++) ringSeg.push(mk("path", gRing, { fill: "none", stroke: "#fff" }));
|
||||
for (i = 0; i < TG; i++) railSeg.push(mk("path", gRail, { fill: "none", stroke: "#fff" }));
|
||||
for (i = 0; i < TG; i++) rail2Seg.push(mk("path", gRail2, { fill: "none", stroke: "#fff" }));
|
||||
for (i = 0; i < TG; i++) dotSeg.push(mk("path", gDot, { fill: "none", stroke: "#fff" }));
|
||||
for (i = 0; i < TRS; i++) trailSeg.push(mk("path", gTrail, { fill: "none", stroke: "#fff", "stroke-linecap": "round" }));
|
||||
var labelBox = root.querySelector("#orc-labels");
|
||||
for (i = 0; i < STA.length; i++) {
|
||||
dots.push(mk("circle", gSt, { r: 0, fill: "#000", stroke: "#fff" }));
|
||||
var d = document.createElement("div");
|
||||
d.className = "orc-lbl";
|
||||
d.textContent = TXT[i];
|
||||
labelBox.appendChild(d);
|
||||
labels.push(d);
|
||||
}
|
||||
|
||||
// Camera and scene state. Every field is tweened; render() is a pure
|
||||
// function of this object, which is what makes a seek reproducible.
|
||||
var C = {
|
||||
th: -42, beta: 168, rc: 1.55, hc: 0.5, foc: FOC0, look: 0, roll: 14,
|
||||
cx: CX0, cy: CY0, tick: 0, lag: 0, trail: 34, ui: 1.5, glow: 1,
|
||||
};
|
||||
var SS = STA.map(function () { return { o: 0, pop: 0.62 }; });
|
||||
|
||||
// Pinhole projection. World is the ring plane z = 0, ring radius 1.
|
||||
var CP = [0, 0, 0], FW = [0, 0, 1], RT = [1, 0, 0], UP = [0, 1, 0], CR = 1, SR = 0;
|
||||
function aim() {
|
||||
var az = (C.th - C.beta) * RAD;
|
||||
CP = [C.rc * Math.cos(az), C.rc * Math.sin(az), C.hc];
|
||||
var la = (C.th - C.lag) * RAD, k = 1 - C.look;
|
||||
var tx = Math.cos(la) * k, ty = Math.sin(la) * k;
|
||||
var fx = tx - CP[0], fy = ty - CP[1], fz = -CP[2];
|
||||
var fl = Math.hypot(fx, fy, fz) || 1;
|
||||
FW = [fx / fl, fy / fl, fz / fl];
|
||||
var rl = Math.hypot(FW[1], FW[0]) || 1;
|
||||
RT = [FW[1] / rl, -FW[0] / rl, 0];
|
||||
UP = [RT[1] * FW[2], -RT[0] * FW[2], RT[0] * FW[1] - RT[1] * FW[0]];
|
||||
CR = Math.cos(C.roll * RAD);
|
||||
SR = Math.sin(C.roll * RAD);
|
||||
}
|
||||
function pj(x, y, z) {
|
||||
var vx = x - CP[0], vy = y - CP[1], vz = z - CP[2];
|
||||
var zc = vx * FW[0] + vy * FW[1] + vz * FW[2];
|
||||
if (zc < 0.02) return null;
|
||||
var sx = C.foc * (vx * RT[0] + vy * RT[1]) / zc;
|
||||
var sy = -C.foc * (vx * UP[0] + vy * UP[1] + vz * UP[2]) / zc;
|
||||
return [C.cx * W + sx * CR - sy * SR, C.cy * H + sx * SR + sy * CR, zc];
|
||||
}
|
||||
function ring(deg, r) {
|
||||
var a = deg * RAD;
|
||||
return pj(Math.cos(a) * r, Math.sin(a) * r, 0);
|
||||
}
|
||||
function poly(from, step, n, r) {
|
||||
var out = [], p, j;
|
||||
for (j = 0; j <= n; j++) {
|
||||
p = ring(from + step * j, r);
|
||||
if (p) out.push(p);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
function dpath(pts) {
|
||||
var s = "", j;
|
||||
for (j = 0; j < pts.length; j++) s += (j ? "L" : "M") + pts[j][0].toFixed(1) + " " + pts[j][1].toFixed(1);
|
||||
return s;
|
||||
}
|
||||
|
||||
// Depth shade. The near / far range is recomputed per frame off the actual
|
||||
// projected z, so the contrast between near arc and far arc holds at every
|
||||
// camera position instead of only at the one it was tuned on.
|
||||
var ZN = 1, ZF = 2;
|
||||
function shade(z) { return Math.min(1, Math.max(0, (z - ZN) / (ZF - ZN))); }
|
||||
|
||||
// One tick rail: n marks between radii r0 and r1, spun to `spin`, batched into
|
||||
// the group's paths so a rail costs a handful of DOM writes, not n of them.
|
||||
function rail(segs, n, r0, r1, spin, ab, aw, wb, ww) {
|
||||
var per = Math.ceil(n / segs.length), j, k, dd, q, a0, p1, p2;
|
||||
for (j = 0; j < segs.length; j++) {
|
||||
dd = ""; q = 1;
|
||||
for (k = 0; k < per; k++) {
|
||||
a0 = spin + (j * per + k) * (360 / n);
|
||||
p1 = ring(a0, r0); p2 = ring(a0, r1);
|
||||
if (p1 && p2) {
|
||||
dd += "M" + p1[0].toFixed(1) + " " + p1[1].toFixed(1) + "L" + p2[0].toFixed(1) + " " + p2[1].toFixed(1);
|
||||
if (k === (per >> 1)) q = shade(p1[2]);
|
||||
}
|
||||
}
|
||||
segs[j].setAttribute("d", dd);
|
||||
segs[j].setAttribute("stroke-opacity", (C.glow * (ab - aw * q)).toFixed(3));
|
||||
segs[j].setAttribute("stroke-width", (W * (wb - ww * q)).toFixed(2));
|
||||
}
|
||||
}
|
||||
|
||||
function render() {
|
||||
aim();
|
||||
var j, k, p, q, pts, zlo = 1e9, zhi = -1e9;
|
||||
for (j = 0; j < 360; j += 4) {
|
||||
p = ring(j, 1);
|
||||
if (p) { if (p[2] < zlo) zlo = p[2]; if (p[2] > zhi) zhi = p[2]; }
|
||||
}
|
||||
ZN = zlo; ZF = Math.max(zhi, zlo + 1e-3);
|
||||
|
||||
var span = 360 / SEG;
|
||||
for (j = 0; j < SEG; j++) {
|
||||
pts = poly(j * span, span / 5, 5, 1);
|
||||
p = ring(j * span + span / 2, 1);
|
||||
q = p ? shade(p[2]) : 1;
|
||||
ringSeg[j].setAttribute("d", pts.length > 1 ? dpath(pts) : "");
|
||||
ringSeg[j].setAttribute("stroke-opacity", (C.glow * (0.94 - 0.78 * q)).toFixed(3));
|
||||
ringSeg[j].setAttribute("stroke-width", (W * (0.0031 - 0.0018 * q)).toFixed(2));
|
||||
}
|
||||
|
||||
// Three concentric tick rails, each at its own radius, count and rate, so
|
||||
// the opening arc has depth stacked under it instead of one lonely curve.
|
||||
rail(railSeg, TICKS, 0.788, 0.888, C.tick, 0.5, 0.44, 0.0017, 0.0009);
|
||||
rail(rail2Seg, 44, 1.055, 1.145, -C.tick * 0.42, 0.44, 0.38, 0.0023, 0.0013);
|
||||
rail(dotSeg, 84, 0.696, 0.704, C.tick * 0.27, 0.5, 0.42, 0.0026, 0.0014);
|
||||
|
||||
// Type set ON the ring path, so it curves and foreshortens with the plane.
|
||||
// The billboarded station labels are the deliberate contrast to it. Held to
|
||||
// the far arc, the one facing camera, and flipped to screen reading order so
|
||||
// the glyphs can never come out mirrored on the away side.
|
||||
pts = poly(C.th - C.beta + 180 - 66, 3.3, 40, 0.615);
|
||||
if (pts.length > 4 && pts[0][0] > pts[pts.length - 1][0]) pts.reverse();
|
||||
tp.setAttribute("d", pts.length > 4 ? dpath(pts) : "M0 0");
|
||||
band.setAttribute("opacity", (0.85 * C.glow).toFixed(3));
|
||||
|
||||
// Trail. Tapered in both width and alpha, brightest at the head, laid as
|
||||
// segments because a stroke gradient cannot follow an arbitrary curve.
|
||||
var step = C.trail / TRS;
|
||||
for (j = 0; j < TRS; j++) {
|
||||
pts = poly(C.th - C.trail + step * j, step / 2, 2, 1);
|
||||
var f = (j + 1) / TRS;
|
||||
trailSeg[j].setAttribute("d", pts.length > 1 ? dpath(pts) : "");
|
||||
trailSeg[j].setAttribute("stroke-opacity", (f * f * C.glow).toFixed(3));
|
||||
trailSeg[j].setAttribute("stroke-width", (W * 0.0014 * (0.6 + 4.4 * f * f)).toFixed(2));
|
||||
}
|
||||
|
||||
// Clamped at BOTH ends. Without the floor the head is a 4px dot once the
|
||||
// camera reaches 9.4 radii out, and the subject of the shot disappears.
|
||||
p = ring(C.th, 1);
|
||||
var hr = p ? Math.max(W * 0.0052, Math.min(W * 0.012, C.foc * 0.0088 / p[2])) : 0;
|
||||
head.setAttribute("r", p ? hr.toFixed(2) : 0);
|
||||
head.setAttribute("opacity", p ? C.glow : 0);
|
||||
glow.setAttribute("r", p ? (hr * 4.2).toFixed(2) : 0);
|
||||
glow.setAttribute("opacity", p ? C.glow : 0);
|
||||
if (p) {
|
||||
head.setAttribute("cx", p[0].toFixed(1)); head.setAttribute("cy", p[1].toFixed(1));
|
||||
glow.setAttribute("cx", p[0].toFixed(1)); glow.setAttribute("cy", p[1].toFixed(1));
|
||||
}
|
||||
|
||||
for (j = 0; j < STA.length; j++) {
|
||||
p = ring(STA[j], 1);
|
||||
var dr = p ? Math.max(W * 0.0037, Math.min(W * 0.0095, C.foc * 0.0062 / p[2])) * SS[j].pop : 0;
|
||||
dots[j].setAttribute("cx", p ? p[0].toFixed(1) : 0);
|
||||
dots[j].setAttribute("cy", p ? p[1].toFixed(1) : 0);
|
||||
dots[j].setAttribute("r", dr.toFixed(2));
|
||||
dots[j].setAttribute("stroke-width", (W * 0.0018).toFixed(2));
|
||||
dots[j].setAttribute("opacity", p ? SS[j].o.toFixed(3) : 0);
|
||||
// Billboarded: position comes from the projection, orientation never does.
|
||||
// The label rides its own radius (LR), the dot stays on the ring.
|
||||
var lp = p && ring(STA[j], LR[j]);
|
||||
labels[j].style.opacity = p && lp ? SS[j].o : 0;
|
||||
if (p && lp) {
|
||||
var off = (dr / C.ui + U * 0.9).toFixed(1);
|
||||
labels[j].style.transform = "translate3d(" + lp[0].toFixed(1) + "px," + (lp[1] + DY[j] * U).toFixed(1) +
|
||||
"px,0) scale(" + C.ui.toFixed(3) + ") translate(" +
|
||||
(SIDE[j] > 0 ? off + "px" : "calc(-100% - " + off + "px)") + ",-50%)";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var D = Math.max(0.001, parseFloat(root.dataset.duration || "3.6"));
|
||||
|
||||
// Rest state pinned outside the timeline, both ends written on every tween.
|
||||
gsap.set(C, { th: -42, beta: 168, rc: 1.55, hc: 0.5, foc: FOC0, look: 0, roll: 14, cx: CX0, cy: CY0, tick: 0, lag: 0, trail: 34, ui: 1.5, glow: 1 });
|
||||
SS.forEach(function (s, j) { s.o = j === 0 ? 1 : 0; s.pop = j === 0 ? 1 : 0.62; });
|
||||
|
||||
var tl = gsap.timeline({ paused: true, onUpdate: render });
|
||||
|
||||
// TRACK plus PULLBACK on one continuous angle tween: the head never changes
|
||||
// gear at the cut, only the camera does, which is what keeps the two acts
|
||||
// reading as one shot. Ends exactly on station 6.
|
||||
tl.fromTo(C, { th: -42 }, { th: 175, duration: D, ease: E.head }, 0);
|
||||
tl.fromTo(C, { beta: 168 }, { beta: 74, duration: D, ease: E.head }, 0);
|
||||
// The lag and the catch. This is the camera operator, not the rig.
|
||||
tl.fromTo(C, { lag: 0 }, { lag: 7, duration: 1.25, ease: E.lag }, 0.3);
|
||||
tl.fromTo(C, { lag: 7 }, { lag: 1.5, duration: 0.55, ease: E.morph }, 1.55);
|
||||
|
||||
// PULLBACK, then SETTLE. Dolly, focal and aim share one window so the resolve
|
||||
// is a single gesture; the roll runs longer so its dead tail is covered by the
|
||||
// settle rather than landing on the same frame as the dolly (Law 3). The
|
||||
// settle is the reference's own tail, it creeps 3.4% closer and keeps rolling,
|
||||
// which is why no frame past 85% of D repeats the one before it.
|
||||
tl.fromTo(C, { rc: 1.55 }, { rc: RC1, duration: 1.35, ease: E.camPush }, 1.6);
|
||||
tl.fromTo(C, { hc: 0.5 }, { hc: HC1, duration: 1.35, ease: E.camPush }, 1.6);
|
||||
tl.fromTo(C, { foc: FOC0 }, { foc: FOC1, duration: 1.35, ease: E.camPush }, 1.6);
|
||||
tl.fromTo(C, { cx: CX0 }, { cx: CX1, duration: 1.35, ease: E.camPush }, 1.6);
|
||||
tl.fromTo(C, { cy: CY0 }, { cy: CY1, duration: 1.35, ease: E.camPush }, 1.6);
|
||||
tl.fromTo(C, { ui: 1.5 }, { ui: 1, duration: 1.35, ease: E.camPush }, 1.6);
|
||||
tl.fromTo(C, { trail: 34 }, { trail: 62, duration: 1.35, ease: E.camPush }, 1.6);
|
||||
tl.fromTo(C, { look: 0 }, { look: 1, duration: 1.25, ease: E.camSettle }, 1.75);
|
||||
tl.fromTo(C, { roll: 14 }, { roll: -23.5, duration: 3.05, ease: E.camSettle }, 0);
|
||||
tl.fromTo(C, { tick: 0 }, { tick: -118, duration: D, ease: E.linear }, 0);
|
||||
tl.fromTo(C, { rc: RC1 }, { rc: RC1 * 0.967, duration: 0.65, ease: E.linear }, 2.95);
|
||||
tl.fromTo(C, { hc: HC1 }, { hc: HC1 * 0.967, duration: 0.65, ease: E.linear }, 2.95);
|
||||
tl.fromTo(C, { roll: -23.5 }, { roll: -26, duration: 0.55, ease: E.linear }, 3.05);
|
||||
|
||||
// Stations arrive at their own fixed angles as the camera reaches them.
|
||||
[0.0, 0.42, 1.0, 1.5, 2.18, 2.36, 2.55, 2.72].forEach(function (at, j) {
|
||||
if (j === 0) return;
|
||||
tl.fromTo(SS[j], { o: 0 }, { o: 1, duration: 0.26, ease: E.morph }, at);
|
||||
tl.fromTo(SS[j], { pop: 0.62 }, { pop: 1, duration: 0.34, ease: E.springSm }, at);
|
||||
});
|
||||
// The head lands on station 6 and it takes the light, which is the close.
|
||||
tl.fromTo(SS[5], { pop: 1 }, { pop: 1.5, duration: 0.3, ease: E.springSm }, 3.3);
|
||||
|
||||
tl.set({}, {}, D); // pin the full duration
|
||||
tl.seek(0);
|
||||
render(); // frame zero is a deliverable, and seek(0) from 0 fires nothing
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["orbit-ring-camera"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 5.9 KiB |
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: particle-text-dissolve at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>particle-text-dissolve 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="4" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="particle-text-dissolve"
|
||||
data-composition-src="./particle-text-dissolve.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="4" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,414 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
particle-text-dissolve: HyperFrames video primitive (type / particles).
|
||||
Wave M8. Direct donor: particle-image-reveal (canvas determinism law).
|
||||
|
||||
Text assembles FROM a seeded particle cloud, or dissolves TO it (direction
|
||||
enum). Per-particle target positions are sampled ONCE at mount from the
|
||||
rendered text bitmap: the token-styled line is rastered to an offscreen
|
||||
canvas, read back with getImageData, and every lit cell on a deterministic
|
||||
grid becomes a particle target. Particles are table-driven with ZERO
|
||||
per-particle tweens; one onUpdate painter clears and redraws the whole
|
||||
field from scratch each frame.
|
||||
|
||||
direction "in": particles fly from a scattered cloud onto the glyphs while
|
||||
the crisp DOM line wipes in along the same left-to-right front; each
|
||||
particle fades as it settles, so by the end of IN the canvas is empty and
|
||||
the DOM text holds crisp and themable.
|
||||
direction "out": the crisp line holds for a beat, then erases left to
|
||||
right as particles are born on the departing glyphs and scatter outward,
|
||||
fading in flight; the HOLD is empty.
|
||||
|
||||
Variables (declared in data-composition-variables below):
|
||||
- text (string, default "Dissolve"): the line that assembles/dissolves.
|
||||
- direction ("in" | "out", default "in").
|
||||
- density ("low" | "med" | "high", default "med"): particle count cap.
|
||||
- accent ("green" | "blue" | "violet", default "green"): text and
|
||||
particle color; green rides --brand, blue rides --accent, violet
|
||||
rides --accent-2.
|
||||
- exit ("none" | "fade" | "up", default "none"): frame roots own
|
||||
transitions.
|
||||
|
||||
Envelope, fixed IN and OUT with elastic HOLD only (never timeScale):
|
||||
IN_BASE = 2.80s the assembly (or dissolve) plays out completely
|
||||
HOLD = max(0, D - IN - OUT); truly still: direction in holds the
|
||||
crisp DOM line, direction out holds an empty stage; either
|
||||
way the canvas is one clear rect
|
||||
OUT_BASE = 0.45s only when exit != none
|
||||
If D < IN_BASE + OUT_BASE, IN and OUT compress together.
|
||||
|
||||
Determinism (canvas 2D law, per particle-image-reveal): the text bitmap
|
||||
readback and the per-particle attribute table are computed exactly once
|
||||
during synchronous timeline construction; the table's random components
|
||||
come from fixed LCG seed 0x9d1550f7. Every painted frame is a pure
|
||||
function of (table, timeline time): the anchor tween's onUpdate clears
|
||||
the canvas and redraws every particle. No Math.random, no wall clock, no
|
||||
incremental state, no requestAnimationFrame. Eventful seeks
|
||||
(suppressEvents=false, the engine's render path) repaint identically in
|
||||
any order and either direction.
|
||||
|
||||
Mount contract: the runtime clones only this template. #root fills the
|
||||
host box (no data-width/data-height, container-type: size, cqmin units),
|
||||
is styled via #root only, and registers one paused timeline under the
|
||||
LITERAL "particle-text-dissolve" key. All DOM state is set with explicit
|
||||
endpoints (gsap.set + fromTo) so any seek order lands identical frames.
|
||||
-->
|
||||
<html
|
||||
lang="en"
|
||||
data-composition-id="particle-text-dissolve"
|
||||
data-composition-duration="4"
|
||||
data-composition-variables='[
|
||||
{ "id": "text", "type": "string", "role": "content", "label": "Text", "description": "The line that assembles from (or dissolves into) the particle cloud.", "default": "Dissolve" },
|
||||
{ "id": "direction", "type": "enum", "role": "timing", "label": "Direction", "description": "in assembles the text from the cloud and holds it crisp; out erases the text into the cloud and holds empty.", "default": "in", "options": [{ "value": "in", "label": "Assemble in" }, { "value": "out", "label": "Dissolve out" }] },
|
||||
{ "id": "density", "type": "enum", "role": "style", "label": "Density", "description": "Particle count cap for the field.", "default": "med", "options": [{ "value": "low", "label": "Low" }, { "value": "med", "label": "Medium" }, { "value": "high", "label": "High" }] },
|
||||
{ "id": "accent", "type": "enum", "role": "style", "label": "Accent", "description": "Text and particle color: green rides --brand, blue rides --accent, violet rides --accent-2.", "default": "green", "options": [{ "value": "green", "label": "Green" }, { "value": "blue", "label": "Blue" }, { "value": "violet", "label": "Violet" }] },
|
||||
{ "id": "exit", "type": "enum", "role": "timing", "label": "Exit", "description": "Optional departure. Default none: the end state holds until the frame cuts.", "default": "none", "options": [{ "value": "none", "label": "None" }, { "value": "fade", "label": "Fade" }, { "value": "up", "label": "Up" }] }
|
||||
]'
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Particle Text Dissolve</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="particle-text-dissolve" data-duration="4" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
color: var(--fg, #f8fafc);
|
||||
font-family: var(--font-display, "Inter", system-ui, sans-serif);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.ptd-clip {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
background: var(--bg, transparent);
|
||||
}
|
||||
|
||||
.ptd-stage {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
.ptd-text {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
will-change: clip-path, opacity;
|
||||
}
|
||||
|
||||
.ptd-line {
|
||||
color: var(--ptd-accent);
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
letter-spacing: 0.02em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ptd-canvas {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div
|
||||
id="particle-text-dissolve-clip"
|
||||
class="ptd-clip clip"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
>
|
||||
<div class="ptd-stage">
|
||||
<div class="ptd-text">
|
||||
<span class="ptd-line"></span>
|
||||
</div>
|
||||
<canvas class="ptd-canvas" aria-hidden="true"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var stage = root.querySelector(".ptd-stage");
|
||||
var textLayer = root.querySelector(".ptd-text");
|
||||
var line = root.querySelector(".ptd-line");
|
||||
var canvas = root.querySelector(".ptd-canvas");
|
||||
var vars =
|
||||
window.__hyperframes && window.__hyperframes.getVariables
|
||||
? window.__hyperframes.getVariables()
|
||||
: {};
|
||||
|
||||
var text =
|
||||
typeof vars.text === "string" && vars.text.length > 0 ? vars.text : "Dissolve";
|
||||
var direction = vars.direction === "out" ? "out" : "in";
|
||||
var densityCaps = { low: 900, med: 1700, high: 2800 };
|
||||
var density = Object.prototype.hasOwnProperty.call(densityCaps, vars.density)
|
||||
? vars.density
|
||||
: "med";
|
||||
// Each enum choice routes to a DIFFERENT contract token so the
|
||||
// variable stays meaningful under a theme.
|
||||
var accentColors = {
|
||||
green: "var(--brand, #71f5a7)",
|
||||
blue: "var(--accent, #61a8ff)",
|
||||
violet: "var(--accent-2, #c5a3ff)",
|
||||
};
|
||||
var accent = Object.prototype.hasOwnProperty.call(accentColors, vars.accent)
|
||||
? vars.accent
|
||||
: "green";
|
||||
var exit = vars.exit === "fade" || vars.exit === "up" ? vars.exit : "none";
|
||||
|
||||
root.style.setProperty("--ptd-accent", accentColors[accent]);
|
||||
line.textContent = text;
|
||||
|
||||
// Envelope: fixed IN/OUT, elastic HOLD, never time-scaled.
|
||||
var IN_BASE = 2.8;
|
||||
var OUT_BASE = exit === "none" ? 0 : 0.45;
|
||||
var duration = Math.max(0.001, parseFloat(root.dataset.duration || "4"));
|
||||
var totalBase = Math.max(0.001, IN_BASE + OUT_BASE);
|
||||
var scale = duration < totalBase ? duration / totalBase : 1;
|
||||
var IN = IN_BASE * scale;
|
||||
var OUT = OUT_BASE * scale;
|
||||
var HOLD = Math.max(0, duration - (IN + OUT));
|
||||
var OUT_START = IN + HOLD;
|
||||
|
||||
// Canvas raster basis is fixed once at mount. Elastic root: the
|
||||
// host box decides the resolution; the same host always yields
|
||||
// the same raster, so painted frames stay byte-stable.
|
||||
var dpr = Math.min(2, Math.max(1, Number(window.devicePixelRatio) || 1));
|
||||
var box = root.getBoundingClientRect();
|
||||
var cssW = Math.max(1, Math.round(box.width) || 640);
|
||||
var cssH = Math.max(1, Math.round(box.height) || 360);
|
||||
canvas.width = Math.round(cssW * dpr);
|
||||
canvas.height = Math.round(cssH * dpr);
|
||||
var ctx = canvas.getContext("2d");
|
||||
var minDim = Math.min(canvas.width, canvas.height);
|
||||
|
||||
// Resolve the accent token to a concrete color once at mount so
|
||||
// canvas fills never depend on style recalc during seeks.
|
||||
var hostDoc = root.ownerDocument;
|
||||
var probe = hostDoc.createElement("span");
|
||||
probe.style.color = accentColors[accent];
|
||||
root.appendChild(probe);
|
||||
var particleColor = getComputedStyle(probe).color || "#71f5a7";
|
||||
probe.remove();
|
||||
|
||||
// Rendered-text raster, sampled ONCE at mount. The DOM line and
|
||||
// the offscreen raster share the same computed font stack and the
|
||||
// same fitted pixel size, so particle targets sit on the glyphs
|
||||
// the crisp line will draw.
|
||||
var fontFamily = getComputedStyle(line).fontFamily || "system-ui, sans-serif";
|
||||
var off = hostDoc.createElement("canvas");
|
||||
off.width = canvas.width;
|
||||
off.height = canvas.height;
|
||||
var offCtx = off.getContext("2d", { willReadFrequently: true });
|
||||
var fontPx = Math.round(canvas.height * 0.3);
|
||||
offCtx.font = "600 " + fontPx + "px " + fontFamily;
|
||||
var measured = offCtx.measureText(text).width || 1;
|
||||
var maxWidth = canvas.width * 0.86;
|
||||
if (measured > maxWidth) {
|
||||
fontPx = Math.max(8, Math.floor((fontPx * maxWidth) / measured));
|
||||
offCtx.font = "600 " + fontPx + "px " + fontFamily;
|
||||
}
|
||||
offCtx.textAlign = "center";
|
||||
offCtx.textBaseline = "middle";
|
||||
offCtx.fillStyle = "#ffffff";
|
||||
offCtx.fillText(text, off.width / 2, off.height / 2);
|
||||
// Lock the crisp DOM line to the exact raster the targets came
|
||||
// from: same family string, same device-pixel size.
|
||||
line.style.fontFamily = fontFamily;
|
||||
line.style.fontSize = fontPx / dpr + "px";
|
||||
|
||||
// The LCG and every per-particle decision live here. This IIFE
|
||||
// runs once before timeline construction, then only the table is
|
||||
// read. Particle state at any time is a pure function of
|
||||
// (table row, timeline time). Zero per-particle tweens.
|
||||
var particles = (function () {
|
||||
var state = 0x9d1550f7;
|
||||
function next() {
|
||||
state = (Math.imul(1664525, state) + 1013904223) >>> 0;
|
||||
return state / 4294967296;
|
||||
}
|
||||
// Grid-sample lit cells from the readback (alpha over half).
|
||||
var data = offCtx.getImageData(0, 0, off.width, off.height).data;
|
||||
var step = Math.max(2, Math.round(minDim / 260));
|
||||
var cells = [];
|
||||
var minX = Infinity;
|
||||
var maxX = -Infinity;
|
||||
for (var y = 0; y < off.height; y += step) {
|
||||
for (var x = 0; x < off.width; x += step) {
|
||||
if (data[(y * off.width + x) * 4 + 3] > 127) {
|
||||
cells.push({ x: x, y: y });
|
||||
if (x < minX) minX = x;
|
||||
if (x > maxX) maxX = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cells.length === 0) {
|
||||
// Degenerate raster (empty text box): no particles, the DOM
|
||||
// line still plays its wipe.
|
||||
minX = 0;
|
||||
maxX = 1;
|
||||
}
|
||||
var span = Math.max(1, maxX - minX);
|
||||
// Thin deterministically to the density cap. The keep decision
|
||||
// consumes exactly one LCG draw per cell in grid order, so the
|
||||
// surviving set is a pure function of (raster, seed).
|
||||
var cap = densityCaps[density];
|
||||
var keep = cells.length > cap ? cap / cells.length : 1;
|
||||
var rows = [];
|
||||
for (var i = 0; i < cells.length; i += 1) {
|
||||
var take = next() < keep;
|
||||
if (!take) continue;
|
||||
var tx = cells[i].x;
|
||||
var ty = cells[i].y;
|
||||
var key = (tx - minX) / span;
|
||||
// The front sweeps left to right for both directions; the
|
||||
// per-particle schedule completes strictly inside [0, 0.97].
|
||||
var at = 0.2 + 0.62 * key + 0.05 * next();
|
||||
var travel = 0.18 + 0.1 * next();
|
||||
var fade = 0.05 + 0.04 * next();
|
||||
var angle = next() * Math.PI * 2;
|
||||
rows.push({
|
||||
tx: tx,
|
||||
ty: ty,
|
||||
at: Math.min(0.9, at),
|
||||
travel: travel,
|
||||
fade: fade,
|
||||
offset: (0.1 + 0.22 * next()) * minDim,
|
||||
ox: Math.cos(angle),
|
||||
oy: Math.sin(angle),
|
||||
radius: (0.26 + 0.5 * next()) * (minDim / 200) * step * 0.5,
|
||||
dim: 0.5 + 0.5 * next(),
|
||||
});
|
||||
}
|
||||
return rows;
|
||||
})();
|
||||
|
||||
function clamp01(v) {
|
||||
return v < 0 ? 0 : v > 1 ? 1 : v;
|
||||
}
|
||||
|
||||
// Pure repaint: clear, then draw every particle from (row, p).
|
||||
// direction in: fly cloud -> glyph, fade once settled (donor
|
||||
// law). direction out: born on the glyph as the front passes,
|
||||
// fly outward, fade in flight. Both end all-zero by p = 1.
|
||||
function paint(timeSeconds) {
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
var p = IN > 0 ? clamp01(timeSeconds / IN) : 1;
|
||||
var endClamp = clamp01((1 - p) / 0.04);
|
||||
if (endClamp === 0) return;
|
||||
ctx.fillStyle = particleColor;
|
||||
for (var i = 0; i < particles.length; i += 1) {
|
||||
var row = particles[i];
|
||||
var alpha;
|
||||
var dist;
|
||||
if (direction === "in") {
|
||||
var birth = Math.max(0, row.at - row.travel);
|
||||
var u = clamp01((p - birth) / (row.at - birth));
|
||||
if (u <= 0) continue;
|
||||
var settled = clamp01((p - row.at) / row.fade);
|
||||
alpha = clamp01(u / 0.16) * (1 - settled) * row.dim * endClamp;
|
||||
var e = 1 - Math.pow(1 - u, 3);
|
||||
dist = row.offset * (1 - e);
|
||||
} else {
|
||||
var v = clamp01((p - row.at) / row.travel);
|
||||
if (v <= 0) continue;
|
||||
alpha = clamp01(v / 0.14) * (1 - v) * row.dim * endClamp;
|
||||
dist = row.offset * (v * v);
|
||||
}
|
||||
if (alpha <= 0.002) continue;
|
||||
var x = row.tx + row.ox * dist;
|
||||
var y = row.ty + row.oy * dist;
|
||||
ctx.globalAlpha = alpha * 0.92;
|
||||
ctx.beginPath();
|
||||
ctx.arc(x, y, row.radius, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
}
|
||||
ctx.globalAlpha = 1;
|
||||
}
|
||||
|
||||
// The crisp line wipes along the same front the particles sweep.
|
||||
var clipShown = "inset(0% 0% 0% 0%)";
|
||||
var clipInStart = "inset(0% 100% 0% 0%)";
|
||||
var clipOutEnd = "inset(0% 0% 0% 100%)";
|
||||
|
||||
gsap.set(stage, { opacity: 1, y: "0cqh" });
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
paint(tl.time());
|
||||
},
|
||||
});
|
||||
|
||||
// Anchor tween: an inert plain-object tween spanning the full
|
||||
// authored duration so tl.time() covers [0, D] and the painter
|
||||
// fires on every eventful seek, including seeks into the hold.
|
||||
tl.to({ p: 0 }, { p: 1, duration: duration, ease: "none" }, 0);
|
||||
|
||||
if (direction === "in") {
|
||||
// The line reveals behind the arriving particles.
|
||||
tl.fromTo(
|
||||
textLayer,
|
||||
{ opacity: 0 },
|
||||
{ opacity: 1, duration: IN * 0.3, ease: "power2.out" },
|
||||
IN * 0.16,
|
||||
);
|
||||
tl.fromTo(
|
||||
textLayer,
|
||||
{ clipPath: clipInStart },
|
||||
{ clipPath: clipShown, duration: IN * 0.76, ease: "power1.inOut" },
|
||||
IN * 0.18,
|
||||
);
|
||||
} else {
|
||||
// The line erases as the front passes; particles carry it off.
|
||||
gsap.set(textLayer, { opacity: 1 });
|
||||
tl.fromTo(
|
||||
textLayer,
|
||||
{ clipPath: clipShown },
|
||||
{ clipPath: clipOutEnd, duration: IN * 0.76, ease: "power1.inOut" },
|
||||
IN * 0.18,
|
||||
);
|
||||
}
|
||||
|
||||
// HOLD: truly still. The canvas is one clear rect (every alpha
|
||||
// is exactly zero by the end of IN) and the line is either fully
|
||||
// shown or fully clipped; nothing drifts.
|
||||
|
||||
// OUT: optional departure; exit none holds until the frame cuts.
|
||||
if (exit === "up") {
|
||||
tl.to(stage, { y: "-4cqh", duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
tl.to(stage, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
} else if (exit === "fade") {
|
||||
tl.to(stage, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
}
|
||||
|
||||
tl.seek(0);
|
||||
paint(0);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["particle-text-dissolve"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: persona-card-fan at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>persona-card-fan 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="3" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="persona-card-fan"
|
||||
data-composition-src="./persona-card-fan.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="3" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,492 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
persona-card-fan: HyperFrames video primitive (options appear beside a speaker).
|
||||
|
||||
Portrait cards deal in one after another on the right of the frame. Each new
|
||||
card grows in place at the front, and the cards it displaces swing back into a
|
||||
narrow wedge whose OUTER edge is pinned: the deepest card never moves again,
|
||||
the new arrivals subdivide the same wedge, so the fan tightens as it fills.
|
||||
Presenter stays in the left third.
|
||||
|
||||
Envelope (D = 3.00s, 30fps):
|
||||
0.00-0.30 card 1 lands. It opens already 63% through its own deal, so
|
||||
frame zero is a card in flight, not an empty frame (Law 8).
|
||||
0.30-0.60 hold. One card, the drift is the only motion.
|
||||
0.60-1.10 DEAL 2. Card 2 grows in at the front, card 1 swings back to the
|
||||
wedge's outer edge (u = 1, 12.25 degrees).
|
||||
1.10-1.46 hold.
|
||||
1.46-1.96 DEAL 3. Card 3 grows in, card 2 takes the wedge's midpoint
|
||||
(u = 0.5), card 1 does not move.
|
||||
1.96-2.32 hold.
|
||||
2.32-2.82 DEAL 4. Card 4 grows in, cards 2 and 3 slide to u = 2/3 and 1/3,
|
||||
card 1 still does not move.
|
||||
2.82-3.00 landing. Drift only.
|
||||
0.00-3.00 the drift, running under all of it.
|
||||
|
||||
Reference: refs/b6/src/x-syn-roleplay.mp4, 00:59.5 to 01:06.5, sampled at
|
||||
10fps into refs/b6/frames/persona-card-fan (f001-f070), measured at 960x540
|
||||
and quoted as percentages of frame width (W) and height (H), or as multiples
|
||||
of the front card's own width (w = 214px = 22.3% of W).
|
||||
|
||||
front card, upright to within 1 degree (right-edge slope -0.8 deg on f047,
|
||||
+1.2 deg on f068). Edges on f068: left 605, right 818, top 31, bottom 337,
|
||||
i.e. 22.3% of W by 56.9% of H, aspect 0.70. Centre 74.1% of W, 34.1% of H.
|
||||
THE FAN COMPRESSES AS THE STACK FILLS, and this is the whole move. Per-slot
|
||||
exposure past the front card's right edge, averaged over three heights
|
||||
(y 90, y 180, y 300), measured on the settled frame at each count:
|
||||
2 cards (f046) one slot 0.25w
|
||||
3 cards (f058) per slot 0.13w
|
||||
4 cards (f062-f070) per slot 0.10w
|
||||
The wedge itself barely changes: the deepest card sits 0.40w out at the
|
||||
top corner whether the stack holds two cards or four. What changes is how
|
||||
many cards share that wedge. Following ONE card proves it: card 2 is 0.21w
|
||||
out when it is one of three (f058) and 0.28w out when it is one of four
|
||||
(f068), while card 1 sits at the outer edge from f042 to f070 and never
|
||||
moves again. So the slot is u = k / (n - 1), not a fixed step per card.
|
||||
slot transform, solved rather than guessed. Reading a right EDGE at fixed
|
||||
heights is underdetermined: scale, pivot depth and translate trade against
|
||||
each other and any of them fits. Two CORNERS per sliver fixes all four
|
||||
numbers exactly. Read at 8x on f068, as deltas from the front card's own
|
||||
corners in px at 960 wide:
|
||||
u = 1/3 top-right (+28, +24) bottom-right (+14, -13)
|
||||
u = 2/3 top-right (+50, +47) bottom-right (+26, -25)
|
||||
u = 1 top-right (+66, +67) bottom-right (+36, -36)
|
||||
The bottom-right corner rises while the top-right corner falls, so the
|
||||
back cards are visibly SHORTER, which no rotation alone can do. Solving
|
||||
each depth independently for scale, rotation and translate about the
|
||||
card's own centre gives three points on one straight line in u:
|
||||
u = 1/3 scale 0.881 rot 2.97 deg dx 0.158w dy 0.002H
|
||||
u = 2/3 scale 0.769 rot 5.83 deg dx 0.295w dy 0.009H
|
||||
u = 1 scale 0.672 rot 8.37 deg dx 0.406w dy 0.016H
|
||||
so the build carries scale 1 - 0.34u, rotation 8.6u degrees, dx 0.43wu,
|
||||
dy 0.013Hu, about transform-origin 50% 50%. Worst residual against the
|
||||
three measured depths is 3px on a 214px card.
|
||||
the deal is a centred scale-up, not a slide. On f036 the arriving card
|
||||
spans x 634 to 742, 108px against the settled 214 (scale 0.50), and its
|
||||
centre sits 12px left (0.056w) and 9px below the front slot's centre. It
|
||||
grows in place.
|
||||
deal curve, from the fan's outer edge across deal 2 (f035 to f040, drift
|
||||
subtracted): 0, 0.482, 0.726, 0.881, 0.929, 1. Fitted
|
||||
cb(0.321, 0.996, 0.727, 0.877), max error 0.98% of travel. The nearest
|
||||
palette curve, enterSoft, is 6.1% off, so the local fit ships.
|
||||
NO back-card veil. Sampling one card's own art as it recedes (card 2 at
|
||||
f046 front, f058 at u = 0.5, f068 at u = 0.67) shows no darkening at all;
|
||||
earlier rounds read a drop that was the difference between two different
|
||||
portraits. The depth cue in the reference is a CAST SHADOW: across f068 at
|
||||
y 100-150 each sliver opens with a notch to 0.82 of its own plateau and
|
||||
recovers over 6px (0.03w), then holds flat. So the cards carry a
|
||||
right-and-down box-shadow and no veil layer.
|
||||
drift, from the front card's own edges f030 to f068: right edge 794 to 818,
|
||||
left edge 579 to 605, i.e. 0.65% of W per second to the right, and top
|
||||
edge 29 to 31, bottom 340 to 337, i.e. vertically still. Carried as
|
||||
1.95cqw across D and zero vertical. Steady rate, so E.linear by
|
||||
measurement, not by convenience.
|
||||
cadence f027, f036, f048, f059 (0.9s, 1.2s, 1.1s), deal itself 0.5s.
|
||||
|
||||
Deviations, both declared:
|
||||
1. Cadence compressed from a 1.05s mean to 0.86s. Four arrivals at the
|
||||
reference's own spacing needs 4.2s and the tail would be dead runtime.
|
||||
The deal itself is untouched at 0.50s, and so is the curve.
|
||||
2. Copy, palette and card art are inventions. The reference's own cards
|
||||
carry photographic portraits and its own product's labels; nothing of
|
||||
either is reproduced here.
|
||||
|
||||
Presenter safe zone, 16:9: measured on the 1920x1080 shot frames, not on a
|
||||
contact sheet tile. The group's leftmost pixel is the front card's left edge
|
||||
at frame zero, 60.4% of W, and it only moves right from there. The
|
||||
presenter's left 32% is clear for the whole clip by 28 points.
|
||||
|
||||
Copy and colour are placeholders. Overridable on #root: --pcf-card,
|
||||
--pcf-ink, --pcf-sub, --pcf-chip, --pcf-a1..a4, --pcf-b1..b4, --pcf-c1..c4.
|
||||
|
||||
Media slot: .pcf-plate is a procedural gradient standing in for a portrait.
|
||||
Replace its background with a real image (background-image: url(...)) on each
|
||||
.pcf-k1..k4, keeping the .pcf-scrim above it so the title stays legible.
|
||||
|
||||
Mount contract: the runtime clones only this template; #root fills the host,
|
||||
carries no data-width or data-height, and registers one paused timeline under
|
||||
the hardcoded persona-card-fan id. Composed for 16:9; the container band
|
||||
below keeps 9:16 and 1:1 inside the frame rather than making them sing.
|
||||
-->
|
||||
<html lang="en" data-composition-id="persona-card-fan" data-composition-duration="3">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Persona Card Fan</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="persona-card-fan" data-duration="3" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
color: var(--pcf-ink, #f4f3f1);
|
||||
font-family: Inter, "Helvetica Neue", system-ui, sans-serif;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* The drift layer. It translates only: the reference's card keeps its
|
||||
measured size to within 3% while its position moves, and its top and
|
||||
bottom edges hold to 3px over 3.8s, so this is a graphic sliding
|
||||
sideways, not a camera pushing. */
|
||||
.pcf-drift {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
|
||||
/* A zero size anchor at the front card's measured centre, 74.1% of W
|
||||
and 34.1% of H at the end of the reference segment, so 71.5% of W at
|
||||
the start of it. Lateral, so cqw and cqh, never cqmin. The card hangs
|
||||
off it by half its own size in static CSS: no transform here, because
|
||||
GSAP owns the card's transform and would overwrite one. */
|
||||
.pcf-stage {
|
||||
position: absolute;
|
||||
top: 34cqh;
|
||||
left: 71.5cqw;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/* The reference card at its measured size: 22.3% of frame width by
|
||||
56.9% of frame height in a 16:9 frame, which is 39.6cqmin by
|
||||
56.9cqmin. Sized in cqmin so it keeps its shape in every aspect.
|
||||
The box-shadow is the fan's depth cue, offset right and down because
|
||||
in the reference each card shadows the sliver of the card BEHIND it,
|
||||
which lies to its right. */
|
||||
.pcf-card {
|
||||
position: absolute;
|
||||
top: -28.45cqmin;
|
||||
left: -19.8cqmin;
|
||||
overflow: hidden;
|
||||
width: 39.6cqmin;
|
||||
height: 56.9cqmin;
|
||||
border-radius: 2cqmin;
|
||||
background: var(--pcf-card, #101114);
|
||||
box-shadow: 1cqmin 0.7cqmin 1.5cqmin rgba(4, 5, 8, 0.55);
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.pcf-plate,
|
||||
.pcf-scrim {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
|
||||
/* Procedural stand-in for a portrait: a raking two stop gradient plus
|
||||
one soft off centre key, so each card reads as its own subject at a
|
||||
glance when only a sliver of it is showing. It runs the FULL card,
|
||||
not the top 60%: ending it early left a hard horizontal seam where
|
||||
the plate stopped, and the scrim is what should be hiding that. */
|
||||
.pcf-plate {
|
||||
background: linear-gradient(158deg, var(--pcf-a) 0%, var(--pcf-b) 100%);
|
||||
}
|
||||
|
||||
.pcf-plate::after {
|
||||
position: absolute;
|
||||
content: "";
|
||||
inset: 0;
|
||||
background: radial-gradient(50% 34% at 50% 27%, var(--pcf-c) 0%, transparent 76%);
|
||||
}
|
||||
|
||||
.pcf-scrim {
|
||||
top: 28%;
|
||||
background: linear-gradient(180deg, transparent 0%, var(--pcf-card, #101114) 64%);
|
||||
}
|
||||
|
||||
.pcf-body {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 2.99cqmin;
|
||||
left: 0;
|
||||
padding: 0 2.67cqmin;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pcf-title {
|
||||
margin: 0;
|
||||
font-size: 3.49cqmin;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.014em;
|
||||
line-height: 1.22;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pcf-sub {
|
||||
margin: 0.67cqmin 0 0;
|
||||
color: var(--pcf-sub, #a8a6a2);
|
||||
font-size: 2.57cqmin;
|
||||
font-weight: 500;
|
||||
font-variant-numeric: tabular-nums;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
.pcf-rule {
|
||||
display: block;
|
||||
width: 62%;
|
||||
height: 0.42cqmin;
|
||||
margin: 2.03cqmin auto 0;
|
||||
border-radius: 999px;
|
||||
background: rgba(244, 243, 241, 0.22);
|
||||
}
|
||||
|
||||
.pcf-chip {
|
||||
display: inline-block;
|
||||
margin-top: 2.03cqmin;
|
||||
padding: 1.01cqmin 3.29cqmin;
|
||||
border-radius: 999px;
|
||||
background: var(--pcf-chip, #24262c);
|
||||
font-size: 1.99cqmin;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.pcf-k1 {
|
||||
z-index: 1;
|
||||
--pcf-a: var(--pcf-a1, #47707c);
|
||||
--pcf-b: var(--pcf-b1, #23414f);
|
||||
--pcf-c: var(--pcf-c1, #9ecfc7);
|
||||
}
|
||||
.pcf-k2 {
|
||||
z-index: 2;
|
||||
--pcf-a: var(--pcf-a2, #9a6c33);
|
||||
--pcf-b: var(--pcf-b2, #46301a);
|
||||
--pcf-c: var(--pcf-c2, #e6bb79);
|
||||
}
|
||||
.pcf-k3 {
|
||||
z-index: 3;
|
||||
--pcf-a: var(--pcf-a3, #64497f);
|
||||
--pcf-b: var(--pcf-b3, #33254a);
|
||||
--pcf-c: var(--pcf-c3, #c3a6de);
|
||||
}
|
||||
.pcf-k4 {
|
||||
z-index: 4;
|
||||
--pcf-a: var(--pcf-a4, #857a65);
|
||||
--pcf-b: var(--pcf-b4, #45403a);
|
||||
--pcf-c: var(--pcf-c4, #efe3c9);
|
||||
}
|
||||
|
||||
/* Not the native shape. The move is composed for 16:9 and only has to
|
||||
stay inside the frame here. The card is 39.6% of the short side, and
|
||||
the wedge adds 0.40 of a card width, so the group is 71cqmin across;
|
||||
in 16:9 that is 40% of the frame and it sits where the reference puts
|
||||
it, in 9:16 and 1:1 the same group is 71% of the width and the stage
|
||||
recentres so it stays inside with a margin either side. Nothing is
|
||||
resized, so every proportion above is still the reference's. */
|
||||
@container (aspect-ratio < 1.4) {
|
||||
.pcf-stage {
|
||||
left: 52cqw;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="pcf-drift">
|
||||
<div class="pcf-stage">
|
||||
<article class="pcf-card pcf-k1">
|
||||
<span class="pcf-plate"></span>
|
||||
<span class="pcf-scrim"></span>
|
||||
<div class="pcf-body">
|
||||
<h3 class="pcf-title">Harbour Yard</h3>
|
||||
<p class="pcf-sub">Sector 04</p>
|
||||
<span class="pcf-rule"></span>
|
||||
<span class="pcf-chip">Open</span>
|
||||
</div>
|
||||
</article>
|
||||
<article class="pcf-card pcf-k2">
|
||||
<span class="pcf-plate"></span>
|
||||
<span class="pcf-scrim"></span>
|
||||
<div class="pcf-body">
|
||||
<h3 class="pcf-title">Meridian Works</h3>
|
||||
<p class="pcf-sub">Sector 11</p>
|
||||
<span class="pcf-rule"></span>
|
||||
<span class="pcf-chip">Open</span>
|
||||
</div>
|
||||
</article>
|
||||
<article class="pcf-card pcf-k3">
|
||||
<span class="pcf-plate"></span>
|
||||
<span class="pcf-scrim"></span>
|
||||
<div class="pcf-body">
|
||||
<h3 class="pcf-title">Fernwood Depot</h3>
|
||||
<p class="pcf-sub">Sector 26</p>
|
||||
<span class="pcf-rule"></span>
|
||||
<span class="pcf-chip">Open</span>
|
||||
</div>
|
||||
</article>
|
||||
<article class="pcf-card pcf-k4">
|
||||
<span class="pcf-plate"></span>
|
||||
<span class="pcf-scrim"></span>
|
||||
<div class="pcf-body">
|
||||
<h3 class="pcf-title">Beacon Terrace</h3>
|
||||
<p class="pcf-sub">Sector 33</p>
|
||||
<span class="pcf-rule"></span>
|
||||
<span class="pcf-chip">Open</span>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// Cubic-bezier as a GSAP ease. Pure function of progress, so seek-safe:
|
||||
// seek(t) always yields the same value, no internal state to drift.
|
||||
// Newton-Raphson on x, bisection where the slope flattens.
|
||||
function cb(x1, y1, x2, y2) {
|
||||
var A = function (a, b) { return 1 - 3 * b + 3 * a; }, C = function (a) { return 3 * a; };
|
||||
var B = function (a, b) { return 3 * b - 6 * a; };
|
||||
var f = function (t, a, b) { return ((A(a, b) * t + B(a, b)) * t + C(a)) * t; };
|
||||
var d = function (t, a, b) { return 3 * A(a, b) * t * t + 2 * B(a, b) * t + C(a); };
|
||||
return function (p) {
|
||||
if (p <= 0) return 0;
|
||||
if (p >= 1) return 1;
|
||||
var t = p, i, s, e;
|
||||
for (i = 0; i < 8; i++) {
|
||||
s = d(t, x1, x2);
|
||||
if (s === 0) break;
|
||||
e = f(t, x1, x2) - p;
|
||||
if (Math.abs(e) < 1e-7) break;
|
||||
t -= e / s;
|
||||
}
|
||||
if (t < 0 || t > 1) {
|
||||
var lo = 0, hi = 1, j, v;
|
||||
t = p;
|
||||
for (j = 0; j < 30; j++) {
|
||||
v = f(t, x1, x2);
|
||||
if (Math.abs(v - p) < 1e-7) break;
|
||||
if (v > p) hi = t; else lo = t;
|
||||
t = (lo + hi) / 2;
|
||||
}
|
||||
}
|
||||
return f(t, y1, y2);
|
||||
};
|
||||
}
|
||||
|
||||
var E = {
|
||||
enterSoft: cb(0.33, 0.7, 0.35, 1.0),
|
||||
// Fitted to the fan's outer edge across deal 2 of the reference,
|
||||
// f035 to f040 with the drift subtracted (0, 0.482, 0.726, 0.881,
|
||||
// 0.929, 1). Max error 0.98% of travel; enterSoft, the nearest
|
||||
// palette curve, is 6.1% off.
|
||||
deal: cb(0.321, 0.996, 0.727, 0.877),
|
||||
// The drift is a steady rate in the reference, so it is linear by
|
||||
// measurement rather than by convenience. See the header.
|
||||
linear: function (p) { return p; },
|
||||
};
|
||||
|
||||
gsap.defaults({ immediateRender: false });
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var drift = root.querySelector(".pcf-drift");
|
||||
var cards = [].slice.call(root.querySelectorAll(".pcf-card"));
|
||||
|
||||
// GSAP writes transforms as px, so cq units do not survive on a tween.
|
||||
// Read them at build time. Lateral travel is cqw; the card's own box
|
||||
// is cqmin, mirroring the CSS, so the entry offsets below stay in
|
||||
// proportion to the card in all three aspects.
|
||||
var UW = (root.clientWidth || 1920) / 100;
|
||||
var UMIN = Math.min(root.clientWidth || 1920, root.clientHeight || 1080) / 100;
|
||||
var CW = 39.6 * UMIN;
|
||||
var CH = 56.9 * UMIN;
|
||||
|
||||
// The wedge, solved from the reference's own corners: the top-right
|
||||
// and bottom-right corner of every sliver on f068, read at 8x, against
|
||||
// the front card's corners. Two corners fix all four numbers, and all
|
||||
// three depths land on the same straight line in u (see the header).
|
||||
// Everything is about the card's own centre.
|
||||
var ROT = 8.6, DS = 0.34, DXC = 0.43, DYC = 0.013;
|
||||
|
||||
// Depth inside the wedge. Card i of n on screen sits at slot n-1-i,
|
||||
// and the slots SUBDIVIDE the wedge instead of stepping through it:
|
||||
// the oldest card is pinned at u = 1 from the moment it is displaced,
|
||||
// and every arrival pushes the cards between it and the front closer
|
||||
// together. That is the compression the reference has and a fixed
|
||||
// per-slot step does not: one slot back is 0.25w when two cards are
|
||||
// up and 0.10w when four are.
|
||||
function u(i, n) {
|
||||
return n < 2 ? 0 : (n - 1 - i) / (n - 1);
|
||||
}
|
||||
|
||||
function slot(uu) {
|
||||
return {
|
||||
x: DXC * CW * uu,
|
||||
y: DYC * CH * uu,
|
||||
rotation: ROT * uu,
|
||||
scale: 1 - DS * uu,
|
||||
};
|
||||
}
|
||||
|
||||
// Where a card is dealt from. The reference grows it in place: on f036
|
||||
// the arriving card is 108px against the settled 214 (scale 0.50) with
|
||||
// its centre 0.056w left and 0.029 card heights below the front slot's.
|
||||
// The origin is the card's own centre, so that is the whole entry: no
|
||||
// lateral slide, no compensating lift.
|
||||
var SE = 0.5;
|
||||
function entry() {
|
||||
return { x: -0.056 * CW, y: 0.029 * CH, rotation: 0, scale: SE };
|
||||
}
|
||||
|
||||
// Card 1 opens 63% of the way through its own deal, so frame zero is a
|
||||
// card in flight rather than an empty frame or a full stop.
|
||||
var OPEN = 0.63;
|
||||
function partial() {
|
||||
var a = entry(), b = slot(0), o = {};
|
||||
["x", "y", "rotation", "scale"].forEach(function (k) {
|
||||
o[k] = a[k] + (b[k] - a[k]) * OPEN;
|
||||
});
|
||||
return o;
|
||||
}
|
||||
|
||||
var D = 3.0, DEAL = 0.5, FADE = 0.09;
|
||||
var AT = [0, 0.6, 1.46, 2.32];
|
||||
|
||||
// Rest state pinned outside the timeline, both ends written on every
|
||||
// tween, so a seek never inherits a start value from the screen.
|
||||
gsap.set(cards, { transformOrigin: "50% 50%" });
|
||||
gsap.set(drift, { x: 0, y: 0 });
|
||||
gsap.set(cards[0], Object.assign(partial(), { opacity: 1 }));
|
||||
cards.slice(1).forEach(function (c) {
|
||||
gsap.set(c, Object.assign(entry(), { opacity: 0 }));
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
// The drift, under everything. It is the layer that is still moving
|
||||
// through every hold and through every deal's tail, which is how the
|
||||
// strong-out deal curve stays legal (Law 3, the overlap clause).
|
||||
tl.fromTo(drift, { x: 0 }, { x: 1.95 * UW, duration: D, ease: E.linear }, 0);
|
||||
|
||||
tl.fromTo(cards[0], partial(), Object.assign(slot(0), { duration: 0.3, ease: E.enterSoft }), 0);
|
||||
|
||||
// One deal, one window. The arriving card and every card it displaces
|
||||
// ride the same 0.50s and the same curve, so the whole wedge reads as
|
||||
// one gesture instead of four events.
|
||||
for (var d = 1; d < cards.length; d++) {
|
||||
var t0 = AT[d];
|
||||
tl.fromTo(cards[d], entry(), Object.assign(slot(0), { duration: DEAL, ease: E.deal }), t0);
|
||||
tl.fromTo(cards[d], { opacity: 0 }, { opacity: 1, duration: FADE, ease: E.enterSoft }, t0);
|
||||
for (var i = 0; i < d; i++) {
|
||||
tl.fromTo(cards[i], slot(u(i, d)), Object.assign(slot(u(i, d + 1)), { duration: DEAL, ease: E.deal }), t0);
|
||||
}
|
||||
}
|
||||
|
||||
tl.set({}, {}, D); // pin the full duration
|
||||
tl.seek(0);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["persona-card-fan"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 5.1 KiB |
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: pill-row-collapse at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>pill-row-collapse 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="3" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="pill-row-collapse"
|
||||
data-composition-src="./pill-row-collapse.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="3" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,487 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
pill-row-collapse: HyperFrames video primitive (process / narrowing).
|
||||
|
||||
A five stage pipeline builds itself as a row of labelled pills, holds a beat,
|
||||
then the row spreads and clears while the first pill glides to dead centre.
|
||||
|
||||
Measured from reference-shipos.mp4, 5.0s to 7.0s. Reference geometry as fractions
|
||||
of the 1920x1080 source, and the anti-slop gate: row band y 44.63 to 55.40
|
||||
(pill height 10.5%), row span x 7.34 to 92.08 (84.7% of width), gap 3.0% of
|
||||
width, caption band y 83.9 to 95.6, label ink 5.46% of frame height. Pill
|
||||
height, type scale, dot and paddings are cqmin against those; the gap is the
|
||||
one lateral measurement, so cqw.
|
||||
Labels and caption text live in the markup. Overridable on #root: --prc-bg,
|
||||
--prc-ink, --prc-caption, --prc-active, --prc-fill-1..5, --prc-dot-1..5.
|
||||
Envelope (D = 3.00s): BUILD 0.00-1.40, pills seed and type in left to right,
|
||||
pill 1 already mid-type-in on frame zero, the caption settling under them and
|
||||
landing with the last one. HOLD 1.40-1.90, row and caption both dead still, the
|
||||
only window in which five labels can be read. COLLAPSE 1.90-2.70, every pill
|
||||
translates along the row axis, further the higher its index; 2 to 5 clear frame
|
||||
and fade, 1 re-centres and darkens active. The caption cuts out on the first
|
||||
collapse frame, the slot holds empty, and the new line cuts in from 2.20.
|
||||
|
||||
The type-in is a clip, not a width. --prc-r is the pixels cut off the label's
|
||||
right edge, quantised to character boundaries so a glyph is never bisected;
|
||||
the capsule cuts by the same value minus --prc-lead, so it always leads the
|
||||
caret by one pill radius of empty fill, and clamps at 0, which is both the
|
||||
rest state and the seed floor. Letters never scale, Layout is never touched.
|
||||
Mount contract: the runtime clones only this template; #root fills the host,
|
||||
carries no data-width or data-height, and registers one paused timeline under
|
||||
the hardcoded pill-row-collapse id.
|
||||
-->
|
||||
<html lang="en" data-composition-id="pill-row-collapse" data-composition-duration="3">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Pill Row Collapse</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="pill-row-collapse" data-duration="3" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
background: var(--prc-bg, #f6f6f3);
|
||||
color: var(--prc-ink, #2b2a28);
|
||||
font-family: Inter, "Helvetica Neue", system-ui, sans-serif;
|
||||
pointer-events: none;
|
||||
|
||||
/* One scale knob. Every pill measurement hangs off it so an aspect
|
||||
change is a single number, never a second set of rules. */
|
||||
--prc-s: 1;
|
||||
--prc-h: calc(var(--prc-s) * 10.5cqmin);
|
||||
--prc-fs: calc(var(--prc-s) * 6.05cqmin);
|
||||
--prc-dot-size: calc(var(--prc-s) * 3.2cqmin);
|
||||
--prc-pad-l: calc(var(--prc-s) * 2.7cqmin);
|
||||
--prc-pad-r: calc(var(--prc-s) * 3.1cqmin);
|
||||
--prc-dot-gap: calc(var(--prc-s) * 2.7cqmin);
|
||||
/* How far the capsule's right edge leads the last visible glyph. One
|
||||
pill radius, minus the right padding the capsule leads by for free
|
||||
because the pill is sized to its content. */
|
||||
--prc-lead: calc(var(--prc-h) / 2 - var(--prc-pad-r));
|
||||
}
|
||||
|
||||
/* Row band centre sits at 50% of frame height, which is where the
|
||||
measured band 44.63 to 55.40 puts it. */
|
||||
.prc-row {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2.45cqw;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.prc-pill {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
height: var(--prc-h);
|
||||
padding: 0 var(--prc-pad-r) 0 var(--prc-pad-l);
|
||||
/* Rest state. The rounded inset is always on, so the capsule needs no
|
||||
border-radius of its own: this one declaration is both the shape
|
||||
and the type-in mechanism. Cut by the label's cut minus the lead,
|
||||
clamped at zero, so mid-type the capsule stands one radius past the
|
||||
caret and at rest it is the full pill. The clamp is also why the
|
||||
seed is a capsule and not a sliver: it never narrows past
|
||||
(content offset + radius), which is wider than the pill is tall. */
|
||||
clip-path: inset(0px max(0px, calc(var(--prc-r, 0) * 1px - var(--prc-lead))) 0px 0px round 999px);
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.prc-fill,
|
||||
.prc-veil {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
|
||||
.prc-fill {
|
||||
background: var(--prc-tint);
|
||||
}
|
||||
|
||||
/* The active state. One opacity tween darkens fill, dot and label
|
||||
together, which is what the reference does when the survivor lands. */
|
||||
.prc-veil {
|
||||
background: var(--prc-active, #201f1d);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.prc-dot {
|
||||
position: relative;
|
||||
flex: 0 0 auto;
|
||||
width: var(--prc-dot-size);
|
||||
height: var(--prc-dot-size);
|
||||
margin-right: var(--prc-dot-gap);
|
||||
border-radius: 50%;
|
||||
background: var(--prc-mark);
|
||||
transform-origin: 50% 50%;
|
||||
}
|
||||
|
||||
.prc-lbl {
|
||||
position: relative;
|
||||
/* Bleed vertically. The label box is one em tall at line-height 1, so a
|
||||
flat inset(0 ...) shears the descender off every g, p and y; the
|
||||
landing frame of this shot is the word Triage, which made it obvious.
|
||||
Only the right edge is doing work here, so give the other three room. */
|
||||
clip-path: inset(-50% calc(var(--prc-r, 0) * 1px) -50% 0px);
|
||||
font-size: var(--prc-fs);
|
||||
font-weight: 500;
|
||||
letter-spacing: -0.012em;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.prc-p1 {
|
||||
--prc-tint: var(--prc-fill-1, #e1dfdb);
|
||||
--prc-mark: var(--prc-dot-1, #979591);
|
||||
}
|
||||
.prc-p2 {
|
||||
--prc-tint: var(--prc-fill-2, #ecdfb3);
|
||||
--prc-mark: var(--prc-dot-2, #bd9131);
|
||||
}
|
||||
.prc-p3 {
|
||||
--prc-tint: var(--prc-fill-3, #cbdeef);
|
||||
--prc-mark: var(--prc-dot-3, #3c82c8);
|
||||
}
|
||||
.prc-p4 {
|
||||
--prc-tint: var(--prc-fill-4, #e6daef);
|
||||
--prc-mark: var(--prc-dot-4, #9a74b7);
|
||||
}
|
||||
.prc-p5 {
|
||||
--prc-tint: var(--prc-fill-5, #d5e5d5);
|
||||
--prc-mark: var(--prc-dot-5, #639e74);
|
||||
}
|
||||
|
||||
/* Caption band. Bottom anchored at the measured 95.6, not top anchored,
|
||||
so a one line caption and a two line caption share a baseline and the
|
||||
cut lands the new copy where the old copy sat. The reference grey (#b4b4b4)
|
||||
is 1.9:1 here and unreadable: the reference is a bold burned in
|
||||
subtitle with an outline, ours is thin text on paper, so copying the
|
||||
hex reproduced the value and lost the legibility. 5.5:1 instead. */
|
||||
.prc-cap {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 4.4cqh;
|
||||
left: 0;
|
||||
color: var(--prc-caption, #6b6b66);
|
||||
padding: 0 5cqw;
|
||||
filter: blur(calc(var(--prc-blur, 0) * 1px));
|
||||
/* Not scaled by --prc-s. The pills grow in portrait so a column does
|
||||
not read as an island; the caption does not, because cqmin already
|
||||
tracks the short side and a scaled caption overruns the frame. */
|
||||
font-size: 4.9cqmin;
|
||||
font-weight: 500;
|
||||
line-height: 1.3;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.prc-cap-b {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* Portrait and square. A five wide row of capsules cannot hold 84.7% of
|
||||
the width legibly below about 4:3, so the row becomes a column and the
|
||||
same three phases run with the axis swapped. No scale bump at square:
|
||||
stacking five pills already spends 66% of the height, so the 1.15 this
|
||||
once carried only bought a 12% pill and a 5% bottom margin, which read
|
||||
as a denser variant rather than the same move at a different crop.
|
||||
Only the tall crop needs the bump, and it gets it below. */
|
||||
@container (aspect-ratio < 1.35) {
|
||||
/* Centred, not left aligned: the survivor only moves on the column axis,
|
||||
so whatever cross-axis position the layout gives it is where it lands.
|
||||
Left aligned, Triage is narrower than Review and the shot ends with
|
||||
the subject sitting off centre. */
|
||||
.prc-row {
|
||||
top: 57%;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: calc(var(--prc-s) * 3.4cqmin);
|
||||
}
|
||||
|
||||
/* The caption moves above the column, and the column drops to 57%, for
|
||||
one reason: the losers exit downward here, and with the caption in
|
||||
its landscape slot every pill in the lower half wiped across the copy
|
||||
on its way out. Reading order stays caption-then-subject either way. */
|
||||
.prc-cap {
|
||||
top: 3cqh;
|
||||
bottom: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@container (aspect-ratio < 0.95) {
|
||||
#root {
|
||||
--prc-s: 1.5;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="prc-row">
|
||||
<div class="prc-pill prc-p1">
|
||||
<span class="prc-fill"></span>
|
||||
<span class="prc-dot"></span>
|
||||
<span class="prc-lbl">Triage</span>
|
||||
<span class="prc-veil"></span>
|
||||
</div>
|
||||
<div class="prc-pill prc-p2">
|
||||
<span class="prc-fill"></span>
|
||||
<span class="prc-dot"></span>
|
||||
<span class="prc-lbl">Plan</span>
|
||||
<span class="prc-veil"></span>
|
||||
</div>
|
||||
<div class="prc-pill prc-p3">
|
||||
<span class="prc-fill"></span>
|
||||
<span class="prc-dot"></span>
|
||||
<span class="prc-lbl">Build</span>
|
||||
<span class="prc-veil"></span>
|
||||
</div>
|
||||
<div class="prc-pill prc-p4">
|
||||
<span class="prc-fill"></span>
|
||||
<span class="prc-dot"></span>
|
||||
<span class="prc-lbl">Review</span>
|
||||
<span class="prc-veil"></span>
|
||||
</div>
|
||||
<div class="prc-pill prc-p5">
|
||||
<span class="prc-fill"></span>
|
||||
<span class="prc-dot"></span>
|
||||
<span class="prc-lbl">Ship</span>
|
||||
<span class="prc-veil"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="prc-cap prc-cap-a">Every stage of the work, from raw<br />feedback to a shipped product.</div>
|
||||
<div class="prc-cap prc-cap-b">First up is triage.</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// Cubic-bezier as a GSAP ease. Pure function of progress, so seek-safe:
|
||||
// seek(t) always yields the same value, no internal state to drift.
|
||||
// Newton-Raphson on x, bisection where the slope flattens.
|
||||
function cb(x1, y1, x2, y2) {
|
||||
var A = function (a, b) { return 1 - 3 * b + 3 * a; }, C = function (a) { return 3 * a; };
|
||||
var B = function (a, b) { return 3 * b - 6 * a; };
|
||||
var f = function (t, a, b) { return ((A(a, b) * t + B(a, b)) * t + C(a)) * t; };
|
||||
var d = function (t, a, b) { return 3 * A(a, b) * t * t + 2 * B(a, b) * t + C(a); };
|
||||
return function (p) {
|
||||
if (p <= 0) return 0;
|
||||
if (p >= 1) return 1;
|
||||
var t = p, i, s, e;
|
||||
for (i = 0; i < 8; i++) {
|
||||
s = d(t, x1, x2);
|
||||
if (s === 0) break;
|
||||
e = f(t, x1, x2) - p;
|
||||
if (Math.abs(e) < 1e-7) break;
|
||||
t -= e / s;
|
||||
}
|
||||
if (t < 0 || t > 1) {
|
||||
var lo = 0, hi = 1, j, v;
|
||||
t = p;
|
||||
for (j = 0; j < 30; j++) {
|
||||
v = f(t, x1, x2);
|
||||
if (Math.abs(v - p) < 1e-7) break;
|
||||
if (v > p) hi = t; else lo = t;
|
||||
t = (lo + hi) / 2;
|
||||
}
|
||||
}
|
||||
return f(t, y1, y2);
|
||||
};
|
||||
}
|
||||
|
||||
// Named for what they do in a shot. No GSAP preset appears here on
|
||||
// purpose: a named ease is a category, not a curve.
|
||||
var E = {
|
||||
enterSoft: cb(0.33, 0.7, 0.35, 1.0),
|
||||
camSettle: cb(0.16, 0.84, 0.28, 1.0),
|
||||
morph: cb(0.65, 0.05, 0.35, 1.0),
|
||||
springSm: cb(0.34, 1.3, 0.5, 1.0),
|
||||
// Fitted to the losers, not from the palette: exitAway's lazy start
|
||||
// lets the survivor outrun the pill on its right and the capsules
|
||||
// overlap a third of the way through. The measured losers move on the
|
||||
// collapse's first frame, because this is a row spreading apart, not
|
||||
// four objects deciding to leave. Fitted to pill 2's deltas (4.8, 12.0,
|
||||
// 27.4, 35.5 as % of width), RMS 1.3%; minimum gap to the survivor
|
||||
// across the collapse is the 3.0% rest gap, so the losers always lead.
|
||||
spread: cb(0.2, 0.0, 0.5, 0.7),
|
||||
// Fitted to the survivor's left-edge travel (7.6, 8.5, 10.7, 19.1,
|
||||
// 28.5, 36.7, 39.3, 40.9, 42.1, 42.4 as % of width), max error 2.9% of
|
||||
// travel; camPush, the nearest palette curve, is 12.7% off. The lazy
|
||||
// start is the point: the pill barely moves while the others leave.
|
||||
recentre: cb(0.54, 0.06, 0.18, 0.94),
|
||||
};
|
||||
|
||||
gsap.defaults({ immediateRender: false });
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var pills = [].slice.call(root.querySelectorAll(".prc-pill"));
|
||||
var capA = root.querySelector(".prc-cap-a");
|
||||
var capB = root.querySelector(".prc-cap-b");
|
||||
|
||||
var rootW = root.clientWidth || 1920, rootH = root.clientHeight || 1080;
|
||||
// GSAP writes transforms as px, so a cqmin tween distance would not
|
||||
// survive. Read the unit once, at build time, and multiply.
|
||||
var U = Math.min(rootW, rootH) / 100 || 10.8;
|
||||
|
||||
// Which layout the container query built, read off the real boxes
|
||||
// rather than re-deriving the threshold. One source of truth.
|
||||
var r0 = pills[0].getBoundingClientRect();
|
||||
var stacked = pills[1].getBoundingClientRect().top > r0.bottom - 1;
|
||||
var axisLen = stacked ? rootH : rootW;
|
||||
|
||||
// Per pill and per k: the px right-edge cut leaving exactly the first k
|
||||
// characters showing. Measured with a Range over the text node, so it
|
||||
// holds for whatever font resolves and for the negative letter spacing.
|
||||
// stops[0] hides the label, which is also the seed cut.
|
||||
var stops = pills.map(function (pill) {
|
||||
var lbl = pill.querySelector(".prc-lbl");
|
||||
var node = lbl.firstChild;
|
||||
var right = lbl.getBoundingClientRect().right;
|
||||
var range = document.createRange();
|
||||
var out = [];
|
||||
for (var k = 0; k <= node.nodeValue.length; k++) {
|
||||
range.setStart(node, 0); range.setEnd(node, k);
|
||||
out.push(Math.max(0, right - range.getBoundingClientRect().right));
|
||||
}
|
||||
return out;
|
||||
});
|
||||
var cut = stops.map(function (s) { return s[0]; });
|
||||
|
||||
// Quantise a curve so the reveal only rests on a character boundary. A
|
||||
// continuous clip cuts whatever glyph it lands in, which is a wipe;
|
||||
// stepping glyph by glyph is typing. Still a pure function of progress,
|
||||
// so seek-safe: no caret state, no callback.
|
||||
function typed(base, list, from) {
|
||||
var q = list
|
||||
.filter(function (w) { return w <= from; })
|
||||
.map(function (w) { return 1 - w / from; });
|
||||
return function (p) {
|
||||
var v = base(p), best = 0;
|
||||
for (var i = 0; i < q.length; i++) if (q[i] <= v && q[i] > best) best = q[i];
|
||||
return best;
|
||||
};
|
||||
}
|
||||
|
||||
// The survivor lands dead centre of the frame on the row axis.
|
||||
var recentreBy = stacked
|
||||
? rootH / 2 - (r0.top + r0.height / 2)
|
||||
: rootW / 2 - (r0.left + r0.width / 2);
|
||||
|
||||
// Displacement grows with index, spreading the row rather than sliding
|
||||
// it: the reference's 1 : 1.17 : 1.35 : 1.55 ratio. Object permanence
|
||||
// (Law 4): each carries its pill past the far edge, so the fade only
|
||||
// catches the slowest after most of the travel is already done.
|
||||
var away = [0, 0.8, 0.94, 1.08, 1.24].map(function (f) { return f * axisLen; });
|
||||
|
||||
var D = Math.max(0.001, parseFloat(root.dataset.duration || "3"));
|
||||
var s = D < 3 ? D / 3 : 1; // compress the beats, never the order
|
||||
|
||||
function setR(pill, v) { pill.style.setProperty("--prc-r", String(v)); }
|
||||
function dots(list) { return list.map(function (p) { return p.querySelector(".prc-dot"); }); }
|
||||
|
||||
// Every pill gets a visible typing beat. Pill 1 opens part typed, snapped
|
||||
// to a character boundary, so frame zero is a whole word fragment and a
|
||||
// delivered frame (Law 8) with no beat lost.
|
||||
var STEP = 0.25 * s, TYPE = 0.46 * s, P1_LEFT = 0.55;
|
||||
var p1From = stops[0].reduce(function (a, w) {
|
||||
return Math.abs(w - cut[0] * P1_LEFT) < Math.abs(a - cut[0] * P1_LEFT) ? w : a;
|
||||
}, cut[0]);
|
||||
|
||||
// Rest state pinned outside the timeline, both ends written on every
|
||||
// tween, so a seek never inherits a start value from the screen.
|
||||
pills.forEach(function (pill, i) { setR(pill, i ? cut[i] : p1From); });
|
||||
gsap.set(pills, { x: 0, y: 0 });
|
||||
gsap.set(pills[0], { opacity: 1 });
|
||||
gsap.set(pills.slice(1), { opacity: 0 });
|
||||
gsap.set(root.querySelectorAll(".prc-dot"), { scale: 1 });
|
||||
gsap.set(dots(pills.slice(1)), { scale: 0.92 });
|
||||
gsap.set(root.querySelectorAll(".prc-veil"), { opacity: 0 });
|
||||
capA.style.setProperty("--prc-blur", "1.2");
|
||||
gsap.set(capA, { opacity: 1, y: 2.2 * U });
|
||||
gsap.set(capB, { opacity: 0, y: 1.4 * U });
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
// BUILD. A pill arrives as a whole seeded capsule with its dot already
|
||||
// in it, never a dotless sliver: the clip-path clamp holds the seed at
|
||||
// (content offset + one radius), wider than the pill is tall, so the
|
||||
// smallest state is a real pill. Then the label types out of it.
|
||||
function build(i, at) {
|
||||
var pill = pills[i];
|
||||
tl.fromTo(pill, { opacity: 0 }, { opacity: 1, duration: 0.08 * s, ease: E.enterSoft }, at);
|
||||
tl.fromTo(pill.querySelector(".prc-dot"), { scale: 0.92 }, { scale: 1, duration: 0.3 * s, ease: E.springSm }, at);
|
||||
tl.fromTo(pill, { "--prc-r": cut[i] }, { "--prc-r": 0, duration: TYPE, ease: typed(E.morph, stops[i], cut[i]) }, at);
|
||||
}
|
||||
|
||||
// Pill 1 gets the tail of its own type-in and none of the entrance, so
|
||||
// it rides an ease-out; restarting an ease-in-out from rest would read
|
||||
// as a stutter on the opening frame.
|
||||
tl.fromTo(pills[0], { "--prc-r": p1From }, { "--prc-r": 0, duration: TYPE * P1_LEFT, ease: typed(E.camSettle, stops[0], p1From) }, 0);
|
||||
build(1, 0.06 * s);
|
||||
build(2, 0.06 * s + STEP);
|
||||
build(3, 0.06 * s + STEP * 2);
|
||||
build(4, 0.06 * s + STEP * 3);
|
||||
|
||||
// HOLD, 1.40 to 1.90. The caption lands with the last pill so the hold is
|
||||
// frame wide. Letting it settle into the hold instead made it the one
|
||||
// moving thing in the beat whose entire job is stillness: 21px of upward
|
||||
// creep under a frozen row reads as drift, not as a held frame. The render
|
||||
// goes bit-identical from 1.35, where the settle's last 50ms is sub-pixel.
|
||||
// audit-hold 1.30 1.90 ref reference-shipos f-006..f-010 (5.5-5.9s) dead still
|
||||
// at 1920x1080: row band y440-640 moves 0.000 to 0.006% of pixels over a
|
||||
// 16-level threshold, caption band y860-1060 moves 0.000%. The reference
|
||||
// holds the whole frame for 0.4s before its collapse; this holds 0.5s.
|
||||
tl.fromTo(capA, { y: 2.2 * U }, { y: 0, duration: 1.1 * s, ease: E.morph }, 0.3 * s);
|
||||
tl.fromTo(capA, { "--prc-blur": 1.2 }, { "--prc-blur": 0, duration: 1.1 * s, ease: E.morph }, 0.3 * s);
|
||||
|
||||
var CO = 1.9 * s, CD = 0.8 * s;
|
||||
|
||||
// COLLAPSE. The four losers accelerate away on one shared window; the
|
||||
// survivor rides the fitted curve to centre on the same window, so the
|
||||
// two reads are one gesture rather than two events. axis() picks the
|
||||
// translate channel from the layout the container query actually built.
|
||||
function axis(v) { return stacked ? { y: v } : { x: v }; }
|
||||
[1, 2, 3, 4].forEach(function (i) {
|
||||
tl.fromTo(pills[i], axis(0), Object.assign(axis(away[i]), { duration: CD, ease: E.spread }), CO);
|
||||
// One shared fade window, no stagger: the index-scaled distance already
|
||||
// makes them leave in order, so a staggered fade reads as four decisions.
|
||||
tl.fromTo(pills[i], { opacity: 1 }, { opacity: 0, duration: 0.24 * s, ease: E.morph }, CO + 0.16 * s);
|
||||
});
|
||||
tl.fromTo(pills[0], axis(0), Object.assign(axis(recentreBy), { duration: CD, ease: E.recentre }), CO);
|
||||
|
||||
// The survivor becomes the active item as it lands, timed to run past the
|
||||
// position tween's dead tail (Law 3). 0.06, not 0.15: the reference barely
|
||||
// darkens the fill, and one veil over the capsule buys fill and dot at once.
|
||||
tl.fromTo(pills[0].querySelector(".prc-veil"), { opacity: 0 }, { opacity: 0.06, duration: 0.7 * s, ease: E.morph }, CO + 0.4 * s);
|
||||
|
||||
// CAPTION CUT. A cut with a gap, not a cross fade. The old line leaves on
|
||||
// the collapse's first frame, the slot sits empty, and the new line
|
||||
// arrives at full strength: the two strings never share the band, so it
|
||||
// never doubles in height and the contrast never dips. Cross fading them
|
||||
// under a blur put both on screen for 0.3s at 1.9:1. The reference cuts.
|
||||
tl.fromTo(capA, { opacity: 1 }, { opacity: 0, duration: 0.15 * s, ease: E.morph }, CO);
|
||||
tl.fromTo(capB, { opacity: 0 }, { opacity: 1, duration: 0.24 * s, ease: E.enterSoft }, CO + 0.3 * s);
|
||||
tl.fromTo(capB, { y: 1.4 * U }, { y: 0, duration: 0.5 * s, ease: E.camSettle }, CO + 0.3 * s);
|
||||
|
||||
tl.set({}, {}, D); // pin the full duration
|
||||
tl.seek(0);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["pill-row-collapse"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 7.9 KiB |
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: plan-room-audit at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>plan-room-audit 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="3.2" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="plan-room-audit"
|
||||
data-composition-src="./plan-room-audit.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="3.2" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,544 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
plan-room-audit: HyperFrames video primitive (spec audit / floor plan).
|
||||
|
||||
A floor plan sheet spins into square, draws itself on the way, then audits
|
||||
itself room by room. Native orientation 9:16, composed for it only.
|
||||
|
||||
Envelope (D = 3.20s, all beats scale with D):
|
||||
SPIN 0.00-1.70 the sheet sweeps 69.5deg clockwise, from -69.5 to
|
||||
square, and grows 0.897 to 1.000. Its silhouette goes
|
||||
landscape (1.019) through 1.000 at 45deg to portrait
|
||||
(0.960): the sheet changes orientation as it turns.
|
||||
1.70s is reference C's own measured settle duration.
|
||||
DRAW 0.00-0.62 one continuous outer wall path strokes on while the
|
||||
sheet is still turning, seeded 34% inked at t=0, which
|
||||
is past the first corner, so frame zero holds a plan
|
||||
rather than a bare bar.
|
||||
PARTS 0.48-1.08 four interior partitions draw, 0.10 apart. The outer
|
||||
corners land at 0.62, before any fill starts.
|
||||
AUDIT 1.24-3.02 five rooms fill in reading order, 0.30 apart, each fill
|
||||
scaling out of its OWN centroid (0.60 to 1.00); its
|
||||
leader draws 0.10 later, its value tag drops onto the
|
||||
leader 0.18 later over 0.40s, and the meter ticks 0/5 to
|
||||
5/5 in step so the number and the filled rooms always
|
||||
agree. The audit opens inside the spin's tail (first
|
||||
fill at -11.0deg) so no beat is spent on a parked frame,
|
||||
and every tag lands after the sheet is square: that is
|
||||
how the full amplitude is bought without counter
|
||||
rotating a single label.
|
||||
LOCK 2.66-3.20 every room fill ramps 0.20 to 0.32 alpha, the plan
|
||||
reading as resolved rather than merely still.
|
||||
|
||||
Three references, because the vertical ships this pattern as a held
|
||||
screenshot and never animates it. Full tables in batch6/spec-plan-room-audit.md.
|
||||
|
||||
A, the pattern and the gap (refs/b6/frames/plan-room-audit, 26 frames at
|
||||
10fps). A white plan sheet fades over blurred interior footage and is HELD
|
||||
DEAD STILL the whole time it is up, while the narration counts the spec
|
||||
aloud. Frame 001 at 540x960: sheet x 16.30% to 83.52% of width, y 36.46% to
|
||||
63.44% of height. Its wordmark, address and hairline rule sit ON that sheet,
|
||||
immediately above the plans, as ONE card, and that is the construction taken
|
||||
here: the header row, the hairline and the plan are all inside the sheet
|
||||
panel and turn with it. None of A's stillness is taken, and no wordmark,
|
||||
address, square footage or spec figure from it is reproduced: every value
|
||||
here is invented (FLOOR PLAN, UNIT 4B / LEVEL 2, 340 / 96 / 120 / 84 / 260).
|
||||
|
||||
B, the fill and tag timing (refs/b6/frames/plan-room-audit-b, 150 frames at
|
||||
10fps, dark teal #021F26, card #344C53, line art #6FBAD4, white values).
|
||||
Measured per tile, ink onset then white-label onset: icons draw over 0.30 to
|
||||
0.40s each, staggered 0.40 to 0.60s; value labels rise over 0.40 to 0.60s
|
||||
each, staggered 0.10 to 0.20s. The per-item durations here sit inside those
|
||||
ranges, unchanged: fill 0.36s (B's icon range 0.30 to 0.40) and tag 0.40s
|
||||
(B's label range 0.40 to 0.60). Only the stagger compresses, to 0.30s, since
|
||||
B spends 4.0s on six tiles and this spends 1.5s on five rooms. B's ORDERING
|
||||
is not taken: B runs every icon first and every label after, and tags
|
||||
staggered WITH their fills is the only way one room at a time stays the
|
||||
single subject (Law 6).
|
||||
|
||||
C, the settle (refs/b6/frames/plan-room-audit-c, 40 frames at 10fps). Per
|
||||
frame minimum-area-rectangle angle over the wall pixels, unwrapped through
|
||||
the 90deg fold at frame 17, gives 18 samples running 20.5deg to 90.0deg:
|
||||
69.5deg of travel over 1.7s, and cb(0.53, 0.04, 0.51, 0.93) fits it to a max
|
||||
error of 0.69% of travel. morph is 11.0% off, camPush 34.2% and camSettle
|
||||
67.5%, because all three are ease-outs and this is a real ease-in-out. The
|
||||
full amplitude is taken, not a fraction of it: C's gesture is a plan that
|
||||
spins into square, and its screen silhouette (axis aligned bounding box of
|
||||
the wall pixels, measured here frame by frame) runs 320x288 landscape at
|
||||
frame 9 to 290x302 portrait at frame 26, bulging to 374x357 at frame 17
|
||||
halfway through. A rigid sheet of aspect 0.960, which is C's own landed
|
||||
proportion (289 by 301), swept 69.5deg reproduces that signature: 1.019
|
||||
landscape, 1.000 at 45deg, 0.960 portrait, with the bounding box peaking at
|
||||
t=0.84 of 1.70, the same normalised instant C peaks at. Direction is C's too:
|
||||
at frame 9 C's topmost wall pixel sits left of centre and its leftmost sits
|
||||
below centre, which is the pose of a rectangle held at -69.5deg, so the sweep
|
||||
runs clockwise into square. Growth over the same window: min-rect diagonal
|
||||
372.0 to 417.3, so 0.897 to 1.000.
|
||||
|
||||
Deliberate deviations, each with its reason:
|
||||
1. C's shadow is a large soft cast to the lower LEFT of a plan sitting on
|
||||
white paper. That cannot be reproduced here: the stage is 14/255, so a
|
||||
black shadow has 14 levels of room and any gradient inside it bands or
|
||||
crushes in H.264. The lift is therefore made of light, not dark. The sheet
|
||||
is a panel stepped off the stage (#1A2026 on #0C0F11), which is reference
|
||||
A's own construction, and its edge carries a rim gradient that is bright
|
||||
along the top and right and falls to almost nothing along the bottom and
|
||||
left. That encodes C's light direction exactly: the dim corner of the rim
|
||||
is where C's cast shadow sits. The rim dims 0.60 to 0.34 as the sheet
|
||||
seats, because an airborne edge catches more of the environment than a
|
||||
seated one. Luminance numbers measured on the rendered 9:16 PNG are in
|
||||
batch6/spec-plan-room-audit.md.
|
||||
2. Fills start at scale 0.60, not the 0.90 to 0.95 Law 4 asks for. A fill is
|
||||
an area revealed out of a point, not an object arriving; at 0.90 the bloom
|
||||
out of the centroid is invisible, which is the one thing the fills are for.
|
||||
3. No U unit is read. Law 0b covers tweened px transforms and there are none:
|
||||
the sheet tweens rotation and scale, which are unitless, and every tween
|
||||
inside the SVG is in viewBox user units, which GSAP writes in user space.
|
||||
4. The meter is driven by linear, which is a stepper here and not motion: the
|
||||
rooms are evenly staggered, so a curved driver would tick the number on a
|
||||
different rhythm than the fills it counts and the two would stop agreeing.
|
||||
5. The meter is the one element outside the sheet. It is a stage readout
|
||||
about the plan, not a mark printed on it, so it does not turn with it.
|
||||
|
||||
Frame zero (Law 8): stage, meter reading 0 / 5, and the sheet held at
|
||||
-69.5deg and 0.897 scale with its header, hairline and 34% of its outer wall
|
||||
already inked. Presenter safe zone: at 9:16 the sheet's deepest reach over
|
||||
the whole sweep is 47.96% of frame height, at t=0.84 where the turning
|
||||
bounding box peaks, and the deepest lit pixel in the frame is the meter
|
||||
caption. The lower 38% is empty at every frame; checked against the local
|
||||
a-roll, a QA asset referenced nowhere in this file.
|
||||
|
||||
Media slot: none, this draws everything it shows. To composite over footage,
|
||||
set --pra-bg to transparent on #root and mount it above the video. Colours,
|
||||
both header strings, the five tag values and the meter caption are all
|
||||
overridable: --pra-bg, --pra-sheet, --pra-wall, --pra-accent, --pra-ink,
|
||||
--pra-dim, and the markup itself.
|
||||
|
||||
Mount contract: the runtime clones only this template, #root fills the host,
|
||||
carries no data-width or data-height, and registers one paused timeline under
|
||||
the hardcoded plan-room-audit id.
|
||||
-->
|
||||
<html lang="en" data-composition-id="plan-room-audit" data-composition-duration="3.2">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Plan Room Audit</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="plan-room-audit" data-duration="3.2" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
background: var(--pra-bg, #0c0f11);
|
||||
color: var(--pra-ink, #edf3f6);
|
||||
font-family: Inter, "Helvetica Neue", system-ui, sans-serif;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Everything hangs off .pra-stage, never off #root, because a
|
||||
container query cannot restyle its own container. */
|
||||
.pra-stage {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
|
||||
/* The sheet. Aspect 0.960 (289 by 301 user units), which is reference
|
||||
C's own landed proportion, sized in cqmin so the panel keeps that
|
||||
aspect and never overruns the short side when this file is shot
|
||||
outside its native 9:16. Header, hairline and plan all live inside
|
||||
it, so the whole card turns as one object, which is what A shows
|
||||
and what C does. */
|
||||
.pra-svg {
|
||||
position: absolute;
|
||||
top: 26cqh;
|
||||
left: 50%;
|
||||
width: 57.6cqmin;
|
||||
height: 60cqmin;
|
||||
overflow: visible;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.pra-card {
|
||||
fill: var(--pra-sheet, #1a2026);
|
||||
}
|
||||
|
||||
/* The lift. Not a drop shadow: on a 14/255 stage a black shadow has
|
||||
nowhere to go. A rim gradient, bright along the top and right and
|
||||
near zero along the bottom and left, puts C's light direction on
|
||||
the edge and leaves the dim corner where C's cast shadow sits. */
|
||||
.pra-rim {
|
||||
fill: none;
|
||||
stroke: url(#pra-rim-g);
|
||||
stroke-width: 1.8;
|
||||
}
|
||||
|
||||
.pra-mark {
|
||||
fill: var(--pra-ink, #edf3f6);
|
||||
font-family: inherit;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.18em;
|
||||
}
|
||||
|
||||
.pra-addr {
|
||||
fill: var(--pra-dim, #8fa3ac);
|
||||
font-family: inherit;
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
|
||||
.pra-hair {
|
||||
stroke: var(--pra-dim, #8fa3ac);
|
||||
stroke-width: 0.7;
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
.pra-fill {
|
||||
fill: var(--pra-accent, #6fbad4);
|
||||
}
|
||||
|
||||
.pra-outer,
|
||||
.pra-part {
|
||||
fill: none;
|
||||
stroke: var(--pra-wall, #e8eef1);
|
||||
stroke-linecap: square;
|
||||
stroke-linejoin: miter;
|
||||
}
|
||||
|
||||
.pra-outer {
|
||||
stroke-width: 4.1;
|
||||
}
|
||||
|
||||
.pra-part {
|
||||
stroke-width: 2.8;
|
||||
}
|
||||
|
||||
.pra-lead {
|
||||
stroke: var(--pra-accent, #6fbad4);
|
||||
stroke-width: 1.65;
|
||||
}
|
||||
|
||||
.pra-dot {
|
||||
fill: var(--pra-accent, #6fbad4);
|
||||
}
|
||||
|
||||
.pra-tag {
|
||||
fill: var(--pra-ink, #edf3f6);
|
||||
font-family: inherit;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
/* The meter. A CSS counter fed by a GSAP snapped custom property, so
|
||||
the number is pure style and lands on any cold seek. Nothing here
|
||||
is ever written from a callback: seek() suppresses onUpdate by
|
||||
default, and a callback painted readout renders its start value on
|
||||
every single frame. */
|
||||
.pra-meter {
|
||||
position: absolute;
|
||||
top: 51cqh;
|
||||
right: 0;
|
||||
left: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pra-num {
|
||||
counter-reset: pra-n var(--pra-n, 0) pra-d var(--pra-total, 5);
|
||||
display: block;
|
||||
font-size: 11cqmin;
|
||||
font-variant-numeric: tabular-nums;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.pra-num::before {
|
||||
content: counter(pra-n) " / " counter(pra-d);
|
||||
}
|
||||
|
||||
.pra-cap {
|
||||
display: block;
|
||||
margin-top: 1.6cqmin;
|
||||
color: var(--pra-dim, #8fa3ac);
|
||||
font-size: 3.1cqmin;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.22em;
|
||||
}
|
||||
|
||||
/* Fallbacks, graceful rather than equal. The move is authored for
|
||||
9:16, where cqh is 1.78x cqmin; at 1:1 and 16:9 cqh equals cqmin,
|
||||
so the same numbers would push the turning sheet off the top and
|
||||
the meter off the bottom. One band covers both, because square and
|
||||
landscape share that cqh, and it shrinks the sheet and re-spaces
|
||||
the column so the turn still clears the frame. */
|
||||
@container (aspect-ratio >= 0.95) {
|
||||
.pra-svg {
|
||||
top: 32cqh;
|
||||
width: 34.6cqmin;
|
||||
height: 36cqmin;
|
||||
}
|
||||
|
||||
.pra-meter {
|
||||
top: 62cqh;
|
||||
}
|
||||
|
||||
.pra-num {
|
||||
font-size: 9cqmin;
|
||||
}
|
||||
}
|
||||
|
||||
/* At 16:9 the presenter owns the left 32%, so the whole stage moves
|
||||
into the right 68% and keeps its proportions. */
|
||||
@container (aspect-ratio > 1.3) {
|
||||
.pra-stage {
|
||||
left: 32cqw;
|
||||
width: 68cqw;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="pra-stage">
|
||||
<svg class="pra-svg" viewBox="0 0 289 301" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<linearGradient id="pra-rim-g" x1="1" y1="0" x2="0" y2="1">
|
||||
<stop offset="0" stop-color="#e8eef1" stop-opacity="1" />
|
||||
<stop offset="0.55" stop-color="#e8eef1" stop-opacity="0.42" />
|
||||
<stop offset="1" stop-color="#e8eef1" stop-opacity="0.12" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
|
||||
<rect class="pra-card" x="0" y="0" width="289" height="301" rx="5" />
|
||||
|
||||
<g class="pra-head">
|
||||
<text class="pra-mark" x="18" y="32">FLOOR PLAN</text>
|
||||
<text class="pra-addr" x="271" y="32" text-anchor="end">UNIT 4B / LEVEL 2</text>
|
||||
<line class="pra-hair" x1="18" y1="44" x2="271" y2="44" />
|
||||
</g>
|
||||
|
||||
<g class="pra-fills">
|
||||
<rect class="pra-fill" x="18" y="60" width="153" height="145" />
|
||||
<rect class="pra-fill" x="171" y="60" width="100" height="72" />
|
||||
<rect class="pra-fill" x="171" y="132" width="100" height="73" />
|
||||
<rect class="pra-fill" x="18" y="205" width="90" height="78" />
|
||||
<rect class="pra-fill" x="108" y="205" width="163" height="78" />
|
||||
</g>
|
||||
|
||||
<g class="pra-walls">
|
||||
<path class="pra-outer" d="M18 60 H271 V283 H18 Z" />
|
||||
<path class="pra-part" d="M171 60 V205" />
|
||||
<path class="pra-part" d="M171 132 H271" />
|
||||
<path class="pra-part" d="M18 205 H271" />
|
||||
<path class="pra-part" d="M108 205 V283" />
|
||||
</g>
|
||||
|
||||
<g class="pra-tags">
|
||||
<line class="pra-lead" x1="94.5" y1="132.5" x2="94.5" y2="121" />
|
||||
<line class="pra-lead" x1="221" y1="96" x2="221" y2="84.5" />
|
||||
<line class="pra-lead" x1="221" y1="168.5" x2="221" y2="157" />
|
||||
<line class="pra-lead" x1="63" y1="244" x2="63" y2="232.5" />
|
||||
<line class="pra-lead" x1="189.5" y1="244" x2="189.5" y2="232.5" />
|
||||
<circle class="pra-dot" cx="94.5" cy="132.5" r="2.6" />
|
||||
<circle class="pra-dot" cx="221" cy="96" r="2.6" />
|
||||
<circle class="pra-dot" cx="221" cy="168.5" r="2.6" />
|
||||
<circle class="pra-dot" cx="63" cy="244" r="2.6" />
|
||||
<circle class="pra-dot" cx="189.5" cy="244" r="2.6" />
|
||||
<text class="pra-tag" x="94.5" y="117" text-anchor="middle">340 SF</text>
|
||||
<text class="pra-tag" x="221" y="80.5" text-anchor="middle">96 SF</text>
|
||||
<text class="pra-tag" x="221" y="153" text-anchor="middle">120 SF</text>
|
||||
<text class="pra-tag" x="63" y="228.5" text-anchor="middle">84 SF</text>
|
||||
<text class="pra-tag" x="189.5" y="228.5" text-anchor="middle">260 SF</text>
|
||||
</g>
|
||||
|
||||
<rect class="pra-rim" x="0" y="0" width="289" height="301" rx="5" />
|
||||
</svg>
|
||||
|
||||
<div class="pra-meter">
|
||||
<span class="pra-num"></span>
|
||||
<span class="pra-cap">ROOMS AUDITED</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// Cubic-bezier as a GSAP ease. Pure function of progress, so seek-safe:
|
||||
// seek(t) always yields the same value, no internal state to drift.
|
||||
// Newton-Raphson on x, bisection where the slope flattens.
|
||||
function cb(x1, y1, x2, y2) {
|
||||
var A = function (a, b) { return 1 - 3 * b + 3 * a; }, C = function (a) { return 3 * a; };
|
||||
var B = function (a, b) { return 3 * b - 6 * a; };
|
||||
var f = function (t, a, b) { return ((A(a, b) * t + B(a, b)) * t + C(a)) * t; };
|
||||
var d = function (t, a, b) { return 3 * A(a, b) * t * t + 2 * B(a, b) * t + C(a); };
|
||||
return function (p) {
|
||||
if (p <= 0) return 0;
|
||||
if (p >= 1) return 1;
|
||||
var t = p, i, s, e;
|
||||
for (i = 0; i < 8; i++) {
|
||||
s = d(t, x1, x2);
|
||||
if (s === 0) break;
|
||||
e = f(t, x1, x2) - p;
|
||||
if (Math.abs(e) < 1e-7) break;
|
||||
t -= e / s;
|
||||
}
|
||||
if (t < 0 || t > 1) {
|
||||
var lo = 0, hi = 1, j, v;
|
||||
t = p;
|
||||
for (j = 0; j < 30; j++) {
|
||||
v = f(t, x1, x2);
|
||||
if (Math.abs(v - p) < 1e-7) break;
|
||||
if (v > p) hi = t; else lo = t;
|
||||
t = (lo + hi) / 2;
|
||||
}
|
||||
}
|
||||
return f(t, y1, y2);
|
||||
};
|
||||
}
|
||||
|
||||
// Named for what they do in a shot. A named GSAP preset is a
|
||||
// category, not a curve, so none appears here.
|
||||
var E = {
|
||||
enter: cb(0.22, 0.9, 0.3, 1.0),
|
||||
enterSoft: cb(0.33, 0.7, 0.35, 1.0),
|
||||
camSettle: cb(0.16, 0.84, 0.28, 1.0),
|
||||
camPush: cb(0.4, 0.0, 0.2, 1.0),
|
||||
morph: cb(0.65, 0.05, 0.35, 1.0),
|
||||
// Fitted to reference C's per-frame angle table: 18 samples, 1.7s,
|
||||
// 69.5deg, max error 0.69% of travel. morph is 11.0% off, camPush
|
||||
// 34.2%, camSettle 67.5%, because all three are ease-outs and this
|
||||
// is a real ease-in-out.
|
||||
settle: cb(0.53, 0.04, 0.51, 0.93),
|
||||
// Stepper for the meter, not motion. See deviation 4 in the header.
|
||||
linear: function (p) { return p; },
|
||||
};
|
||||
|
||||
gsap.defaults({ immediateRender: false });
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var svg = root.querySelector(".pra-svg");
|
||||
var rim = root.querySelector(".pra-rim");
|
||||
var outer = root.querySelector(".pra-outer");
|
||||
var parts = [].slice.call(root.querySelectorAll(".pra-part"));
|
||||
var fills = [].slice.call(root.querySelectorAll(".pra-fill"));
|
||||
var leads = [].slice.call(root.querySelectorAll(".pra-lead"));
|
||||
var dots = [].slice.call(root.querySelectorAll(".pra-dot"));
|
||||
var tags = [].slice.call(root.querySelectorAll(".pra-tag"));
|
||||
var num = root.querySelector(".pra-num");
|
||||
|
||||
// Dash the whole path so stroke-dashoffset is a draw, and hand back
|
||||
// the length so both ends of every tween can be written out.
|
||||
function dash(el) {
|
||||
var L = el.getTotalLength();
|
||||
el.style.strokeDasharray = L + " " + L;
|
||||
return L;
|
||||
}
|
||||
var Louter = dash(outer);
|
||||
var Lpart = parts.map(dash);
|
||||
var Llead = leads.map(dash);
|
||||
|
||||
var D = Math.max(0.001, parseFloat(root.dataset.duration || "3.2"));
|
||||
var s = D / 3.2; // every beat scales, so nothing can run past D
|
||||
|
||||
// Reference C's amplitude, whole: -69.5 to square, clockwise, with
|
||||
// C's own 0.897 to 1.000 growth over C's own 1.70s.
|
||||
// SEED 0.66 inks 34% of the outer wall at t=0. 26.6% is where the
|
||||
// first corner sits, so anything less than that leaves frame zero
|
||||
// holding a bare diagonal bar instead of a plan.
|
||||
var ROT = -69.5, SC = 0.897, SET = 1.7 * s, SEED = 0.66;
|
||||
var FILL0 = 1.24 * s, STEP = 0.3 * s, FILLA = 0.2, FILLB = 0.32;
|
||||
var RIMA = 0.6, RIMB = 0.34, LOCK0 = 2.66 * s;
|
||||
|
||||
// Rest state pinned outside the timeline, both ends written on every
|
||||
// tween, so a seek never inherits a start value from the screen.
|
||||
gsap.set(svg, { rotation: ROT, scale: SC, transformOrigin: "50% 50%" });
|
||||
gsap.set(rim, { strokeOpacity: RIMA });
|
||||
gsap.set(outer, { strokeDashoffset: Louter * SEED });
|
||||
gsap.set(parts, { strokeDashoffset: function (i) { return Lpart[i]; } });
|
||||
gsap.set(leads, { strokeDashoffset: function (i) { return Llead[i]; } });
|
||||
gsap.set(fills, { opacity: 0, scale: 0.6, fillOpacity: FILLA, transformOrigin: "50% 50%" });
|
||||
gsap.set(dots, { opacity: 0, scale: 0.5, transformOrigin: "50% 50%" });
|
||||
gsap.set(tags, { opacity: 0, y: -3 });
|
||||
gsap.set(num, { "--pra-n": 0, "--pra-total": fills.length });
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
// SPIN. Reference C's curve AND reference C's amplitude, on a sheet
|
||||
// whose aspect is C's landed proportion, so the silhouette turns
|
||||
// landscape to portrait exactly as C's does. It runs first, not
|
||||
// last, because every value tag then lands on a square sheet and
|
||||
// none of them has to be counter rotated to stay readable.
|
||||
tl.fromTo(svg, { rotation: ROT, scale: SC }, { rotation: 0, scale: 1, duration: SET, ease: E.settle }, 0);
|
||||
// The lift seats with it: an airborne edge catches more of the
|
||||
// environment than a landed one.
|
||||
tl.fromTo(rim, { strokeOpacity: RIMA }, { strokeOpacity: RIMB, duration: SET, ease: E.settle }, 0);
|
||||
|
||||
// DRAW. One continuous outer wall, seeded 34% inked at t=0 so no beat
|
||||
// is spent on an empty sheet. Ease-out, for the same reason pill 1
|
||||
// rides one in pill-row-collapse: restarting an ease-in-out from rest
|
||||
// mid stroke reads as a stutter on frame zero.
|
||||
tl.fromTo(outer, { strokeDashoffset: Louter * SEED }, { strokeDashoffset: 0, duration: 0.62 * s, ease: E.camSettle }, 0);
|
||||
|
||||
// PARTS. The corners are down before any of these start, so the plan
|
||||
// reads as an enclosure being subdivided, not strokes in a pile.
|
||||
parts.forEach(function (p, i) {
|
||||
tl.fromTo(p, { strokeDashoffset: Lpart[i] }, { strokeDashoffset: 0, duration: 0.3 * s, ease: E.morph }, (0.48 + i * 0.1) * s);
|
||||
});
|
||||
|
||||
// AUDIT. One room at a time, in reading order. GSAP resolves
|
||||
// transformOrigin against each rect's own bbox, so five rooms bloom
|
||||
// from five different centroids with no geometry in the script. The
|
||||
// first fill opens at 1.24, inside the spin's tail (Law 3).
|
||||
fills.forEach(function (f, i) {
|
||||
var at = FILL0 + i * STEP;
|
||||
tl.fromTo(f, { opacity: 0, scale: 0.6 }, { opacity: 1, scale: 1, duration: 0.36 * s, ease: E.enter }, at);
|
||||
tl.fromTo(dots[i], { opacity: 0, scale: 0.5 }, { opacity: 1, scale: 1, duration: 0.24 * s, ease: E.enter }, at + 0.06 * s);
|
||||
tl.fromTo(leads[i], { strokeDashoffset: Llead[i] }, { strokeDashoffset: 0, duration: 0.2 * s, ease: E.morph }, at + 0.1 * s);
|
||||
// The tag drops from above ONTO the leader just drawn, so the
|
||||
// leader is something it lands on rather than a decoration. 0.40s
|
||||
// is the bottom of reference B's measured label range.
|
||||
tl.fromTo(tags[i], { opacity: 0, y: -3 }, { opacity: 1, y: 0, duration: 0.4 * s, ease: E.camSettle }, at + 0.18 * s);
|
||||
tl.fromTo(tags[i], { opacity: 0 }, { opacity: 1, duration: 0.26 * s, ease: E.enterSoft }, at + 0.18 * s);
|
||||
});
|
||||
|
||||
// METER. One snapped custom property, painted by a CSS counter. The
|
||||
// 0.08 offset puts each tick 0.02s after its own room finishes
|
||||
// blooming, so the number counts rooms that are done and never
|
||||
// claims one the eye can still see arriving.
|
||||
tl.fromTo(
|
||||
num,
|
||||
{ "--pra-n": 0 },
|
||||
{ "--pra-n": fills.length, duration: fills.length * STEP, ease: E.linear, snap: { "--pra-n": 1 } },
|
||||
FILL0 + 0.08 * s
|
||||
);
|
||||
|
||||
// LOCK. Every fill ramps together, so the plan reads as resolved
|
||||
// instead of merely stopped, and the last tag's tail has a full
|
||||
// frame area moving through it. No stagger: the rooms were
|
||||
// individuated on the way in, and doing it twice would re-open a
|
||||
// question the audit already answered.
|
||||
tl.fromTo(fills, { fillOpacity: FILLA }, { fillOpacity: FILLB, duration: 0.54 * s, ease: E.camPush }, LOCK0);
|
||||
|
||||
tl.set({}, {}, D); // pin the full duration
|
||||
tl.seek(0);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["plan-room-audit"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 5.9 KiB |
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: press-ripple at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>press-ripple 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="3" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="press-ripple"
|
||||
data-composition-src="./press-ripple.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="3" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1,375 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
press-ripple: HyperFrames video primitive (product demo / payoff)
|
||||
|
||||
A cursor decel-arrives from off-stage (power2.out, it arrives, never passes
|
||||
through), lands a few px off-center on a caller-positioned target zone, the
|
||||
target and cursor compress in lockstep, release with two ink ripple rings,
|
||||
then the cursor exits off-stage the way it came. The pressed state and the
|
||||
ripple aftermath carry the hold; the cursor never camps on the label.
|
||||
|
||||
The target is a slot: the element marked data-slot="target" is the press
|
||||
surface. Its default content is a token-styled pill carrying the label
|
||||
variable; replace the slot's children to press anything else. The slot
|
||||
wrapper flips data-state="idle" to data-state="pressed" at the press, so
|
||||
custom slot content can style its own pressed look.
|
||||
|
||||
Variables:
|
||||
label: text inside the default pill (ignored when the slot is replaced)
|
||||
target_x, target_y: zone center as a percent of the host box
|
||||
press_at: seconds from mount start when the compression begins
|
||||
cursor: light or dark pointer
|
||||
accent: green, blue, or violet ink (ripple rings + pressed pill fill)
|
||||
exit: none, fade, or up (default none; holds end films)
|
||||
|
||||
Envelope (elastic HOLD, never time-scaled):
|
||||
IN = entrance settle, cursor arrival, press, release ripple, cursor exit
|
||||
HOLD = the rest of D, completely still on the pressed state
|
||||
OUT = none by default; 0.45s fade or fade-up when exit is set
|
||||
press_at clamps into the window that keeps the whole gesture inside D.
|
||||
|
||||
Sync point: the press lands at press_at (default 1.4s).
|
||||
|
||||
Mount contract: the runtime clones only this template. #root fills the host
|
||||
box, establishes the container query basis, has no data-width or data-height,
|
||||
and registers one paused timeline under the literal press-ripple key.
|
||||
-->
|
||||
<html
|
||||
lang="en"
|
||||
data-composition-id="press-ripple"
|
||||
data-composition-duration="3"
|
||||
data-composition-variables='[
|
||||
{ "id": "label", "type": "string", "role": "content", "label": "Label", "description": "Text inside the default pill target.", "default": "Get started" },
|
||||
{ "id": "target_x", "type": "number", "role": "layout", "label": "Target X", "description": "Zone center, percent of host width.", "default": 50, "min": 8, "max": 92, "step": 1, "unit": "%" },
|
||||
{ "id": "target_y", "type": "number", "role": "layout", "label": "Target Y", "description": "Zone center, percent of host height.", "default": 50, "min": 8, "max": 92, "step": 1, "unit": "%" },
|
||||
{ "id": "press_at", "type": "number", "role": "timing", "label": "Press at", "description": "Seconds from mount start when the press begins.", "default": 1.4, "min": 0.9, "max": 10, "step": 0.1, "unit": "s" },
|
||||
{ "id": "cursor", "type": "enum", "role": "style", "label": "Cursor", "description": "Pointer tone.", "default": "light", "options": [{ "value": "light", "label": "Light" }, { "value": "dark", "label": "Dark" }] },
|
||||
{ "id": "accent", "type": "enum", "role": "style", "label": "Accent", "description": "Contract color for the ripple ink and pressed fill.", "default": "green", "options": [{ "value": "green", "label": "Green" }, { "value": "blue", "label": "Blue" }, { "value": "violet", "label": "Violet" }] },
|
||||
{ "id": "exit", "type": "enum", "role": "style", "label": "Exit", "description": "How the frame leaves. None holds the pressed state.", "default": "none", "options": [{ "value": "none", "label": "None" }, { "value": "fade", "label": "Fade" }, { "value": "up", "label": "Fade up" }] }
|
||||
]'
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Press Ripple</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="press-ripple" data-duration="3" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
color: var(--fg, #f8fafc);
|
||||
font-family: var(--font-body, Inter, system-ui, sans-serif);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.pr-clip {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
background: var(--bg, #0b0c0e);
|
||||
}
|
||||
|
||||
.pr-stage {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
|
||||
/* Caller-positioned target zone; --pr-x / --pr-y come from the
|
||||
target_x / target_y variables. */
|
||||
.pr-zone {
|
||||
position: absolute;
|
||||
left: calc(var(--pr-x, 50) * 1cqw);
|
||||
top: calc(var(--pr-y, 50) * 1cqh);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
/* Ink ripple rings, centered under the slot, hidden until release.
|
||||
The ink mixes the accent toward --fg so the rings carry real
|
||||
weight against the host background on both light and dark
|
||||
themes; thickness reads as drawn ink, not a hairline. */
|
||||
.pr-ring {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 20cqmin;
|
||||
height: 20cqmin;
|
||||
margin: -10cqmin 0 0 -10cqmin;
|
||||
border: 0.85cqmin solid
|
||||
color-mix(in srgb, var(--pr-accent, #71f5a7) 72%, var(--fg, #f8fafc));
|
||||
border-radius: 50%;
|
||||
opacity: 0;
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
/* GSAP owns this wrapper's opacity/y (entrance) and scale (press). */
|
||||
.pr-actor {
|
||||
position: relative;
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
.pr-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: var(--space-2, 2.6cqmin) calc(var(--space-2, 2.6cqmin) * 2.1);
|
||||
border: 0.22cqmin solid var(--border, #343a46);
|
||||
border-radius: 999px;
|
||||
background: var(--surface, #14171c);
|
||||
color: var(--fg, #f8fafc);
|
||||
font-family: var(--font-body, Inter, system-ui, sans-serif);
|
||||
font-size: 4.6cqmin;
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
letter-spacing: -0.015em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pr-target-slot[data-state="pressed"] .pr-pill {
|
||||
border-color: color-mix(in srgb, var(--pr-accent, #71f5a7) 72%, var(--fg, #f8fafc));
|
||||
background: var(--pr-accent, #71f5a7);
|
||||
color: var(--bg, #0b0c0e);
|
||||
}
|
||||
|
||||
/* Pointer: SVG tip sits exactly at this box's top-left corner, so
|
||||
the box position places the tip itself. GSAP moves it with x/y
|
||||
transforms only (never left/top: layout props snap to integer
|
||||
device pixels under the seek-by-frame capture engine) and scales
|
||||
it about the tip (press). */
|
||||
.pr-cursor {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 7cqmin;
|
||||
height: 7cqmin;
|
||||
transform-origin: 0 0;
|
||||
filter: drop-shadow(0 0.4cqmin 0.9cqmin rgba(2, 6, 23, 0.45));
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
.pr-cursor svg {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div
|
||||
id="press-ripple-clip"
|
||||
class="pr-clip clip"
|
||||
data-start="0"
|
||||
data-duration="3"
|
||||
data-track-index="0"
|
||||
>
|
||||
<div class="pr-stage">
|
||||
<div class="pr-zone">
|
||||
<div class="pr-ring" aria-hidden="true"></div>
|
||||
<div class="pr-ring" aria-hidden="true"></div>
|
||||
<div class="pr-actor">
|
||||
<div class="pr-target-slot" data-slot="target" data-state="idle">
|
||||
<span class="pr-pill"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pr-cursor" aria-hidden="true">
|
||||
<svg viewBox="0 0 20 20">
|
||||
<path
|
||||
class="pr-cursor-path"
|
||||
d="M0.6 0.6 L0.6 14.6 L4.4 11.3 L6.7 16.8 L9.4 15.6 L7.1 10.2 L12.4 9.8 Z"
|
||||
stroke-width="1.1"
|
||||
stroke-linejoin="round"
|
||||
></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var stage = root.querySelector(".pr-stage");
|
||||
var zone = root.querySelector(".pr-zone");
|
||||
var rings = root.querySelectorAll(".pr-ring");
|
||||
var actor = root.querySelector(".pr-actor");
|
||||
var slot = root.querySelector(".pr-target-slot");
|
||||
var pill = root.querySelector(".pr-pill");
|
||||
var cursor = root.querySelector(".pr-cursor");
|
||||
var cursorPath = root.querySelector(".pr-cursor-path");
|
||||
|
||||
var vars =
|
||||
window.__hyperframes && window.__hyperframes.getVariables
|
||||
? window.__hyperframes.getVariables()
|
||||
: {};
|
||||
|
||||
function num(value, fallback, min, max) {
|
||||
var n = Number(value);
|
||||
if (!isFinite(n)) n = fallback;
|
||||
return Math.min(max, Math.max(min, n));
|
||||
}
|
||||
|
||||
var labelText =
|
||||
vars.label == null
|
||||
? "Get started"
|
||||
: String(vars.label).trim().replace(/\s+/g, " ");
|
||||
var targetX = num(vars.target_x, 50, 8, 92);
|
||||
var targetY = num(vars.target_y, 50, 8, 92);
|
||||
var cursorTone = vars.cursor === "dark" ? "dark" : "light";
|
||||
var exit = vars.exit === "fade" || vars.exit === "up" ? vars.exit : "none";
|
||||
|
||||
var accentColors = {
|
||||
green: "var(--brand, #71f5a7)",
|
||||
blue: "var(--accent, #61a8ff)",
|
||||
violet: "var(--accent-2, #c5a3ff)",
|
||||
};
|
||||
var accent = Object.prototype.hasOwnProperty.call(accentColors, vars.accent)
|
||||
? vars.accent
|
||||
: "green";
|
||||
// The bundler mirrors composition variables as scoped CSS custom
|
||||
// props, so this unit's own accent variable shadows the contract
|
||||
// --accent token inside the subtree ("blue" is a valid CSS color
|
||||
// and would render pure blue). When the shadow is present, fall
|
||||
// back to the literal contract value instead of var(--accent).
|
||||
var computedAccent = getComputedStyle(root).getPropertyValue("--accent").trim();
|
||||
if (
|
||||
computedAccent === "green" ||
|
||||
computedAccent === "blue" ||
|
||||
computedAccent === "violet"
|
||||
) {
|
||||
accentColors.blue = "#61a8ff";
|
||||
}
|
||||
|
||||
pill.textContent = labelText;
|
||||
root.style.setProperty("--pr-accent", accentColors[accent]);
|
||||
root.style.setProperty("--pr-x", String(targetX));
|
||||
root.style.setProperty("--pr-y", String(targetY));
|
||||
if (cursorTone === "dark") {
|
||||
cursorPath.setAttribute("fill", "#111827");
|
||||
cursorPath.setAttribute("stroke", "#f8fafc");
|
||||
} else {
|
||||
cursorPath.setAttribute("fill", "#f8fafc");
|
||||
cursorPath.setAttribute("stroke", "#0f172a");
|
||||
}
|
||||
|
||||
var duration = Math.max(0.001, parseFloat(root.dataset.duration || "3"));
|
||||
var OUT = exit === "none" ? 0 : 0.45;
|
||||
// The whole press tail (compress + release ripple + cursor exit)
|
||||
// is ~1.05s; keep it inside D, then keep the OUT window after it.
|
||||
var pressAt = num(vars.press_at, 1.4, 0.9, Math.max(0.9, duration - 1.05 - OUT));
|
||||
// Human aim: the tip lands a few px off the zone's true center.
|
||||
var landX = targetX + 0.55;
|
||||
var landY = targetY + 0.85;
|
||||
var arriveEnd = pressAt - 0.16;
|
||||
var arriveStart = Math.max(0, arriveEnd - 0.78);
|
||||
|
||||
// Motion runs on transforms only (x/y px), never left/top: layout
|
||||
// props snap to integer device pixels under the seek-by-frame
|
||||
// capture engine. Stage size is read once, synchronously, at load
|
||||
// (deterministic: fixed viewport per render) to convert the
|
||||
// percent-based land/off-stage positions into px.
|
||||
var stageW = root.clientWidth || 1920;
|
||||
var stageH = root.clientHeight || 1080;
|
||||
function xAt(percent) {
|
||||
return (percent / 100) * stageW;
|
||||
}
|
||||
function yAt(percent) {
|
||||
return (percent / 100) * stageH;
|
||||
}
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
// IN: target settles in.
|
||||
tl.fromTo(
|
||||
actor,
|
||||
{ opacity: 0, y: "2.6cqh" },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power3.out" },
|
||||
0,
|
||||
);
|
||||
|
||||
// Cursor decel-arrives from off-stage bottom-right. power2.out to
|
||||
// an exact endpoint: it arrives, it never passes through.
|
||||
tl.fromTo(
|
||||
cursor,
|
||||
{ x: xAt(114), y: yAt(112) },
|
||||
{
|
||||
x: xAt(landX),
|
||||
y: yAt(landY),
|
||||
duration: arriveEnd - arriveStart,
|
||||
ease: "power2.out",
|
||||
},
|
||||
arriveStart,
|
||||
);
|
||||
|
||||
// Press: target and cursor compress in lockstep (cursor about its
|
||||
// tip), then release with a soft spring.
|
||||
tl.to([actor, cursor], { scale: 0.93, duration: 0.12, ease: "power1.in" }, pressAt);
|
||||
tl.set(slot, { attr: { "data-state": "pressed" } }, pressAt + 0.12);
|
||||
tl.to(
|
||||
[actor, cursor],
|
||||
{ scale: 1, duration: 0.42, ease: "back.out(1.8)" },
|
||||
pressAt + 0.14,
|
||||
);
|
||||
|
||||
// Ink ripple rings from under the slot: real weight (thick ink,
|
||||
// fg-mixed contrast, wide travel), still just two rings.
|
||||
tl.fromTo(
|
||||
rings,
|
||||
{ scale: 0.16, autoAlpha: 0.95 },
|
||||
{
|
||||
scale: 2.6,
|
||||
autoAlpha: 0,
|
||||
duration: 0.66,
|
||||
ease: "power2.out",
|
||||
stagger: 0.11,
|
||||
immediateRender: false,
|
||||
},
|
||||
pressAt + 0.1,
|
||||
);
|
||||
|
||||
// The cursor exits off-stage after the release (accelerating,
|
||||
// power2.in) so it never occludes the label during the hold; the
|
||||
// pressed state and the ripple aftermath carry the frame. Both
|
||||
// endpoints are explicit so reverse seeks restore the landing.
|
||||
tl.fromTo(
|
||||
cursor,
|
||||
{ x: xAt(landX), y: yAt(landY) },
|
||||
{
|
||||
x: xAt(112),
|
||||
y: yAt(110),
|
||||
duration: 0.55,
|
||||
ease: "power2.in",
|
||||
immediateRender: false,
|
||||
},
|
||||
pressAt + 0.5,
|
||||
);
|
||||
|
||||
// HOLD: dead-still on the pressed state; elastic with D.
|
||||
|
||||
// OUT: only when the host opts in; frame roots own transitions.
|
||||
if (exit !== "none") {
|
||||
var outStart = Math.max(pressAt + 1.05, duration - OUT);
|
||||
var outVars = { opacity: 0, duration: OUT, ease: "power2.in" };
|
||||
if (exit === "up") outVars.y = "-4cqh";
|
||||
tl.to(stage, outVars, outStart);
|
||||
}
|
||||
|
||||
tl.seek(0);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["press-ripple"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: rank-list-settle at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>rank-list-settle 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="2.1" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="rank-list-settle"
|
||||
data-composition-src="./rank-list-settle.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="2.1" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 5.6 KiB |
@@ -0,0 +1,481 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
rank-list-settle: HyperFrames video primitive (comparison / proof)
|
||||
|
||||
Concept: a ranked comparison list rolls upward past the frame, decelerates
|
||||
hard, and parks with the winning row landed exactly on the section label's
|
||||
line. A focus lamp is fixed on that line. Whatever row is crossing it is full
|
||||
black with a saturated chip; everything else washes out. So the roll reads as
|
||||
competitors passing under a lamp, and the landing delivers the winner at full
|
||||
strength the instant the list stops.
|
||||
|
||||
ROW CONTENT LIVES IN THE MARKUP. Edit the eight .rls-row blocks below to your
|
||||
own names and numbers. Keep the winner last and keep class="rls-win" on it:
|
||||
the list geometry parks the last row on the lamp, and the lamp does the rest.
|
||||
|
||||
Variables:
|
||||
- title (string, default "Cost per commit"): the section label the winning
|
||||
row lands on.
|
||||
Theme hooks (set on the host, all optional):
|
||||
--rls-bg, --rls-title, --rls-ink,
|
||||
--rls-chip-lose, --rls-lose-ink, --rls-chip-win, --rls-win-ink
|
||||
Chip colours are the LIT values, the ones a row shows at the lamp. The lamp
|
||||
fades them toward the background, so do not pre-pale them.
|
||||
|
||||
Envelope (D = 2.10s):
|
||||
LEAD 0.00 to 0.10 the list is already rolling at speed when the clip opens
|
||||
ROLL 0.10 to 1.10 45.4% of frame height, 80% of it in the first 0.4s
|
||||
LAND 1.00 to 1.85 the winner chip settles onto its own right edge
|
||||
hold to 2.10 clears the 32-sample resolution floor without a dead tail
|
||||
|
||||
There is no arrival tween on the winner. Its ink is a function of where it is,
|
||||
so it is fully black and fully green at 1.60s because that is when it reaches
|
||||
the lamp, not because a fade happens to finish there. That is the whole point:
|
||||
an opacity tween on one row delivers the punch late and at a rate no eye can
|
||||
see, which is exactly how the first cut of this file failed.
|
||||
|
||||
Every lamp value is sampled from the same eased position the list is tweened
|
||||
on, at build time, and laid down as explicit fromTo segments. No rAF, no
|
||||
onUpdate, no DOM reads: a seek to any time lands on the same number. The
|
||||
segments carry a linear ease because they are a reconstruction of an already
|
||||
eased curve, not an easing choice.
|
||||
|
||||
Mount contract: the runtime clones only this template. #root fills the host
|
||||
box, establishes the container query basis, has no data-width or data-height,
|
||||
and registers one paused timeline under the hardcoded rank-list-settle id.
|
||||
-->
|
||||
<html
|
||||
lang="en"
|
||||
data-composition-id="rank-list-settle"
|
||||
data-composition-duration="2.1"
|
||||
data-composition-variables='[
|
||||
{ "id": "title", "type": "string", "role": "content", "label": "Section label", "description": "The line the winning row lands on.", "default": "Cost per commit" }
|
||||
]'
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Rank List Settle</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="rank-list-settle" data-duration="2.1" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
container-name: rls;
|
||||
isolation: isolate;
|
||||
background: var(--rls-bg, #ffffff);
|
||||
color: var(--rls-ink, #0a0a0a);
|
||||
font-family: var(--font-display, system-ui, "Helvetica Neue", Arial, sans-serif);
|
||||
font-weight: 450;
|
||||
pointer-events: none;
|
||||
|
||||
/* Chip height and type scale in cqmin so they read the same in all
|
||||
three aspects. Row pitch is the same idea but it lives on
|
||||
.rls-list, not here: a container query cannot restyle its own
|
||||
container, so a pitch declared on #root would survive the
|
||||
portrait branch and leave two-line rows overlapping. */
|
||||
--rls-chip-h: 5.28cqmin;
|
||||
}
|
||||
|
||||
/* The label is vertically centred and stays put. Its centreline is
|
||||
both the landing mark for the winning row and the lamp. */
|
||||
.rls-title {
|
||||
position: absolute;
|
||||
top: 50cqh;
|
||||
left: 14.11cqw;
|
||||
width: 34cqw;
|
||||
transform: translateY(-50%);
|
||||
color: var(--rls-title, #050505);
|
||||
font-size: 7.4cqmin;
|
||||
font-weight: 500;
|
||||
letter-spacing: -0.021em;
|
||||
line-height: 1.04;
|
||||
}
|
||||
|
||||
/* The clip window. Fixed, never animated: an overflow box that moves
|
||||
drags its own clip off the target. FLAT across the whole live band,
|
||||
and that is the point. An earlier cut shaped this gradient into a
|
||||
second lamp, which stacked a distance falloff on top of the real one
|
||||
and washed the far rows to within 7/255 of the background: the list
|
||||
read as a five item fragment mid roll. The reference has no falloff
|
||||
at all, its unlit rows hold one constant grey six pitches out, so the
|
||||
only job left here is to stop rows hard-cutting at the frame edge. */
|
||||
.rls-viewport {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
-webkit-mask-image: linear-gradient(
|
||||
to bottom,
|
||||
rgba(0, 0, 0, 0) 0%,
|
||||
rgba(0, 0, 0, 1) 6%,
|
||||
rgba(0, 0, 0, 1) 94%,
|
||||
rgba(0, 0, 0, 0) 100%
|
||||
);
|
||||
mask-image: linear-gradient(
|
||||
to bottom,
|
||||
rgba(0, 0, 0, 0) 0%,
|
||||
rgba(0, 0, 0, 1) 6%,
|
||||
rgba(0, 0, 0, 1) 94%,
|
||||
rgba(0, 0, 0, 0) 100%
|
||||
);
|
||||
}
|
||||
|
||||
/* Parked so the last row's centreline sits on 50cqh. The offset is a
|
||||
static margin, not a transform, because GSAP owns the transform. */
|
||||
.rls-list {
|
||||
position: absolute;
|
||||
top: 50cqh;
|
||||
right: 0;
|
||||
left: 0;
|
||||
margin-top: calc(-7.5 * var(--rls-pitch));
|
||||
--rls-pitch: 7.78cqmin;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
/* Right edge at 86cqw, chip left edge at 80cqw, names at 56.25cqw:
|
||||
the reference geometry, in cqw because it is lateral. */
|
||||
.rls-row {
|
||||
display: flex;
|
||||
height: var(--rls-pitch);
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-right: 14cqw;
|
||||
margin-left: 56.25cqw;
|
||||
gap: 2cqmin;
|
||||
--lit: 0;
|
||||
}
|
||||
|
||||
/* The lamp. One number per row drives both readouts through two steep
|
||||
ramps, and the shape is measured, not invented. Sampling f-005 and
|
||||
f-018 across every row: an unlit label is rgb(198,198,198) and an
|
||||
unlit chip fill is rgb(253,242,234) NO MATTER how far the row is
|
||||
from the line, so there is no falloff to model, only a window.
|
||||
Over white those are 0.23 and 0.20 of their lit colour, so 0.22 is
|
||||
the one shared floor, and it is a floor on a FLAT field: nothing
|
||||
downstream may dim it further. The window is about twice as wide
|
||||
for the label as for the chip: at 0.8 of a pitch away f-005 shows a
|
||||
black label on a row whose chip is still pale. Everything else is
|
||||
flat. */
|
||||
.rls-name {
|
||||
color: var(--rls-ink, #0a0a0a);
|
||||
font-size: 3.7cqmin;
|
||||
letter-spacing: -0.012em;
|
||||
line-height: 1;
|
||||
opacity: clamp(0.22, calc((var(--lit, 0) - 0.3) * 5.5), 1);
|
||||
white-space: nowrap;
|
||||
will-change: opacity;
|
||||
}
|
||||
|
||||
.rls-chip {
|
||||
display: flex;
|
||||
height: var(--rls-chip-h);
|
||||
min-width: 6cqw;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 1.3cqmin;
|
||||
border-radius: 0.85cqmin;
|
||||
opacity: clamp(0.22, calc((var(--lit, 0) - 0.46) * 3.2), 1);
|
||||
background: var(--rls-chip-lose, #f7b199);
|
||||
color: var(--rls-lose-ink, #bf4521);
|
||||
font-size: 3.55cqmin;
|
||||
font-variant-numeric: tabular-nums;
|
||||
letter-spacing: -0.01em;
|
||||
line-height: 1;
|
||||
will-change: opacity, transform;
|
||||
}
|
||||
|
||||
/* Only the winner is green. Every other chip is the loser colour. */
|
||||
.rls-win .rls-chip {
|
||||
background: var(--rls-chip-win, #c4ead1);
|
||||
color: var(--rls-win-ink, #28b463);
|
||||
transform-origin: 100% 50%;
|
||||
}
|
||||
|
||||
/* Square and narrower: the label and the chips crowd, so widen the
|
||||
row band. Keyed on aspect rather than a pixel width so the same
|
||||
16:9 shot rendered at 1280 across does not flip branch. */
|
||||
@container rls (max-aspect-ratio: 5 / 4) {
|
||||
.rls-title {
|
||||
left: 6cqw;
|
||||
width: 30cqw;
|
||||
font-size: 6.2cqmin;
|
||||
}
|
||||
|
||||
.rls-row {
|
||||
margin-right: 5cqw;
|
||||
margin-left: 40cqw;
|
||||
}
|
||||
}
|
||||
|
||||
/* Portrait. ONE flex line, like every other aspect. An earlier cut
|
||||
folded the row to two lines here on the theory that the name and
|
||||
chip could not fit; they can, with 293px of clear air left over at
|
||||
1080 across, and folding split the payoff in half: the winning name
|
||||
and the winning number ended up 58px apart, 46% of a row pitch, so
|
||||
neither one sat on the label line. Portrait only needs a taller
|
||||
pitch, so eight rows spread over a 16:9 frame's worth of extra
|
||||
height, and a wider band, which is what the square branch above
|
||||
already does. */
|
||||
@container rls (max-aspect-ratio: 4 / 5) {
|
||||
.rls-list {
|
||||
--rls-pitch: 11.6cqmin;
|
||||
}
|
||||
|
||||
/* The label wraps to two lines here, so it needs its own column and
|
||||
a real gutter, or its second line butts against the winning name
|
||||
on the one frame the whole clip is built to deliver. */
|
||||
.rls-title {
|
||||
width: 22cqw;
|
||||
font-size: 5.4cqmin;
|
||||
}
|
||||
|
||||
.rls-row {
|
||||
margin-left: 34cqw;
|
||||
}
|
||||
|
||||
.rls-chip {
|
||||
min-width: 14cqw;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="rls-title">Cost per commit</div>
|
||||
|
||||
<div class="rls-viewport">
|
||||
<div class="rls-list">
|
||||
<div class="rls-row">
|
||||
<span class="rls-name">Legacy Suite</span><span class="rls-chip">$12.69</span>
|
||||
</div>
|
||||
<div class="rls-row">
|
||||
<span class="rls-name">Team Plan</span><span class="rls-chip">$6.77</span>
|
||||
</div>
|
||||
<div class="rls-row">
|
||||
<span class="rls-name">Starter</span><span class="rls-chip">$4.63</span>
|
||||
</div>
|
||||
<div class="rls-row">
|
||||
<span class="rls-name">Enterprise</span><span class="rls-chip">$6.76</span>
|
||||
</div>
|
||||
<div class="rls-row">
|
||||
<span class="rls-name">Pro Bundle</span><span class="rls-chip">$7.34</span>
|
||||
</div>
|
||||
<div class="rls-row">
|
||||
<span class="rls-name">Basic</span><span class="rls-chip">$1.49</span>
|
||||
</div>
|
||||
<div class="rls-row">
|
||||
<span class="rls-name">Standard</span><span class="rls-chip">$2.91</span>
|
||||
</div>
|
||||
<div class="rls-row rls-win">
|
||||
<span class="rls-name">Our Platform</span><span class="rls-chip">$1.38</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// Cubic-bezier evaluated as a GSAP ease. Pure function of progress, so
|
||||
// it is seek-safe: seek(t) always yields the same value, no internal
|
||||
// state to drift. Newton-Raphson on x, bisection where the slope flattens.
|
||||
function cb(x1, y1, x2, y2) {
|
||||
var A = function (a, b) { return 1 - 3 * b + 3 * a; };
|
||||
var B = function (a, b) { return 3 * b - 6 * a; };
|
||||
var C = function (a) { return 3 * a; };
|
||||
var f = function (t, a, b) { return ((A(a, b) * t + B(a, b)) * t + C(a)) * t; };
|
||||
var d = function (t, a, b) { return 3 * A(a, b) * t * t + 2 * B(a, b) * t + C(a); };
|
||||
return function (p) {
|
||||
if (p <= 0) return 0;
|
||||
if (p >= 1) return 1;
|
||||
var t = p, i, s, e;
|
||||
for (i = 0; i < 8; i++) {
|
||||
s = d(t, x1, x2);
|
||||
if (s === 0) break;
|
||||
e = f(t, x1, x2) - p;
|
||||
if (Math.abs(e) < 1e-7) break;
|
||||
t -= e / s;
|
||||
}
|
||||
if (t < 0 || t > 1) {
|
||||
var lo = 0, hi = 1, j, v;
|
||||
t = p;
|
||||
for (j = 0; j < 30; j++) {
|
||||
v = f(t, x1, x2);
|
||||
if (Math.abs(v - p) < 1e-7) break;
|
||||
if (v > p) hi = t; else lo = t;
|
||||
t = (lo + hi) / 2;
|
||||
}
|
||||
}
|
||||
return f(t, y1, y2);
|
||||
};
|
||||
}
|
||||
|
||||
// Named for what they do in a shot. No GSAP preset appears in this file
|
||||
// on purpose: a named ease is a category, not a curve.
|
||||
var E = {
|
||||
enter: cb(0.22, 0.9, 0.3, 1.0),
|
||||
enterSoft: cb(0.33, 0.7, 0.35, 1.0),
|
||||
exitAway: cb(0.5, 0.0, 0.75, 0.2),
|
||||
exitSettle: cb(0.3, 0.8, 0.4, 1.0),
|
||||
camSettle: cb(0.16, 0.84, 0.28, 1.0),
|
||||
camPush: cb(0.4, 0.0, 0.2, 1.0),
|
||||
camWhip: cb(0.7, 0.0, 0.1, 1.0),
|
||||
morph: cb(0.65, 0.05, 0.35, 1.0),
|
||||
spring0: cb(0.34, 1.0, 0.36, 1.0),
|
||||
springSm: cb(0.34, 1.3, 0.5, 1.0),
|
||||
springMd: cb(0.28, 1.55, 0.45, 1.0),
|
||||
linear: function (p) { return p; },
|
||||
|
||||
// Fitted to the reference roll, max error 1.9% of travel: 80% of
|
||||
// the distance inside the first 40% of the time. Closer than any
|
||||
// palette curve (enter is 3.4% off, camSettle 3.5%), so the
|
||||
// measurement wins over the shelf.
|
||||
rollSettle: cb(0.18, 0.78, 0.18, 0.98),
|
||||
|
||||
// The clip opens at speed, not fading up. Start slope 0.85 over a
|
||||
// 0.1s lead is 11.9 pitches per second at frame 0, which is what
|
||||
// the reference does between f-001 and f-002 (11.7); end slope 1.7
|
||||
// hands off at 23.8 into the roll's own 25.3, so there is no step.
|
||||
preRoll: cb(0.4, 0.34, 0.75, 0.575),
|
||||
};
|
||||
|
||||
gsap.defaults({ immediateRender: false });
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var titleEl = root.querySelector(".rls-title");
|
||||
var list = root.querySelector(".rls-list");
|
||||
var rows = Array.prototype.slice.call(root.querySelectorAll(".rls-row"));
|
||||
var winChip = root.querySelector(".rls-win .rls-chip");
|
||||
var vars =
|
||||
window.__hyperframes && window.__hyperframes.getVariables
|
||||
? window.__hyperframes.getVariables()
|
||||
: {};
|
||||
|
||||
if (vars.title != null) titleEl.textContent = String(vars.title);
|
||||
|
||||
// GSAP writes transforms in px, so a tweened distance in cqmin does
|
||||
// not survive. Read the unit at build time. Measuring the pitch off
|
||||
// a real row rather than recomputing it keeps portrait's taller
|
||||
// pitch on the same 5.83-pitch roll without a second constant.
|
||||
var U = Math.min(root.clientWidth, root.clientHeight) / 100 || 10.8;
|
||||
var pitch = (rows[0] && rows[0].offsetHeight) || 7.78 * U;
|
||||
|
||||
var D = Math.max(0.001, parseFloat(root.dataset.duration || "2.0"));
|
||||
var s = D < 2.0 ? D / 2.0 : 1; // compress the beats, never the order
|
||||
var FPS = parseFloat(root.dataset.fps || "30") || 30;
|
||||
var LEAD_D = 0.1 * s;
|
||||
var ROLL_AT = 0.1 * s;
|
||||
var ROLL_D = 1.0 * s;
|
||||
|
||||
// Distances in ROW PITCHES, which is the unit the lamp thinks in.
|
||||
var LEAD = 1.4;
|
||||
var ROLL = 5.834; // 45.4% of frame height in 16:9
|
||||
var LAMP = 1.6; // how many pitches deep the lamp still reaches
|
||||
|
||||
// The list position, in pitches above rest, as a function of time.
|
||||
// Same two curves and the same clock as the tweens below, so the
|
||||
// lamp can never drift out of step with what is on screen.
|
||||
function posY(t) {
|
||||
if (t <= 0) return ROLL + LEAD;
|
||||
if (t < LEAD_D) return ROLL + LEAD * (1 - E.preRoll(t / LEAD_D));
|
||||
if (t < ROLL_AT + ROLL_D) return ROLL * (1 - E.rollSettle((t - ROLL_AT) / ROLL_D));
|
||||
return 0;
|
||||
}
|
||||
|
||||
var last = rows.length - 1;
|
||||
function litAt(i, t) {
|
||||
var d = Math.abs(i - last + posY(t));
|
||||
return Math.max(0, Math.min(1, 1 - d / LAMP));
|
||||
}
|
||||
|
||||
// Rest state pinned outside the timeline, and both ends written on
|
||||
// every tween, so a seek can never inherit a start value from the
|
||||
// screen. The list opens part-way through its own roll with the top
|
||||
// row already under the lamp, which is the frame the reference
|
||||
// opens on too.
|
||||
gsap.set(list, { y: (ROLL + LEAD) * pitch });
|
||||
gsap.set(winChip, { scale: 0.9 });
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
// LEAD. 0.1s, and it is a run-in at speed, not an anticipation. The
|
||||
// 0.6s version this replaces moved 6% of the travel in 17% of the
|
||||
// clip while the rows merely faded up, so the shot opened inert.
|
||||
tl.fromTo(
|
||||
list,
|
||||
{ y: (ROLL + LEAD) * pitch },
|
||||
{ y: ROLL * pitch, duration: LEAD_D, ease: E.preRoll },
|
||||
0,
|
||||
);
|
||||
|
||||
// ROLL. The measured move. Its final frame travels about 0.4px, under
|
||||
// the dead-frame gate, which is why the chip settle is laid across
|
||||
// that tail instead of starting after it.
|
||||
tl.fromTo(
|
||||
list,
|
||||
{ y: ROLL * pitch },
|
||||
{ y: 0, duration: ROLL_D, ease: E.rollSettle },
|
||||
ROLL_AT,
|
||||
);
|
||||
|
||||
// LAND. The chip settles into its own right edge, the edge the whole
|
||||
// column aligns on. Small element, so a small overshoot is the
|
||||
// correct end of the size-to-bounce rule, and it is also the layer
|
||||
// still moving through the roll's dead tail and the hold.
|
||||
tl.fromTo(
|
||||
winChip,
|
||||
{ scale: 0.9 },
|
||||
{ scale: 1, duration: 0.85 * s, ease: E.springSm },
|
||||
ROLL_AT + 0.9 * s,
|
||||
);
|
||||
|
||||
// THE LAMP. Sampled at render frame rate off posY, then emitted as
|
||||
// explicit fromTo segments whenever the value has drifted enough to
|
||||
// matter. The gate is 0.004 rather than 0.01 because the CSS ramps
|
||||
// multiply this number by up to 5.5, so a hundredth here would band
|
||||
// into a visible five-percent opacity step. Rows nowhere near the
|
||||
// lamp hold at exactly zero and emit nothing.
|
||||
var END = ROLL_AT + ROLL_D;
|
||||
var STEP = 1 / FPS;
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var prevV = litAt(i, 0);
|
||||
var prevT = 0;
|
||||
gsap.set(rows[i], { "--lit": prevV });
|
||||
for (var t = STEP; t <= END + STEP; t += STEP) {
|
||||
var at = Math.min(t, END);
|
||||
var v = litAt(i, at);
|
||||
if (Math.abs(v - prevV) >= 0.004 || at >= END) {
|
||||
if (v !== prevV) {
|
||||
tl.fromTo(
|
||||
rows[i],
|
||||
{ "--lit": prevV },
|
||||
{ "--lit": v, duration: at - prevT, ease: E.linear },
|
||||
prevT,
|
||||
);
|
||||
}
|
||||
prevV = v;
|
||||
prevT = at;
|
||||
}
|
||||
if (at >= END) break;
|
||||
}
|
||||
}
|
||||
|
||||
tl.set({}, {}, D); // pin the full duration
|
||||
tl.seek(0);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["rank-list-settle"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: receipt-card at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>receipt-card 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="2.2" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="receipt-card"
|
||||
data-composition-src="./receipt-card.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="2.2" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 8.7 KiB |
@@ -0,0 +1,407 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
receipt-card: HyperFrames video primitive (source citation, 9:16 native).
|
||||
|
||||
A quote card flies in from the right at a 18deg tilt, unrotates onto the flat,
|
||||
and then one phrase inside it takes a selection mark: the mark boxes fill blue
|
||||
at full width, in place, while the marked words cross to white.
|
||||
|
||||
ENVELOPE (D = 2.20s, 30fps)
|
||||
0.00-0.72 ARRIVE. The plate translates 0.645 of its own width leftward to
|
||||
rest. Frame zero is not empty: the card opens 497px right of rest
|
||||
at 9:16, so its left 56% (the head of every line) is already in
|
||||
frame and already tilted.
|
||||
0.00-0.92 SETTLE. Tilt 18.0deg to 0, on a baked spring with 3% overshoot,
|
||||
so the card crosses flat by +0.54deg and comes back. Its window
|
||||
outruns the translation's, which is what keeps the translation's
|
||||
dead tail off the render (Law 3, overlap).
|
||||
0.30-1.05 CONTACT. The drop shadow deepens from 0.18 to 1 as the card lands.
|
||||
0.62-1.90 PUSH. The plate scales 1.000 to 1.030, linear. This is the one
|
||||
authored beat in the file and it exists because the reference's
|
||||
own pacing cannot be copied here, see deviation 3.
|
||||
1.863-2.130 MARK. The reference's event, at the reference's measured length
|
||||
of 0.267s and on the curve fitted to it. Every mark box on every
|
||||
line of the phrase ramps together, at full width, from paper to
|
||||
#4347F6, and the phrase's ink crosses from #16181C to white on the
|
||||
same ramp. Nothing sweeps and nothing grows.
|
||||
|
||||
REFERENCE: refs/b6/tt/brew-7667238634860449038.mp4, the card at 17.0-22.5s
|
||||
(the 55 supplied frames) for geometry and the mark, plus the tilted card at
|
||||
74.6-80.5s for the resting angle. Everything below is measured, at 1080x1920,
|
||||
as a fraction of the frame.
|
||||
card x 14.26 to 85.56 (71.30% wide), y 52.24 to 72.19 (19.95% tall),
|
||||
constant for all 55 frames: the card never grows, the copy
|
||||
fills it. Corner radius 40px (3.70% of frame width). Fill
|
||||
#FCFCFC on a live plate, so white.
|
||||
publisher serif, all caps, tracked, centred, cap height 20px, sitting
|
||||
34px below the card's top edge, above the quote.
|
||||
quote bold sans, 47px, line advance 56px (line-height 1.19), centred,
|
||||
near black, inset 40px from the card's sides.
|
||||
mark one rectangle per line the phrase occupies, 45px tall against
|
||||
the 56px line advance (0.80), starting about 8px before the
|
||||
phrase and ending about 8px after it. Square corners, verified
|
||||
at 4x on the 48.93s mark: no visible radius on any of the four.
|
||||
mark colour #4347F6. The 24919 paper pixels inside the mark box read
|
||||
(251, 251, 251) before the ramp and (63, 67, 243) after it.
|
||||
ink on mark white. The same box's 6910 glyph core pixels read (7, 7, 7)
|
||||
before and (237, 245, 250) after. The words invert.
|
||||
tilt the 76.0s card's bottom edge, fitted over the middle half of
|
||||
its span, is -17.6deg. Rounded to 18.0deg here.
|
||||
|
||||
THE MARK IS A FILL, NOT A SWEEP. Re-measured at the source's native 30fps, not
|
||||
on the 10fps frames. Method: subtract the pre-onset frame's blueness, isolate
|
||||
the mark's own connected component, then read that component in 8 equal column
|
||||
bins left to right and 6 row bins top to bottom, every frame.
|
||||
20.400-20.667 all 8 column bins leave zero on the SAME frame (20.433) and
|
||||
sit at the same normalised progress at every sample: leftmost
|
||||
bin 0.080, rightmost 0.081 at 20.433; 0.837 and 0.857 at
|
||||
20.600. A sweep cannot do that.
|
||||
48.933-49.467 the second clean onset, 16 frames of ramp, same result: bins
|
||||
0.085 and 0.093 at the first lit frame, 0.585 and 0.596 at
|
||||
the midpoint. The 6 ROW bins ramp together too, so it is not
|
||||
a vertical wipe either.
|
||||
60.300, 63.667 both go from zero to plateau between two adjacent frames.
|
||||
Those are shot cuts, not ramps, and are not evidence.
|
||||
At 20.4 the phrase runs over TWO line boxes and both boxes ramp in lockstep,
|
||||
so the mark does not travel across the line break either.
|
||||
|
||||
FITTED CURVE. Sampled at 30fps as the mark box's paper colour distance from
|
||||
its unmarked value (0, 6.83, 22.41, 38.87, 56.22, 71.85, 87.85, 95.92, 99.50
|
||||
percent of final), cb(0.181, 0.002, 0.709, 1.000) fits that table to a max
|
||||
error of 3.09% of travel, and 0.50% against the mean-blueness table it was
|
||||
fitted to. The nearest palette curve, morph, is 16.4% off; camWhip 19.6%,
|
||||
camPush 21.8%, enterSoft 36.2%, enter 52.4%. That curve drives the mark here.
|
||||
|
||||
DELIBERATE DEVIATIONS, each with its reason:
|
||||
1. An authored 1.28s push in the middle. The reference's real pacing for this
|
||||
shot is: hard cut to a finished card, 3.30s dead, one 0.267s cross dissolve,
|
||||
then 1.73s dead (the card box and the mark pixel count are both flat to
|
||||
within 0.3 of a level from 20.667 to 21.567, measured at 1080x1920). A
|
||||
primitive cannot be 88% hold: the batch's floor is 2.07s and the audit
|
||||
gates dead runtime. So the reference's EVENT is reproduced exactly, at its
|
||||
measured length and on its own curve, and the runtime the reference spends
|
||||
holding is spent here on a slow linear scale push instead. Linear because
|
||||
both of the source's two real card motions are linear (the push at
|
||||
47.1-48.6s, 0.74% of frame width per frame, and the rise at 87.2-89.0s,
|
||||
1.5% of frame height per frame). The amplitude is authored, and it is the
|
||||
one number in this file that no measurement backs.
|
||||
2. The reference cuts its cards in on a shot change, so there is no entrance
|
||||
table anywhere in the source. The arrival is therefore authored from the
|
||||
palette, with the reference supplying only its angle.
|
||||
3. Two more lines of copy fade in during the SAME 0.267s window as the mark,
|
||||
on the same curve (measured over the unmarked words left of the mark:
|
||||
235.6 to 7.4 mean luminance, 0, 7.1, 22.4, 40.2, 58.3, 75.0, 91.9, 96.7,
|
||||
99.1 percent). Not adopted: it needs the quote split into per line blocks,
|
||||
and the move this file packages is the mark, not the shot's edit.
|
||||
4. One card, not the several the source uses. Two cards arriving from two
|
||||
edges is two subjects in one beat (Law 6), and the second one would have to
|
||||
land in the presenter's zone.
|
||||
5. Copy, publisher and the opaque stage are invented. Nothing of the source's
|
||||
subject matter, publisher or quote text is reused, and the source has no
|
||||
page background at all: it marks over live footage. Set --rc-bg to
|
||||
transparent to composite the same way.
|
||||
|
||||
Frame zero (Law 8): the tilted card already 44% of the way in from the right,
|
||||
publisher and all five quote lines set, shadow at 0.18, no mark. Nothing
|
||||
starts from an empty frame.
|
||||
|
||||
Presenter safe zone: authored for 9:16, where the whole move lives above 62%
|
||||
of frame height. The plate rests at y 21.5 to 41.5, and its deepest point at
|
||||
any moment is the tilted lower left corner at t=0, at 47.2%. Checked against
|
||||
the local a-roll, which is a QA asset and is referenced nowhere in this file.
|
||||
|
||||
Media slot: there is none, this draws everything it shows. To composite over
|
||||
footage, set --rc-bg to transparent on #root and mount it above the video.
|
||||
Overridable on #root: --rc-bg, --rc-card, --rc-ink, --rc-pub, --rc-mark,
|
||||
--rc-marked-ink, --rc-shadow. The publisher name, the quote and which words
|
||||
carry the mark all live in the markup: move the .rc-phrase span and the mark
|
||||
boxes follow it.
|
||||
|
||||
Contrast: white on #4347F6 is 6.05:1, over the 4.5:1 floor. Mid ramp the
|
||||
phrase passes through grey on lavender for about 0.13s, which is what the
|
||||
reference does and what any cross dissolve does.
|
||||
|
||||
Mount contract: the runtime clones only this template, #root fills the host,
|
||||
carries no data-width or data-height, and registers one paused timeline under
|
||||
the hardcoded receipt-card id.
|
||||
-->
|
||||
<html lang="en" data-composition-id="receipt-card" data-composition-duration="2.2">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Receipt Card</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="receipt-card" data-duration="2.2" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
background: var(--rc-bg, #0e1013);
|
||||
font-family: Inter, "Helvetica Neue", system-ui, sans-serif;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* The plate carries both the card and its shadow, so the arrival is
|
||||
one transform on one element and the shadow can never shear off it.
|
||||
Width is the reference's 71.30% of frame width, capped in cqmin so
|
||||
a landscape host does not stretch a 5 line quote to 1369px. */
|
||||
.rc-plate {
|
||||
position: absolute;
|
||||
top: 21.5cqh;
|
||||
left: 50%;
|
||||
width: min(71.3cqw, 78cqmin);
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.rc-shade {
|
||||
position: absolute;
|
||||
inset: 1.4cqmin -0.6cqmin -2.2cqmin;
|
||||
border-radius: 4.4cqmin;
|
||||
background: var(--rc-shadow, rgba(0, 0, 0, 0.62));
|
||||
filter: blur(2.6cqmin);
|
||||
}
|
||||
|
||||
.rc-card {
|
||||
position: relative;
|
||||
padding: 3.15cqmin 3.7cqmin 2.8cqmin;
|
||||
border-radius: 3.7cqmin;
|
||||
background: var(--rc-card, #fcfcfc);
|
||||
}
|
||||
|
||||
/* Publisher line. Serif, all caps and tracked rather than true small
|
||||
caps: synthesised small caps differ per host font, and the reference
|
||||
sets it in caps anyway. */
|
||||
.rc-pub {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
margin: 0 0 2.4cqmin;
|
||||
color: var(--rc-pub, #16181c);
|
||||
font-family: Georgia, "Times New Roman", serif;
|
||||
font-size: 2.32cqmin;
|
||||
letter-spacing: 0.14em;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.rc-quote {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
margin: 0;
|
||||
color: var(--rc-ink, #16181c);
|
||||
font-size: 4.35cqmin;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.005em;
|
||||
line-height: 1.19;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* The marked state of the card, as one layer: the mark boxes plus a
|
||||
copy of the quote whose only visible text is the phrase, in white.
|
||||
Fading this whole layer in is what the reference does. Compositing
|
||||
white-on-blue over black-on-white gives the reference's own mid ramp
|
||||
greys for free, so no per element colour tween is needed. */
|
||||
.rc-marks {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 2;
|
||||
overflow: hidden;
|
||||
border-radius: 3.7cqmin;
|
||||
}
|
||||
|
||||
.rc-mark {
|
||||
position: absolute;
|
||||
background: var(--rc-mark, #4347f6);
|
||||
}
|
||||
|
||||
/* The overlay copy. Everything except the phrase is transparent, so
|
||||
the base quote below shows through unchanged at any opacity. */
|
||||
.rc-marks .rc-quote {
|
||||
position: absolute;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.rc-marks .rc-phrase {
|
||||
color: var(--rc-marked-ink, #ffffff);
|
||||
}
|
||||
|
||||
/* Landscape is a fallback, not the native shape: the presenter owns
|
||||
the left 32% there, so the plate moves into the right two thirds
|
||||
instead of sitting on top of the person. */
|
||||
@container (aspect-ratio > 1.35) {
|
||||
.rc-plate {
|
||||
left: 66%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="rc-plate">
|
||||
<div class="rc-shade"></div>
|
||||
<div class="rc-card">
|
||||
<div class="rc-marks"></div>
|
||||
<p class="rc-pub">The Daily Ledger</p>
|
||||
<p class="rc-quote">
|
||||
“Most of the work happens long before anyone is watching, and the part that looks effortless is
|
||||
usually <span class="rc-phrase">the part that took the longest to get right</span>.”
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// Cubic-bezier as a GSAP ease. Pure function of progress, so seek-safe:
|
||||
// seek(t) always yields the same value, no internal state to drift.
|
||||
// Newton-Raphson on x, bisection where the slope flattens.
|
||||
function cb(x1, y1, x2, y2) {
|
||||
var A = function (a, b) { return 1 - 3 * b + 3 * a; }, C = function (a) { return 3 * a; };
|
||||
var B = function (a, b) { return 3 * b - 6 * a; };
|
||||
var f = function (t, a, b) { return ((A(a, b) * t + B(a, b)) * t + C(a)) * t; };
|
||||
var d = function (t, a, b) { return 3 * A(a, b) * t * t + 2 * B(a, b) * t + C(a); };
|
||||
return function (p) {
|
||||
if (p <= 0) return 0;
|
||||
if (p >= 1) return 1;
|
||||
var t = p, i, s, e;
|
||||
for (i = 0; i < 8; i++) {
|
||||
s = d(t, x1, x2);
|
||||
if (s === 0) break;
|
||||
e = f(t, x1, x2) - p;
|
||||
if (Math.abs(e) < 1e-7) break;
|
||||
t -= e / s;
|
||||
}
|
||||
if (t < 0 || t > 1) {
|
||||
var lo = 0, hi = 1, j, v;
|
||||
t = p;
|
||||
for (j = 0; j < 30; j++) {
|
||||
v = f(t, x1, x2);
|
||||
if (Math.abs(v - p) < 1e-7) break;
|
||||
if (v > p) hi = t; else lo = t;
|
||||
t = (lo + hi) / 2;
|
||||
}
|
||||
}
|
||||
return f(t, y1, y2);
|
||||
};
|
||||
}
|
||||
|
||||
// Named for what they do in a shot. No GSAP preset appears here on
|
||||
// purpose: a named ease is a category, not a curve.
|
||||
var E = {
|
||||
enter: cb(0.22, 0.9, 0.3, 1.0),
|
||||
exitSettle: cb(0.3, 0.8, 0.4, 1.0),
|
||||
springSm: cb(0.34, 1.3, 0.5, 1.0),
|
||||
// Fitted, not chosen. See the header: this is the reference's own
|
||||
// mark ramp at 20.400 to 20.667s, 9 samples at 30fps, max error
|
||||
// 0.50% of travel. It drives the fill here, as it does there.
|
||||
marker: cb(0.181, 0.002, 0.709, 1.0),
|
||||
// The source's two real card motions are both constant rate.
|
||||
linear: cb(0.0, 0.0, 1.0, 1.0),
|
||||
};
|
||||
|
||||
gsap.defaults({ immediateRender: false });
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var plate = root.querySelector(".rc-plate");
|
||||
var card = root.querySelector(".rc-card");
|
||||
var shade = root.querySelector(".rc-shade");
|
||||
var quote = root.querySelector(".rc-quote");
|
||||
var phrase = root.querySelector(".rc-phrase");
|
||||
var marks = root.querySelector(".rc-marks");
|
||||
|
||||
// GSAP writes transforms as px, so a cqmin tween distance would not
|
||||
// survive. Read the unit once, at build time, and multiply.
|
||||
var U = Math.min(root.clientWidth, root.clientHeight) / 100 || 10.8;
|
||||
|
||||
var cardBox = card.getBoundingClientRect();
|
||||
var plateW = plate.getBoundingClientRect().width || 71 * U;
|
||||
// Travel is a fraction of the PLATE, not of the frame. As a frame
|
||||
// fraction the same number leaves the card entirely off screen in
|
||||
// landscape, where the plate is parked at 66%, and frame zero comes
|
||||
// out empty. 0.645 of the plate is the reference's 497px at 9:16.
|
||||
var IN_X = 0.645 * plateW;
|
||||
var TILT = -18; // the 76.0s card's fitted bottom edge, -17.6deg
|
||||
|
||||
// One box per line the phrase occupies, measured rather than
|
||||
// authored: a Range reports the real line fragments, so moving the
|
||||
// span or changing the host font re-cuts the boxes for free.
|
||||
var fs = parseFloat(getComputedStyle(quote).fontSize) || 4.35 * U;
|
||||
var rng = document.createRange();
|
||||
rng.selectNodeContents(phrase);
|
||||
var PAD = 0.62 * U;
|
||||
var MH = 0.98 * fs; // 45px against a 56px line advance in the reference
|
||||
[].slice
|
||||
.call(rng.getClientRects())
|
||||
.filter(function (r) { return r.width > 4; })
|
||||
.forEach(function (r) {
|
||||
var el = document.createElement("span");
|
||||
el.className = "rc-mark";
|
||||
el.style.left = r.left - cardBox.left - PAD + "px";
|
||||
el.style.top = r.top - cardBox.top + (r.height - MH) / 2 + 0.04 * fs + "px";
|
||||
el.style.width = r.width + PAD * 2 + "px";
|
||||
el.style.height = MH + "px";
|
||||
marks.appendChild(el);
|
||||
});
|
||||
|
||||
// The white ink sits on the same layer, above the boxes, as a copy
|
||||
// of the quote pinned over the original. Cloning rather than
|
||||
// re-authoring keeps the two line breakings identical by
|
||||
// construction, at any host width and any host font.
|
||||
var qb = quote.getBoundingClientRect();
|
||||
var over = quote.cloneNode(true);
|
||||
over.style.left = qb.left - cardBox.left + "px";
|
||||
over.style.top = qb.top - cardBox.top + "px";
|
||||
over.style.width = qb.width + "px";
|
||||
marks.appendChild(over);
|
||||
|
||||
var D = 2.2;
|
||||
|
||||
// Rest state pinned outside the timeline, both ends written on every
|
||||
// tween, so a seek never inherits a start value from the screen.
|
||||
gsap.set(plate, { x: IN_X, rotation: TILT, scale: 1, transformOrigin: "50% 50%" });
|
||||
gsap.set(shade, { opacity: 0.18 });
|
||||
gsap.set(marks, { opacity: 0 });
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
// ARRIVE and SETTLE. The tilt's window is longer than the slide's on
|
||||
// purpose: the slide's tail is the flattest part of enter, and the
|
||||
// spring is still crossing flat through all of it.
|
||||
tl.fromTo(plate, { x: IN_X }, { x: 0, duration: 0.72, ease: E.enter }, 0);
|
||||
tl.fromTo(plate, { rotation: TILT }, { rotation: 0, duration: 0.92, ease: E.springSm }, 0);
|
||||
tl.fromTo(shade, { opacity: 0.18 }, { opacity: 1, duration: 0.75, ease: E.exitSettle }, 0.3);
|
||||
|
||||
// PUSH. Opens at 0.62, inside the spring's tail, which is the handoff
|
||||
// Law 3 asks for: the spring is mathematically alive until 0.92 but
|
||||
// its last 30% is under a pixel at the card's corner. Runs to 1.90,
|
||||
// where the mark takes over. See header deviation 1: this is standing
|
||||
// in for runtime the reference spends holding perfectly still.
|
||||
tl.fromTo(plate, { scale: 1 }, { scale: 1.03, duration: 1.28, ease: E.linear }, 0.62);
|
||||
|
||||
// MARK. The reference's event, whole: 0.267s, its own fitted curve,
|
||||
// every box on every line at once and at full width. Ends at 2.130
|
||||
// rather than at D so the last sample the harness takes, at 0.9697*D,
|
||||
// lands on the finished state instead of inside the ramp.
|
||||
tl.fromTo(marks, { opacity: 0 }, { opacity: 1, duration: 0.267, ease: E.marker }, 1.863);
|
||||
|
||||
tl.set({}, {}, D); // pin the full duration
|
||||
tl.seek(0);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["receipt-card"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: state-chip-rail at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>state-chip-rail 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="5" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="state-chip-rail"
|
||||
data-composition-src="./state-chip-rail.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="5" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 4.9 KiB |
@@ -0,0 +1,363 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
state-chip-rail: HyperFrames video primitive (product demo / state machine)
|
||||
|
||||
A rail of mono status chips advances a data-state snap machine on a cue
|
||||
schedule. CSS alone responds to each chip's [data-state]; the timeline only
|
||||
flips attributes with tl.set, so every advance is an instantaneous snap that
|
||||
is exact in both seek directions (GSAP zero-duration sets record the prior
|
||||
attribute value and restore it on backward seeks). The active chip is ink on
|
||||
surface, done chips dim, pending chips stay hollow. Optional badges pop
|
||||
beside one named state when it activates. Generalizes the flagship
|
||||
agent-console status rail (cohere-north frame 04).
|
||||
|
||||
Variables (declared in data-composition-variables below):
|
||||
- states (string, default "Queued,Reading,Drafting,Done"): comma list of
|
||||
chip labels, in machine order. 2 to 8 states; extras are dropped.
|
||||
- times (string, default ""): comma-separated activation times in seconds
|
||||
relative to mount start, one per ADVANCE (state 1, state 2, ...).
|
||||
Blank or invalid entries use the default even rhythm. Values are
|
||||
clamped into the mount window and forced monotonic.
|
||||
- badge_state (number, default 1): index of the state the badges pop
|
||||
beside. Clamped to the states range.
|
||||
- badges (string, default ""): comma list of badge labels rendered after
|
||||
the badge_state chip; they pop in when that state activates. Empty
|
||||
disables badges. Up to 4.
|
||||
- accent (green | blue | violet, default green): active-chip accent.
|
||||
green -> --brand, blue -> --accent, violet -> --accent-2.
|
||||
- exit ("none" | "fade" | "up", default "none"): frame roots own
|
||||
transitions; the default hold-ends-the-film.
|
||||
|
||||
Envelope, fixed IN with elastic HOLD (never gsap.timeScale()):
|
||||
IN = chip cascade (~0.8s) then the advance schedule; the default
|
||||
rhythm spreads advances so the final state lands ~1s before the
|
||||
mount window closes.
|
||||
HOLD = still after the last advance; nothing floats, nothing loops.
|
||||
OUT = 0 when exit is "none"; else 0.45s fade / fade-up of the rail.
|
||||
|
||||
Mount contract: elastic root, no data-width/data-height, styled via #root
|
||||
only, container-type: size, one paused timeline registered under the
|
||||
literal "state-chip-rail" key. Deterministic and seek-safe: fromTo
|
||||
entrances, attribute snaps via tl.set, no CSS transitions, no Date.now,
|
||||
no randomness. State dimming rides color (color-mix), never opacity, so it
|
||||
can never collide with the entrance opacity tweens.
|
||||
-->
|
||||
<html
|
||||
lang="en"
|
||||
data-composition-id="state-chip-rail"
|
||||
data-composition-duration="5"
|
||||
data-composition-variables='[
|
||||
{ "id": "states", "type": "string", "role": "content", "label": "States", "description": "Comma-separated chip labels in machine order (2 to 8 states).", "default": "Queued,Reading,Drafting,Done" },
|
||||
{ "id": "times", "type": "string", "role": "timing", "label": "Times", "description": "Comma-separated activation times in seconds, one per advance (state 1 onward). Blank entries use the default even rhythm.", "default": "" },
|
||||
{ "id": "badge_state", "type": "number", "role": "content", "label": "Badge state", "description": "Index of the state the badges pop beside.", "default": 1, "min": 0, "max": 7, "step": 1 },
|
||||
{ "id": "badges", "type": "string", "role": "content", "label": "Badges", "description": "Comma-separated badge labels shown beside the badge state. Empty disables.", "default": "" },
|
||||
{ "id": "accent", "type": "enum", "role": "style", "label": "Accent", "description": "Accent token family used by the active chip.", "default": "green", "options": [{ "value": "green", "label": "Green" }, { "value": "blue", "label": "Blue" }, { "value": "violet", "label": "Violet" }] },
|
||||
{ "id": "exit", "type": "enum", "role": "timing", "label": "Exit", "description": "How the rail leaves the frame. Default none: the hold ends the film.", "default": "none", "options": [{ "value": "none", "label": "None" }, { "value": "fade", "label": "Fade" }, { "value": "up", "label": "Up" }] }
|
||||
]'
|
||||
>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>State Chip Rail</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="state-chip-rail" data-duration="5" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
background: var(--bg, transparent);
|
||||
color: var(--fg, #f8fafc);
|
||||
font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.scr-clip {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.scr-rail {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-wrap: nowrap;
|
||||
max-width: 94cqw;
|
||||
gap: var(--scr-gap, 0.8em);
|
||||
font-size: var(--scr-font, 2cqmin);
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
.scr-chip,
|
||||
.scr-badge {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
gap: 0.55em;
|
||||
padding: 0.62em 1.05em;
|
||||
overflow: hidden;
|
||||
border: 0.16cqmin solid var(--border, #334155);
|
||||
border-radius: 100cqmax;
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
white-space: nowrap;
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
.scr-dot {
|
||||
flex: 0 0 auto;
|
||||
width: 0.5em;
|
||||
aspect-ratio: 1;
|
||||
border: 0.16cqmin solid var(--muted, #94a3b8);
|
||||
border-radius: 50%;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* The snap machine: presentation is pure CSS on [data-state]; the
|
||||
timeline only flips the attribute. Dimming rides color, never
|
||||
opacity, so it cannot fight the entrance opacity tweens. */
|
||||
.scr-chip[data-state="pending"] {
|
||||
border-color: color-mix(in srgb, var(--border, #334155) 80%, transparent);
|
||||
background: transparent;
|
||||
color: color-mix(in srgb, var(--muted, #94a3b8) 78%, transparent);
|
||||
}
|
||||
|
||||
.scr-chip[data-state="active"] {
|
||||
border-color: color-mix(in srgb, var(--scr-accent) 62%, var(--border, #334155));
|
||||
background: var(--surface, #131a24);
|
||||
color: var(--fg, #f8fafc);
|
||||
}
|
||||
.scr-chip[data-state="active"] .scr-dot {
|
||||
border-color: transparent;
|
||||
background: var(--scr-accent, var(--brand, #71f5a7));
|
||||
}
|
||||
|
||||
.scr-chip[data-state="done"] {
|
||||
border-color: color-mix(in srgb, var(--border, #334155) 45%, transparent);
|
||||
background: transparent;
|
||||
color: color-mix(in srgb, var(--muted, #94a3b8) 42%, transparent);
|
||||
}
|
||||
.scr-chip[data-state="done"] .scr-dot {
|
||||
border-color: transparent;
|
||||
background: color-mix(in srgb, var(--scr-accent, #71f5a7) 38%, transparent);
|
||||
}
|
||||
|
||||
.scr-badge {
|
||||
padding: 0.5em 0.9em;
|
||||
border-color: color-mix(in srgb, var(--border, #334155) 70%, transparent);
|
||||
color: color-mix(in srgb, var(--muted, #94a3b8) 88%, transparent);
|
||||
font-size: 0.82em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div
|
||||
id="state-chip-rail-clip"
|
||||
class="scr-clip clip"
|
||||
data-start="0"
|
||||
data-duration="5"
|
||||
data-track-index="0"
|
||||
>
|
||||
<div class="scr-rail" role="list"></div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// Literal id, never read off the DOM: the flattening step strips
|
||||
// data-composition-id from the mounted root (see toggle-flip).
|
||||
var compositionId = "state-chip-rail";
|
||||
var root = document.getElementById("root");
|
||||
var rail = root.querySelector(".scr-rail");
|
||||
var vars =
|
||||
window.__hyperframes && window.__hyperframes.getVariables
|
||||
? window.__hyperframes.getVariables()
|
||||
: {};
|
||||
|
||||
function commaList(value, max) {
|
||||
return String(value == null ? "" : value)
|
||||
.split(",")
|
||||
.map(function (token) {
|
||||
return token.trim();
|
||||
})
|
||||
.filter(function (token) {
|
||||
return token !== "";
|
||||
})
|
||||
.slice(0, max);
|
||||
}
|
||||
|
||||
var states = commaList(vars.states, 8);
|
||||
if (states.length === 0) states = ["Queued", "Reading", "Drafting", "Done"];
|
||||
var count = states.length;
|
||||
|
||||
var badges = commaList(vars.badges, 4);
|
||||
var badgeStateRaw = Math.round(Number(vars.badge_state));
|
||||
var badgeState = Number.isFinite(badgeStateRaw)
|
||||
? Math.max(0, Math.min(count - 1, badgeStateRaw))
|
||||
: Math.min(1, count - 1);
|
||||
|
||||
var exit = vars.exit === "fade" || vars.exit === "up" ? vars.exit : "none";
|
||||
|
||||
// Each enum choice routes to a DIFFERENT contract token so the
|
||||
// variable stays meaningful under a theme.
|
||||
var accentColors = {
|
||||
green: "var(--brand, #71f5a7)",
|
||||
blue: "var(--accent, #61a8ff)",
|
||||
violet: "var(--accent-2, #c5a3ff)",
|
||||
};
|
||||
var accent = Object.prototype.hasOwnProperty.call(accentColors, vars.accent)
|
||||
? vars.accent
|
||||
: "green";
|
||||
root.style.setProperty("--scr-accent", accentColors[accent]);
|
||||
|
||||
// Build the rail: chips in machine order, badges directly after
|
||||
// the badge_state chip. State 0 is active from mount.
|
||||
var chips = states.map(function (label, index) {
|
||||
var chip = document.createElement("div");
|
||||
chip.className = "scr-chip";
|
||||
chip.setAttribute("role", "listitem");
|
||||
chip.setAttribute("data-state", index === 0 ? "active" : "pending");
|
||||
var dot = document.createElement("span");
|
||||
dot.className = "scr-dot";
|
||||
dot.setAttribute("aria-hidden", "true");
|
||||
var text = document.createElement("span");
|
||||
text.textContent = label;
|
||||
chip.appendChild(dot);
|
||||
chip.appendChild(text);
|
||||
return chip;
|
||||
});
|
||||
var badgeElements = badges.map(function (label) {
|
||||
var badge = document.createElement("div");
|
||||
badge.className = "scr-badge";
|
||||
badge.textContent = label;
|
||||
return badge;
|
||||
});
|
||||
chips.forEach(function (chip, index) {
|
||||
rail.appendChild(chip);
|
||||
if (index === badgeState) {
|
||||
badgeElements.forEach(function (badge) {
|
||||
rail.appendChild(badge);
|
||||
});
|
||||
}
|
||||
});
|
||||
rail.setAttribute("aria-label", states.join(", "));
|
||||
|
||||
// Deterministic fit: wide-tracked mono at ~0.76em per glyph, plus
|
||||
// chip padding, dot, and rail gaps, all measured in em.
|
||||
var railEm = (count - 1 + badges.length) * 0.8;
|
||||
states.forEach(function (label) {
|
||||
railEm += Array.from(label).length * 0.76 + 3.1;
|
||||
});
|
||||
badges.forEach(function (label) {
|
||||
railEm += (Array.from(label).length * 0.76 + 2.5) * 0.82;
|
||||
});
|
||||
var fontCqw = Math.min(2.4, 90 / Math.max(1, railEm));
|
||||
root.style.setProperty("--scr-font", "min(" + fontCqw.toFixed(3) + "cqw, 9cqh)");
|
||||
|
||||
// RETIME RANGE: fixed IN cascade + advance schedule, elastic
|
||||
// still HOLD, optional OUT.
|
||||
var OUT_BASE = 0.45;
|
||||
var duration = Math.max(0.001, parseFloat(root.dataset.duration || "5"));
|
||||
var OUT = exit === "none" ? 0 : Math.min(OUT_BASE, duration * 0.2);
|
||||
var avail = duration - OUT;
|
||||
|
||||
var CHIP = Math.min(0.45, Math.max(0.2, avail * 0.15));
|
||||
var entryGap = Math.min(0.08, Math.max(0.02, avail * 0.02));
|
||||
var entryEnd = 0.12 + entryGap * (count - 1) + CHIP;
|
||||
|
||||
// Default rhythm: advances spread evenly from just after the
|
||||
// cascade to ~1s before the window closes.
|
||||
var firstAdvance = Math.min(Math.max(entryEnd + 0.15, 0.9), Math.max(0.2, avail - 0.6));
|
||||
var lastAdvance = Math.max(firstAdvance, avail - 1.0);
|
||||
var advanceCount = count - 1;
|
||||
var timesList = String(vars.times == null ? "" : vars.times).split(",");
|
||||
var previous = 0.15;
|
||||
var advances = [];
|
||||
for (var k = 0; k < advanceCount; k += 1) {
|
||||
var fallback =
|
||||
advanceCount > 1
|
||||
? firstAdvance + (k * (lastAdvance - firstAdvance)) / (advanceCount - 1)
|
||||
: firstAdvance;
|
||||
var cueText = (timesList[k] || "").trim();
|
||||
var cue = Number(cueText);
|
||||
var start = cueText !== "" && Number.isFinite(cue) ? cue : fallback;
|
||||
start = Math.max(0.15, Math.min(start, Math.max(0.15, avail - 0.45)));
|
||||
start = Math.max(start, previous + 0.05);
|
||||
previous = start;
|
||||
advances.push(start);
|
||||
}
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
// IN: chips cascade into the rail. Explicit both-endpoints state
|
||||
// so any seek is exact. Badges hold at scale 0 until their pop
|
||||
// (they keep their layout slot, so the rail never reflows).
|
||||
chips.forEach(function (chip, index) {
|
||||
gsap.set(chip, { opacity: 0, y: "2.5cqh" });
|
||||
tl.fromTo(
|
||||
chip,
|
||||
{ opacity: 0, y: "2.5cqh" },
|
||||
{ opacity: 1, y: "0cqh", duration: CHIP, ease: "power3.out" },
|
||||
0.12 + entryGap * index,
|
||||
);
|
||||
});
|
||||
|
||||
// The snap machine: pure attribute flips. GSAP records the prior
|
||||
// value on first render in timeline order, so backward seeks
|
||||
// restore pending / active exactly.
|
||||
advances.forEach(function (start, index) {
|
||||
var stateIndex = index + 1;
|
||||
tl.set(chips[stateIndex], { attr: { "data-state": "active" } }, start);
|
||||
tl.set(chips[stateIndex - 1], { attr: { "data-state": "done" } }, start);
|
||||
});
|
||||
|
||||
// Badges pop beside their state as it activates.
|
||||
if (badgeElements.length > 0) {
|
||||
var popStart = badgeState === 0 ? entryEnd + 0.1 : advances[badgeState - 1] + 0.12;
|
||||
popStart = Math.min(popStart, Math.max(0.2, avail - 0.4));
|
||||
badgeElements.forEach(function (badge, index) {
|
||||
gsap.set(badge, { opacity: 0, scale: 0 });
|
||||
tl.fromTo(
|
||||
badge,
|
||||
{ opacity: 0, scale: 0 },
|
||||
{ opacity: 1, scale: 1, duration: 0.4, ease: "power3.out" },
|
||||
popStart + 0.14 * index,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// HOLD: intentionally still. The resolved machine reads as a frame.
|
||||
|
||||
// OUT: the whole rail leaves together.
|
||||
if (exit !== "none") {
|
||||
var OUT_START = duration - OUT;
|
||||
tl.to(rail, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
if (exit === "up") {
|
||||
tl.to(rail, { y: "-3cqh", duration: OUT, ease: "power2.in" }, OUT_START);
|
||||
}
|
||||
}
|
||||
|
||||
tl.seek(0);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines[compositionId] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: thread-message-stack at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>thread-message-stack 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="5" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="thread-message-stack"
|
||||
data-composition-src="./thread-message-stack.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="5" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,502 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
thread-message-stack: HyperFrames video primitive (conversation / social)
|
||||
|
||||
A message thread builds itself OVER A MOVING BACKGROUND. Each new bubble lands on the bottom line and
|
||||
shoves the whole stack up with one fast spring; older messages ride off the top under a gradient mask.
|
||||
A grey typing pill leads every INCOMING message by about half a second, and only the incoming side gets
|
||||
one, because no messaging UI shows you your own typing indicator. There is no header, avatar, wordmark
|
||||
or rule: refs/frames/orchid f-005, f-020 and f-040 have nothing above the bubbles but footage, and the
|
||||
only branding is the small sender tag that rides up with one message.
|
||||
|
||||
== SWAPPING IN REAL FOOTAGE ========================================================================
|
||||
The roll behind the thread is PROCEDURAL: drifting defocused colour blobs driven by the same paused
|
||||
timeline as the bubbles, so this file ships no media and stays deterministic and licence clean. To put
|
||||
a real clip or a still behind the thread instead, replace the whole <div id="roll"> element with ONE
|
||||
line, either
|
||||
<video id="roll" class="clip" src="footage.mp4" muted playsinline></video>
|
||||
<img id="roll" src="plate.jpg" alt="" />
|
||||
#roll already carries position:absolute, inset:0 and object-fit:cover, and the roll tweens no-op when
|
||||
no .tms-blob children are present. Nothing else changes: the scrim, the top mask and both bubble fills
|
||||
are authored to survive arbitrary footage.
|
||||
====================================================================================================
|
||||
|
||||
Measured off refs/orchid.mp4 13.0 to 18.0s (f-001..040 at 8fps, 1920x1080): outgoing right edge 51.4%,
|
||||
max width 19.3%; incoming left edge 5.9%, up to 35.4% wide; pushes 4.7 to 13.9% of frame height, each
|
||||
under 0.25s, settling BACK 0.2 to 0.4%, which is a 3.5% overshoot, which is springSm. Overlay grade is
|
||||
the reusable part of this primitive: the blue carries a vertical gradient plus a soft drop shadow, and
|
||||
the grey is translucent enough that the plate reads faintly through it while the ink stays fully
|
||||
legible (f-020, f-030). Measured on the render, at the brightest point the roll reaches, the incoming
|
||||
ink sits at 9.1:1 against its own fill in 16:9 and 10.5:1 in 9:16.
|
||||
|
||||
Two deliberate departures. (1) BUBBLES DO NOT FADE IN, which overrules Law 4: the reference has nothing
|
||||
at 15.750s and a full extent, fully opaque bubble one 8fps frame later, so opacity is a 0.04s cut (one
|
||||
frame at 30fps) and all the physicality lives in the scale from 0.94. The corner radius is constant for
|
||||
the same reason. (2) The thread opens on three settled bubbles rather than the reference's one, because
|
||||
the reference fills the other 97% of its frame with a woman on a staircase and one bubble over a
|
||||
procedural plate is thin. Law 8: frame zero is a deliverable.
|
||||
|
||||
Message text lives in the markup, one line per .tms-bubble; the two line message uses an explicit <br>
|
||||
so its slot height stays exact in every aspect. Variables: --tms-roll-bg (base under the blobs, and the
|
||||
letterbox colour once real footage is in), --tms-out-fill (measured #2D89E1), --tms-out-ink,
|
||||
--tms-in-fill, --tms-in-ink, --tms-tag-ink, --tms-radius. Envelope, D = 5.00s, given as pill / bubble:
|
||||
0.40 / 0.86 wait that is actually wild (in, tag) 1.88 can you fix it (out)
|
||||
2.10 / 2.58 way ahead of you (in) 3.66 you are unreal (out)
|
||||
4.24 / 4.70 he owes you dinner for this one (in)
|
||||
Cadence between messages is 0.86, 1.02, 0.70, 1.08, 1.04s and the pill leads are 0.46, 0.48, 0.46s:
|
||||
irregular on purpose, a uniform stagger reads mechanical (Law 5). No interval of this clip is still,
|
||||
because the roll drifts continuously under every beat. Mount contract: the runtime clones only this
|
||||
template. #root fills the host box, establishes the container query basis, has no data-width or
|
||||
data-height, and registers one paused timeline under the hardcoded thread-message-stack id.
|
||||
-->
|
||||
<html lang="en" data-composition-id="thread-message-stack" data-composition-duration="5">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Thread Message Stack</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="thread-message-stack" data-duration="5" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
background: var(--tms-roll-bg, #2e241a);
|
||||
font-family: "Helvetica Neue", "Segoe UI", Inter, system-ui, sans-serif;
|
||||
pointer-events: none;
|
||||
|
||||
--tms-out-fill: #2d89e1;
|
||||
--tms-out-ink: #ffffff;
|
||||
--tms-in-fill: rgba(240, 240, 245, 0.72);
|
||||
--tms-in-ink: #101216;
|
||||
--tms-tag-ink: #ffffff;
|
||||
--tms-radius: 5.7cqmin;
|
||||
}
|
||||
|
||||
/* The roll. Swap this whole element for a <video class="clip"> or an
|
||||
<img>; see the block at the top of the file. Overscaled so the
|
||||
handheld drift never exposes an edge. */
|
||||
#roll {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
object-fit: cover;
|
||||
background: var(--tms-roll-bg, #2e241a);
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
/* Large soft lights, screened over the base so overlaps brighten the
|
||||
way out of focus highlights do. Blur is static CSS, never tweened. */
|
||||
.tms-blob {
|
||||
position: absolute;
|
||||
left: calc(var(--x) * 1cqw);
|
||||
top: calc(var(--y) * 1cqh);
|
||||
width: calc(var(--d) * 1cqmax);
|
||||
height: calc(var(--d) * 1cqmax);
|
||||
border-radius: 50%;
|
||||
background: radial-gradient(circle at 50% 50%, var(--c) 0%, transparent 62%);
|
||||
filter: blur(2.1cqmin);
|
||||
mix-blend-mode: screen;
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
/* The scrim. Darkens the thread column across its whole height, not
|
||||
just the bottom, because the sender tag rides up into the top half
|
||||
and white type over a bright blob is the one place this breaks. */
|
||||
.tms-scrim {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background:
|
||||
linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0.18) 45%, rgba(0, 0, 0, 0.34) 100%),
|
||||
linear-gradient(to right, rgba(0, 0, 0, 0.3) 0, rgba(0, 0, 0, 0.16) 52cqw, rgba(0, 0, 0, 0) 78cqw);
|
||||
}
|
||||
|
||||
/* The thread viewport. The mask is why an old bubble dissolves at the
|
||||
top instead of being guillotined by an overflow edge. Mixed units so
|
||||
the fade band stays about one bubble tall in every aspect instead of
|
||||
half the frame in portrait. */
|
||||
.tms-view {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
-webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 calc(3cqh + 12cqmin), #000 100%);
|
||||
mask-image: linear-gradient(to bottom, transparent 0, #000 calc(3cqh + 12cqmin), #000 100%);
|
||||
}
|
||||
|
||||
/* Anything that is not portrait. Only 9:16 has the height to carry a
|
||||
tall stack: measured at 4.5s it shows 8 bands topping out at 26.5%
|
||||
of frame height, which is what a real phone thread looks like. Both
|
||||
16:9 and 1:1 run out of room and let the stack climb off the top
|
||||
edge (1:1 measured a band top at 2.3% before this rule), at which
|
||||
point the roll behind stops reading as footage and starts reading
|
||||
as wallpaper. The reference never lets the thread above y=24%
|
||||
(f-038 tops out at 24.4%) because that is where the subject is. So
|
||||
outside portrait the clear stop moves down: a bubble is fully gone
|
||||
before its top edge reaches a third of frame height, which caps the
|
||||
solid band count at four. Keyed on aspect via a container query
|
||||
against #root, which is already a size container. */
|
||||
@container (min-aspect-ratio: 0.95) {
|
||||
.tms-view {
|
||||
-webkit-mask-image: linear-gradient(
|
||||
to bottom,
|
||||
transparent 0,
|
||||
transparent 30cqh,
|
||||
#000 42cqh,
|
||||
#000 100%
|
||||
);
|
||||
mask-image: linear-gradient(to bottom, transparent 0, transparent 30cqh, #000 42cqh, #000 100%);
|
||||
}
|
||||
}
|
||||
|
||||
/* 82cqmin is 46.1cqw in 16:9, which reproduces the measured thread
|
||||
width of 45.5% of frame; in 9:16 and 1:1 the same number is 82cqw,
|
||||
so the thread widens to fill the frame the way a real phone thread
|
||||
does. The landing line is in cqh so the newest bubble's bottom sits
|
||||
at 88% of frame height in all three aspects. */
|
||||
.tms-col {
|
||||
position: absolute;
|
||||
bottom: 12cqh;
|
||||
left: 6cqw;
|
||||
width: min(88cqw, 82cqmin);
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
/* Fixed pitch per slot, in cqmin, declared as --h and mirrored by the
|
||||
P array in the script. Nothing measures the DOM for push geometry:
|
||||
the distances are authored, so a zero sized or detached host cannot
|
||||
produce a frozen render. */
|
||||
.tms-slot {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
height: calc(var(--h) * 1cqmin);
|
||||
}
|
||||
|
||||
.tms-out {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.tms-in {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
/* The bubble and the typing pill share this box, so the pill sits at
|
||||
exactly the corner the bubble will occupy. That is the "replaced by"
|
||||
read: the pill rides up with the push and is cut on the frame the
|
||||
bubble's own corner arrives. */
|
||||
.tms-body {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* An absolute max-width, not a percentage: .tms-body is a shrink to fit
|
||||
flex item, so a percentage resolves against a width derived from this
|
||||
box and every bubble collapses to two lines. 68cqmin is 37.6% of
|
||||
frame width in 16:9, just clear of the measured 35.4% widest bubble. */
|
||||
.tms-bubble {
|
||||
max-width: 68cqmin;
|
||||
padding: 2.6cqmin 4.2cqmin;
|
||||
border-radius: var(--tms-radius);
|
||||
font-size: 4.6cqmin;
|
||||
font-weight: 500;
|
||||
letter-spacing: -0.005em;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
/* Overlay grade. The gradient rides on top of the fill variable so the
|
||||
palette stays a single token per side. */
|
||||
.tms-out .tms-bubble {
|
||||
background:
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(0, 0, 0, 0.17) 100%),
|
||||
var(--tms-out-fill);
|
||||
box-shadow: 0 0.7cqmin 2.4cqmin rgba(0, 0, 0, 0.38);
|
||||
color: var(--tms-out-ink);
|
||||
transform-origin: 100% 100%;
|
||||
}
|
||||
|
||||
.tms-in .tms-bubble {
|
||||
background:
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(0, 0, 0, 0.05) 100%),
|
||||
var(--tms-in-fill);
|
||||
box-shadow: 0 0.6cqmin 2cqmin rgba(0, 0, 0, 0.3);
|
||||
color: var(--tms-in-ink);
|
||||
transform-origin: 0% 100%;
|
||||
}
|
||||
|
||||
.tms-tag {
|
||||
color: var(--tms-tag-ink);
|
||||
font-size: 2.4cqmin;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.005em;
|
||||
line-height: 1.25;
|
||||
padding-left: 1.2cqmin;
|
||||
text-shadow: 0 0.2cqmin 0.8cqmin rgba(0, 0, 0, 0.72);
|
||||
}
|
||||
|
||||
.tms-pill {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1.2cqmin;
|
||||
height: 5.6cqmin;
|
||||
padding: 0 2.8cqmin;
|
||||
border-radius: 2.8cqmin;
|
||||
background: var(--tms-in-fill);
|
||||
box-shadow: 0 0.5cqmin 1.6cqmin rgba(0, 0, 0, 0.28);
|
||||
transform-origin: 0% 100%;
|
||||
}
|
||||
|
||||
.tms-dot {
|
||||
width: 1.5cqmin;
|
||||
height: 1.5cqmin;
|
||||
border-radius: 50%;
|
||||
background: var(--tms-in-ink);
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="roll">
|
||||
<i class="tms-blob" style="--c: #f0d3a6; --x: 2; --y: -12; --d: 52"></i>
|
||||
<i class="tms-blob" style="--c: #e8a86a; --x: 44; --y: -18; --d: 62"></i>
|
||||
<i class="tms-blob" style="--c: #c2705a; --x: 22; --y: 22; --d: 54"></i>
|
||||
<i class="tms-blob" style="--c: #6b4a7a; --x: -22; --y: 34; --d: 58"></i>
|
||||
<i class="tms-blob" style="--c: #2e6a8c; --x: 60; --y: 40; --d: 50"></i>
|
||||
<i class="tms-blob" style="--c: #ffe6c0; --x: 70; --y: -6; --d: 38"></i>
|
||||
<i class="tms-blob" style="--c: #8c3f52; --x: 6; --y: 62; --d: 46"></i>
|
||||
<i class="tms-blob" style="--c: #d9a24e; --x: 34; --y: 58; --d: 42"></i>
|
||||
</div>
|
||||
<div class="tms-scrim"></div>
|
||||
|
||||
<div class="tms-view">
|
||||
<div class="tms-col">
|
||||
<!-- Three settled bubbles: the conversation is already in progress at frame zero. These
|
||||
never animate, they just ride off the top. -->
|
||||
<div class="tms-slot tms-out" style="--h: 14.4"><div class="tms-body"><div class="tms-bubble">he had one job</div></div></div>
|
||||
<div class="tms-slot tms-in" style="--h: 14.4"><div class="tms-body"><div class="tms-bubble">which was</div></div></div>
|
||||
<div class="tms-slot tms-out" style="--h: 14.4"><div class="tms-body"><div class="tms-bubble">so he forgot</div></div></div>
|
||||
|
||||
<!-- Everything below arrives during the clip. Incoming slots carry a typing pill. -->
|
||||
<div class="tms-slot tms-in" style="--h: 17.4">
|
||||
<div class="tms-tag">Northbeam support</div>
|
||||
<div class="tms-body">
|
||||
<div class="tms-bubble">wait that is actually wild</div>
|
||||
<div class="tms-pill"><i class="tms-dot"></i><i class="tms-dot"></i><i class="tms-dot"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tms-slot tms-out" style="--h: 14.4"><div class="tms-body"><div class="tms-bubble">can you fix it</div></div></div>
|
||||
<div class="tms-slot tms-in" style="--h: 14.4">
|
||||
<div class="tms-body">
|
||||
<div class="tms-bubble">way ahead of you</div>
|
||||
<div class="tms-pill"><i class="tms-dot"></i><i class="tms-dot"></i><i class="tms-dot"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tms-slot tms-out" style="--h: 14.4"><div class="tms-body"><div class="tms-bubble">you are unreal</div></div></div>
|
||||
<div class="tms-slot tms-in" style="--h: 20.6">
|
||||
<div class="tms-body">
|
||||
<div class="tms-bubble">he owes you dinner<br />for this one</div>
|
||||
<div class="tms-pill"><i class="tms-dot"></i><i class="tms-dot"></i><i class="tms-dot"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
// Cubic-bezier evaluated as a GSAP ease. A pure function of progress, so it is seek-safe:
|
||||
// seek(t) always yields the same value, no internal state to drift. Newton-Raphson on x,
|
||||
// with a bisection fallback where the slope flattens.
|
||||
function cb(x1, y1, x2, y2) {
|
||||
var A = function (a, b) { return 1 - 3 * b + 3 * a; },
|
||||
B = function (a, b) { return 3 * b - 6 * a; },
|
||||
f = function (t, a, b) { return ((A(a, b) * t + B(a, b)) * t + 3 * a) * t; },
|
||||
d = function (t, a, b) { return 3 * A(a, b) * t * t + 2 * B(a, b) * t + 3 * a; };
|
||||
return function (p) {
|
||||
if (p <= 0) return 0;
|
||||
if (p >= 1) return 1;
|
||||
var t = p, i, s, e, lo = 0, hi = 1, j, v;
|
||||
for (i = 0; i < 8; i++) {
|
||||
s = d(t, x1, x2);
|
||||
if (s === 0) break;
|
||||
e = f(t, x1, x2) - p;
|
||||
if (Math.abs(e) < 1e-7) break;
|
||||
t -= e / s;
|
||||
}
|
||||
if (t < 0 || t > 1) {
|
||||
t = p;
|
||||
for (j = 0; j < 30; j++) {
|
||||
v = f(t, x1, x2);
|
||||
if (Math.abs(v - p) < 1e-7) break;
|
||||
if (v > p) hi = t; else lo = t;
|
||||
t = (lo + hi) / 2;
|
||||
}
|
||||
}
|
||||
return f(t, y1, y2);
|
||||
};
|
||||
}
|
||||
// Named for what they do in a shot. No GSAP preset appears in this file on purpose: a named
|
||||
// ease is a category, not a curve. springSm is 3.0% overshoot, which is the measured settle
|
||||
// back (0.3% against an 8.4% push); do not raise it, a bigger overshoot is feel and feel
|
||||
// loses to a ruler.
|
||||
var E = {
|
||||
enter: cb(0.22, 0.9, 0.3, 1.0),
|
||||
morph: cb(0.65, 0.05, 0.35, 1.0),
|
||||
springSm: cb(0.34, 1.3, 0.5, 1.0),
|
||||
linear: function (p) { return p; },
|
||||
};
|
||||
|
||||
gsap.defaults({ immediateRender: false });
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var col = root.querySelector(".tms-col");
|
||||
var roll = root.querySelector("#roll");
|
||||
var blobs = root.querySelectorAll(".tms-blob");
|
||||
var slots = root.querySelectorAll(".tms-slot");
|
||||
var D = Math.max(0.001, parseFloat(root.dataset.duration || "5"));
|
||||
// GSAP writes transforms as px, so every tweened distance is resolved at build time. U is
|
||||
// cqmin, for the thread, so pushes agree with the slot pitches in the stylesheet. W and Hc
|
||||
// are cqw and cqh, for the roll, whose drift is lateral and cover-the-frame geometry.
|
||||
var U = Math.min(root.clientWidth, root.clientHeight) / 100 || 10.8;
|
||||
var W = root.clientWidth / 100 || 19.2;
|
||||
var Hc = root.clientHeight / 100 || 10.8;
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
// ---- the roll ------------------------------------------------------------------------
|
||||
// Per blob: x0 y0 (cqw, cqh) -> x1 y1, scale0 -> scale1, opacity a -> b, opacity half period.
|
||||
// Every roll tween runs for exactly D and no longer. That is not a style choice: a tween that
|
||||
// ends past D lengthens the timeline, and the runtime hides every clip past the composition's
|
||||
// own data-duration, so the render goes black for the whole overhang. The drift is linear,
|
||||
// which Law 2 allows for constant motion and which also means it cannot have a dead tail: the
|
||||
// field is still travelling on the last rendered frame. The opacity periods are mutually
|
||||
// non-syncing and each divides into D a whole number of times, so the field breathes without
|
||||
// lining up and without a tween overhanging the end (Law 5).
|
||||
var ROLL = [
|
||||
[-6, -4, 8, 6, 1.0, 1.16, 0.96, 0.64, 1.62],
|
||||
[8, 0, -6, 11, 1.08, 0.94, 1.0, 0.72, 2.35],
|
||||
[-9, 5, 5, -7, 0.94, 1.12, 0.94, 0.6, 1.66],
|
||||
[4, -6, -8, 7, 1.12, 0.98, 0.86, 0.54, 1.24],
|
||||
[-5, 7, 9, -5, 0.96, 1.14, 0.9, 0.56, 2.48],
|
||||
[2, -3, -8, 6, 1.0, 1.1, 0.9, 0.6, 1.85],
|
||||
[-4, 4, 7, -7, 1.05, 0.95, 0.82, 0.5, 1.42],
|
||||
[7, -5, -5, 7, 0.98, 1.12, 0.86, 0.56, 2.2],
|
||||
];
|
||||
// Handheld: the whole field slides and swells under the blobs, so the drift reads as one
|
||||
// camera rather than as five moving shapes. morph is the zero dead frame curve of the
|
||||
// palette, which is what this needs when it has to stay alive all the way to D.
|
||||
gsap.set(roll, { x: 0, y: 0, scale: 1.12 });
|
||||
if (blobs.length) {
|
||||
tl.fromTo(roll, { x: 0, y: 0, scale: 1.12 },
|
||||
{ x: -3.2 * W, y: -2.0 * Hc, scale: 1.19, duration: D, ease: E.morph }, 0);
|
||||
}
|
||||
blobs.forEach(function (b, k) {
|
||||
var r = ROLL[k % ROLL.length];
|
||||
gsap.set(b, { x: r[0] * W, y: r[1] * Hc, scale: r[4], opacity: r[6] });
|
||||
tl.fromTo(b, { x: r[0] * W, y: r[1] * Hc, scale: r[4] },
|
||||
{ x: r[2] * W, y: r[3] * Hc, scale: r[5], duration: D, ease: E.linear }, 0);
|
||||
tl.fromTo(b, { opacity: r[6] },
|
||||
{ opacity: r[7], duration: r[8], ease: E.morph, yoyo: true,
|
||||
repeat: Math.max(1, Math.floor(D / r[8])) - 1 }, 0);
|
||||
});
|
||||
|
||||
// ---- the thread ----------------------------------------------------------------------
|
||||
// Slot pitches in cqmin, mirroring the --h attributes in the markup. Slots 0 to 2 are the
|
||||
// seeded history (2 is the newest settled message), 3 to 7 arrive during the clip.
|
||||
var P = [14.4, 14.4, 14.4, 17.4, 14.4, 14.4, 14.4, 20.6];
|
||||
var SETTLED = 2;
|
||||
var PILL = 8.6; // pill height 5.6 plus the 3.0 gap above it
|
||||
// Y[i] is the column offset that puts slot i's bottom on the landing line, so pushing from
|
||||
// Y[i - 1] to Y[i] is exactly one slot.
|
||||
var Y = [];
|
||||
var acc = 0;
|
||||
for (var i = P.length - 1; i >= 0; i--) {
|
||||
Y[i] = acc;
|
||||
acc += P[i];
|
||||
}
|
||||
// Rest state pinned outside the timeline. Frame zero is a thread already in progress, three
|
||||
// settled bubbles with the newest on the landing line, over a roll that is already drifting.
|
||||
gsap.set(col, { y: Y[SETTLED] * U });
|
||||
slots.forEach(function (slot, idx) {
|
||||
var settled = idx <= SETTLED;
|
||||
gsap.set(slot.querySelector(".tms-bubble"), { opacity: settled ? 1 : 0, scale: settled ? 1 : 0.94 });
|
||||
var pill = slot.querySelector(".tms-pill");
|
||||
var tag = slot.querySelector(".tms-tag");
|
||||
if (pill) gsap.set(pill, { opacity: 0, scale: 0.94 });
|
||||
if (tag) gsap.set(tag, { opacity: 0 });
|
||||
});
|
||||
|
||||
// One y tween per arrival, on the whole column. Under 0.25s: the push is the entire feel of
|
||||
// this primitive and a slow one reads as a scroll. A full slot is 14.4cqmin, 155px in 16:9,
|
||||
// which is the measured move, and springSm settles it back about 4px.
|
||||
function push(from, to, at) {
|
||||
tl.fromTo(col, { y: from * U }, { y: to * U, duration: 0.22, ease: E.springSm }, at);
|
||||
}
|
||||
// Opacity is a cut, not a fade: 0.04s is one frame at 30fps. Written as a fromTo so both ends
|
||||
// live on the timeline and a backwards seek can never inherit what was last on screen.
|
||||
function cut(el, to, at) {
|
||||
tl.fromTo(el, { opacity: to ? 0 : 1 }, { opacity: to, duration: 0.04, ease: E.linear }, at);
|
||||
}
|
||||
// Ambient life on the three dots. Non-syncing half periods so they never line up. No loop, no
|
||||
// rAF: finite yoyo tweens on the same seekable timeline as everything else.
|
||||
function bob(pill, t0, t1) {
|
||||
var per = [0.31, 0.37, 0.43];
|
||||
pill.querySelectorAll(".tms-dot").forEach(function (dot, k) {
|
||||
var p = per[k];
|
||||
tl.fromTo(dot, { y: 0, opacity: 0.4 },
|
||||
{ y: -0.85 * U, opacity: 0.85, duration: p, ease: E.morph, yoyo: true,
|
||||
repeat: Math.max(1, Math.round((Math.min(t1, D) - t0) / p)) - 1 }, t0);
|
||||
});
|
||||
}
|
||||
// An incoming message arrives twice: the pill takes its slot (pushing by its own pitch), then
|
||||
// the bubble takes the pill's place and grows the slot to full height. An outgoing message
|
||||
// arrives once, in a single full slot push.
|
||||
function arrive(idx, tMsg, tPill) {
|
||||
var slot = slots[idx];
|
||||
var pill = slot.querySelector(".tms-pill");
|
||||
var bubble = slot.querySelector(".tms-bubble");
|
||||
var tag = slot.querySelector(".tms-tag");
|
||||
if (pill) {
|
||||
push(Y[idx - 1], Y[idx - 1] - PILL, tPill);
|
||||
push(Y[idx - 1] - PILL, Y[idx], tMsg);
|
||||
cut(pill, 1, tPill);
|
||||
tl.fromTo(pill, { scale: 0.94 }, { scale: 1, duration: 0.2, ease: E.enter }, tPill);
|
||||
// The tag arrives with the pill: in the reference the sender is named the moment they
|
||||
// start typing, and the tag then rides up with its own message for the rest of the clip.
|
||||
// It is per-message branding, not a header.
|
||||
if (tag) tl.fromTo(tag, { opacity: 0 }, { opacity: 1, duration: 0.2, ease: E.enter }, tPill);
|
||||
bob(pill, tPill, tMsg);
|
||||
// The pill sits on the bubble's own corner, so any overlap reads as two objects in one
|
||||
// place instead of one replacing the other. Cut it on the frame the bubble lands.
|
||||
cut(pill, 0, tMsg);
|
||||
} else {
|
||||
push(Y[idx - 1], Y[idx], tMsg);
|
||||
}
|
||||
cut(bubble, 1, tMsg);
|
||||
tl.fromTo(bubble, { scale: 0.94 }, { scale: 1, duration: 0.26, ease: E.enter }, tMsg);
|
||||
}
|
||||
|
||||
// The last message lands at 4.70 and is still settling at 4.96, so the clip resolves on a
|
||||
// delivered thread rather than on a reply that never arrives.
|
||||
arrive(3, 0.86, 0.4);
|
||||
arrive(4, 1.88);
|
||||
arrive(5, 2.58, 2.1);
|
||||
arrive(6, 3.66);
|
||||
arrive(7, 4.7, 4.24);
|
||||
|
||||
tl.set({}, {}, D); // pin the full duration
|
||||
tl.seek(0);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["thread-message-stack"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: version-plate-type at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>version-plate-type 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="3.4" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="version-plate-type"
|
||||
data-composition-src="./version-plate-type.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="3.4" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,642 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
version-plate-type: HyperFrames video primitive (word assembles, then resolves).
|
||||
|
||||
A word is stamped one glyph at a time as a cluster of white plates, each plate
|
||||
cropping an oversized letter, each carrying a red misregistration layer and a
|
||||
red version tab. Hard cut to the resolved state: one word per beat inside a
|
||||
selection box that is dragged wider, then shorter, then closed on its own
|
||||
letters, then pushed off frame.
|
||||
|
||||
THE PRIMITIVE IS THE PLATES AND THE BOX, NOT THE LETTERS. A glyph is a clipping
|
||||
box with an oversized letter measured into it, and every resolved word is fitted
|
||||
to one constant ink width, so any string you drop in keeps the geometry.
|
||||
|
||||
REFERENCE: whop.mp4 1920x1080 30fps, 12.867s to 14.900s, re-extracted at 30fps
|
||||
(61 content frames, cut on twos). Every number below is measured off those PNGs
|
||||
with a white-ink mask (min channel > 130, saturation < 28), never off a sheet.
|
||||
|
||||
THERE IS NO CAMERA IN THE REFERENCE, and the falsifier is in the numbers: a
|
||||
camera scales both axes at once, in proportion. Measured across the resolved
|
||||
phase, the two axes never move together. 13.567 to 13.933: ink width 49.85 ->
|
||||
88.96% of frame width while cap height holds 70.56 -> 70.46%. 13.933 to 14.400:
|
||||
cap height 70.46 -> 43.70% (-38%) while width moves 88.96 -> 82.45% (-7%) and
|
||||
the ink's RIGHT edge stays pinned at 94.74 to 95.10% through four word cuts.
|
||||
The ink's vertical centre holds at 49.3 to 49.7% throughout. That is one axis
|
||||
at a time, which is a selection box being dragged by its handles, and it is why
|
||||
there is a cursor parked on the top-right handle. The four measured phases are
|
||||
shipped as four separate moves:
|
||||
|
||||
A STRETCH 13.567-13.933 ink width 49.84 -> 88.96% of frame, cap height
|
||||
pinned at 70.6%. Crosses two word cuts, so it is the BOX widening
|
||||
and each word being stretched to it, not a word growing.
|
||||
fit cb(0.503, 0.000, 0.262, 1.000), max err 3.34% of travel, 7
|
||||
samples (an unconstrained fit reaches 1.54% at cb(0.747, 0.279,
|
||||
0.006, 0.819) but that end control point does not settle).
|
||||
B SQUEEZE 13.933-14.467 cap height 70.46 -> 43.15% of frame height while
|
||||
the ink's RIGHT edge holds 95.05 -> 94.74% for most of the phase
|
||||
(width 88.96 -> 82.45% by 14.400, 77.09% by 14.467, against a 38%
|
||||
fall in height), vertical centre 49.58 -> 49.54%.
|
||||
fit cb(0.532, 0.180, 0.000, 1.000), max err 2.39%, 9 samples.
|
||||
C CONVERGE 14.500-14.700 the last word's letters close on their own centre,
|
||||
ink width 42.50 -> 25.26% at constant cap height, box following.
|
||||
fit cb(0.207, 0.670, 0.634, 1.000). 4 samples against 3 free
|
||||
parameters, so this is an interpolation, not a test: what it
|
||||
encodes is 64% of the travel inside the first third.
|
||||
D PUSH 14.767-14.900 uniform scale up until the word leaves frame. Two
|
||||
usable samples before it clips, so the curve is shape-matched
|
||||
(accelerating), not fitted, and says so.
|
||||
|
||||
STAMP, measured: the shot OPENS in extreme close-up (two glyphs, ink bbox 100%
|
||||
of frame height, R plate 1.70x its settled width) and whips out through one
|
||||
motion-blurred frame at 13.067, then settles laterally, decelerating, to 13.433.
|
||||
Plate arrival by slot: {2,4} already down at 12.867, then 6, 5, 3, 7, and slot 1
|
||||
LAST at 13.267. Slots 7 and 2 blink back out together at 13.433.
|
||||
settle curve fitted to that post-whip lateral pan: cb(0.410, 0.773, 0.987,
|
||||
1.000), max err 0.62% of travel, 6 samples. The whip itself is one frame at
|
||||
30fps, so it cannot be fitted; it is stretched over 3 audit samples and shaped.
|
||||
|
||||
COLOUR, sampled unquantised: background #0B0B0B under the plates and #131313
|
||||
under the type (one value here, #0D0D0D), plate face #EBEBEB drifting to
|
||||
#E2E2E2 (#EDEDEF here), letter #010101, tab red #D41E10, selection #6599BE
|
||||
median, which is a 2px antialiased line, so #4C8FD6 is shipped.
|
||||
|
||||
DELIBERATE DEVIATIONS:
|
||||
1. PRESENTER SAFE ZONE. The presenter owns the left 32% of a landscape frame
|
||||
at full height, so the move lives in a stage inset to 34%. The reference
|
||||
centres its box on the frame; this centres it on the STAGE, which is the
|
||||
fix for the round-2 build's left anchor. Measured on the built PNGs, the
|
||||
left-most non-black pixel over all 32 frames is 36.04% of frame width,
|
||||
including the terminal push, which is taken about 16% of the stage (the
|
||||
closed box's own left edge) rather than about its centre.
|
||||
2. CADENCE. The reference cuts on twos (1/15s) and its word beats run 0.10s
|
||||
to 0.13s. The audit samples 32 frames across the clip, 0.11s apart, so a
|
||||
reference beat is under one sample. Beats are stretched about 2.1x. Same
|
||||
order, same hard cuts.
|
||||
3. The reference's ink fills 89% of frame WIDTH. The stage is 66% of frame
|
||||
width, so the same 94% fill of the stage is 62% of the frame, and the type
|
||||
reads smaller than the reference by that ratio. Unavoidable, not a choice.
|
||||
4. Reference cap height is set per word by a stretched face; here each word is
|
||||
fitted uniformly to the constant ink width, so cap height falls out of
|
||||
character count instead. The phrase's lengths (3,4,5,6,4,5) make the height
|
||||
sequence go down AND back up, which is the read a camera cannot produce.
|
||||
5. The registration starts wider than the reference's ~4px and settles to it,
|
||||
so the stamp phase has something resolving under the hard cuts.
|
||||
6. Phase C runs the other way. The reference closes DESIGN by 41% because it
|
||||
is set on TWO LINES, so its letters have room to overlap columns; one line
|
||||
of five letters closing that far is an illegible blob. Beat 6 is therefore
|
||||
sized so its SPREAD state (1.35x letter offsets) is the same constant box
|
||||
every other beat lands on, and it closes to that box. Same travel, same
|
||||
curve, same "the box is being dragged shut" read, no collision.
|
||||
|
||||
FONTS, local and system only, no remote fetch:
|
||||
plates "Helvetica Neue" / Helvetica / Arial at 700, the reference's face
|
||||
resolved Impact, then Haettenschweiler, then Arial Narrow Bold, the closest
|
||||
system match to the reference's condensed grotesque. Override
|
||||
--vpt-face-display for a licensed face.
|
||||
|
||||
ENVELOPE (D = 3.40s, 30fps):
|
||||
0.000-0.300 WHIP. Cluster 1.70x to 1.06x, cropping off frame, then out.
|
||||
0.000-1.320 Plates cut on at 0 ({2,4}), 0.14 (6), 0.28 (5), 0.56 (3),
|
||||
0.70 (7), 0.84 (1); slots 7 and 2 cut back out at 1.18. Under
|
||||
them: the lateral settle 0.300-1.320 and the registration settle.
|
||||
1.320 HARD CUT to the resolved type.
|
||||
1.320-1.940 A, box stretches. Beats 1 and 2.
|
||||
1.940-2.720 B, box squeezes. Beats 3, 4 and 5.
|
||||
2.720-3.060 C, beat 6's letters converge, box and cursor following.
|
||||
3.060-3.400 D, terminal push. The word and its box overflow here and nowhere
|
||||
else; the only other overflow in the file is the opening whip,
|
||||
which crops plates the way the reference's own opening does.
|
||||
|
||||
SLOTS. No media. Seven plate glyphs and six words are text nodes; swap them and
|
||||
the geometry re-measures. Overridable on #root: --vpt-bg, --vpt-plate,
|
||||
--vpt-ink, --vpt-red, --vpt-sel, --vpt-face-plate, --vpt-face-display,
|
||||
--vpt-safe. Mount contract: the runtime clones only this template, #root fills
|
||||
its host and carries no data-width or data-height, and one paused timeline
|
||||
registers under the hardcoded version-plate-type id.
|
||||
-->
|
||||
<html lang="en" data-composition-id="version-plate-type" data-composition-duration="3.4">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Version Plate Type</title>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<div id="root" data-composition-id="version-plate-type" data-duration="3.4" data-fps="30">
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#root {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
container-type: size;
|
||||
isolation: isolate;
|
||||
background: var(--vpt-bg, #0d0d0d);
|
||||
pointer-events: none;
|
||||
|
||||
--vpt-safe: 32%;
|
||||
--vpt-face-plate: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
--vpt-face-display: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
|
||||
}
|
||||
|
||||
/* The presenter owns the left --vpt-safe of a landscape frame, full
|
||||
height, so the whole move lives in this box. It starts two points
|
||||
RIGHT of that boundary because the things that stick out to the left
|
||||
of a stage-anchored element are exactly the ones the safe zone cares
|
||||
about: the misregistration offset behind the left-most plate, a
|
||||
left-edge tab, and the selection box's own padding. It is its own
|
||||
size container, so every cq unit below is a share of the WORKING
|
||||
area rather than of the frame. */
|
||||
.vpt-stage {
|
||||
position: absolute;
|
||||
inset: 0 0 0 calc(var(--vpt-safe) + 2%);
|
||||
container-type: size;
|
||||
}
|
||||
|
||||
/* Portrait and square: the presenter moves to the lower band instead of
|
||||
the left column, so the stage does. Graceful, not equal: this move was
|
||||
composed for 16:9 and only has to survive the other two. */
|
||||
@container (aspect-ratio < 1.2) {
|
||||
.vpt-stage {
|
||||
inset: 0 0 40% 0;
|
||||
}
|
||||
}
|
||||
|
||||
.vpt-fit {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
inset: 0;
|
||||
}
|
||||
|
||||
/* The reference cluster bbox is 1.770 wide to tall inside a 1.778
|
||||
frame. The presenter's column leaves a working area of 1.17, and
|
||||
holding 1.770 inside it would leave a third of the picture empty,
|
||||
which is a different, smaller idea. The box is reproportioned to
|
||||
1.45: every plate rect keeps its place in the collage, the lateral
|
||||
gaps compress about 18%, and the cluster owns ~75% of frame height
|
||||
the way the reference does.
|
||||
|
||||
Scaled about its own LEFT edge, so the opening close-up at 1.70x
|
||||
crops off the top, the bottom and the right the way the reference's
|
||||
does, and never off the left into the presenter. */
|
||||
.vpt-cluster {
|
||||
position: relative;
|
||||
width: min(93cqw, 141cqh);
|
||||
aspect-ratio: 1.45;
|
||||
transform-origin: 0% 50%;
|
||||
font-family: var(--vpt-face-plate);
|
||||
}
|
||||
|
||||
.vpt-plate {
|
||||
position: absolute;
|
||||
left: calc(var(--l) * 1%);
|
||||
top: calc(var(--t) * 1%);
|
||||
width: calc(var(--w) * 1%);
|
||||
height: calc(var(--h) * 1%);
|
||||
}
|
||||
|
||||
/* The misregistration. A duplicate of the plate in ink red, sitting
|
||||
behind it and offset, so a thin red edge shows along two sides. GSAP
|
||||
owns its transform; the rest offset is pinned by gsap.set, never here,
|
||||
so a seek can never inherit whatever the last frame left. */
|
||||
.vpt-mis {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: var(--vpt-red, #d51b0f);
|
||||
}
|
||||
|
||||
/* The crop. The letter is measured to fill --fill of the plate's height
|
||||
with its INK flush to the plate's top edge, which is what the
|
||||
reference does on all seven plates (ink height over plate height 0.94
|
||||
to 1.00, top margin 0.00). Wide letters then run off the plate's
|
||||
sides, which is the crop; narrow ones leave white to the right, which
|
||||
the reference also does. */
|
||||
.vpt-face {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
overflow: hidden;
|
||||
background: var(--vpt-plate, #ededef);
|
||||
}
|
||||
|
||||
.vpt-g {
|
||||
position: absolute;
|
||||
color: var(--vpt-ink, #010101);
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.vpt-tab {
|
||||
position: absolute;
|
||||
bottom: 100%;
|
||||
left: 0;
|
||||
width: calc(var(--tw, 46) * 1%);
|
||||
height: 3.1cqh;
|
||||
background: var(--vpt-red, #d51b0f);
|
||||
color: var(--vpt-plate, #ededef);
|
||||
padding: 0 0.7cqh;
|
||||
font-size: 2.1cqh;
|
||||
font-weight: 700;
|
||||
line-height: 3.1cqh;
|
||||
}
|
||||
|
||||
/* Two tabs break the pattern in the reference: one runs down the left
|
||||
edge, one hangs off the bottom. Without them the cluster reads as a
|
||||
grid of identical widgets rather than as a sheet of press plates. */
|
||||
.vpt-tab--l {
|
||||
right: 100%;
|
||||
bottom: auto;
|
||||
left: auto;
|
||||
top: 44%;
|
||||
width: 3.1cqh;
|
||||
height: calc(var(--tw, 46) * 1%);
|
||||
padding: 0.7cqh 0;
|
||||
line-height: 3.1cqh;
|
||||
text-align: center;
|
||||
writing-mode: vertical-rl;
|
||||
}
|
||||
|
||||
.vpt-tab--b {
|
||||
top: 100%;
|
||||
bottom: auto;
|
||||
}
|
||||
|
||||
/* Resolved type. Phases A and B are taken about the stage's centre,
|
||||
because the reference's box is dragged symmetrically: its centre
|
||||
holds at 50.00% of frame on every beat. */
|
||||
.vpt-type {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
font-family: var(--vpt-face-display);
|
||||
transform-origin: 50% 50%;
|
||||
}
|
||||
|
||||
/* Phase D. The reference's push is a centred blow-up (ink 34.84 to 68.07%
|
||||
of frame at 14.767, 20.94 to 82.76% at 14.800, full frame by 14.867:
|
||||
the centre holds at 51.7%). A centred blow-up here would drive the left
|
||||
edge straight through the presenter, so the origin is moved onto the
|
||||
closed box's own left edge (16% of the stage, 44.6% of frame). Same
|
||||
gesture, same overflow off the right, the top and the bottom, but the
|
||||
left edge is the one thing that stays put. */
|
||||
.vpt-beat {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
transform-origin: 16% 50%;
|
||||
}
|
||||
|
||||
.vpt-w {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
color: var(--vpt-plate, #ededef);
|
||||
font-size: 20cqh;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
/* One span per letter, each parked at its own measured advance, so the
|
||||
convergence is a transform per letter and never a letter-spacing
|
||||
tween (which the runtime's static guard rejects). */
|
||||
.vpt-w > span {
|
||||
position: absolute;
|
||||
line-height: 1;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
/* Eight handles, four corners and four edge midpoints, painted as eight
|
||||
background layers on the one box element. A design canvas selection,
|
||||
and no extra nodes. */
|
||||
.vpt-box {
|
||||
position: absolute;
|
||||
border: 0.24cqh solid var(--vpt-sel, #4c8fd6);
|
||||
--hs: 1.9cqh;
|
||||
background-image: linear-gradient(var(--vpt-sel, #4c8fd6), var(--vpt-sel, #4c8fd6)),
|
||||
linear-gradient(var(--vpt-sel, #4c8fd6), var(--vpt-sel, #4c8fd6)),
|
||||
linear-gradient(var(--vpt-sel, #4c8fd6), var(--vpt-sel, #4c8fd6)),
|
||||
linear-gradient(var(--vpt-sel, #4c8fd6), var(--vpt-sel, #4c8fd6)),
|
||||
linear-gradient(var(--vpt-sel, #4c8fd6), var(--vpt-sel, #4c8fd6)),
|
||||
linear-gradient(var(--vpt-sel, #4c8fd6), var(--vpt-sel, #4c8fd6)),
|
||||
linear-gradient(var(--vpt-sel, #4c8fd6), var(--vpt-sel, #4c8fd6)),
|
||||
linear-gradient(var(--vpt-sel, #4c8fd6), var(--vpt-sel, #4c8fd6));
|
||||
background-position: 0 0, 50% 0, 100% 0, 0 50%, 100% 50%, 0 100%, 50% 100%, 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-size: var(--hs) var(--hs);
|
||||
}
|
||||
|
||||
.vpt-cur {
|
||||
position: absolute;
|
||||
width: 2.9cqh;
|
||||
fill: var(--vpt-plate, #ededef);
|
||||
stroke: var(--vpt-ink, #010101);
|
||||
stroke-width: 1.1;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="vpt-stage">
|
||||
<div class="vpt-fit">
|
||||
<div class="vpt-cluster">
|
||||
<div class="vpt-plate" style="--l: 0; --t: 2.26; --w: 16.89; --h: 31.73; --fill: 0.97; --gx: 4; --tw: 46">
|
||||
<span class="vpt-mis"></span>
|
||||
<span class="vpt-face"><span class="vpt-g">S</span></span>
|
||||
<span class="vpt-tab">V1</span>
|
||||
</div>
|
||||
<div class="vpt-plate" style="--l: 31.94; --t: 12.19; --w: 26.71; --h: 26.36; --fill: 0.95; --gx: 5; --tw: 40">
|
||||
<span class="vpt-mis"></span>
|
||||
<span class="vpt-face"><span class="vpt-g">A</span></span>
|
||||
<span class="vpt-tab">V2</span>
|
||||
</div>
|
||||
<div class="vpt-plate" style="--l: 65.88; --t: 0; --w: 31.61; --h: 41.35; --fill: 1; --gx: 4; --tw: 30">
|
||||
<span class="vpt-mis"></span>
|
||||
<span class="vpt-face"><span class="vpt-g">N</span></span>
|
||||
<span class="vpt-tab vpt-tab--l">V3</span>
|
||||
</div>
|
||||
<div class="vpt-plate" style="--l: 2.92; --t: 49.7; --w: 19.93; --h: 44.95; --fill: 0.99; --gx: -10; --tw: 62">
|
||||
<span class="vpt-mis"></span>
|
||||
<span class="vpt-face"><span class="vpt-g">d</span></span>
|
||||
<span class="vpt-tab">V4</span>
|
||||
</div>
|
||||
<div class="vpt-plate" style="--l: 28.91; --t: 50.56; --w: 29.66; --h: 38.49; --fill: 0.96; --gx: 5; --tw: 38">
|
||||
<span class="vpt-mis"></span>
|
||||
<span class="vpt-face"><span class="vpt-g">b</span></span>
|
||||
<span class="vpt-tab vpt-tab--b">V5</span>
|
||||
</div>
|
||||
<div class="vpt-plate" style="--l: 61.92; --t: 63.65; --w: 17.15; --h: 36.35; --fill: 1; --gx: -27; --tw: 68">
|
||||
<span class="vpt-mis"></span>
|
||||
<span class="vpt-face"><span class="vpt-g">o</span></span>
|
||||
<span class="vpt-tab">V6</span>
|
||||
</div>
|
||||
<div class="vpt-plate" style="--l: 83.49; --t: 40.65; --w: 16.51; --h: 51.63; --fill: 0.98; --gx: -56; --tw: 78">
|
||||
<span class="vpt-mis"></span>
|
||||
<span class="vpt-face"><span class="vpt-g">x</span></span>
|
||||
<span class="vpt-tab">V7</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="vpt-type">
|
||||
<div class="vpt-beat"><span class="vpt-w">SET</span><span class="vpt-box"></span></div>
|
||||
<div class="vpt-beat"><span class="vpt-w">EACH</span><span class="vpt-box"></span></div>
|
||||
<div class="vpt-beat"><span class="vpt-w">PLATE</span><span class="vpt-box"></span></div>
|
||||
<div class="vpt-beat"><span class="vpt-w">SQUARE</span><span class="vpt-box"></span></div>
|
||||
<div class="vpt-beat"><span class="vpt-w">THEN</span><span class="vpt-box"></span></div>
|
||||
<div class="vpt-beat"><span class="vpt-w">PRINT</span><span class="vpt-box"></span></div>
|
||||
<svg class="vpt-cur" viewBox="0 0 12 18" aria-hidden="true">
|
||||
<path d="M0.6 0.6 L0.6 14.6 L4.4 11.2 L6.8 17.2 L9.2 16.2 L6.8 10.4 L11.4 10.3 Z" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// Cubic-bezier as a GSAP ease. Pure function of progress, so seek-safe:
|
||||
// seek(t) always yields the same value, no internal state to drift.
|
||||
// Newton-Raphson on x, bisection where the slope flattens.
|
||||
function cb(x1, y1, x2, y2) {
|
||||
var A = function (a, b) { return 1 - 3 * b + 3 * a; }, C = function (a) { return 3 * a; };
|
||||
var B = function (a, b) { return 3 * b - 6 * a; };
|
||||
var f = function (t, a, b) { return ((A(a, b) * t + B(a, b)) * t + C(a)) * t; };
|
||||
var d = function (t, a, b) { return 3 * A(a, b) * t * t + 2 * B(a, b) * t + C(a); };
|
||||
return function (p) {
|
||||
if (p <= 0) return 0;
|
||||
if (p >= 1) return 1;
|
||||
var t = p, i, s, e;
|
||||
for (i = 0; i < 8; i++) {
|
||||
s = d(t, x1, x2);
|
||||
if (s === 0) break;
|
||||
e = f(t, x1, x2) - p;
|
||||
if (Math.abs(e) < 1e-7) break;
|
||||
t -= e / s;
|
||||
}
|
||||
if (t < 0 || t > 1) {
|
||||
var lo = 0, hi = 1, j, v;
|
||||
t = p;
|
||||
for (j = 0; j < 30; j++) {
|
||||
v = f(t, x1, x2);
|
||||
if (Math.abs(v - p) < 1e-7) break;
|
||||
if (v > p) hi = t; else lo = t;
|
||||
t = (lo + hi) / 2;
|
||||
}
|
||||
}
|
||||
return f(t, y1, y2);
|
||||
};
|
||||
}
|
||||
|
||||
// Every curve below is fitted to a table in spec-version-plate-type.md.
|
||||
var E = {
|
||||
// Recedes to an off state but stays in frame: the misprint pulling
|
||||
// into register. The one palette curve in the file.
|
||||
exitSettle: cb(0.3, 0.8, 0.4, 1.0),
|
||||
// One motion-blurred frame in the reference, so shaped, not fitted.
|
||||
whip: cb(0.16, 0.9, 0.3, 1.0),
|
||||
// The reference's post-whip lateral pan, 6 samples, max err 0.62%.
|
||||
settle: cb(0.41, 0.773, 0.987, 1.0),
|
||||
// Box widening, 7 samples, max err 3.34% of travel.
|
||||
stretch: cb(0.503, 0.0, 0.262, 1.0),
|
||||
// Box shortening, 9 samples, max err 2.39% of travel.
|
||||
squeeze: cb(0.532, 0.18, 0.0, 1.0),
|
||||
// Letters closing, 4 samples against 3 parameters: an interpolation.
|
||||
converge: cb(0.207, 0.67, 0.634, 1.0),
|
||||
// Two usable samples before the reference clips: shape, not fit.
|
||||
push: cb(0.4, 0.3, 0.7, 1.0),
|
||||
};
|
||||
|
||||
gsap.defaults({ immediateRender: false });
|
||||
|
||||
var root = document.getElementById("root");
|
||||
var stage = root.querySelector(".vpt-stage");
|
||||
var plates = [].slice.call(root.querySelectorAll(".vpt-plate"));
|
||||
var mis = root.querySelectorAll(".vpt-mis");
|
||||
var cluster = root.querySelector(".vpt-cluster");
|
||||
var type = root.querySelector(".vpt-type");
|
||||
var cur = root.querySelector(".vpt-cur");
|
||||
var beats = [].slice.call(root.querySelectorAll(".vpt-beat"));
|
||||
|
||||
// GSAP writes transforms as px, so a cq distance would not survive on a
|
||||
// tween. Read the unit once, at build time, off the STAGE and not the
|
||||
// frame, because the stage is the working area. (Law 0b.)
|
||||
var SW = stage.clientWidth, SH = stage.clientHeight;
|
||||
var U = Math.min(SW, SH) / 100 || 10.8;
|
||||
|
||||
// GLYPH METRICS. The layout box is not the ink: line boxes carry
|
||||
// half-leading and exclude the overshoot on round glyphs, which is why
|
||||
// the round-2 selection box let O and U bowls break out of it by 14px.
|
||||
// Canvas actualBoundingBox* is the painted bbox, so everything below is
|
||||
// measured off the ink. Deterministic, no network, no layout thrash.
|
||||
var CV = document.createElement("canvas").getContext("2d");
|
||||
function ink(el, txt) {
|
||||
var cs = getComputedStyle(el), F = parseFloat(cs.fontSize);
|
||||
CV.font = cs.fontWeight + " " + F + "px " + cs.fontFamily;
|
||||
var m = CV.measureText(txt), acc = 0, L = 0, R = 0, A = 0, D = 0;
|
||||
var adv = [], cen = [];
|
||||
txt.split("").forEach(function (ch, i) {
|
||||
var c = CV.measureText(ch);
|
||||
if (i === 0) L = acc - c.actualBoundingBoxLeft;
|
||||
R = acc + c.actualBoundingBoxRight;
|
||||
A = Math.max(A, c.actualBoundingBoxAscent);
|
||||
D = Math.max(D, c.actualBoundingBoxDescent);
|
||||
adv.push(acc);
|
||||
cen.push(acc + c.width / 2);
|
||||
acc += c.width;
|
||||
});
|
||||
return {
|
||||
F: F, l: L, w: R - L, a: A, h: A + D, adv: adv, cen: cen,
|
||||
// Top of a line-height:1 box to the baseline, from the font's own
|
||||
// ascent and Chrome's half-leading.
|
||||
base: (F - m.fontBoundingBoxAscent - m.fontBoundingBoxDescent) / 2 + m.fontBoundingBoxAscent,
|
||||
};
|
||||
}
|
||||
|
||||
// PLATES. Each letter is sized so its INK is --fill of the plate's
|
||||
// height and its ink top is flush with the plate's top edge, which is
|
||||
// the reference's own geometry on all seven plates. --gx is then the
|
||||
// ink's left inset as a share of plate width, negative where the
|
||||
// reference crops the letter off the plate's left.
|
||||
plates.forEach(function (p) {
|
||||
var g = p.querySelector(".vpt-g"), t = g.textContent;
|
||||
var cs = getComputedStyle(p), H = p.clientHeight, W = p.clientWidth;
|
||||
var m0 = ink(g, t);
|
||||
g.style.fontSize = (m0.F * H * parseFloat(cs.getPropertyValue("--fill")) / m0.h) + "px";
|
||||
var m = ink(g, t);
|
||||
g.style.left = (W * parseFloat(cs.getPropertyValue("--gx")) / 100 - m.l) + "px";
|
||||
g.style.top = (m.a - m.base) + "px";
|
||||
});
|
||||
|
||||
// RESOLVED WORDS. One constant ink width for every beat, centred on the
|
||||
// stage, exactly as the reference holds x0 6.09 to x1 95.05 with its
|
||||
// centre at 50.6 across six different words. Cap height is then a
|
||||
// consequence of character count, not a camera.
|
||||
var TW = SW * 0.88;
|
||||
var PAD = 1.4 * U;
|
||||
var KS = 1.35;
|
||||
var live = beats.map(function (beat, i) {
|
||||
var w = beat.querySelector(".vpt-w"), box = beat.querySelector(".vpt-box");
|
||||
var txt = w.textContent, m0 = ink(w, txt);
|
||||
// The last beat is set so that its SPREAD state is the same constant
|
||||
// box every other beat lands on, and it closes from there.
|
||||
w.style.fontSize = (m0.F * (i === 5 ? TW / KS : TW) / m0.w) + "px";
|
||||
var m = ink(w, txt);
|
||||
var x0 = (SW - m.w) / 2, top = (SH - m.h) / 2 - (m.base - m.a);
|
||||
var cx = x0 + m.w / 2, dx = [];
|
||||
w.textContent = "";
|
||||
var ls = txt.split("").map(function (ch, i) {
|
||||
var s = document.createElement("span");
|
||||
s.textContent = ch;
|
||||
s.style.left = (x0 - m.l + m.adv[i]) + "px";
|
||||
s.style.top = top + "px";
|
||||
w.appendChild(s);
|
||||
dx.push(x0 - m.l + m.cen[i] - cx);
|
||||
return s;
|
||||
});
|
||||
// The box wraps the INK bbox plus one padding, which puts the
|
||||
// reference's measured 1.05x to 1.08x box-to-cap-height ratio on
|
||||
// every beat whatever letters it holds.
|
||||
var bt = (SH - m.h) / 2 - PAD;
|
||||
box.style.top = bt + "px";
|
||||
box.style.height = (m.h + 2 * PAD) + "px";
|
||||
return { box: box, ls: ls, dx: dx, cx: cx, w: m.w, bt: bt };
|
||||
});
|
||||
function bx(b, k) { return b.cx - b.w * k / 2 - PAD; }
|
||||
function bw(b, k) { return b.w * k + 2 * PAD; }
|
||||
live.forEach(function (b) {
|
||||
b.box.style.left = bx(b, 1) + "px";
|
||||
b.box.style.width = bw(b, 1) + "px";
|
||||
});
|
||||
|
||||
var D = 3.4;
|
||||
var CUT = 1.32; // stamp -> type
|
||||
var B = [CUT, 1.68, 1.94, 2.2, 2.46, 2.72];
|
||||
var PUSH = 3.06;
|
||||
var REG = 0.36 * U; // the reference's ~4px misregistration
|
||||
var SX0 = 0.56; // 49.84 / 88.96, phase A's start
|
||||
var SQ = 0.62; // 43.15 / 70.46, phase B's end
|
||||
var PS = 9; // enough that the last word leaves frame
|
||||
|
||||
// Rest state pinned outside the timeline, both ends written on every
|
||||
// tween, so a seek never inherits a start value from the screen.
|
||||
gsap.set(mis, { x: -REG, y: -REG });
|
||||
gsap.set(cluster, { opacity: 1, scale: 1 });
|
||||
gsap.set(type, { opacity: 0, scaleX: 1, scaleY: 1 });
|
||||
gsap.set(beats, { opacity: 0, scale: 1 });
|
||||
gsap.set(cur, { opacity: 1 });
|
||||
// Frame zero is a deliverable (Law 8): the reference opens with slots
|
||||
// 2 and 4 already down, in close-up, and slot 1 arrives LAST.
|
||||
gsap.set(plates, { opacity: 0 });
|
||||
gsap.set([plates[1], plates[3]], { opacity: 1 });
|
||||
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
// STAMP. No entrance tween anywhere: the reference stamps each plate as
|
||||
// a hard cut on twos, and easing one in reads as a softer, different
|
||||
// idea. Order is the reference's, measured slot by slot.
|
||||
[[5, 0.14], [4, 0.28], [2, 0.56], [6, 0.7], [0, 0.84]].forEach(function (s) {
|
||||
tl.set(plates[s[0]], { opacity: 1 }, s[1]);
|
||||
});
|
||||
// Slots 7 and 2 blink back out on one frame at the reference's 13.433,
|
||||
// which is its last state before the cut.
|
||||
tl.set([plates[6], plates[1]], { opacity: 0 }, 1.18);
|
||||
|
||||
// The opening close-up and its whip out, then the decelerating lateral
|
||||
// settle that runs under every plate cut (Law 3, overlap). One tween
|
||||
// drives all seven red plates, because a misprint is one separation
|
||||
// shifting, not seven elements each deciding to.
|
||||
tl.fromTo(cluster, { scale: 1.7 }, { scale: 1.06, duration: 0.3, ease: E.whip }, 0);
|
||||
tl.fromTo(cluster, { scale: 1.06 }, { scale: 1, duration: CUT - 0.3, ease: E.settle }, 0.3);
|
||||
tl.fromTo(mis, { x: -4.2 * REG, y: -2.7 * REG }, { x: -REG, y: -REG, duration: CUT, ease: E.exitSettle }, 0);
|
||||
|
||||
// HARD CUT. The reference does not cross fade these two states and
|
||||
// neither does this: one frame is plates, the next is type.
|
||||
tl.set(cluster, { opacity: 0 }, CUT);
|
||||
tl.set(type, { opacity: 1 }, CUT);
|
||||
|
||||
// One word per beat, every one a cut, with the cursor parked on the top
|
||||
// right handle of whichever box is live.
|
||||
live.forEach(function (b, i) {
|
||||
tl.set(beats[i], { opacity: 1 }, B[i]);
|
||||
tl.set(cur, { x: bx(b, 1) + bw(b, 1), y: b.bt }, B[i]);
|
||||
if (i) tl.set(beats[i - 1], { opacity: 0 }, B[i]);
|
||||
});
|
||||
|
||||
// A, the box widening: one axis, so the cap height does not move.
|
||||
tl.fromTo(type, { scaleX: SX0, scaleY: 1 }, { scaleX: 1, duration: B[2] - CUT, ease: E.stretch }, CUT);
|
||||
// B, the box shortening: the other axis, so the ink width does not move.
|
||||
tl.fromTo(type, { scaleY: 1 }, { scaleY: SQ, duration: B[5] - B[2], ease: E.squeeze }, B[2]);
|
||||
|
||||
// C, the last word's letters closing on their own centre while the box
|
||||
// and the cursor follow them in. Per-letter transforms, never a
|
||||
// letter-spacing tween.
|
||||
var L = live[5], CD = PUSH - B[5];
|
||||
tl.fromTo(L.ls, { x: function (i) { return L.dx[i] * (KS - 1); } }, {
|
||||
x: 0, duration: CD, ease: E.converge,
|
||||
}, B[5]);
|
||||
tl.fromTo(L.box, { left: bx(L, KS), width: bw(L, KS) }, {
|
||||
left: bx(L, 1), width: bw(L, 1), duration: CD, ease: E.converge,
|
||||
}, B[5]);
|
||||
tl.fromTo(cur, { x: bx(L, KS) + bw(L, KS) }, {
|
||||
x: bx(L, 1) + bw(L, 1), duration: CD, ease: E.converge,
|
||||
}, B[5]);
|
||||
|
||||
// D, the terminal push. Taken on the beat, not on .vpt-type, so it
|
||||
// rides the stage's 20% origin and leaves frame right, top and bottom
|
||||
// while its left edge walks away from the presenter.
|
||||
tl.set(cur, { opacity: 0 }, PUSH);
|
||||
tl.fromTo(beats[5], { scale: 1 }, { scale: PS, duration: D - PUSH, ease: E.push }, PUSH);
|
||||
|
||||
tl.set({}, {}, D); // pin the full duration
|
||||
tl.seek(0);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["version-plate-type"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<!-- generated by harness/host.py, do not edit: whiteboard-ink at 1920x1080 -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>whiteboard-ink 1920x1080</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body { width: 1920px; height: 1080px; overflow: hidden; background: #0b0b0d; }
|
||||
#root {
|
||||
--bg: #0b0b0d;
|
||||
--fg: #f8fafc;
|
||||
--font-display: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
width: 1920px; height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #0b0b0d;
|
||||
}
|
||||
/* container-type: size is what lets the primitive lay itself out in cqw
|
||||
and cqh units, which is how one file survives three aspects. */
|
||||
#mount {
|
||||
position: absolute;
|
||||
left: 0px; top: 0px;
|
||||
width: 1920px; height: 1080px;
|
||||
container-type: size;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" data-composition-id="qa-host" data-start="0"
|
||||
data-width="1920" data-height="1080" data-duration="5" data-fps="30">
|
||||
<div id="mount" class="clip"
|
||||
data-composition-id="whiteboard-ink"
|
||||
data-composition-src="./whiteboard-ink.html"
|
||||
data-variable-values='{}'
|
||||
data-start="0" data-duration="5" data-track-index="0"
|
||||
data-width="1920" data-height="1080"></div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["qa-host"] = gsap.timeline({ paused: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||