mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-07 01:56:04 +00:00
This reverts commit 3b53bfd2f7.
This commit is contained in:
-142
@@ -1,142 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>Per-Word Crossfade - Demo</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
#demo {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: #fafafa;
|
||||
font-family: Inter, system-ui, sans-serif;
|
||||
}
|
||||
.demo-frame {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 40px;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
padding: 120px 160px;
|
||||
}
|
||||
/* outgoing phrase — static, fades out */
|
||||
.phrase-out {
|
||||
display: inline-flex;
|
||||
gap: 28px;
|
||||
font-size: 128px;
|
||||
font-weight: 900;
|
||||
letter-spacing: -0.04em;
|
||||
line-height: 1;
|
||||
color: #71717a;
|
||||
font-family: Inter, system-ui, sans-serif;
|
||||
position: relative;
|
||||
}
|
||||
.phrase-out span {
|
||||
display: inline-block;
|
||||
will-change: opacity;
|
||||
}
|
||||
/* incoming phrase — the GSAP-animated element */
|
||||
.hf-remocn-per-word-crossfade {
|
||||
color: #18181b;
|
||||
font-family: Inter, system-ui, sans-serif;
|
||||
font-weight: 900;
|
||||
letter-spacing: -0.04em;
|
||||
}
|
||||
.hf-remocn-per-word-crossfade {
|
||||
display: inline-flex;
|
||||
gap: 28px;
|
||||
font-size: 128px;
|
||||
line-height: 1;
|
||||
}
|
||||
.hf-remocn-per-word-crossfade span {
|
||||
display: inline-block;
|
||||
transform: translate(var(--hf-word-x, 0px), var(--hf-word-y, 0px))
|
||||
scale(var(--hf-word-scale, 1));
|
||||
filter: blur(var(--hf-word-blur, 0px));
|
||||
will-change: transform, filter, opacity;
|
||||
}
|
||||
/* label */
|
||||
.demo-label {
|
||||
font-size: 26px;
|
||||
font-weight: 500;
|
||||
color: #a1a1aa;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
margin-top: 24px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="demo"
|
||||
data-composition-id="per-word-crossfade-demo"
|
||||
data-start="0"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
data-duration="5"
|
||||
>
|
||||
<div class="demo-frame">
|
||||
<!-- outgoing phrase: fades out word-by-word -->
|
||||
<div class="phrase-out">
|
||||
<span>Write</span><span>once</span><span>publish</span><span>anywhere</span>
|
||||
</div>
|
||||
<!-- incoming phrase: per-word crossfade in -->
|
||||
<div class="hf-remocn-per-word-crossfade">
|
||||
<span>Create</span><span>once</span><span>reuse</span><span>everywhere</span>
|
||||
</div>
|
||||
<div class="demo-label">per-word crossfade</div>
|
||||
</div>
|
||||
<script>
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
const startTime = 0.5;
|
||||
|
||||
// outgoing phrase fades out word-by-word
|
||||
tl.to(
|
||||
".phrase-out span",
|
||||
{
|
||||
opacity: 0,
|
||||
duration: 0.25,
|
||||
stagger: 0.055,
|
||||
ease: "power2.in",
|
||||
},
|
||||
startTime,
|
||||
);
|
||||
|
||||
// incoming phrase fades in word-by-word (the named component)
|
||||
tl.fromTo(
|
||||
".hf-remocn-per-word-crossfade span",
|
||||
{ opacity: 0, "--hf-word-y": "22px", "--hf-word-scale": 0.92, "--hf-word-blur": "5px" },
|
||||
{
|
||||
opacity: 1,
|
||||
"--hf-word-y": "0px",
|
||||
"--hf-word-scale": 1,
|
||||
"--hf-word-blur": "0px",
|
||||
duration: 0.3,
|
||||
stagger: 0.055,
|
||||
ease: "power3.out",
|
||||
},
|
||||
startTime + 0.1,
|
||||
);
|
||||
|
||||
tl.set({}, {}, 5);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["per-word-crossfade-demo"] = tl;
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user