mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 16:08:56 +00:00
* docs(catalog): put each item page's title, description and Docs text in the server HTML Mintlify renders snippet components in the browser only, so everything inside CatalogDetail (title, standfirst, the Docs tab) was missing from the HTML search engines read: 448 catalog pages served Googlebot no body text. The generator now writes the H1 and standfirst as page markup above the component and the Docs tab as page markup after it, shown with that tab (docs/custom.css). The component no longer draws its own title. Pages patched structurally only; registry drift on 14 pages is left for a regeneration of its own. * docs(catalog): keep the title's top spacing the component gave it * fix(docs): catalog titles and descriptions keep markdown markers literal MDX reads text inside the static <h1> and <p> as inline markdown, so @_blue_sweater_ rendered as italic blue_sweater. mdxText now writes backslash, backtick, * _ [ ] ~ as character references too, with a unit test; the four affected pages are re-escaped.
244 lines
10 KiB
Plaintext
244 lines
10 KiB
Plaintext
---
|
|
title: "Tilt Card"
|
|
description: "A transitions.dev-inspired tilt card primitive with depth layers and hover-style parallax"
|
|
mode: "frame"
|
|
---
|
|
|
|
import { CatalogDetail, CatalogSlot } from "/snippets/catalog-detail.jsx";
|
|
import { InstallCommand } from "/snippets/install-command.jsx";
|
|
|
|
<div className="hf-ve-static-head not-prose">
|
|
<h1>Tilt Card</h1>
|
|
<p>A transitions.dev-inspired tilt card primitive with depth layers and hover-style parallax</p>
|
|
</div>
|
|
|
|
<CatalogDetail
|
|
previewSrc="/public/catalog/components/tilt-card.json"
|
|
compositionId="tilt-card"
|
|
compositionSrc="compositions/components/tilt-card.html"
|
|
title="Tilt Card"
|
|
variables={[{"id":"eyebrow","type":"string","role":"content","label":"Eyebrow","description":"Small uppercase kicker above the headline.","default":"Primitive"},{"id":"headline","type":"string","role":"content","label":"Headline","description":"Large card headline.","default":"Agent-ready motion"},{"id":"glow","type":"enum","role":"motion","label":"Glow","description":"How far the corner glow reaches past the card edges, which sets both its spread at rest and how far the timeline drift carries it.","default":"standard","options":[{"value":"tight","label":"Tight"},{"value":"standard","label":"Standard"},{"value":"wide","label":"Wide"}]},{"id":"accent","type":"enum","role":"style","label":"Accent","description":"Colour family of the card gradient, corner glow, eyebrow and drop shadow.","default":"indigo","options":[{"value":"indigo","label":"Indigo"},{"value":"emerald","label":"Emerald"},{"value":"violet","label":"Violet"}]}]}
|
|
meta={{"category":"Motion Primitives","badge":"Stable","codeLines":156}}
|
|
attribution={{"path":"registry/components/tilt-card","tags":["video-primitive","transition-primitive","transitions-dev-port","card","tilt"]}}
|
|
hasCode
|
|
rawUrl="https://raw.githubusercontent.com/heygen-com/hyperframes/main/registry/components/tilt-card/tilt-card.html"
|
|
>
|
|
|
|
<CatalogSlot slot="code">
|
|
|
|
```html tilt-card.html
|
|
<!--
|
|
Tilt Card - transitions.dev-inspired primitive for HyperFrames.
|
|
|
|
Paste the markup, CSS and script into a composition. Use the timeline
|
|
integration note at the bottom as the starting point for deterministic GSAP
|
|
animation.
|
|
|
|
Variables. The script reads each one, falls back to the declared default on
|
|
anything missing or unrecognised, and writes the result into the markup or
|
|
into a custom property the CSS above consumes. The timeline recipe below is
|
|
untouched by them: it keeps driving the same rise and the same tilt angles.
|
|
|
|
- eyebrow (string, default "Primitive"): the small uppercase kicker above
|
|
the headline. Blank falls back to the default.
|
|
- headline (string, default "Agent-ready motion"): the large card
|
|
headline. Blank falls back to the default.
|
|
- glow (tight | standard | wide, default standard): how far the corner
|
|
glow reaches past the card edges. A wider glow spreads more light at
|
|
rest, and because the timeline drifts it by a percentage of its own box,
|
|
a wider glow also carries that drift further across the card.
|
|
- accent (indigo | emerald | violet, default indigo): the colour family of
|
|
the card, covering the gradient, the corner glow, the eyebrow and the
|
|
drop shadow together.
|
|
|
|
On every default the result is identical to the original: an indigo card with
|
|
a sky-blue corner glow reaching 30% past every edge.
|
|
-->
|
|
|
|
<div
|
|
class="hf-transition-tilt-card"
|
|
data-composition-variables='[
|
|
{"id": "eyebrow", "type": "string", "role": "content", "label": "Eyebrow", "description": "Small uppercase kicker above the headline.", "default": "Primitive"},
|
|
{"id": "headline", "type": "string", "role": "content", "label": "Headline", "description": "Large card headline.", "default": "Agent-ready motion"},
|
|
{"id": "glow", "type": "enum", "role": "motion", "label": "Glow", "description": "How far the corner glow reaches past the card edges, which sets both its spread at rest and how far the timeline drift carries it.", "default": "standard", "options": [{"value": "tight", "label": "Tight"}, {"value": "standard", "label": "Standard"}, {"value": "wide", "label": "Wide"}]},
|
|
{"id": "accent", "type": "enum", "role": "style", "label": "Accent", "description": "Colour family of the card gradient, corner glow, eyebrow and drop shadow.", "default": "indigo", "options": [{"value": "indigo", "label": "Indigo"}, {"value": "emerald", "label": "Emerald"}, {"value": "violet", "label": "Violet"}]}
|
|
]'
|
|
>
|
|
<div class="hf-transition-tilt-glow"></div>
|
|
<div class="hf-transition-tilt-content">
|
|
<span>Primitive</span>
|
|
<strong>Agent-ready motion</strong>
|
|
</div>
|
|
</div>
|
|
|
|
<style>
|
|
.hf-transition-tilt-card {
|
|
position: relative;
|
|
width: 420px;
|
|
height: 260px;
|
|
overflow: hidden;
|
|
border: 1px solid rgba(255, 255, 255, 0.18);
|
|
border-radius: 30px;
|
|
background: linear-gradient(135deg, #18181b, var(--hf-tilt-accent, #312e81));
|
|
color: #ffffff;
|
|
font-family: Inter, system-ui, sans-serif;
|
|
transform-style: preserve-3d;
|
|
box-shadow: 0 32px 90px var(--hf-tilt-shadow, rgba(49, 46, 129, 0.34));
|
|
}
|
|
.hf-transition-tilt-glow {
|
|
position: absolute;
|
|
inset: var(--hf-tilt-glow-inset, -30%);
|
|
background: radial-gradient(
|
|
circle at 30% 20%,
|
|
var(--hf-tilt-glow, rgba(125, 211, 252, 0.5)),
|
|
transparent 36%
|
|
);
|
|
}
|
|
.hf-transition-tilt-content {
|
|
position: relative;
|
|
display: grid;
|
|
align-content: end;
|
|
gap: 10px;
|
|
height: 100%;
|
|
padding: 34px;
|
|
transform: translateZ(38px);
|
|
}
|
|
.hf-transition-tilt-content span {
|
|
color: var(--hf-tilt-label, #a5b4fc);
|
|
font-size: 13px;
|
|
font-weight: 900;
|
|
letter-spacing: 0.12em;
|
|
text-transform: uppercase;
|
|
}
|
|
.hf-transition-tilt-content strong {
|
|
max-width: 280px;
|
|
font-size: 34px;
|
|
line-height: 0.96;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
(function () {
|
|
"use strict";
|
|
|
|
var vars =
|
|
window.__hyperframes && window.__hyperframes.getVariables
|
|
? window.__hyperframes.getVariables()
|
|
: {};
|
|
|
|
// Unrecognised overrides return to their declared defaults.
|
|
var insets = { tight: "-18%", standard: "-30%", wide: "-46%" };
|
|
var accents = {
|
|
indigo: {
|
|
accent: "#312e81",
|
|
glow: "rgba(125, 211, 252, 0.5)",
|
|
label: "#a5b4fc",
|
|
shadow: "rgba(49, 46, 129, 0.34)",
|
|
},
|
|
emerald: {
|
|
accent: "#065f46",
|
|
glow: "rgba(110, 231, 183, 0.5)",
|
|
label: "#6ee7b7",
|
|
shadow: "rgba(6, 95, 70, 0.34)",
|
|
},
|
|
violet: {
|
|
accent: "#5b21b6",
|
|
glow: "rgba(216, 180, 254, 0.5)",
|
|
label: "#d8b4fe",
|
|
shadow: "rgba(91, 33, 182, 0.34)",
|
|
},
|
|
};
|
|
|
|
function pick(table, value, fallback) {
|
|
return Object.prototype.hasOwnProperty.call(table, value) ? value : fallback;
|
|
}
|
|
|
|
function text(value, fallback) {
|
|
var resolved = value == null ? "" : String(value).trim();
|
|
return resolved.length > 0 ? resolved : fallback;
|
|
}
|
|
|
|
var eyebrow = text(vars.eyebrow, "Primitive");
|
|
var headline = text(vars.headline, "Agent-ready motion");
|
|
var inset = insets[pick(insets, vars.glow, "standard")];
|
|
var accent = accents[pick(accents, vars.accent, "indigo")];
|
|
|
|
var roots = document.querySelectorAll(".hf-transition-tilt-card");
|
|
for (var i = 0; i < roots.length; i += 1) {
|
|
var root = roots[i];
|
|
root.style.setProperty("--hf-tilt-glow-inset", inset);
|
|
root.style.setProperty("--hf-tilt-accent", accent.accent);
|
|
root.style.setProperty("--hf-tilt-glow", accent.glow);
|
|
root.style.setProperty("--hf-tilt-label", accent.label);
|
|
root.style.setProperty("--hf-tilt-shadow", accent.shadow);
|
|
root.querySelector(".hf-transition-tilt-content span").textContent = eyebrow;
|
|
root.querySelector(".hf-transition-tilt-content strong").textContent = headline;
|
|
}
|
|
})();
|
|
</script>
|
|
|
|
<!--
|
|
Timeline integration:
|
|
tl.fromTo('.hf-transition-tilt-card', { opacity: 0, y: 30, rotateX: 0, rotateY: 0 }, { opacity: 1, y: 0, duration: 0.38, ease: 'power2.out' }, 0.3);
|
|
tl.to('.hf-transition-tilt-card', { rotateX: -7, rotateY: 10, duration: 0.72, ease: 'power3.inOut' }, 0.75);
|
|
tl.to('.hf-transition-tilt-glow', { xPercent: 12, yPercent: 10, duration: 0.72, ease: 'power3.inOut' }, 0.75);
|
|
-->
|
|
```
|
|
|
|
</CatalogSlot>
|
|
|
|
<CatalogSlot slot="install">
|
|
|
|
<InstallCommand command="npx hyperframes add tilt-card" item="tilt-card" />
|
|
|
|
That writes one file: `compositions/components/tilt-card.html`.
|
|
|
|
</CatalogSlot>
|
|
|
|
</CatalogDetail>
|
|
|
|
<div data-static-slot="docs" className="prose prose-gray dark:prose-invert">
|
|
|
|
## Paste it into your composition
|
|
|
|
Open `compositions/components/tilt-card.html` and copy what is inside into your own composition.
|
|
The file opens with a comment header that walks you through it.
|
|
|
|
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 |
|
|
| --- | --- | --- | --- |
|
|
| `eyebrow` | `Primitive` | string | Small uppercase kicker above the headline. |
|
|
| `headline` | `Agent-ready motion` | string | Large card headline. |
|
|
| `glow` | `standard` | `tight`, `standard`, `wide` | How far the corner glow reaches past the card edges, which sets both its spread at rest and how far the timeline drift carries it. |
|
|
| `accent` | `indigo` | `indigo`, `emerald`, `violet` | Colour family of the card gradient, corner glow, eyebrow and drop shadow. |
|
|
|
|
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="tilt-card"
|
|
data-composition-src="compositions/components/tilt-card.html"
|
|
data-variable-values='{"eyebrow":"Primitive","headline":"Agent-ready motion","glow":"standard","accent":"indigo"}'
|
|
></div>
|
|
```
|
|
|
|
{/* hf:generated-footer */}
|
|
|
|
Tagged `video-primitive` `transition-primitive` `transitions-dev-port` `card` `tilt`.
|
|
|
|
## Related topics
|
|
|
|
- [Browse the complete Catalog](/catalog)
|
|
- [Add assets and Catalog items in the browser editor](/studio/assets-and-blocks)
|
|
- [Put blocks together into one video](/concepts/compositions)
|
|
|
|
</div>
|