Files
hyperframes/docs/catalog/blocks/share-sheet-carousel.mdx
WaterrrForever 254fe4bd8a feat(registry): say what a promoted template's slots mean, not where they sit (#3562)
* feat(registry): say what a promoted template's slots mean, not where they sit

Every declaration described its slot by position — appName was "small credit in the corner
of every banner" — and every editing contract described the supplied brand only by what it
may not touch, chatgpt-exchange going as far as "only the subject discussed inside the
conversation". An agent filling those slots has nothing telling it that the video is an
advertisement for that brand, and remixes shipped with an invented brand instead of the
real one.

Adds `portrays` to the 35 identity-bearing variables across seven templates: what the slot
stands for, as a list, kept orthogonal to `role` (which says which aspect of the
composition a knob affects, not what a value means to a viewer). Rewrites those variables'
descriptions to state meaning, and gives every TEMPLATE.md the affirmative sentence it was
missing. notes-reveal now records honestly that it declares no identity slot at all, which
is why a remix of it cannot carry a brand.

`portrays` is optional metadata: rendering ignores it, the promoted contract still projects
{id, type, role}, and packages that predate it keep working. Variable ids, types, roles,
labels, and defaults are untouched, so installs and renders see the same contract.

* feat(notes-reveal): give the template somewhere to say whose ad it is

This was the one promoted template that declared no identity slot at all, and the
previous commit could only record that honestly. A remix of it could not name the
advertiser, could not carry its domain, and had nowhere to place its mark — so the
ad it produced was unattributable no matter how good the copy was.

The closing card ends at y=1708, leaving 212px of dotted scene. A sign-off strip
lives there: `brandLogo` (portrays subject_logo) above `brandDomain` (portrays
subject_domain), in the card's own plum and Courier Prime. Putting it outside the
card means the hand-lettered headline and the checklist keep the geometry they were
designed with — verified by `hyperframes check`, which reports the same 0 errors and
the same warning counts as origin/main, with one more contrast check (367/367 AA).

No name slot: this template has no text slot that can hold a bare brand name.
`cardTop`'s marker line continues into the fixed words "OF ONE FILE", and a name set
beside a wordmark reads twice — rendering it proved that before this was committed.
The mark plus the domain carry the attribution, which is what the other end-card
templates do.

Rendered to check rather than assumed: the packaged default reads as the HyperFrames
wordmark over hyperframes.heygen.com, and a resolved symbol mark (Notion's cube over
notion.com) sits correctly in the same strip.

* fix(notes-reveal): make the note the ad, and stop the headline leaving the card

Three defects, all visible in the reported gamma remix.

The seven body lines carried their characters as pre-split `<span class="ch">`
elements so the reveal animation could address them by id. That made the note
permanently unwritable: 46% of the 24.9s runtime, and the only place the note
says anything, was fixed copy about making videos with HyperFrames -- shipped
inside an advertisement for a Dutch DIY chain. The spans are now built at
runtime from seven declared variables, keeping the same ids, so the animation
is untouched and the copy is the brand's.

`cardMid` and `cardBottom` ("OF", "ONE FILE") were literals with no variable at
all, so a remix could only ever change the first of the card's three lines.

Every text slot sat at a fixed left edge on one line, guarded only by a
character cap -- the wrong unit. `cardTop` allowed 12 characters; "THE POWER"
(9) fits and "CREATE DECKS" (12) does not, which is why both reported gamma
remixes shipped with the closing headline over the edge of the card. Slots are
now fitted to their box at render time, shrinking type only as far as needed and
never past the designed size. The card headlines also carried
`data-layout-allow-overflow`, switching off the one check that would have caught
it; those waivers are gone. The note's title and body keep theirs, because
`#note-body` is translated across the whole scene and leaves the canvas by
design.

Timing is preserved rather than regenerated: each body line is revealed inside
the frame window the packaged rhythm already used, so `JUMPS` and the hand-tuned
`SCROLLS` curves stay valid and the composition is still 24.867s for any length
of copy. A line whose length matches the packaged copy keeps its rhythm frame
for frame.

Verified: rendered with the packaged defaults, SSIM 1.000000 across all 746
frames against the previous template -- the design is bit-identical. Rendered
with the gamma values that overflowed, and with a stress set of long and
one-word values: both stay inside the card and the note, both still 24.867s.
`hyperframes check` passes, with layout warnings down from 28 to 8 and no new
issue class. Note that `check` takes no variable values, so it guards the
template's defaults and the fit is what guards a remix.

* fix(notes-reveal): make the fit floor and the character caps agree

A cap that admits a string still too wide at the floor font size puts the text
back outside its box -- the exact bug the fit was added for. With the floor at
0.6 and the title cap at 40, a 40-character title still overflowed `#note-body`
by 30px, because "Things nobody told me" is 21 characters and 900px at 88px, so
42.9px per character, and 40 characters need to reach about 0.45 of the design
size to fit.

Floor to 0.45 and the caps in: titles 34, body lines 52, cardTop and cardBottom
16. Every cap is now satisfiable with room to spare, and the common case stays
far from the floor.

Found by probing all eight promoted templates with values about 1.8x the length
of their packaged defaults, which is the length a real remix produces; short
sentinel values only ever prove a slot is wired.

Defaults are unaffected: SSIM 1.000000 across all 746 frames, still 24.867s,
`hyperframes check` still passes.

* fix(exchange): scroll the composer to follow the caret

`prompt` is an editable slot in both templates, but `.comp-text` is a
fixed-width single line with `white-space: pre` inside a composer that clips,
and the packaged prompt already reaches the mic -- it has no headroom at all.
A longer prompt therefore slid under the mic and the send button and lost its
tail, with the caret hidden behind them: the remix read as having typed into
nowhere, cut mid-word.

Both now scroll the typed text left to keep the caret in view, the way a real
single-line input does, on the very per-character times the reveal already uses.
The limit is measured to the opaque round button rather than the mic, because the
packaged prompt's caret already sits 2px past the mic's left edge in
chatgpt-exchange -- measuring to the mic would scroll the packaged composition.

Shrink-to-fit was the other option and it is worse: with no headroom it shrinks
the packaged prompt too, and it still cannot absorb a prompt twice as long
without unreadable type. It was tried, measured, and dropped.

A prompt that fits emits no keyframes and the element is never handed to GSAP at
all -- even a zero translate stamps a transform, which changes how the text
rasterizes.

claude-exchange puts this inside its existing `build()`, which already re-runs on
`document.fonts.ready`, so it measures the final font. chatgpt-exchange builds
once, so its scroll keyframes are kept in a list and rebuilt on the same event.

Verified on the packaged defaults: claude-exchange SSIM 1.000000 across 1284
frames. chatgpt-exchange is not frame-deterministic -- rendering it twice
unchanged gives 0.999959 with 249 frames under 0.9999, and before-vs-after gives
0.999967 with the same 249 -- so the change sits inside its own noise. Durations
unchanged at 14.9s and 21.4s. `hyperframes check` reports byte-identical results
to the unchanged templates.

* fix(notes-reveal): fit the checklist cells instead of counting their characters

The three checklist rows were the only text slots with no width fit, so
their character cap was doing the job a measurement should: it was set to 8
because that was the widest the packaged strings needed, and a gamma.com
remix delivered "DIRECT MEE" and rendered "DIRECT M".

Fit the labels and values like every other text slot -- dividing the
label's scaleX(0.86) back out of its column, since fitWidth measures the
untransformed width -- and return the cap to a backstop at 18.

"DIRECT MEE" needs no shrink at all: it ends at x=694 against a tick at
x=715, so the truncation was never about room. Measured: the packaged
defaults still render at their authored 44px and 50px, and all three values
clear the tick.

* fix(chatgpt-exchange): nest the caret scroll so its rebuild can be undone

`tl.to()` returns the TIMELINE, not the tween it created, so `caretScrollTweens`
held 49 references to the master timeline. The fonts-ready rebuild then called
`.kill()` on the master timeline 49 times and re-added its keyframes on top of
the ones it meant to replace. Measured with an overflowing prompt:

  master timeline detached from the global timeline (tl.parent -> null)
  scroll tweens on #cge-typed: 49 before the rebuild, 98 after
  49 timestamps left with two competing tweens on the same property

GSAP's `Animation.kill()` interrupts and detaches rather than killing children,
so the composition kept rendering under an explicit seek -- which is why the
packaged-defaults SSIM check passed and never saw this. It is still wrong: the
timeline is off the ticker, and the stale keyframes were measured against the
fallback font.

Only an overflowing prompt reaches it, i.e. exactly the remix the scroll exists
for. The packaged prompt emits no steps, so nothing is created and nothing is
killed.

Now one nested child timeline holds the steps: a real object that can be killed
and replaced, and killing it cannot reach `tl`. Children sit at the same absolute
times and the nest is added at 0, so the motion is unchanged.

Verified: overflowing prompt holds at 49 scroll tweens across the rebuild with no
duplicated timestamps and the timeline stays attached. Packaged defaults against
the pre-feature baseline -- SSIM 0.999998 over 894 frames, 13 frames below
0.9999 against a 249-frame noise floor for this template, duration 14.9s
unchanged.

Found by Magi in review of #3562.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat(lint): catch a timeline's return value being treated as a tween

Magi asked for a regression that makes the caret-scroll failure unable to return.
A render fixture cannot be that guard, and neither can a unit test. Both were
measured before choosing this:

- The unit-test DOM has no layout. In happy-dom `getBoundingClientRect()` is
  {left: 0, width: 0} and offsetWidth/offsetLeft are 0, so the template's own
  guard computes limit = -8 and returns before collecting a single keyframe,
  whatever the prompt length. `document.fonts` does not exist there either, so
  the rebuild never runs. Both preconditions are unreachable -- the test would
  pass on the broken code and the fixed code alike. Rames flagged this; verified.
- A render fixture would not fail either. Rendering the long prompt through the
  real pipeline on the broken vs fixed template gives SSIM 0.999994 over 894
  frames with ZERO frames below 0.999. The renderer drives the composition by
  explicit seek, and the duplicated keyframes are added last so they win, which
  is exactly why `.kill()` on the master timeline stayed invisible. A golden mp4
  would have cost a fixture and a shard and guarded nothing.

What is testable is the root cause, and it is a static property: `tl.to()` returns
the TIMELINE, `gsap.to()` returns a Tween, and the two read identically. So the
guard is a lint rule, which needs no DOM, fires on the source, and covers every
composition in the registry rather than this one template.

The rule keys on the timeline handles `collectTimelineVarNames` already finds,
which is what keeps `gsap.to()` and `Array.from()` out of it. Pushing a timeline
return into an array is flagged outright -- that is the collect-to-discard shape.
A bound return is flagged only once something tween-scoped is aimed at it, so a
pointless-but-harmless capture stays quiet.

Verified against the real files, not just synthetic ones: the pre-fix
chatgpt-exchange raises exactly one error and names the offending line; the fixed
file is clean. Across all 642 HTML files under registry/ and examples/ the rule
finds nothing, and lint output on the eight promoted blocks is identical to
origin/main error-for-error and warning-for-warning, so error severity costs no
existing template. 540 lint tests pass, 6 of them new.

Requested by Magi in review of #3562; unit-test DOM measurement by Rames Jusso.
2026-09-01 23:41:11 +08:00

880 lines
32 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Share-Sheet Carousel"
description: "A share sheet springs up from the bottom of the phone and cycles previews inside its card on a fast cut rhythm while the blurred ground swaps behind it, ending on an accept tap"
---
import { InstallCommand } from "/snippets/install-command.jsx";
import { VariablesExplorer } from "/snippets/variables-explorer.jsx";
<VariablesExplorer
previewSrc="/public/catalog/blocks/share-sheet-carousel.json"
compositionId="share-sheet-carousel"
compositionSrc="compositions/share-sheet-carousel.html"
variables={[{"id":"shareTitle","type":"string","role":"content","label":"Sheet title","description":"Heading at the top of the share sheet.","default":"Share"},{"id":"senderName","type":"string","role":"content","label":"Sender","description":"Name of the brand this video promotes, shown as the sender offering the item. Use the real name of that brand.","portrays":["subject_name"],"default":"HyperFrames"},{"id":"itemLabel","type":"string","role":"content","label":"Item","description":"What the sender is offering, completing the sentence \"… would like to share …\".","default":"a video"},{"id":"stripText","type":"string","role":"content","label":"Brand strip","description":"Positioning line of the brand this video promotes, in small caps beside its logo.","portrays":["subject_tagline"],"default":"OPEN-SOURCE VIDEO ENGINE · SHIP FROM HTML"},{"id":"acceptLabel","type":"string","role":"content","label":"Accept label","description":"Right-hand action button.","default":"Accept"},{"id":"declineLabel","type":"string","role":"content","label":"Decline label","description":"Left-hand action button.","default":"Decline"},{"id":"slideImage1","type":"image","role":"content","label":"Slide image 1","description":"First carousel image; also fills the blurred background.","default":"assets/slide-01.jpg"},{"id":"slideImage2","type":"image","role":"content","label":"Slide image 2","description":"Second carousel image; also fills the blurred background.","default":"assets/slide-02.jpg"},{"id":"slideImage3","type":"image","role":"content","label":"Slide image 3","description":"Third carousel image; also fills the blurred background.","default":"assets/slide-03.jpg"},{"id":"slideImage4","type":"image","role":"content","label":"Slide image 4","description":"Fourth carousel image; also fills the blurred background.","default":"assets/slide-04.jpg"},{"id":"brandLogo","type":"image","role":"content","label":"Brand logo","description":"Transparent horizontal wordmark of the brand this video promotes, in the preview strip.","portrays":["subject_logo"],"default":"assets/hyperframes-logo-black.svg"}]}
>
```html share-sheet-carousel.html
<!doctype html>
<html
lang="en"
data-composition-variables='[
{ "id": "shareTitle", "type": "string", "role": "content", "label": "Sheet title", "description": "Heading at the top of the share sheet.", "default": "Share" },
{ "id": "senderName", "type": "string", "role": "content", "label": "Sender", "description": "Name of the brand this video promotes, shown as the sender offering the item. Use the real name of that brand.", "portrays": ["subject_name"], "default": "HyperFrames" },
{ "id": "itemLabel", "type": "string", "role": "content", "label": "Item", "description": "What the sender is offering, completing the sentence \"… would like to share …\".", "default": "a video" },
{ "id": "stripText", "type": "string", "role": "content", "label": "Brand strip", "description": "Positioning line of the brand this video promotes, in small caps beside its logo.", "portrays": ["subject_tagline"], "default": "OPEN-SOURCE VIDEO ENGINE · SHIP FROM HTML" },
{ "id": "acceptLabel", "type": "string", "role": "content", "label": "Accept label", "description": "Right-hand action button.", "default": "Accept" },
{ "id": "declineLabel", "type": "string", "role": "content", "label": "Decline label", "description": "Left-hand action button.", "default": "Decline" },
{ "id": "slideImage1", "type": "image", "role": "content", "label": "Slide image 1", "description": "First carousel image; also fills the blurred background.", "default": "assets/slide-01.jpg" },
{ "id": "slideImage2", "type": "image", "role": "content", "label": "Slide image 2", "description": "Second carousel image; also fills the blurred background.", "default": "assets/slide-02.jpg" },
{ "id": "slideImage3", "type": "image", "role": "content", "label": "Slide image 3", "description": "Third carousel image; also fills the blurred background.", "default": "assets/slide-03.jpg" },
{ "id": "slideImage4", "type": "image", "role": "content", "label": "Slide image 4", "description": "Fourth carousel image; also fills the blurred background.", "default": "assets/slide-04.jpg" },
{ "id": "brandLogo", "type": "image", "role": "content", "label": "Brand logo", "description": "Transparent horizontal wordmark of the brand this video promotes, in the preview strip.", "portrays": ["subject_logo"], "default": "assets/hyperframes-logo-black.svg" }
]'
>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=1080, height=1920" />
<title>Share-Sheet Carousel</title>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #000;
}
#ssc-root {
position: relative;
width: 1080px;
height: 1920px;
overflow: hidden;
background: #000;
font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}
#ssc-scene {
position: absolute;
inset: 0;
}
/* ---------------- fullscreen grounds ---------------- */
/* the ground behind the sheet is the current slide blown up and blurred,
exactly as the source footage was */
.ssc-bg {
position: absolute;
left: -80px;
top: -80px;
width: 1240px;
height: 2080px;
object-fit: cover;
filter: blur(46px) saturate(1.1) brightness(0.88);
}
/* ---------------- the share sheet ---------------- */
/* geometry measured from the reference: 668x974 card at (206,473),
spring entry sampled frame-by-frame (spec provenance: measured) */
#ssc-card {
position: absolute;
left: 206px;
top: 473px;
width: 668px;
height: 974px;
background: #f9f9f9;
border-radius: 34px;
box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
opacity: 0;
}
#ssc-cardclipper {
position: absolute;
inset: 0;
border-radius: 34px;
overflow: hidden;
}
#ssc-title {
position: absolute;
top: 49px;
left: 0;
width: 100%;
text-align: center;
font-size: 44px;
font-weight: 600;
color: #101010;
line-height: 44px;
letter-spacing: 0.2px;
}
#ssc-subtitle {
position: absolute;
top: 117px;
left: 0;
width: 100%;
text-align: center;
font-size: 29px;
font-weight: 400;
color: #313131;
line-height: 29px;
}
#ssc-subtitle b {
font-weight: 700;
}
#ssc-imagebox {
position: absolute;
left: 43px;
top: 191px;
width: 582px;
height: 632px;
border-radius: 24px;
overflow: hidden;
}
.ssc-slide {
position: absolute;
left: 0;
top: 0;
width: 582px;
height: 476px;
object-fit: cover;
}
/* the brand strip riding the bottom of the preview, as the reference had */
#ssc-strip {
position: absolute;
left: 0;
top: 476px;
width: 582px;
height: 156px;
background: #f2ecdf;
display: grid;
place-items: center;
align-content: center;
gap: 14px;
}
#ssc-strip img {
height: 38px;
display: block;
}
#ssc-strip-text {
font-size: 17px;
font-weight: 600;
letter-spacing: 2.4px;
color: #4a4438;
text-transform: uppercase;
}
#ssc-hdivider {
position: absolute;
left: 0;
top: 859px;
width: 100%;
height: 1.5px;
background: #dfdfdf;
}
#ssc-vdivider {
position: absolute;
left: 333px;
top: 861px;
width: 1.5px;
bottom: 0;
background: #dfdfdf;
}
#ssc-presscell {
position: absolute;
left: 335px;
top: 861px;
right: 0;
bottom: 0;
background: #e9e9e9;
border-radius: 0 0 34px 0;
opacity: 0;
}
.ssc-btn {
position: absolute;
top: 861px;
bottom: 0;
display: grid;
place-items: center;
font-size: 34px;
}
#ssc-decline {
left: 0;
width: 333px;
color: #6f6f73;
font-weight: 400;
}
#ssc-accept {
left: 335px;
right: 0;
color: var(--hf-ui-accent, #087a57);
font-weight: 600;
}
</style>
</head>
<body>
<div
id="ssc-root"
data-composition-id="share-sheet-carousel"
data-start="0"
data-width="1080"
data-height="1920"
data-duration="7.2333"
data-fps="30"
>
<section
id="ssc-scene"
class="clip"
data-start="0"
data-duration="7.2333"
data-track-index="1"
>
<img
class="ssc-bg"
id="ssc-bg-1"
data-var-src="slideImage1"
src="assets/slide-01.jpg"
alt=""
style="opacity: 1"
/>
<img
class="ssc-bg"
id="ssc-bg-2"
data-var-src="slideImage2"
src="assets/slide-02.jpg"
alt=""
style="opacity: 0"
/>
<img
class="ssc-bg"
id="ssc-bg-3"
data-var-src="slideImage3"
src="assets/slide-03.jpg"
alt=""
style="opacity: 0"
/>
<img
class="ssc-bg"
id="ssc-bg-4"
data-var-src="slideImage4"
src="assets/slide-04.jpg"
alt=""
style="opacity: 0"
/>
<div id="ssc-card">
<div id="ssc-cardclipper">
<div id="ssc-title">Share</div>
<div id="ssc-subtitle"><b>HyperFrames</b>&nbsp;would like to share a video</div>
<div id="ssc-imagebox">
<img
class="ssc-slide"
id="ssc-slide-1"
data-var-src="slideImage1"
src="assets/slide-01.jpg"
alt=""
style="opacity: 1"
/>
<img
class="ssc-slide"
id="ssc-slide-2"
data-var-src="slideImage2"
src="assets/slide-02.jpg"
alt=""
style="opacity: 0"
/>
<img
class="ssc-slide"
id="ssc-slide-3"
data-var-src="slideImage3"
src="assets/slide-03.jpg"
alt=""
style="opacity: 0"
/>
<img
class="ssc-slide"
id="ssc-slide-4"
data-var-src="slideImage4"
src="assets/slide-04.jpg"
alt=""
style="opacity: 0"
/>
<div id="ssc-strip">
<img
data-var-src="brandLogo"
src="assets/hyperframes-logo-black.svg"
alt="Brand logo"
/>
<div id="ssc-strip-text">OPEN-SOURCE VIDEO ENGINE · SHIP FROM HTML</div>
</div>
</div>
<div id="ssc-hdivider"></div>
<div id="ssc-presscell"></div>
<div id="ssc-vdivider"></div>
<div id="ssc-decline" class="ssc-btn">Decline</div>
<div id="ssc-accept" class="ssc-btn">Accept</div>
</div>
</div>
</section>
</div>
<script>
(function () {
"use strict";
/* -------- variables -------- */
var vars =
window.__hyperframes && typeof window.__hyperframes.getVariables === "function"
? window.__hyperframes.getVariables()
: {};
function text(value, fallback) {
if (typeof value !== "string") return fallback;
var t = value.trim();
if (!t) return fallback;
return t.length > 60 ? t.slice(0, 60) : t;
}
document.getElementById("ssc-title").textContent = text(vars.shareTitle, "Share");
var subtitle = document.getElementById("ssc-subtitle");
subtitle.innerHTML = "";
var sender = document.createElement("b");
sender.textContent = text(vars.senderName, "HyperFrames");
subtitle.appendChild(sender);
subtitle.appendChild(
document.createTextNode(" would like to share " + text(vars.itemLabel, "a video")),
);
document.getElementById("ssc-strip-text").textContent = text(
vars.stripText,
"OPEN-SOURCE VIDEO ENGINE · SHIP FROM HTML",
);
document.getElementById("ssc-decline").textContent = text(vars.declineLabel, "Decline");
document.getElementById("ssc-accept").textContent = text(vars.acceptLabel, "Accept");
/* -------- timeline: spring entry and cut rhythm measured from the reference -------- */
window.__timelines = window.__timelines || {};
var tl = gsap.timeline({ paused: true });
tl.set("#ssc-card", { y: 1450, autoAlpha: 0 }, 0.001);
tl.set("#ssc-presscell", { autoAlpha: 0 }, 0.001);
/* sheet spring-up: frame-sampled from the reference, kept verbatim */
var SPRING = [
[0.056667, 1198, 0.13],
[0.09, 903, 0.21],
[0.123333, 648, 0.36],
[0.156667, 437, 0.43],
[0.19, 262, 0.5],
[0.223333, 120, 0.62],
[0.256667, 8, 0.78],
[0.29, -76, 0.89],
[0.323333, -138, 1.0],
[0.356667, -175, null],
[0.39, -191, null],
[0.423333, -192, null],
[0.456667, -181, null],
[0.49, -159, null],
[0.523333, -131, null],
[0.556667, -100, null],
[0.59, -68, null],
[0.623333, -41, null],
[0.656667, -18, null],
[0.69, -5, null],
[0.723333, 0, null],
];
SPRING.forEach(function (step) {
var props = { y: step[1] };
if (step[2] !== null) props.autoAlpha = step[2];
tl.set("#ssc-card", props, step[0]);
});
/* cut rhythm: fourteen swaps, cycling the four stills */
var SLIDE_COUNT = 4;
var CUTS = [
0.99, 1.356667, 1.69, 2.023333, 2.356667, 2.69, 3.09, 3.456667, 3.79, 4.123333, 4.456667,
4.79, 5.156667,
];
var current = 0;
CUTS.forEach(function (t, i) {
var next = (i + 1) % SLIDE_COUNT;
tl.set(["#ssc-bg-" + (current + 1), "#ssc-slide-" + (current + 1)], { autoAlpha: 0 }, t);
tl.set(["#ssc-bg-" + (next + 1), "#ssc-slide-" + (next + 1)], { autoAlpha: 1 }, t);
current = next;
});
/* accept press: cell highlights and the card dips, then releases */
tl.set("#ssc-card", { y: 3 }, 6.323333);
tl.set("#ssc-presscell", { autoAlpha: 1 }, 6.323333);
tl.set("#ssc-card", { y: 0 }, 6.656667);
tl.set("#ssc-presscell", { autoAlpha: 0 }, 6.656667);
tl.set({}, {}, 7.2333);
window.__timelines["share-sheet-carousel"] = tl;
})();
</script>
</body>
</html>
```
</VariablesExplorer>
## Install
<InstallCommand command="npx hyperframes add share-sheet-carousel" item="share-sheet-carousel" />
That writes `compositions/share-sheet-carousel.html`, plus 6 supporting files under `assets/`.
## Add it to your video
It runs for 7.2333 seconds at 1080×1920. Paste this into your composition:
```html index.html
<div
data-composition-id="share-sheet-carousel"
data-composition-src="compositions/share-sheet-carousel.html"
data-start="0"
data-duration="7.2333"
data-track-index="1"
data-width="1080"
data-height="1920"
></div>
```
Move it in time with `data-start`. Put it on a different timeline row with
`data-track-index`. See [data attributes](/concepts/data-attributes) for the rest.
## 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 |
| --- | --- | --- | --- |
| `shareTitle` | `Share` | string | Heading at the top of the share sheet. |
| `senderName` | `HyperFrames` | string | Name of the brand this video promotes, shown as the sender offering the item. Use the real name of that brand. |
| `itemLabel` | `a video` | string | What the sender is offering, completing the sentence "… would like to share …". |
| `stripText` | `OPEN-SOURCE VIDEO ENGINE · SHIP FROM HTML` | string | Positioning line of the brand this video promotes, in small caps beside its logo. |
| `acceptLabel` | `Accept` | string | Right-hand action button. |
| `declineLabel` | `Decline` | string | Left-hand action button. |
| `slideImage1` | `assets/slide-01.jpg` | image | First carousel image; also fills the blurred background. |
| `slideImage2` | `assets/slide-02.jpg` | image | Second carousel image; also fills the blurred background. |
| `slideImage3` | `assets/slide-03.jpg` | image | Third carousel image; also fills the blurred background. |
| `slideImage4` | `assets/slide-04.jpg` | image | Fourth carousel image; also fills the blurred background. |
| `brandLogo` | `assets/hyperframes-logo-black.svg` | image | Transparent horizontal wordmark of the brand this video promotes, in the preview strip. |
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="share-sheet-carousel"
data-composition-src="compositions/share-sheet-carousel.html"
data-variable-values='{"shareTitle":"Share","senderName":"HyperFrames","itemLabel":"a video","stripText":"OPEN-SOURCE VIDEO ENGINE · SHIP FROM HTML","acceptLabel":"Accept","declineLabel":"Decline","slideImage1":"assets/slide-01.jpg","slideImage2":"assets/slide-02.jpg","slideImage3":"assets/slide-03.jpg","slideImage4":"assets/slide-04.jpg","brandLogo":"assets/hyperframes-logo-black.svg"}'
></div>
```
## Source
<Accordion title={`share-sheet-carousel.html`}>
```html
<!doctype html>
<html
lang="en"
data-composition-variables='[
{ "id": "shareTitle", "type": "string", "role": "content", "label": "Sheet title", "description": "Heading at the top of the share sheet.", "default": "Share" },
{ "id": "senderName", "type": "string", "role": "content", "label": "Sender", "description": "Name of the brand this video promotes, shown as the sender offering the item. Use the real name of that brand.", "portrays": ["subject_name"], "default": "HyperFrames" },
{ "id": "itemLabel", "type": "string", "role": "content", "label": "Item", "description": "What the sender is offering, completing the sentence \"… would like to share …\".", "default": "a video" },
{ "id": "stripText", "type": "string", "role": "content", "label": "Brand strip", "description": "Positioning line of the brand this video promotes, in small caps beside its logo.", "portrays": ["subject_tagline"], "default": "OPEN-SOURCE VIDEO ENGINE · SHIP FROM HTML" },
{ "id": "acceptLabel", "type": "string", "role": "content", "label": "Accept label", "description": "Right-hand action button.", "default": "Accept" },
{ "id": "declineLabel", "type": "string", "role": "content", "label": "Decline label", "description": "Left-hand action button.", "default": "Decline" },
{ "id": "slideImage1", "type": "image", "role": "content", "label": "Slide image 1", "description": "First carousel image; also fills the blurred background.", "default": "assets/slide-01.jpg" },
{ "id": "slideImage2", "type": "image", "role": "content", "label": "Slide image 2", "description": "Second carousel image; also fills the blurred background.", "default": "assets/slide-02.jpg" },
{ "id": "slideImage3", "type": "image", "role": "content", "label": "Slide image 3", "description": "Third carousel image; also fills the blurred background.", "default": "assets/slide-03.jpg" },
{ "id": "slideImage4", "type": "image", "role": "content", "label": "Slide image 4", "description": "Fourth carousel image; also fills the blurred background.", "default": "assets/slide-04.jpg" },
{ "id": "brandLogo", "type": "image", "role": "content", "label": "Brand logo", "description": "Transparent horizontal wordmark of the brand this video promotes, in the preview strip.", "portrays": ["subject_logo"], "default": "assets/hyperframes-logo-black.svg" }
]'
>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=1080, height=1920" />
<title>Share-Sheet Carousel</title>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #000;
}
#ssc-root {
position: relative;
width: 1080px;
height: 1920px;
overflow: hidden;
background: #000;
font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}
#ssc-scene {
position: absolute;
inset: 0;
}
/* ---------------- fullscreen grounds ---------------- */
/* the ground behind the sheet is the current slide blown up and blurred,
exactly as the source footage was */
.ssc-bg {
position: absolute;
left: -80px;
top: -80px;
width: 1240px;
height: 2080px;
object-fit: cover;
filter: blur(46px) saturate(1.1) brightness(0.88);
}
/* ---------------- the share sheet ---------------- */
/* geometry measured from the reference: 668x974 card at (206,473),
spring entry sampled frame-by-frame (spec provenance: measured) */
#ssc-card {
position: absolute;
left: 206px;
top: 473px;
width: 668px;
height: 974px;
background: #f9f9f9;
border-radius: 34px;
box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
opacity: 0;
}
#ssc-cardclipper {
position: absolute;
inset: 0;
border-radius: 34px;
overflow: hidden;
}
#ssc-title {
position: absolute;
top: 49px;
left: 0;
width: 100%;
text-align: center;
font-size: 44px;
font-weight: 600;
color: #101010;
line-height: 44px;
letter-spacing: 0.2px;
}
#ssc-subtitle {
position: absolute;
top: 117px;
left: 0;
width: 100%;
text-align: center;
font-size: 29px;
font-weight: 400;
color: #313131;
line-height: 29px;
}
#ssc-subtitle b {
font-weight: 700;
}
#ssc-imagebox {
position: absolute;
left: 43px;
top: 191px;
width: 582px;
height: 632px;
border-radius: 24px;
overflow: hidden;
}
.ssc-slide {
position: absolute;
left: 0;
top: 0;
width: 582px;
height: 476px;
object-fit: cover;
}
/* the brand strip riding the bottom of the preview, as the reference had */
#ssc-strip {
position: absolute;
left: 0;
top: 476px;
width: 582px;
height: 156px;
background: #f2ecdf;
display: grid;
place-items: center;
align-content: center;
gap: 14px;
}
#ssc-strip img {
height: 38px;
display: block;
}
#ssc-strip-text {
font-size: 17px;
font-weight: 600;
letter-spacing: 2.4px;
color: #4a4438;
text-transform: uppercase;
}
#ssc-hdivider {
position: absolute;
left: 0;
top: 859px;
width: 100%;
height: 1.5px;
background: #dfdfdf;
}
#ssc-vdivider {
position: absolute;
left: 333px;
top: 861px;
width: 1.5px;
bottom: 0;
background: #dfdfdf;
}
#ssc-presscell {
position: absolute;
left: 335px;
top: 861px;
right: 0;
bottom: 0;
background: #e9e9e9;
border-radius: 0 0 34px 0;
opacity: 0;
}
.ssc-btn {
position: absolute;
top: 861px;
bottom: 0;
display: grid;
place-items: center;
font-size: 34px;
}
#ssc-decline {
left: 0;
width: 333px;
color: #6f6f73;
font-weight: 400;
}
#ssc-accept {
left: 335px;
right: 0;
color: var(--hf-ui-accent, #087a57);
font-weight: 600;
}
</style>
</head>
<body>
<div
id="ssc-root"
data-composition-id="share-sheet-carousel"
data-start="0"
data-width="1080"
data-height="1920"
data-duration="7.2333"
data-fps="30"
>
<section
id="ssc-scene"
class="clip"
data-start="0"
data-duration="7.2333"
data-track-index="1"
>
<img
class="ssc-bg"
id="ssc-bg-1"
data-var-src="slideImage1"
src="assets/slide-01.jpg"
alt=""
style="opacity: 1"
/>
<img
class="ssc-bg"
id="ssc-bg-2"
data-var-src="slideImage2"
src="assets/slide-02.jpg"
alt=""
style="opacity: 0"
/>
<img
class="ssc-bg"
id="ssc-bg-3"
data-var-src="slideImage3"
src="assets/slide-03.jpg"
alt=""
style="opacity: 0"
/>
<img
class="ssc-bg"
id="ssc-bg-4"
data-var-src="slideImage4"
src="assets/slide-04.jpg"
alt=""
style="opacity: 0"
/>
<div id="ssc-card">
<div id="ssc-cardclipper">
<div id="ssc-title">Share</div>
<div id="ssc-subtitle"><b>HyperFrames</b>&nbsp;would like to share a video</div>
<div id="ssc-imagebox">
<img
class="ssc-slide"
id="ssc-slide-1"
data-var-src="slideImage1"
src="assets/slide-01.jpg"
alt=""
style="opacity: 1"
/>
<img
class="ssc-slide"
id="ssc-slide-2"
data-var-src="slideImage2"
src="assets/slide-02.jpg"
alt=""
style="opacity: 0"
/>
<img
class="ssc-slide"
id="ssc-slide-3"
data-var-src="slideImage3"
src="assets/slide-03.jpg"
alt=""
style="opacity: 0"
/>
<img
class="ssc-slide"
id="ssc-slide-4"
data-var-src="slideImage4"
src="assets/slide-04.jpg"
alt=""
style="opacity: 0"
/>
<div id="ssc-strip">
<img
data-var-src="brandLogo"
src="assets/hyperframes-logo-black.svg"
alt="Brand logo"
/>
<div id="ssc-strip-text">OPEN-SOURCE VIDEO ENGINE · SHIP FROM HTML</div>
</div>
</div>
<div id="ssc-hdivider"></div>
<div id="ssc-presscell"></div>
<div id="ssc-vdivider"></div>
<div id="ssc-decline" class="ssc-btn">Decline</div>
<div id="ssc-accept" class="ssc-btn">Accept</div>
</div>
</div>
</section>
</div>
<script>
(function () {
"use strict";
/* -------- variables -------- */
var vars =
window.__hyperframes && typeof window.__hyperframes.getVariables === "function"
? window.__hyperframes.getVariables()
: {};
function text(value, fallback) {
if (typeof value !== "string") return fallback;
var t = value.trim();
if (!t) return fallback;
return t.length > 60 ? t.slice(0, 60) : t;
}
document.getElementById("ssc-title").textContent = text(vars.shareTitle, "Share");
var subtitle = document.getElementById("ssc-subtitle");
subtitle.innerHTML = "";
var sender = document.createElement("b");
sender.textContent = text(vars.senderName, "HyperFrames");
subtitle.appendChild(sender);
subtitle.appendChild(
document.createTextNode(" would like to share " + text(vars.itemLabel, "a video")),
);
document.getElementById("ssc-strip-text").textContent = text(
vars.stripText,
"OPEN-SOURCE VIDEO ENGINE · SHIP FROM HTML",
);
document.getElementById("ssc-decline").textContent = text(vars.declineLabel, "Decline");
document.getElementById("ssc-accept").textContent = text(vars.acceptLabel, "Accept");
/* -------- timeline: spring entry and cut rhythm measured from the reference -------- */
window.__timelines = window.__timelines || {};
var tl = gsap.timeline({ paused: true });
tl.set("#ssc-card", { y: 1450, autoAlpha: 0 }, 0.001);
tl.set("#ssc-presscell", { autoAlpha: 0 }, 0.001);
/* sheet spring-up: frame-sampled from the reference, kept verbatim */
var SPRING = [
[0.056667, 1198, 0.13],
[0.09, 903, 0.21],
[0.123333, 648, 0.36],
[0.156667, 437, 0.43],
[0.19, 262, 0.5],
[0.223333, 120, 0.62],
[0.256667, 8, 0.78],
[0.29, -76, 0.89],
[0.323333, -138, 1.0],
[0.356667, -175, null],
[0.39, -191, null],
[0.423333, -192, null],
[0.456667, -181, null],
[0.49, -159, null],
[0.523333, -131, null],
[0.556667, -100, null],
[0.59, -68, null],
[0.623333, -41, null],
[0.656667, -18, null],
[0.69, -5, null],
[0.723333, 0, null],
];
SPRING.forEach(function (step) {
var props = { y: step[1] };
if (step[2] !== null) props.autoAlpha = step[2];
tl.set("#ssc-card", props, step[0]);
});
/* cut rhythm: fourteen swaps, cycling the four stills */
var SLIDE_COUNT = 4;
var CUTS = [
0.99, 1.356667, 1.69, 2.023333, 2.356667, 2.69, 3.09, 3.456667, 3.79, 4.123333, 4.456667,
4.79, 5.156667,
];
var current = 0;
CUTS.forEach(function (t, i) {
var next = (i + 1) % SLIDE_COUNT;
tl.set(["#ssc-bg-" + (current + 1), "#ssc-slide-" + (current + 1)], { autoAlpha: 0 }, t);
tl.set(["#ssc-bg-" + (next + 1), "#ssc-slide-" + (next + 1)], { autoAlpha: 1 }, t);
current = next;
});
/* accept press: cell highlights and the card dips, then releases */
tl.set("#ssc-card", { y: 3 }, 6.323333);
tl.set("#ssc-presscell", { autoAlpha: 1 }, 6.323333);
tl.set("#ssc-card", { y: 0 }, 6.656667);
tl.set("#ssc-presscell", { autoAlpha: 0 }, 6.656667);
tl.set({}, {}, 7.2333);
window.__timelines["share-sheet-carousel"] = tl;
})();
</script>
</body>
</html>
```
</Accordion>
{/* hf:generated-footer */}
Tagged `showcase` `mock-ui` `share-sheet` `vertical` `ad-template`.
Created by Miao Yang.
## Related topics
- [Browse the complete Catalog](/catalog)
- [Add assets and Catalog items in Studio](/studio/assets-and-blocks)
- [Build a richer composition](/go-further)