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:
-173
@@ -1,173 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>Text State Swap - 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: #f5f5f4;
|
||||
font-family: Inter, system-ui, sans-serif;
|
||||
}
|
||||
/* ponytail: scale on non-GSAP wrapper, safe to use transform here */
|
||||
.demo-frame {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
transform: scale(2.6);
|
||||
transform-origin: center center;
|
||||
}
|
||||
.demo-card {
|
||||
background: #ffffff;
|
||||
border: 1px solid #e4e4e7;
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 24px 70px rgba(0, 0, 0, 0.08);
|
||||
padding: 32px 40px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
width: 340px;
|
||||
}
|
||||
.demo-card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.demo-card-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #71717a;
|
||||
letter-spacing: 0.02em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.demo-card-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: #22c55e;
|
||||
}
|
||||
.demo-card-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
.demo-card-line {
|
||||
height: 10px;
|
||||
border-radius: 5px;
|
||||
background: #f4f4f5;
|
||||
}
|
||||
.demo-card-line.w-full {
|
||||
width: 100%;
|
||||
}
|
||||
.demo-card-line.w-3q {
|
||||
width: 75%;
|
||||
}
|
||||
.demo-card-line.w-half {
|
||||
width: 50%;
|
||||
}
|
||||
.demo-card-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
padding-top: 4px;
|
||||
border-top: 1px solid #f4f4f5;
|
||||
}
|
||||
.hf-transition-text-state-swap {
|
||||
position: relative;
|
||||
width: 140px;
|
||||
height: 22px;
|
||||
overflow: hidden;
|
||||
color: #18181b;
|
||||
font:
|
||||
700 14px/1 Inter,
|
||||
system-ui,
|
||||
sans-serif;
|
||||
}
|
||||
.hf-transition-text-state-swap span {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
filter: blur(var(--hf-text-blur, 0px));
|
||||
transform: translateY(var(--hf-text-y, 0px));
|
||||
will-change: transform, filter, opacity;
|
||||
}
|
||||
.hf-transition-text-state-swap .to {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="demo"
|
||||
data-composition-id="text-state-swap-demo"
|
||||
data-start="0"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
data-duration="5"
|
||||
>
|
||||
<div class="demo-frame">
|
||||
<div class="demo-card">
|
||||
<div class="demo-card-header">
|
||||
<span class="demo-card-title">Draft</span>
|
||||
<span class="demo-card-dot"></span>
|
||||
</div>
|
||||
<div class="demo-card-body">
|
||||
<div class="demo-card-line w-full"></div>
|
||||
<div class="demo-card-line w-3q"></div>
|
||||
<div class="demo-card-line w-full"></div>
|
||||
<div class="demo-card-line w-half"></div>
|
||||
</div>
|
||||
<div class="demo-card-footer">
|
||||
<div class="hf-transition-text-state-swap">
|
||||
<span class="from">Saving draft…</span><span class="to">Saved</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
const startTime = 0.5;
|
||||
tl.to(
|
||||
".hf-transition-text-state-swap .from",
|
||||
{
|
||||
opacity: 0,
|
||||
"--hf-text-y": "-18px",
|
||||
"--hf-text-blur": "8px",
|
||||
duration: 0.18,
|
||||
ease: "power2.in",
|
||||
},
|
||||
startTime,
|
||||
);
|
||||
tl.fromTo(
|
||||
".hf-transition-text-state-swap .to",
|
||||
{ opacity: 0, "--hf-text-y": "18px", "--hf-text-blur": "8px" },
|
||||
{
|
||||
opacity: 1,
|
||||
"--hf-text-y": "0px",
|
||||
"--hf-text-blur": "0px",
|
||||
duration: 0.26,
|
||||
ease: "power2.out",
|
||||
},
|
||||
startTime + 0.12,
|
||||
);
|
||||
tl.set({}, {}, 5);
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["text-state-swap-demo"] = tl;
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user