Files
hyperframes/docs/catalog/components/pan-stations.mdx
Miguel ÁngelandMiguel Angel Simon Sierra 1ae2067b8d feat(catalog): put the variables panel back, on payloads (#3199)
* feat(catalog): put the variables panel back, on payloads

The panel drove its preview by loading an .html from docs/public, a type the
host does not publish, so it showed an empty frame in production and was
parked when the catalog was re-landed.

It now mounts the same JSON payload the plain player uses and re-mounts it as
values change, injecting them as window.__hfVariables into the composition head
before any of its scripts run, which is where the runtime reads overrides from.
Doing it in the markup rather than after load is what stops the composition
initialising with the wrong values first.

172 items with variables get the panel back; the playhead carries across a
change so a tweak mid-shot does not jump back to frame zero.

* fix(docs): drop the unused url form and the needless escapes

* fix(docs): the panel cannot reference a binding beside the export

* feat(catalog): make importing an SVG the obvious move

A reader arrives at this control with a shape, not with path data, and the
panel asked for the coordinates first. Import is now the primary action in a
drop target you can see is a drop target, and the raw path sits behind a
disclosure for anyone who wants it.

* feat(cli): let a fruitless catalog search report the gap

An agent that searches by meaning and finds nothing worth installing knows
something we do not: the name of a move the catalog is missing. There was no
way to tell us, so that knowledge was lost at the end of every run.

hyperframes feedback --search-miss "<query>" --wanted "<the move>" records it.
It carries no rating, so it never lands in the rating metric, and it is a
separate deliberate command rather than something catalog --query does on its
own: plain search still sends nothing, which is what the CLI promises.

--rating stops being required at the arg level, since a miss has no rating to
give. The check moved into the run body, where an absent one is now handled
rather than crashing on undefined.

* feat(cli): carry tuned variable values into the install snippet

Someone who tunes a block on its catalog page had no way to keep those values:
the install command was the same one everybody gets, and the tuning stayed on
the page.

hyperframes add <item> --vars '<json>' now prints a mount element carrying
data-variable-values, so the values land where the block is used.

They ride on the host rather than being written into the installed file. That
keeps the composition on disk byte-identical to the registry's, so a later
reinstall can still tell an edit from an update, and it lets two mounts of the
same block carry different values.

* fix(catalog): serve the item's own directory so runtime paths resolve

Some compositions assemble their asset URLs at run time —
"compositions/components/" + texture + ".png" for the texture masks, a font the
compiler pulled into _remote_media — and no scan of the markup can see a string
that does not exist until a script concatenates it. Those items either rendered
black or were dropped to a video that had never been uploaded.

Each item that needs it now has its prepared directory published, and its
payload carries a <base> pointing at it, so any relative path the composition
invents resolves. caption-texture renders its masks again, and
variable-font-flex has a preview at all for the first time: its MP4 and poster
are both 403.

Both layouts are published, because which one a composition asks for differs
per item, and a directory only earns that if it is under 2 MB. The 12 MB
texture sheet keeps the recorded video it already had.

* fix(catalog): let the variables panel actually drive the composition

Every control on the panel was inert. The values reached the composition and
nothing repainted, because the payload had already been compiled: compiling
inlines a mounted component and resolves its variables into the markup and CSS,
so by the time a reader turns a knob there is nothing left to change.

An item that declares variables now ships uncompiled, keeping the mount the
runtime loads at run time, which is the only state where data-variable-values
still means anything. The component travels inline as a data URI rather than a
sibling file, because .html is the one type the docs host will not publish. The
demo's own pinned values come off, so the reader's choices reach the mount
instead of losing to the values the demo picked to show itself off.

Measured on the rendered frame rather than the DOM: green rgb(98,207,144),
blue rgb(6,6,199), violet rgb(177,147,230), and back to green.

docs/public/catalog drops from 48 MB to 35 MB along the way, since an
uncompiled payload carries far less than an inlined one.

* feat(catalog): keep variable changes in the url

A reader who tuned a piece lost it on reload, and had nothing to send anyone.
The values now live in the query string, scoped by composition id so two links
never read each other,and only the ones that differ from the defaults are
written, so changing one knob gives a short URL rather than every variable
spelled out.

replaceState rather than pushState: dragging a slider should not leave a trail
of history entries. An unreadable value is ignored rather than thrown, so a
truncated or hand-edited link opens the piece at its defaults.

* fix(catalog): only rewrite the url when a value actually changed

* refactor(catalog): memoise the declared defaults on their content

* feat(catalog): offer an install command carrying the tuned values

The Install block is generated before anyone touches a knob, so it can only
ever print the plain command. Someone who spent a minute tuning a piece copied
it and got the defaults back.

The panel now carries its own command in the Snippet tab, with --vars holding
exactly the values that differ. An untouched piece still offers the same short
command, so nothing gets noisier for the common case.

* fix(catalog): a piece with nothing to render is a skip, not a failure

caption-blend-difference is a stylesheet and a paragraph of prose — a class you
add to your own captions, with no standalone scene to show. The generator
treated that as a build failure, so every run ended by reporting something
broken when nothing was.

It now reports the shape it is and keeps its recorded video, which is the only
honest preview such an item has. A genuine render failure still throws.

* fix(catalog): restore variables from the url on a cold load

A shared link opened at the defaults. The first render happens on the server,
where there is no window to read the query string from, and React then hydrates
against that markup and never revisits it — so the values only appeared once you
touched a control.

The URL is read again after mount, which is the first moment it exists. The
value is also escaped once now rather than twice: URLSearchParams already
decodes on the way out, and decoding a second time turned an SVG path full of
percent-escapes into something that no longer parsed, besides doubling the
length of every link.

* fix(catalog): mount the preview with the values a link carried

The frame was built from the declared defaults and the shared values were
posted to it afterwards, which is too late for anything the composition reads
once at init: a path arrived after the mark had already been drawn from the
default one, so a link looked right in the panel and wrong on screen.

* feat(catalog): the install command follows the values you tuned

Copying the Install line gave the plain command back, because that block is
generated before anyone touches a knob and had no way to know what changed. The
tuned command only existed in the panel Snippet tab, which is not where anyone
looks for it.

The line now reads the same query string the panel writes, so the two agree
without either component knowing the other exists, and a shared link carries the
right command too. replaceState fires no event, so the panel announces its own
writes.

* fix(catalog): send a text variable to the preview once it is finished

Every other control in the explorer reports a whole value on every event: a
slider at any position is a position, a swatch is a colour. A text field is
not. Typing v3 into a badge posted v first, so the preview remounted and
rendered a composition built from half a word.

The post now waits while a text field has focus and goes out when the edit is
committed, with Enter or by clicking away. The field itself is unchanged and
still tracks every keystroke.

---------

Co-authored-by: Miguel Angel Simon Sierra <miguelangelsi07@gmail.com>
2026-08-10 22:40:01 -04:00

802 lines
29 KiB
Plaintext

---
title: "Pan Stations"
description: "A lateral camera move across a continuous row of labeled feature stations, with a steady dwell at each stop before the next pan."
---
import { InstallCommand } from "/snippets/install-command.jsx";
import { VariablesExplorer } from "/snippets/variables-explorer.jsx";
<VariablesExplorer
previewSrc="/public/catalog/components/pan-stations.json"
compositionId="pan-stations"
compositionSrc="compositions/components/pan-stations.html"
variables={[{"id":"stationCount","type":"number","role":"layout","label":"Station count","description":"Number of feature stations in the row.","default":4,"min":3,"max":6,"step":1},{"id":"labels","type":"string","role":"content","label":"Station labels","description":"Comma-separated labels shown on the station cards.","default":"Capture,Edit,Render,Share"},{"id":"dwell","type":"number","role":"timing","label":"Dwell","description":"Seconds the camera holds at each station before panning.","default":0.6,"min":0.2,"max":2,"step":0.1,"unit":"s"}]}
>
```html pan-stations.html
<!doctype html>
<!--
pan-stations -- HyperFrames video primitive (camera / holdable / exhibit)
Concept: the camera pans laterally across a wide row of labeled feature
stations, settling on each card before moving to the next. The exhibit
reading is primary here. The agitate reading is cross-shelved because the
same camera move can scan broken tools instead of polished features.
Compiled-from evidence: candidates card "pan-stations" plus the ship doc:
"one mechanic, two readings: panning across broken tools agitates, panning
across features exhibits. Re-filed by the adversary pass precisely because
it serves both shelves; the pause cadence is the frozen law." Evidence tags:
SIM fixture, CORPUS blueprint (re-filed per adversary; cross-shelved).
Use when: a sequence of tools, steps, screens, or features should read as
one continuous environment that the camera inspects in order.
Variables (declared in data-composition-variables below):
- stationCount (number, default 4, range 3-6): number of cards in the row.
- labels (CSV string, default "Capture,Edit,Render,Share"): visible station
labels, padded with "Station N" when entries are missing.
- dwell (seconds, default 0.6, range 0.2-2): steady hold at each station.
Envelope (fixed IN/OUT, elastic HOLD only, never gsap.timeScale()):
IN_BASE = 0.45s the first station settles into view
HOLD = max(0, D - (IN + OUT)); complete dwell and pan segments are
scheduled while they fit, then the last reached station holds
OUT_BASE = 0.40s the current station fades out
If D < IN_BASE + OUT_BASE, IN and OUT scale down together so HOLD is zero.
Sync points: none. Station arrivals live in elastic HOLD and are deliberately
not declared as sync points. Dwell gaps contain no eased tween.
Sound cue: none. A host can layer its own station arrival foley if needed.
Mount contract: this is a mountable sub-composition. The runtime clones only
<template> contents, so every real style, node, and script lives inside the
template. #root has no data-width or data-height and fills the host box. It
is styled by ID because composited CSS scoping can stop a root class selector
from matching. Variables come only from getVariables() after mount, because
document.documentElement belongs to the host document at that point.
-->
<html
lang="en"
data-composition-variables='[
{ "id": "stationCount", "type": "number", "role": "layout", "label": "Station count", "description": "Number of feature stations in the row.", "default": 4, "min": 3, "max": 6, "step": 1 },
{ "id": "labels", "type": "string", "role": "content", "label": "Station labels", "description": "Comma-separated labels shown on the station cards.", "default": "Capture,Edit,Render,Share" },
{ "id": "dwell", "type": "number", "role": "timing", "label": "Dwell", "description": "Seconds the camera holds at each station before panning.", "default": 0.6, "min": 0.2, "max": 2, "step": 0.1, "unit": "s" }
]'
>
<head>
<meta charset="UTF-8" />
<title>Pan Stations</title>
<!-- Metadata only. Everything outside <template> is discarded on mount. -->
</head>
<body>
<template>
<div
id="root"
data-composition-id="pan-stations"
data-start="0"
data-duration="4"
data-fps="30"
>
<style>
*,
*::before,
*::after {
box-sizing: border-box;
}
#root {
--ease-standard: cubic-bezier(0.215, 0.61, 0.355, 1);
--ease-exit: cubic-bezier(0.55, 0.055, 0.675, 0.19);
--ease-drift: cubic-bezier(0.445, 0.05, 0.55, 0.95);
--ps-station-width: 78cqw;
--ps-station-gap: var(--space-4, 6cqw);
position: absolute;
inset: 0;
container-type: size;
isolation: isolate;
overflow: hidden;
background: var(--bg, #0b1120);
color: var(--fg, #f8fafc);
font-family: var(--font-body, Inter, system-ui, sans-serif);
}
.ps-clip {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
opacity: 0;
}
.ps-rail {
position: absolute;
left: 0;
right: 0;
top: 50%;
height: 0.18cqh;
background: var(--border, #334155);
opacity: 0.7;
}
.ps-strip {
--ps-pan-index: 0;
position: absolute;
top: 18cqh;
left: 0;
display: flex;
align-items: stretch;
gap: var(--ps-station-gap);
width: max-content;
padding: 0 11cqw;
transform: translateX(
calc(var(--ps-pan-index) * -1 * (var(--ps-station-width) + var(--ps-station-gap)))
);
will-change: transform;
}
.ps-station {
position: relative;
flex: 0 0 var(--ps-station-width);
height: 64cqh;
display: grid;
grid-template-rows: auto 1fr auto;
gap: var(--space-3, 3cqh);
padding: var(--space-5, 5cqw);
overflow: hidden;
border: 0.16cqw solid var(--border, #334155);
border-radius: 3.2cqw;
background: var(--surface, #1e293b);
box-shadow: 0 2.2cqh 6cqw color-mix(in srgb, var(--bg, #0b1120) 72%, transparent);
}
.ps-station::before {
content: "";
position: absolute;
inset: 0;
background: radial-gradient(
circle at 82% 18%,
color-mix(in srgb, var(--brand, #22c55e) 24%, transparent),
transparent 42%
);
}
.ps-kicker,
.ps-label,
.ps-screen {
position: relative;
z-index: 1;
}
.ps-kicker {
display: flex;
align-items: center;
justify-content: space-between;
color: var(--muted, #94a3b8);
font-size: 1.8cqw;
font-weight: 700;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.ps-index {
color: var(--accent, #38bdf8);
font-variant-numeric: tabular-nums;
}
.ps-screen {
display: grid;
grid-template-columns: 0.56fr 1fr;
gap: var(--space-3, 3cqw);
min-height: 0;
}
.ps-tool,
.ps-stack {
border: 0.13cqw solid var(--border, #334155);
border-radius: 2cqw;
background: color-mix(in srgb, var(--bg, #0b1120) 56%, var(--surface, #1e293b));
}
.ps-tool {
display: grid;
place-items: center;
}
.ps-glyph {
width: 8.5cqw;
aspect-ratio: 1;
display: grid;
place-items: center;
border-radius: 2.2cqw;
background: var(--brand, #22c55e);
color: var(--bg, #0b1120);
font-family: var(--font-display, Inter, system-ui, sans-serif);
font-size: 3.2cqw;
font-weight: 850;
}
.ps-stack {
display: grid;
align-content: center;
gap: var(--space-2, 1.8cqh);
padding: var(--space-3, 3cqw);
}
.ps-line {
height: 1.15cqh;
border-radius: 50%;
background: var(--border, #334155);
}
.ps-line:nth-child(1) {
width: 82%;
background: var(--accent, #38bdf8);
}
.ps-line:nth-child(2) {
width: 100%;
}
.ps-line:nth-child(3) {
width: 64%;
}
.ps-label {
max-width: 100%;
overflow-wrap: anywhere;
color: var(--fg, #f8fafc);
font-family: var(--font-display, Inter, system-ui, sans-serif);
font-size: 5.8cqw;
font-weight: 760;
letter-spacing: -0.045em;
line-height: 0.98;
}
</style>
<div
id="pan-stations-clip"
class="ps-clip clip"
data-start="0"
data-duration="4"
data-track-index="0"
>
<div class="ps-rail"></div>
<div class="ps-strip" aria-label="Feature stations"></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 by contract: the mounted root loses data-composition-id.
var compositionId = "pan-stations";
var clip = root.querySelector(".ps-clip");
var strip = root.querySelector(".ps-strip");
var vars =
window.__hyperframes && window.__hyperframes.getVariables
? window.__hyperframes.getVariables()
: {};
// INVARIANT: stationCount is always an integer in the declared 3-6 range.
var rawCount = Number(vars.stationCount);
var stationCount = Number.isFinite(rawCount) ? Math.round(rawCount) : 4;
stationCount = Math.max(3, Math.min(6, stationCount));
// INVARIANT: dwell is finite and positive, then clamps to 0.2-2 seconds.
var rawDwell = Number(vars.dwell);
var dwell = Number.isFinite(rawDwell) ? rawDwell : 0.6;
dwell = Math.max(0.2, Math.min(2, dwell));
var labelsSource =
vars.labels == null ? "Capture,Edit,Render,Share" : String(vars.labels);
var parsedLabels = labelsSource.split(",").map(function (label) {
return label.trim();
});
// Station creation is the only owner of row content and fallback labels.
for (var i = 0; i < stationCount; i += 1) {
var label = parsedLabels[i] || "Station " + (i + 1);
var station = document.createElement("article");
station.className = "ps-station";
station.setAttribute("aria-label", label);
var kicker = document.createElement("div");
kicker.className = "ps-kicker";
kicker.innerHTML = '<span>Feature station</span><span class="ps-index"></span>';
kicker.querySelector(".ps-index").textContent = String(i + 1).padStart(2, "0");
var screen = document.createElement("div");
screen.className = "ps-screen";
screen.innerHTML =
'<div class="ps-tool"><span class="ps-glyph"></span></div>' +
'<div class="ps-stack"><span class="ps-line"></span><span class="ps-line"></span><span class="ps-line"></span></div>';
screen.querySelector(".ps-glyph").textContent = label.charAt(0).toUpperCase();
var title = document.createElement("div");
title.className = "ps-label";
title.textContent = label;
station.appendChild(kicker);
station.appendChild(screen);
station.appendChild(title);
strip.appendChild(station);
}
var stations = Array.from(strip.querySelectorAll(".ps-station"));
// RETIME RANGE: fixed IN/OUT, elastic HOLD, no global time scaling.
var IN_BASE = 0.45;
var OUT_BASE = 0.4;
var PAN_DURATION = 0.25;
var durationValue = parseFloat(root.dataset.duration || "4");
var duration = Number.isFinite(durationValue) ? Math.max(0.001, durationValue) : 4;
var totalBase = IN_BASE + OUT_BASE;
var envelopeScale = duration < totalBase ? duration / totalBase : 1;
var IN = IN_BASE * envelopeScale;
var OUT = OUT_BASE * envelopeScale;
var HOLD = Math.max(0, duration - IN - OUT);
var HOLD_START = IN;
var OUT_START = IN + HOLD;
// Explicit t=0 state for every animated endpoint.
gsap.set(clip, { opacity: 0 });
gsap.set(strip, { "--ps-pan-index": 0 });
var tl = gsap.timeline({ paused: true });
tl.to(clip, { opacity: 1, duration: IN, ease: "power2.out" }, 0);
// HOLD: empty time is the steady dwell. Only complete pans are added.
var cursor = HOLD_START;
for (var stationIndex = 0; stationIndex < stations.length - 1; stationIndex += 1) {
cursor += dwell;
if (cursor + PAN_DURATION > OUT_START) break;
tl.to(
strip,
{
"--ps-pan-index": stationIndex + 1,
duration: PAN_DURATION,
ease: "sine.inOut",
},
cursor,
);
cursor += PAN_DURATION;
}
tl.to(clip, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
tl.seek(0);
window.__timelines = window.__timelines || {};
window.__timelines[compositionId] = tl;
})();
</script>
</div>
</template>
</body>
</html>
```
</VariablesExplorer>
## Install
<InstallCommand command="npx hyperframes add pan-stations" item="pan-stations" />
That writes one file: `compositions/components/pan-stations.html`.
## Paste it into your composition
Open `compositions/components/pan-stations.html` and copy what is inside into your own composition.
A component has no size or duration of its own. It takes both from the composition
you paste it into.
## Variables
Every one of these has a default, so the piece works untouched. Set the ones you
want to change on the element:
| Variable | Default | Accepts | What it does |
| --- | --- | --- | --- |
| `stationCount` | `4` | 3 to 6, step 1 | Number of feature stations in the row. |
| `labels` | `Capture,Edit,Render,Share` | string | Comma-separated labels shown on the station cards. |
| `dwell` | `0.6` | 0.2s to 2s, step 0.1s | Seconds the camera holds at each station before panning. |
Set them with `data-variable-values` on the element that mounts it. These are the
defaults, so this behaves exactly like the preview above until you change one:
```html wrap
<div
data-composition-id="pan-stations"
data-composition-src="compositions/components/pan-stations.html"
data-variable-values='{"stationCount":4,"labels":"Capture,Edit,Render,Share","dwell":0.6}'
></div>
```
## Source
<Accordion title={`pan-stations.html`}>
```html
<!doctype html>
<!--
pan-stations -- HyperFrames video primitive (camera / holdable / exhibit)
Concept: the camera pans laterally across a wide row of labeled feature
stations, settling on each card before moving to the next. The exhibit
reading is primary here. The agitate reading is cross-shelved because the
same camera move can scan broken tools instead of polished features.
Compiled-from evidence: candidates card "pan-stations" plus the ship doc:
"one mechanic, two readings: panning across broken tools agitates, panning
across features exhibits. Re-filed by the adversary pass precisely because
it serves both shelves; the pause cadence is the frozen law." Evidence tags:
SIM fixture, CORPUS blueprint (re-filed per adversary; cross-shelved).
Use when: a sequence of tools, steps, screens, or features should read as
one continuous environment that the camera inspects in order.
Variables (declared in data-composition-variables below):
- stationCount (number, default 4, range 3-6): number of cards in the row.
- labels (CSV string, default "Capture,Edit,Render,Share"): visible station
labels, padded with "Station N" when entries are missing.
- dwell (seconds, default 0.6, range 0.2-2): steady hold at each station.
Envelope (fixed IN/OUT, elastic HOLD only, never gsap.timeScale()):
IN_BASE = 0.45s the first station settles into view
HOLD = max(0, D - (IN + OUT)); complete dwell and pan segments are
scheduled while they fit, then the last reached station holds
OUT_BASE = 0.40s the current station fades out
If D < IN_BASE + OUT_BASE, IN and OUT scale down together so HOLD is zero.
Sync points: none. Station arrivals live in elastic HOLD and are deliberately
not declared as sync points. Dwell gaps contain no eased tween.
Sound cue: none. A host can layer its own station arrival foley if needed.
Mount contract: this is a mountable sub-composition. The runtime clones only
<template> contents, so every real style, node, and script lives inside the
template. #root has no data-width or data-height and fills the host box. It
is styled by ID because composited CSS scoping can stop a root class selector
from matching. Variables come only from getVariables() after mount, because
document.documentElement belongs to the host document at that point.
-->
<html
lang="en"
data-composition-variables='[
{ "id": "stationCount", "type": "number", "role": "layout", "label": "Station count", "description": "Number of feature stations in the row.", "default": 4, "min": 3, "max": 6, "step": 1 },
{ "id": "labels", "type": "string", "role": "content", "label": "Station labels", "description": "Comma-separated labels shown on the station cards.", "default": "Capture,Edit,Render,Share" },
{ "id": "dwell", "type": "number", "role": "timing", "label": "Dwell", "description": "Seconds the camera holds at each station before panning.", "default": 0.6, "min": 0.2, "max": 2, "step": 0.1, "unit": "s" }
]'
>
<head>
<meta charset="UTF-8" />
<title>Pan Stations</title>
<!-- Metadata only. Everything outside <template> is discarded on mount. -->
</head>
<body>
<template>
<div
id="root"
data-composition-id="pan-stations"
data-start="0"
data-duration="4"
data-fps="30"
>
<style>
*,
*::before,
*::after {
box-sizing: border-box;
}
#root {
--ease-standard: cubic-bezier(0.215, 0.61, 0.355, 1);
--ease-exit: cubic-bezier(0.55, 0.055, 0.675, 0.19);
--ease-drift: cubic-bezier(0.445, 0.05, 0.55, 0.95);
--ps-station-width: 78cqw;
--ps-station-gap: var(--space-4, 6cqw);
position: absolute;
inset: 0;
container-type: size;
isolation: isolate;
overflow: hidden;
background: var(--bg, #0b1120);
color: var(--fg, #f8fafc);
font-family: var(--font-body, Inter, system-ui, sans-serif);
}
.ps-clip {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
opacity: 0;
}
.ps-rail {
position: absolute;
left: 0;
right: 0;
top: 50%;
height: 0.18cqh;
background: var(--border, #334155);
opacity: 0.7;
}
.ps-strip {
--ps-pan-index: 0;
position: absolute;
top: 18cqh;
left: 0;
display: flex;
align-items: stretch;
gap: var(--ps-station-gap);
width: max-content;
padding: 0 11cqw;
transform: translateX(
calc(var(--ps-pan-index) * -1 * (var(--ps-station-width) + var(--ps-station-gap)))
);
will-change: transform;
}
.ps-station {
position: relative;
flex: 0 0 var(--ps-station-width);
height: 64cqh;
display: grid;
grid-template-rows: auto 1fr auto;
gap: var(--space-3, 3cqh);
padding: var(--space-5, 5cqw);
overflow: hidden;
border: 0.16cqw solid var(--border, #334155);
border-radius: 3.2cqw;
background: var(--surface, #1e293b);
box-shadow: 0 2.2cqh 6cqw color-mix(in srgb, var(--bg, #0b1120) 72%, transparent);
}
.ps-station::before {
content: "";
position: absolute;
inset: 0;
background: radial-gradient(
circle at 82% 18%,
color-mix(in srgb, var(--brand, #22c55e) 24%, transparent),
transparent 42%
);
}
.ps-kicker,
.ps-label,
.ps-screen {
position: relative;
z-index: 1;
}
.ps-kicker {
display: flex;
align-items: center;
justify-content: space-between;
color: var(--muted, #94a3b8);
font-size: 1.8cqw;
font-weight: 700;
letter-spacing: 0.16em;
text-transform: uppercase;
}
.ps-index {
color: var(--accent, #38bdf8);
font-variant-numeric: tabular-nums;
}
.ps-screen {
display: grid;
grid-template-columns: 0.56fr 1fr;
gap: var(--space-3, 3cqw);
min-height: 0;
}
.ps-tool,
.ps-stack {
border: 0.13cqw solid var(--border, #334155);
border-radius: 2cqw;
background: color-mix(in srgb, var(--bg, #0b1120) 56%, var(--surface, #1e293b));
}
.ps-tool {
display: grid;
place-items: center;
}
.ps-glyph {
width: 8.5cqw;
aspect-ratio: 1;
display: grid;
place-items: center;
border-radius: 2.2cqw;
background: var(--brand, #22c55e);
color: var(--bg, #0b1120);
font-family: var(--font-display, Inter, system-ui, sans-serif);
font-size: 3.2cqw;
font-weight: 850;
}
.ps-stack {
display: grid;
align-content: center;
gap: var(--space-2, 1.8cqh);
padding: var(--space-3, 3cqw);
}
.ps-line {
height: 1.15cqh;
border-radius: 50%;
background: var(--border, #334155);
}
.ps-line:nth-child(1) {
width: 82%;
background: var(--accent, #38bdf8);
}
.ps-line:nth-child(2) {
width: 100%;
}
.ps-line:nth-child(3) {
width: 64%;
}
.ps-label {
max-width: 100%;
overflow-wrap: anywhere;
color: var(--fg, #f8fafc);
font-family: var(--font-display, Inter, system-ui, sans-serif);
font-size: 5.8cqw;
font-weight: 760;
letter-spacing: -0.045em;
line-height: 0.98;
}
</style>
<div
id="pan-stations-clip"
class="ps-clip clip"
data-start="0"
data-duration="4"
data-track-index="0"
>
<div class="ps-rail"></div>
<div class="ps-strip" aria-label="Feature stations"></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 by contract: the mounted root loses data-composition-id.
var compositionId = "pan-stations";
var clip = root.querySelector(".ps-clip");
var strip = root.querySelector(".ps-strip");
var vars =
window.__hyperframes && window.__hyperframes.getVariables
? window.__hyperframes.getVariables()
: {};
// INVARIANT: stationCount is always an integer in the declared 3-6 range.
var rawCount = Number(vars.stationCount);
var stationCount = Number.isFinite(rawCount) ? Math.round(rawCount) : 4;
stationCount = Math.max(3, Math.min(6, stationCount));
// INVARIANT: dwell is finite and positive, then clamps to 0.2-2 seconds.
var rawDwell = Number(vars.dwell);
var dwell = Number.isFinite(rawDwell) ? rawDwell : 0.6;
dwell = Math.max(0.2, Math.min(2, dwell));
var labelsSource =
vars.labels == null ? "Capture,Edit,Render,Share" : String(vars.labels);
var parsedLabels = labelsSource.split(",").map(function (label) {
return label.trim();
});
// Station creation is the only owner of row content and fallback labels.
for (var i = 0; i < stationCount; i += 1) {
var label = parsedLabels[i] || "Station " + (i + 1);
var station = document.createElement("article");
station.className = "ps-station";
station.setAttribute("aria-label", label);
var kicker = document.createElement("div");
kicker.className = "ps-kicker";
kicker.innerHTML = '<span>Feature station</span><span class="ps-index"></span>';
kicker.querySelector(".ps-index").textContent = String(i + 1).padStart(2, "0");
var screen = document.createElement("div");
screen.className = "ps-screen";
screen.innerHTML =
'<div class="ps-tool"><span class="ps-glyph"></span></div>' +
'<div class="ps-stack"><span class="ps-line"></span><span class="ps-line"></span><span class="ps-line"></span></div>';
screen.querySelector(".ps-glyph").textContent = label.charAt(0).toUpperCase();
var title = document.createElement("div");
title.className = "ps-label";
title.textContent = label;
station.appendChild(kicker);
station.appendChild(screen);
station.appendChild(title);
strip.appendChild(station);
}
var stations = Array.from(strip.querySelectorAll(".ps-station"));
// RETIME RANGE: fixed IN/OUT, elastic HOLD, no global time scaling.
var IN_BASE = 0.45;
var OUT_BASE = 0.4;
var PAN_DURATION = 0.25;
var durationValue = parseFloat(root.dataset.duration || "4");
var duration = Number.isFinite(durationValue) ? Math.max(0.001, durationValue) : 4;
var totalBase = IN_BASE + OUT_BASE;
var envelopeScale = duration < totalBase ? duration / totalBase : 1;
var IN = IN_BASE * envelopeScale;
var OUT = OUT_BASE * envelopeScale;
var HOLD = Math.max(0, duration - IN - OUT);
var HOLD_START = IN;
var OUT_START = IN + HOLD;
// Explicit t=0 state for every animated endpoint.
gsap.set(clip, { opacity: 0 });
gsap.set(strip, { "--ps-pan-index": 0 });
var tl = gsap.timeline({ paused: true });
tl.to(clip, { opacity: 1, duration: IN, ease: "power2.out" }, 0);
// HOLD: empty time is the steady dwell. Only complete pans are added.
var cursor = HOLD_START;
for (var stationIndex = 0; stationIndex < stations.length - 1; stationIndex += 1) {
cursor += dwell;
if (cursor + PAN_DURATION > OUT_START) break;
tl.to(
strip,
{
"--ps-pan-index": stationIndex + 1,
duration: PAN_DURATION,
ease: "sine.inOut",
},
cursor,
);
cursor += PAN_DURATION;
}
tl.to(clip, { opacity: 0, duration: OUT, ease: "power2.in" }, OUT_START);
tl.seek(0);
window.__timelines = window.__timelines || {};
window.__timelines[compositionId] = tl;
})();
</script>
</div>
</template>
</body>
</html>
```
</Accordion>
{/* hf:generated-footer */}
Tagged `camera` `pan` `stations` `features` `exhibit` `agitate` `cross-shelved`.
## Related topics
- [Browse the complete Catalog](/catalog)
- [Add assets and Catalog items in Studio](/studio/assets-and-blocks)
- [Build a richer composition](/go-further)