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>
109 lines
3.7 KiB
Plaintext
109 lines
3.7 KiB
Plaintext
---
|
|
title: "Shimmer Sweep"
|
|
description: "Animated light sweep across text or elements using a CSS gradient mask — ideal for AI accents and premium reveals"
|
|
---
|
|
|
|
import { InstallCommand } from "/snippets/install-command.jsx";
|
|
|
|
## Install
|
|
|
|
<InstallCommand command="npx hyperframes add shimmer-sweep" item="shimmer-sweep" />
|
|
|
|
That writes one file: `compositions/components/shimmer-sweep.html`.
|
|
|
|
<iframe
|
|
className="w-full aspect-video rounded-xl border-0 bg-zinc-100 dark:bg-zinc-800"
|
|
title="shimmer-sweep preview"
|
|
loading="lazy"
|
|
srcDoc={`<!doctype html><html><head><meta charset="utf-8"><style>html,body{margin:0;height:100%;overflow:hidden;background:transparent}hyperframes-player{display:block;width:100%;height:100%}</style><script src="https://cdn.jsdelivr.net/npm/@hyperframes/player@latest/dist/hyperframes-player.global.js"><\/script></head><body><script>fetch("/public/catalog/components/shimmer-sweep.json").then(function(r){return r.json()}).then(function(d){var p=document.createElement("hyperframes-player");p.setAttribute("srcdoc",d.html);p.setAttribute("controls","");p.setAttribute("autoplay","");p.setAttribute("loop","");p.setAttribute("muted","");p.setAttribute("poster","https://static.heygen.ai/hyperframes-oss/docs/images/catalog/components/shimmer-sweep.png");document.body.appendChild(p)});<\/script></body></html>`}
|
|
/>
|
|
|
|
## Source
|
|
|
|
<Accordion title="shimmer-sweep.html">
|
|
|
|
```html
|
|
<!--
|
|
Shimmer Sweep — animated light pass across text or elements.
|
|
|
|
Usage: place this snippet AFTER your .shimmer-sweep-target elements.
|
|
Wrap your text element with class="shimmer-sweep-target" and
|
|
paste this snippet into your composition. The GSAP timeline drives
|
|
the sweep position for deterministic frame-by-frame rendering.
|
|
|
|
Customize:
|
|
- --shimmer-color: highlight color (default rgba(255,255,255,0.6))
|
|
- --shimmer-width: highlight band width as % (default 20%)
|
|
- --shimmer-angle: sweep angle (default 120deg)
|
|
- Timeline duration/ease: adjust in the script below
|
|
-->
|
|
|
|
<style>
|
|
.shimmer-sweep-target {
|
|
position: relative;
|
|
display: inline-block;
|
|
}
|
|
|
|
.shimmer-sweep-target .shimmer-mask {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
pointer-events: none;
|
|
background: linear-gradient(
|
|
var(--shimmer-angle, 120deg),
|
|
transparent 0%,
|
|
transparent calc(var(--shimmer-pos, -20%) - var(--shimmer-width, 20%) / 2),
|
|
var(--shimmer-color, rgba(255, 255, 255, 0.6)) var(--shimmer-pos, -20%),
|
|
transparent calc(var(--shimmer-pos, -20%) + var(--shimmer-width, 20%) / 2),
|
|
transparent 100%
|
|
);
|
|
mix-blend-mode: overlay;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
(function () {
|
|
// Auto-inject .shimmer-mask into every .shimmer-sweep-target
|
|
document.querySelectorAll(".shimmer-sweep-target").forEach((el) => {
|
|
if (!el.querySelector(".shimmer-mask")) {
|
|
const mask = document.createElement("div");
|
|
mask.className = "shimmer-mask";
|
|
el.appendChild(mask);
|
|
}
|
|
});
|
|
})();
|
|
</script>
|
|
|
|
<!--
|
|
Timeline integration example (add to your composition's GSAP timeline):
|
|
|
|
// Single sweep from left to right
|
|
tl.fromTo(".shimmer-sweep-target", {
|
|
"--shimmer-pos": "-20%",
|
|
}, {
|
|
"--shimmer-pos": "120%",
|
|
duration: 1.2,
|
|
ease: "power2.inOut",
|
|
stagger: 0.15,
|
|
}, startTime);
|
|
-->
|
|
```
|
|
|
|
</Accordion>
|
|
|
|
## Usage
|
|
|
|
Open `compositions/components/shimmer-sweep.html` and paste its contents into your composition. See the comment header in the file for detailed instructions.
|
|
|
|
{/* hf:generated-footer */}
|
|
|
|
Tagged `text` `shimmer` `highlight` `effect`.
|
|
|
|
## Related topics
|
|
|
|
- [Browse the complete Catalog](/catalog)
|
|
- [Add assets and Catalog items in Studio](/studio/assets-and-blocks)
|
|
- [Build a richer composition](/go-further)
|