mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-11 19:09:20 +00:00
The generated catalog pages rendered the "Source" accordion title as a
JSX expression, `<Accordion title={`name.html`}>`. Mintlify's search
indexer stringifies expression attribute nodes rather than evaluating
them, so every one of the 399 catalog pages surfaced its Source section
in search results as "[object Object]" (visible on the Scroll Feed page,
among others).
The template literal carried no escaping benefit: every title is a
single-segment `name.html` path, and a double-quoted JSX string handles
it directly. Introduce `mdxStringAttribute`, which emits a plain
`name="value"` attribute and escapes `& " < { }` as HTML character
references (MDX decodes references inside quoted attribute values, and
unlike JSON.stringify it does not rely on backslash escapes, which JSX
strings do not honour). Use it for both the Source accordion title and
the preview iframe title, and regenerate the catalog pages.
Regenerated with `npx tsx scripts/generate-catalog-pages.ts`; the only
change across the 399 pages is the one Accordion title line each.
Co-authored-by: Miguel Ángel <miguel.sierra@heygen.com>
362 lines
15 KiB
Plaintext
362 lines
15 KiB
Plaintext
---
|
|
title: "Directional Wipe"
|
|
description: "A directional scene push that slides one panel over another."
|
|
---
|
|
|
|
import { InstallCommand } from "/snippets/install-command.jsx";
|
|
import { VariablesExplorer } from "/snippets/variables-explorer.jsx";
|
|
|
|
## Install
|
|
|
|
<InstallCommand command="npx hyperframes add directional-wipe" item="directional-wipe" />
|
|
|
|
That writes one file: `compositions/components/directional-wipe.html`.
|
|
|
|
<VariablesExplorer
|
|
previewSrc="/public/catalog/components/directional-wipe.json"
|
|
compositionId="directional-wipe"
|
|
compositionSrc="compositions/components/directional-wipe.html"
|
|
variables={[{"id":"palette","type":"enum","role":"style","label":"Palette","description":"Theme token for the ring marking the incoming panel. Slate rides --accent, teal --brand, ember --accent-2; each falls back to a neutral hairline.","default":"slate","options":[{"value":"slate","label":"Slate"},{"value":"teal","label":"Teal"},{"value":"ember","label":"Ember"}]},{"id":"corner","type":"enum","role":"style","label":"Corner","description":"Corner radius of the transition card.","default":"rounded","options":[{"value":"square","label":"Square"},{"value":"rounded","label":"Rounded"},{"value":"soft","label":"Soft"}]}]}
|
|
>
|
|
|
|
```html directional-wipe.html
|
|
<!--
|
|
Directional Wipe - catalog component for HyperFrames.
|
|
|
|
Paste the markup and CSS into a composition. Drive the timeline integration
|
|
from a paused GSAP timeline so renders remain deterministic.
|
|
|
|
Variables. The script below reads each one, falls back to the declared
|
|
default on anything missing or unrecognised, and writes the result as a
|
|
custom property the CSS consumes. The timeline recipe at the bottom is
|
|
untouched by them.
|
|
|
|
- palette (slate | teal | ember, default slate): ink of the ring that marks
|
|
the incoming panel. Both panels are monochrome placeholder material; the
|
|
ring is the one accent-coloured element. slate rides --accent, teal rides
|
|
--brand, ember rides --accent-2, and each falls back to a neutral hairline
|
|
so an unthemed composition renders in black and white.
|
|
- corner (square | rounded | soft, default rounded): corner radius of the
|
|
card. square is 0, rounded the original 30px, soft 56px.
|
|
|
|
On every default the motion is unchanged.
|
|
-->
|
|
|
|
<div
|
|
class="hf-catalog-directional-wipe"
|
|
data-composition-variables='[
|
|
{ "id": "palette", "type": "enum", "role": "style", "label": "Palette", "description": "Theme token for the ring marking the incoming panel. Slate rides --accent, teal --brand, ember --accent-2; each falls back to a neutral hairline.", "default": "slate", "options": [{ "value": "slate", "label": "Slate" }, { "value": "teal", "label": "Teal" }, { "value": "ember", "label": "Ember" }] },
|
|
{ "id": "corner", "type": "enum", "role": "style", "label": "Corner", "description": "Corner radius of the transition card.", "default": "rounded", "options": [{ "value": "square", "label": "Square" }, { "value": "rounded", "label": "Rounded" }, { "value": "soft", "label": "Soft" }] }
|
|
]'
|
|
>
|
|
<div class="scene from">Before</div>
|
|
<div class="scene to">Directional Wipe</div>
|
|
<div class="fx"></div>
|
|
<div class="rgb"></div>
|
|
</div>
|
|
|
|
<style>
|
|
.hf-catalog-directional-wipe {
|
|
--hf-accent: var(--accent, rgba(255, 255, 255, 0.28));
|
|
--hf-l1: rgba(255, 255, 255, 0.72);
|
|
--hf-l3: rgba(255, 255, 255, 0.18);
|
|
--hf-l4: rgba(255, 255, 255, 0.08);
|
|
--hf-hair: rgba(255, 255, 255, 0.14);
|
|
--hf-ink: #111827;
|
|
--hf-muted: #6b7280;
|
|
--hf-surface: #ffffff;
|
|
color: var(--hf-ink);
|
|
font-family: Inter, system-ui, sans-serif;
|
|
}
|
|
.hf-catalog-directional-wipe {
|
|
position: relative;
|
|
width: 760px;
|
|
height: 428px;
|
|
overflow: hidden;
|
|
border-radius: var(--hf-corner, 30px);
|
|
background: #111827;
|
|
box-shadow: 0 28px 80px rgba(15, 23, 42, 0.2);
|
|
}
|
|
.hf-catalog-directional-wipe .scene {
|
|
position: absolute;
|
|
inset: 0;
|
|
display: grid;
|
|
place-items: center;
|
|
font-weight: 900;
|
|
font-size: 58px;
|
|
letter-spacing: -0.05em;
|
|
color: #fff;
|
|
}
|
|
.hf-catalog-directional-wipe .from {
|
|
background:
|
|
repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 4px),
|
|
var(--hf-l4);
|
|
transform: translate(var(--hf-from-x, 0px), var(--hf-from-y, 0px))
|
|
scale(var(--hf-from-scale, 1));
|
|
filter: blur(var(--hf-from-blur, 0px));
|
|
}
|
|
.hf-catalog-directional-wipe .to {
|
|
background:
|
|
repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 4px),
|
|
var(--hf-l3);
|
|
box-shadow: inset 0 0 0 2px var(--hf-accent);
|
|
transform: translate(var(--hf-to-x, 0px), var(--hf-to-y, 0px)) scale(var(--hf-to-scale, 1));
|
|
clip-path: inset(
|
|
var(--hf-clip-top, 0%) var(--hf-clip-right, 100%) var(--hf-clip-bottom, 0%)
|
|
var(--hf-clip-left, 0%)
|
|
);
|
|
}
|
|
.hf-catalog-directional-wipe .fx {
|
|
position: absolute;
|
|
inset: 0;
|
|
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
|
|
mix-blend-mode: screen;
|
|
transform: translateX(var(--hf-fx-x, -110%));
|
|
}
|
|
.hf-catalog-directional-wipe .rgb {
|
|
position: absolute;
|
|
inset: 0;
|
|
pointer-events: none;
|
|
opacity: var(--hf-rgb-opacity, 0);
|
|
background: linear-gradient(
|
|
90deg,
|
|
rgba(239, 68, 68, 0.35),
|
|
transparent,
|
|
rgba(34, 211, 238, 0.35)
|
|
);
|
|
transform: translateX(var(--hf-rgb-x, 0px));
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
(function () {
|
|
"use strict";
|
|
|
|
var vars =
|
|
window.__hyperframes && window.__hyperframes.getVariables
|
|
? window.__hyperframes.getVariables()
|
|
: {};
|
|
|
|
// Unrecognised overrides fall back to their declared defaults.
|
|
// Theme tokens only. The neutral fallback keeps an unthemed mount monochrome.
|
|
var HAIRLINE = "rgba(255, 255, 255, 0.28)";
|
|
var palettes = {
|
|
slate: "var(--accent, " + HAIRLINE + ")",
|
|
teal: "var(--brand, " + HAIRLINE + ")",
|
|
ember: "var(--accent-2, " + HAIRLINE + ")",
|
|
};
|
|
var corners = { square: "0px", rounded: "30px", soft: "56px" };
|
|
|
|
function pick(table, value, fallback) {
|
|
return Object.prototype.hasOwnProperty.call(table, value) ? value : fallback;
|
|
}
|
|
|
|
var palette = palettes[pick(palettes, vars.palette, "slate")];
|
|
var corner = corners[pick(corners, vars.corner, "rounded")];
|
|
|
|
var roots = document.querySelectorAll(".hf-catalog-directional-wipe");
|
|
for (var i = 0; i < roots.length; i += 1) {
|
|
roots[i].style.setProperty("--hf-accent", palette);
|
|
roots[i].style.setProperty("--hf-corner", corner);
|
|
}
|
|
})();
|
|
</script>
|
|
|
|
<!--
|
|
Timeline integration:
|
|
tl.fromTo('.hf-catalog-directional-wipe .to', { '--hf-clip-right': '100%', '--hf-to-x': '60px', '--hf-to-scale': 1.04 }, { '--hf-clip-right': '0%', '--hf-to-x': '0px', '--hf-to-scale': 1, duration: 0.9, ease: 'power3.inOut' }, startTime); tl.to('.hf-catalog-directional-wipe .from', { '--hf-from-x': '-70px', '--hf-from-scale': 0.96, '--hf-from-blur': '5px', duration: 0.9, ease: 'power3.inOut' }, startTime); tl.fromTo('.hf-catalog-directional-wipe .fx', { '--hf-fx-x': '-110%' }, { '--hf-fx-x': '110%', duration: 0.58, ease: 'power2.inOut' }, startTime + 0.18); tl.fromTo('.hf-catalog-directional-wipe .rgb', { '--hf-rgb-opacity': 0, '--hf-rgb-x': '-16px' }, { '--hf-rgb-opacity': 1, '--hf-rgb-x': '16px', repeat: 3, yoyo: true, duration: 0.07, ease: 'steps(1)' }, startTime + 0.32);
|
|
-->
|
|
```
|
|
|
|
</VariablesExplorer>
|
|
|
|
## 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 |
|
|
| --- | --- | --- | --- |
|
|
| `palette` | `slate` | `slate`, `teal`, `ember` | Theme token for the ring marking the incoming panel. Slate rides --accent, teal --brand, ember --accent-2; each falls back to a neutral hairline. |
|
|
| `corner` | `rounded` | `square`, `rounded`, `soft` | Corner radius of the transition card. |
|
|
|
|
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="directional-wipe"
|
|
data-composition-src="compositions/components/directional-wipe.html"
|
|
data-variable-values='{"palette":"slate","corner":"rounded"}'
|
|
></div>
|
|
```
|
|
|
|
## Source
|
|
|
|
<Accordion title="directional-wipe.html">
|
|
|
|
```html
|
|
<!--
|
|
Directional Wipe - catalog component for HyperFrames.
|
|
|
|
Paste the markup and CSS into a composition. Drive the timeline integration
|
|
from a paused GSAP timeline so renders remain deterministic.
|
|
|
|
Variables. The script below reads each one, falls back to the declared
|
|
default on anything missing or unrecognised, and writes the result as a
|
|
custom property the CSS consumes. The timeline recipe at the bottom is
|
|
untouched by them.
|
|
|
|
- palette (slate | teal | ember, default slate): ink of the ring that marks
|
|
the incoming panel. Both panels are monochrome placeholder material; the
|
|
ring is the one accent-coloured element. slate rides --accent, teal rides
|
|
--brand, ember rides --accent-2, and each falls back to a neutral hairline
|
|
so an unthemed composition renders in black and white.
|
|
- corner (square | rounded | soft, default rounded): corner radius of the
|
|
card. square is 0, rounded the original 30px, soft 56px.
|
|
|
|
On every default the motion is unchanged.
|
|
-->
|
|
|
|
<div
|
|
class="hf-catalog-directional-wipe"
|
|
data-composition-variables='[
|
|
{ "id": "palette", "type": "enum", "role": "style", "label": "Palette", "description": "Theme token for the ring marking the incoming panel. Slate rides --accent, teal --brand, ember --accent-2; each falls back to a neutral hairline.", "default": "slate", "options": [{ "value": "slate", "label": "Slate" }, { "value": "teal", "label": "Teal" }, { "value": "ember", "label": "Ember" }] },
|
|
{ "id": "corner", "type": "enum", "role": "style", "label": "Corner", "description": "Corner radius of the transition card.", "default": "rounded", "options": [{ "value": "square", "label": "Square" }, { "value": "rounded", "label": "Rounded" }, { "value": "soft", "label": "Soft" }] }
|
|
]'
|
|
>
|
|
<div class="scene from">Before</div>
|
|
<div class="scene to">Directional Wipe</div>
|
|
<div class="fx"></div>
|
|
<div class="rgb"></div>
|
|
</div>
|
|
|
|
<style>
|
|
.hf-catalog-directional-wipe {
|
|
--hf-accent: var(--accent, rgba(255, 255, 255, 0.28));
|
|
--hf-l1: rgba(255, 255, 255, 0.72);
|
|
--hf-l3: rgba(255, 255, 255, 0.18);
|
|
--hf-l4: rgba(255, 255, 255, 0.08);
|
|
--hf-hair: rgba(255, 255, 255, 0.14);
|
|
--hf-ink: #111827;
|
|
--hf-muted: #6b7280;
|
|
--hf-surface: #ffffff;
|
|
color: var(--hf-ink);
|
|
font-family: Inter, system-ui, sans-serif;
|
|
}
|
|
.hf-catalog-directional-wipe {
|
|
position: relative;
|
|
width: 760px;
|
|
height: 428px;
|
|
overflow: hidden;
|
|
border-radius: var(--hf-corner, 30px);
|
|
background: #111827;
|
|
box-shadow: 0 28px 80px rgba(15, 23, 42, 0.2);
|
|
}
|
|
.hf-catalog-directional-wipe .scene {
|
|
position: absolute;
|
|
inset: 0;
|
|
display: grid;
|
|
place-items: center;
|
|
font-weight: 900;
|
|
font-size: 58px;
|
|
letter-spacing: -0.05em;
|
|
color: #fff;
|
|
}
|
|
.hf-catalog-directional-wipe .from {
|
|
background:
|
|
repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 4px),
|
|
var(--hf-l4);
|
|
transform: translate(var(--hf-from-x, 0px), var(--hf-from-y, 0px))
|
|
scale(var(--hf-from-scale, 1));
|
|
filter: blur(var(--hf-from-blur, 0px));
|
|
}
|
|
.hf-catalog-directional-wipe .to {
|
|
background:
|
|
repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 4px),
|
|
var(--hf-l3);
|
|
box-shadow: inset 0 0 0 2px var(--hf-accent);
|
|
transform: translate(var(--hf-to-x, 0px), var(--hf-to-y, 0px)) scale(var(--hf-to-scale, 1));
|
|
clip-path: inset(
|
|
var(--hf-clip-top, 0%) var(--hf-clip-right, 100%) var(--hf-clip-bottom, 0%)
|
|
var(--hf-clip-left, 0%)
|
|
);
|
|
}
|
|
.hf-catalog-directional-wipe .fx {
|
|
position: absolute;
|
|
inset: 0;
|
|
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
|
|
mix-blend-mode: screen;
|
|
transform: translateX(var(--hf-fx-x, -110%));
|
|
}
|
|
.hf-catalog-directional-wipe .rgb {
|
|
position: absolute;
|
|
inset: 0;
|
|
pointer-events: none;
|
|
opacity: var(--hf-rgb-opacity, 0);
|
|
background: linear-gradient(
|
|
90deg,
|
|
rgba(239, 68, 68, 0.35),
|
|
transparent,
|
|
rgba(34, 211, 238, 0.35)
|
|
);
|
|
transform: translateX(var(--hf-rgb-x, 0px));
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
(function () {
|
|
"use strict";
|
|
|
|
var vars =
|
|
window.__hyperframes && window.__hyperframes.getVariables
|
|
? window.__hyperframes.getVariables()
|
|
: {};
|
|
|
|
// Unrecognised overrides fall back to their declared defaults.
|
|
// Theme tokens only. The neutral fallback keeps an unthemed mount monochrome.
|
|
var HAIRLINE = "rgba(255, 255, 255, 0.28)";
|
|
var palettes = {
|
|
slate: "var(--accent, " + HAIRLINE + ")",
|
|
teal: "var(--brand, " + HAIRLINE + ")",
|
|
ember: "var(--accent-2, " + HAIRLINE + ")",
|
|
};
|
|
var corners = { square: "0px", rounded: "30px", soft: "56px" };
|
|
|
|
function pick(table, value, fallback) {
|
|
return Object.prototype.hasOwnProperty.call(table, value) ? value : fallback;
|
|
}
|
|
|
|
var palette = palettes[pick(palettes, vars.palette, "slate")];
|
|
var corner = corners[pick(corners, vars.corner, "rounded")];
|
|
|
|
var roots = document.querySelectorAll(".hf-catalog-directional-wipe");
|
|
for (var i = 0; i < roots.length; i += 1) {
|
|
roots[i].style.setProperty("--hf-accent", palette);
|
|
roots[i].style.setProperty("--hf-corner", corner);
|
|
}
|
|
})();
|
|
</script>
|
|
|
|
<!--
|
|
Timeline integration:
|
|
tl.fromTo('.hf-catalog-directional-wipe .to', { '--hf-clip-right': '100%', '--hf-to-x': '60px', '--hf-to-scale': 1.04 }, { '--hf-clip-right': '0%', '--hf-to-x': '0px', '--hf-to-scale': 1, duration: 0.9, ease: 'power3.inOut' }, startTime); tl.to('.hf-catalog-directional-wipe .from', { '--hf-from-x': '-70px', '--hf-from-scale': 0.96, '--hf-from-blur': '5px', duration: 0.9, ease: 'power3.inOut' }, startTime); tl.fromTo('.hf-catalog-directional-wipe .fx', { '--hf-fx-x': '-110%' }, { '--hf-fx-x': '110%', duration: 0.58, ease: 'power2.inOut' }, startTime + 0.18); tl.fromTo('.hf-catalog-directional-wipe .rgb', { '--hf-rgb-opacity': 0, '--hf-rgb-x': '-16px' }, { '--hf-rgb-opacity': 1, '--hf-rgb-x': '16px', repeat: 3, yoyo: true, duration: 0.07, ease: 'steps(1)' }, startTime + 0.32);
|
|
-->
|
|
```
|
|
|
|
</Accordion>
|
|
|
|
## Usage
|
|
|
|
Open `compositions/components/directional-wipe.html` and paste its contents into your composition. See the comment header in the file for timeline integration guidance.
|
|
|
|
{/* hf:generated-footer */}
|
|
|
|
Tagged `transition-primitive`.
|
|
|
|
## Related topics
|
|
|
|
- [Browse the complete Catalog](/catalog)
|
|
- [Add assets and Catalog items in Studio](/studio/assets-and-blocks)
|
|
- [Build a richer composition](/go-further)
|