mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-17 15:24:19 +00:00
feat(registry): seed transition blocks — 14 shader + 14 CSS showcase (#270)
## What Add 28 transition blocks from the Hyperframe Template Structure catalog, bringing the registry to 53 total items. ### Shader transitions (14 blocks, WebGL, 4s each) `domain-warp-dissolve`, `ridged-burn`, `whip-pan`, `sdf-iris`, `ripple-waves`, `gravitational-lens`, `cinematic-zoom`, `chromatic-radial-split`, `glitch`, `swirl-vortex`, `thermal-distortion`, `flash-through-white`, `cross-warp-morph`, `light-leak` ### CSS transition showcases (14 blocks, various durations) `transitions-3d`, `transitions-blur`, `transitions-cover`, `transitions-destruction`, `transitions-dissolve`, `transitions-distortion`, `transitions-grid`, `transitions-light`, `transitions-mechanical`, `transitions-other`, `transitions-push`, `transitions-radial`, `transitions-scale`, `transitions-shader` ## Why Phase D content accumulation. Transitions are the most-requested category for the catalog. ## How - Shader transitions extracted from `shader-showcase.zip`, each a standalone HTML with WebGL shaders - CSS transitions extracted from `showcase-bundle.zip`, each a standalone showcase page - All tagged with `transition` + `shader` or `showcase` for catalog grouping - Preview thumbnails generated for all 28 blocks - Catalog pages + index regenerated ## Test plan - [x] All 28 blocks produce preview thumbnails - [x] `registry-item.json` validates for all blocks - [x] Catalog pages generated (45 total items in catalog-index.json) - [x] `oxfmt --check` passes
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
data-composition-id="scene-3-phones"
|
||||
data-composition-id="app-showcase"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
data-duration="5.5"
|
||||
@@ -363,7 +363,7 @@
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap");
|
||||
|
||||
[data-composition-id="scene-3-phones"] {
|
||||
[data-composition-id="app-showcase"] {
|
||||
position: relative;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
@@ -373,12 +373,12 @@
|
||||
}
|
||||
|
||||
/* ── Background ── */
|
||||
[data-composition-id="scene-3-phones"] .s3-bg {
|
||||
[data-composition-id="app-showcase"] .s3-bg {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(160deg, #f1f2ec 0%, #e8ecda 40%, #f1f2ec 100%);
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .s3-bg-glow {
|
||||
[data-composition-id="app-showcase"] .s3-bg-glow {
|
||||
position: absolute;
|
||||
width: 900px;
|
||||
height: 900px;
|
||||
@@ -390,32 +390,32 @@
|
||||
}
|
||||
|
||||
/* ── Stage ── */
|
||||
[data-composition-id="scene-3-phones"] .s3-stage {
|
||||
[data-composition-id="app-showcase"] .s3-stage {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
transform-origin: center center;
|
||||
}
|
||||
|
||||
/* ── Phones ── */
|
||||
[data-composition-id="scene-3-phones"] .s3-phone {
|
||||
[data-composition-id="app-showcase"] .s3-phone {
|
||||
position: absolute;
|
||||
width: 320px;
|
||||
height: 650px;
|
||||
top: 215px;
|
||||
left: 800px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .s3-phone-center {
|
||||
[data-composition-id="app-showcase"] .s3-phone-center {
|
||||
z-index: 30;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .s3-phone-left {
|
||||
[data-composition-id="app-showcase"] .s3-phone-left {
|
||||
z-index: 20;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .s3-phone-right {
|
||||
[data-composition-id="app-showcase"] .s3-phone-right {
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
/* ── Bezel ── */
|
||||
[data-composition-id="scene-3-phones"] .s3-bezel {
|
||||
[data-composition-id="app-showcase"] .s3-bezel {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 42px;
|
||||
@@ -427,7 +427,7 @@
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .s3-notch {
|
||||
[data-composition-id="app-showcase"] .s3-notch {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: 50%;
|
||||
@@ -440,7 +440,7 @@
|
||||
}
|
||||
|
||||
/* ── Screens ── */
|
||||
[data-composition-id="scene-3-phones"] .s3-screen {
|
||||
[data-composition-id="app-showcase"] .s3-screen {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 36px;
|
||||
@@ -449,13 +449,13 @@
|
||||
}
|
||||
|
||||
/* Left screen */
|
||||
[data-composition-id="scene-3-phones"] .s3-screen-left {
|
||||
[data-composition-id="app-showcase"] .s3-screen-left {
|
||||
background: linear-gradient(160deg, #d9e0bc 0%, #c8d4a0 50%, #b8c78a 100%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .left-shapes {
|
||||
[data-composition-id="app-showcase"] .left-shapes {
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 0;
|
||||
@@ -465,16 +465,16 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .left-shapes svg {
|
||||
[data-composition-id="app-showcase"] .left-shapes svg {
|
||||
width: 200px;
|
||||
height: 280px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .left-bottom {
|
||||
[data-composition-id="app-showcase"] .left-bottom {
|
||||
padding: 0 28px 40px;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .left-tagline {
|
||||
[data-composition-id="app-showcase"] .left-tagline {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
color: #271f15;
|
||||
@@ -482,7 +482,7 @@
|
||||
margin-bottom: 16px;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .left-cta {
|
||||
[data-composition-id="app-showcase"] .left-cta {
|
||||
display: inline-block;
|
||||
background: #271f15;
|
||||
color: #e4fa72;
|
||||
@@ -494,7 +494,7 @@
|
||||
}
|
||||
|
||||
/* Center screen */
|
||||
[data-composition-id="scene-3-phones"] .s3-screen-center {
|
||||
[data-composition-id="app-showcase"] .s3-screen-center {
|
||||
background: #1a1a1a;
|
||||
padding: 42px 22px 22px;
|
||||
display: flex;
|
||||
@@ -502,12 +502,12 @@
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
[data-composition-id="scene-3-phones"] .center-header {
|
||||
[data-composition-id="app-showcase"] .center-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .center-avatar {
|
||||
[data-composition-id="app-showcase"] .center-avatar {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
@@ -520,27 +520,27 @@
|
||||
color: #271f15;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .center-user-info {
|
||||
[data-composition-id="app-showcase"] .center-user-info {
|
||||
flex: 1;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .center-name {
|
||||
[data-composition-id="app-showcase"] .center-name {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: #f1f2ec;
|
||||
line-height: 1.2;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .center-subtitle {
|
||||
[data-composition-id="app-showcase"] .center-subtitle {
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: #7c857c;
|
||||
margin-top: 1px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .center-bell {
|
||||
[data-composition-id="app-showcase"] .center-bell {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* Weekly Goal */
|
||||
[data-composition-id="scene-3-phones"] .center-goal {
|
||||
[data-composition-id="app-showcase"] .center-goal {
|
||||
background: #242424;
|
||||
border-radius: 20px;
|
||||
padding: 18px 16px;
|
||||
@@ -549,25 +549,25 @@
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .goal-label {
|
||||
[data-composition-id="app-showcase"] .goal-label {
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
color: #7c857c;
|
||||
align-self: flex-start;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .goal-ring-wrap {
|
||||
[data-composition-id="app-showcase"] .goal-ring-wrap {
|
||||
position: relative;
|
||||
width: 130px;
|
||||
height: 130px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .goal-ring {
|
||||
[data-composition-id="app-showcase"] .goal-ring {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .ring-track {
|
||||
[data-composition-id="app-showcase"] .ring-track {
|
||||
opacity: 0.3;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .goal-count {
|
||||
[data-composition-id="app-showcase"] .goal-count {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
@@ -575,27 +575,27 @@
|
||||
justify-content: center;
|
||||
gap: 2px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .goal-num {
|
||||
[data-composition-id="app-showcase"] .goal-num {
|
||||
font-size: 36px;
|
||||
font-weight: 700;
|
||||
color: #e4fa72;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .goal-sep {
|
||||
[data-composition-id="app-showcase"] .goal-sep {
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: #7c857c;
|
||||
margin: 0 2px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .goal-den {
|
||||
[data-composition-id="app-showcase"] .goal-den {
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: #7c857c;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .goal-days {
|
||||
[data-composition-id="app-showcase"] .goal-days {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .day {
|
||||
[data-composition-id="app-showcase"] .day {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
@@ -607,45 +607,45 @@
|
||||
color: #7c857c;
|
||||
background: #1a1a1a;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .day.done {
|
||||
[data-composition-id="app-showcase"] .day.done {
|
||||
background: #e4fa72;
|
||||
color: #271f15;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* Progress section */
|
||||
[data-composition-id="scene-3-phones"] .center-progress {
|
||||
[data-composition-id="app-showcase"] .center-progress {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .progress-header {
|
||||
[data-composition-id="app-showcase"] .progress-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .progress-title {
|
||||
[data-composition-id="app-showcase"] .progress-title {
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
color: #f1f2ec;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .progress-link {
|
||||
[data-composition-id="app-showcase"] .progress-link {
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: #e4fa72;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .progress-bars {
|
||||
[data-composition-id="app-showcase"] .progress-bars {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .bar-row {
|
||||
[data-composition-id="app-showcase"] .bar-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .bar-icon {
|
||||
[data-composition-id="app-showcase"] .bar-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 8px;
|
||||
@@ -655,31 +655,31 @@
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .bar-info {
|
||||
[data-composition-id="app-showcase"] .bar-info {
|
||||
width: 70px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .bar-name {
|
||||
[data-composition-id="app-showcase"] .bar-name {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #f1f2ec;
|
||||
line-height: 1.2;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .bar-val {
|
||||
[data-composition-id="app-showcase"] .bar-val {
|
||||
display: block;
|
||||
font-size: 10px;
|
||||
font-weight: 400;
|
||||
color: #7c857c;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .bar-track {
|
||||
[data-composition-id="app-showcase"] .bar-track {
|
||||
flex: 1;
|
||||
height: 8px;
|
||||
background: #2a2a2a;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .bar-value {
|
||||
[data-composition-id="app-showcase"] .bar-value {
|
||||
height: 100%;
|
||||
border-radius: 4px;
|
||||
background: #e4fa72;
|
||||
@@ -687,47 +687,47 @@
|
||||
}
|
||||
|
||||
/* Right screen */
|
||||
[data-composition-id="scene-3-phones"] .s3-screen-right {
|
||||
[data-composition-id="app-showcase"] .s3-screen-right {
|
||||
background: #f1f2ec;
|
||||
padding: 42px 20px 24px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .right-header {
|
||||
[data-composition-id="app-showcase"] .right-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .right-title {
|
||||
[data-composition-id="app-showcase"] .right-title {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #7c857c;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .right-value {
|
||||
[data-composition-id="app-showcase"] .right-value {
|
||||
font-size: 40px;
|
||||
font-weight: 700;
|
||||
color: #271f15;
|
||||
line-height: 1;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .right-unit {
|
||||
[data-composition-id="app-showcase"] .right-unit {
|
||||
font-size: 20px;
|
||||
font-weight: 400;
|
||||
color: #7c857c;
|
||||
}
|
||||
|
||||
[data-composition-id="scene-3-phones"] .right-graph-wrap {
|
||||
[data-composition-id="app-showcase"] .right-graph-wrap {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .right-graph {
|
||||
[data-composition-id="app-showcase"] .right-graph {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .right-labels {
|
||||
[data-composition-id="app-showcase"] .right-labels {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 6px;
|
||||
@@ -736,11 +736,11 @@
|
||||
color: #7c857c;
|
||||
}
|
||||
|
||||
[data-composition-id="scene-3-phones"] .right-stats {
|
||||
[data-composition-id="app-showcase"] .right-stats {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .stat-pill {
|
||||
[data-composition-id="app-showcase"] .stat-pill {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
@@ -748,18 +748,18 @@
|
||||
border-radius: 20px;
|
||||
padding: 8px 14px;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .stat-dot {
|
||||
[data-composition-id="app-showcase"] .stat-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .stat-label {
|
||||
[data-composition-id="app-showcase"] .stat-label {
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: #7c857c;
|
||||
}
|
||||
[data-composition-id="scene-3-phones"] .stat-num {
|
||||
[data-composition-id="app-showcase"] .stat-num {
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: #271f15;
|
||||
@@ -769,7 +769,7 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function () {
|
||||
var S = '[data-composition-id="scene-3-phones"] ';
|
||||
var S = '[data-composition-id="app-showcase"] ';
|
||||
window.__timelines = window.__timelines || {};
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
|
||||
@@ -938,7 +938,7 @@
|
||||
tl.to(graphLine, { opacity: 0.65, duration: 0.6, ease: "sine.inOut" }, 4.05);
|
||||
tl.to(graphLine, { opacity: 1, duration: 0.6, ease: "sine.inOut" }, 4.65);
|
||||
|
||||
window.__timelines["scene-3-phones"] = tl;
|
||||
window.__timelines["app-showcase"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -1,502 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>ascii-dashboard</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
background-color: #0a0a0f;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
data-composition-id="ascii-dashboard"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
data-duration="10"
|
||||
>
|
||||
<canvas id="ascii-canvas" width="1920" height="1080"></canvas>
|
||||
|
||||
<style>
|
||||
[data-composition-id="ascii-dashboard"] {
|
||||
position: relative;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #020405;
|
||||
}
|
||||
|
||||
#ascii-canvas {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="../three.min.js"></script>
|
||||
<script>
|
||||
(function initAsciiDashboard() {
|
||||
var root = document.querySelector('[data-composition-id="ascii-dashboard"]');
|
||||
if (!root || typeof THREE === "undefined") {
|
||||
setTimeout(initAsciiDashboard, 50);
|
||||
return;
|
||||
}
|
||||
|
||||
var canvas = root.querySelector("#ascii-canvas");
|
||||
if (!canvas) {
|
||||
setTimeout(initAsciiDashboard, 50);
|
||||
return;
|
||||
}
|
||||
|
||||
var W = 1920;
|
||||
var H = 1080;
|
||||
var ctx = canvas.getContext("2d");
|
||||
|
||||
var CELL_W = 10;
|
||||
var CELL_H = 16;
|
||||
var COLS = Math.floor(W / CELL_W);
|
||||
var ROWS = Math.floor(H / CELL_H);
|
||||
var GLYPHS = " .,:;=+*#%@";
|
||||
var GLYPH_MAX = GLYPHS.length - 1;
|
||||
|
||||
var BAYER = [
|
||||
[0.03125, 0.53125, 0.15625, 0.65625],
|
||||
[0.78125, 0.28125, 0.90625, 0.40625],
|
||||
[0.21875, 0.71875, 0.09375, 0.59375],
|
||||
[0.96875, 0.46875, 0.84375, 0.34375],
|
||||
];
|
||||
|
||||
function clamp01(v) {
|
||||
return v < 0 ? 0 : v > 1 ? 1 : v;
|
||||
}
|
||||
|
||||
function mix(a, b, t) {
|
||||
return a + (b - a) * t;
|
||||
}
|
||||
|
||||
function easeInOut(t) {
|
||||
return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
|
||||
}
|
||||
|
||||
function easeOut(t) {
|
||||
return 1 - Math.pow(1 - t, 3);
|
||||
}
|
||||
|
||||
function smoothStep(edge0, edge1, x) {
|
||||
var t = clamp01((x - edge0) / (edge1 - edge0));
|
||||
return t * t * (3 - 2 * t);
|
||||
}
|
||||
|
||||
function hash(n) {
|
||||
var x = Math.sin(n * 127.1 + 311.7) * 43758.5453123;
|
||||
return x - Math.floor(x);
|
||||
}
|
||||
|
||||
var renderer = new THREE.WebGLRenderer({
|
||||
antialias: true,
|
||||
alpha: false,
|
||||
preserveDrawingBuffer: true,
|
||||
powerPreference: "high-performance",
|
||||
});
|
||||
renderer.setPixelRatio(1);
|
||||
renderer.setSize(COLS, ROWS, false);
|
||||
renderer.outputColorSpace = THREE.SRGBColorSpace;
|
||||
renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
||||
renderer.toneMappingExposure = 1.65;
|
||||
|
||||
var target = new THREE.WebGLRenderTarget(COLS, ROWS, {
|
||||
depthBuffer: true,
|
||||
stencilBuffer: false,
|
||||
});
|
||||
var pixels = new Uint8Array(COLS * ROWS * 4);
|
||||
|
||||
var scene = new THREE.Scene();
|
||||
scene.background = new THREE.Color(0x030507);
|
||||
scene.fog = new THREE.FogExp2(0x020405, 0.085);
|
||||
|
||||
var camera = new THREE.PerspectiveCamera(34, COLS / ROWS, 0.1, 100);
|
||||
camera.position.set(0, 4.5, 15);
|
||||
|
||||
var chartGroup = new THREE.Group();
|
||||
scene.add(chartGroup);
|
||||
|
||||
var ambient = new THREE.AmbientLight(0x406080, 1.8);
|
||||
scene.add(ambient);
|
||||
|
||||
var key = new THREE.DirectionalLight(0x9fe7ff, 2.4);
|
||||
key.position.set(4, 7, 8);
|
||||
scene.add(key);
|
||||
|
||||
var rim = new THREE.DirectionalLight(0xff7b4d, 1.7);
|
||||
rim.position.set(-7, 4, -5);
|
||||
scene.add(rim);
|
||||
|
||||
var magentaPoint = new THREE.PointLight(0xff4fd8, 18, 28, 2);
|
||||
magentaPoint.position.set(-6, 4, 7);
|
||||
scene.add(magentaPoint);
|
||||
|
||||
var cyanPoint = new THREE.PointLight(0x29e7ff, 20, 28, 2);
|
||||
cyanPoint.position.set(7, 2, 6);
|
||||
scene.add(cyanPoint);
|
||||
|
||||
var floor = new THREE.Mesh(
|
||||
new THREE.PlaneGeometry(18, 12),
|
||||
new THREE.MeshStandardMaterial({
|
||||
color: 0x041018,
|
||||
metalness: 0.2,
|
||||
roughness: 0.9,
|
||||
}),
|
||||
);
|
||||
floor.rotation.x = -Math.PI / 2;
|
||||
floor.position.y = -0.02;
|
||||
floor.position.z = 0.35;
|
||||
chartGroup.add(floor);
|
||||
|
||||
var gridMaterial = new THREE.MeshBasicMaterial({
|
||||
color: 0x0f9fb5,
|
||||
transparent: true,
|
||||
opacity: 0.22,
|
||||
});
|
||||
|
||||
var gridLines = [];
|
||||
function addGridLine(x, y, z, sx, sy, sz) {
|
||||
var mesh = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), gridMaterial.clone());
|
||||
mesh.position.set(x, y, z);
|
||||
mesh.scale.set(sx, sy, sz);
|
||||
mesh.material.opacity = 0;
|
||||
chartGroup.add(mesh);
|
||||
gridLines.push(mesh);
|
||||
}
|
||||
|
||||
for (var gx = -6; gx <= 6; gx += 2) addGridLine(gx, 0.01, 0.5, 0.03, 0.03, 9.6);
|
||||
for (var gz = -3; gz <= 5; gz += 2) addGridLine(0, 0.01, gz, 13.6, 0.03, 0.03);
|
||||
|
||||
var axisMaterial = new THREE.MeshStandardMaterial({
|
||||
color: 0xb8f9ff,
|
||||
emissive: 0x0f9fb5,
|
||||
emissiveIntensity: 0.35,
|
||||
roughness: 0.35,
|
||||
metalness: 0.15,
|
||||
});
|
||||
|
||||
var xAxis = new THREE.Mesh(new THREE.BoxGeometry(13, 0.08, 0.08), axisMaterial);
|
||||
xAxis.position.set(0, 0.04, 3.7);
|
||||
chartGroup.add(xAxis);
|
||||
|
||||
var yAxis = new THREE.Mesh(new THREE.BoxGeometry(0.08, 5.8, 0.08), axisMaterial);
|
||||
yAxis.position.set(-6.3, 2.9, 3.7);
|
||||
chartGroup.add(yAxis);
|
||||
|
||||
var zAxis = new THREE.Mesh(new THREE.BoxGeometry(0.08, 0.08, 8.2), axisMaterial);
|
||||
zAxis.position.set(-6.3, 0.04, -0.1);
|
||||
chartGroup.add(zAxis);
|
||||
|
||||
var colors = [0xff5f7a, 0xffa63d, 0x29e7ff, 0x89ff65, 0xbb6dff];
|
||||
var barHeights = [2.2, 3.4, 4.1, 5.4, 4.6];
|
||||
var xPositions = [-4.8, -2.3, 0.2, 2.7, 5.2];
|
||||
var zPositions = [-1.8, -0.9, 0, 0.8, 1.6];
|
||||
var dataNodes = [];
|
||||
var barGeometry = new THREE.BoxGeometry(1, 1, 1);
|
||||
var sphereGeometry = new THREE.IcosahedronGeometry(0.7, 4);
|
||||
var ringGeometry = new THREE.TorusGeometry(0.92, 0.09, 18, 72);
|
||||
|
||||
function makeGlowMaterial(hex) {
|
||||
return new THREE.MeshStandardMaterial({
|
||||
color: hex,
|
||||
emissive: hex,
|
||||
emissiveIntensity: 1.1,
|
||||
roughness: 0.28,
|
||||
metalness: 0.22,
|
||||
transparent: true,
|
||||
});
|
||||
}
|
||||
|
||||
for (var i = 0; i < barHeights.length; i++) {
|
||||
var group = new THREE.Group();
|
||||
chartGroup.add(group);
|
||||
|
||||
var bar = new THREE.Mesh(barGeometry, makeGlowMaterial(colors[i]));
|
||||
bar.scale.set(0.88, 0.001, 0.88);
|
||||
bar.position.set(0, 0.0005, 0);
|
||||
group.add(bar);
|
||||
|
||||
var sphere = new THREE.Mesh(sphereGeometry, makeGlowMaterial(colors[i]));
|
||||
group.add(sphere);
|
||||
|
||||
var ring = new THREE.Mesh(
|
||||
ringGeometry,
|
||||
new THREE.MeshBasicMaterial({
|
||||
color: colors[i],
|
||||
transparent: true,
|
||||
opacity: 0.7,
|
||||
}),
|
||||
);
|
||||
ring.rotation.x = Math.PI / 2;
|
||||
group.add(ring);
|
||||
|
||||
dataNodes.push({
|
||||
group: group,
|
||||
bar: bar,
|
||||
sphere: sphere,
|
||||
ring: ring,
|
||||
height: barHeights[i],
|
||||
color: new THREE.Color(colors[i]),
|
||||
targetX: xPositions[i],
|
||||
targetZ: zPositions[i],
|
||||
});
|
||||
}
|
||||
|
||||
var lineMaterial = new THREE.MeshStandardMaterial({
|
||||
color: 0xffefb7,
|
||||
emissive: 0xffb84d,
|
||||
emissiveIntensity: 0.65,
|
||||
roughness: 0.25,
|
||||
metalness: 0.08,
|
||||
transparent: true,
|
||||
opacity: 0,
|
||||
});
|
||||
|
||||
var pointMaterial = new THREE.MeshStandardMaterial({
|
||||
color: 0xfff3cf,
|
||||
emissive: 0xffd77a,
|
||||
emissiveIntensity: 0.8,
|
||||
roughness: 0.2,
|
||||
metalness: 0.1,
|
||||
transparent: true,
|
||||
opacity: 0,
|
||||
});
|
||||
|
||||
var lineSegments = [];
|
||||
var pointMarkers = [];
|
||||
for (var li = 0; li < dataNodes.length - 1; li++) {
|
||||
var seg = new THREE.Mesh(
|
||||
new THREE.CylinderGeometry(0.07, 0.07, 1, 12),
|
||||
lineMaterial.clone(),
|
||||
);
|
||||
chartGroup.add(seg);
|
||||
lineSegments.push(seg);
|
||||
}
|
||||
for (var pi = 0; pi < dataNodes.length; pi++) {
|
||||
var marker = new THREE.Mesh(
|
||||
new THREE.SphereGeometry(0.16, 14, 14),
|
||||
pointMaterial.clone(),
|
||||
);
|
||||
chartGroup.add(marker);
|
||||
pointMarkers.push(marker);
|
||||
}
|
||||
|
||||
function setSegment(mesh, start, end, opacity) {
|
||||
var dir = new THREE.Vector3().subVectors(end, start);
|
||||
var length = dir.length();
|
||||
mesh.position.copy(start).add(end).multiplyScalar(0.5);
|
||||
mesh.scale.set(1, length, 1);
|
||||
mesh.quaternion.setFromUnitVectors(new THREE.Vector3(0, 1, 0), dir.normalize());
|
||||
mesh.material.opacity = opacity;
|
||||
}
|
||||
|
||||
function updateSceneAtTime(t) {
|
||||
var morph = easeInOut(smoothStep(1.3, 4.7, t));
|
||||
var lineReveal = smoothStep(4.6, 6.2, t);
|
||||
var rotateReveal = easeInOut(smoothStep(5.2, 8.6, t));
|
||||
var settle = smoothStep(8.2, 10.0, t);
|
||||
var scenePulse = 0.5 + 0.5 * Math.sin(t * 2.2);
|
||||
|
||||
chartGroup.position.set(0, -1.6, 0);
|
||||
chartGroup.rotation.x = mix(-0.12, -0.72, rotateReveal);
|
||||
chartGroup.rotation.y = mix(-0.38, 0.68, rotateReveal);
|
||||
chartGroup.rotation.z = mix(0.08, -0.06, rotateReveal * 0.8);
|
||||
|
||||
floor.material.opacity = 1;
|
||||
floor.material.emissive = new THREE.Color(0x000000);
|
||||
|
||||
camera.position.set(
|
||||
mix(0, 1.2, rotateReveal) + Math.sin(t * 0.33) * 0.18,
|
||||
mix(4.5, 5.9, rotateReveal) + Math.cos(t * 0.27) * 0.12,
|
||||
mix(15, 13.8, rotateReveal),
|
||||
);
|
||||
camera.lookAt(0.4, 1.95 + morph * 0.55, 0.7);
|
||||
|
||||
key.intensity = mix(1.9, 2.8, rotateReveal);
|
||||
rim.intensity = mix(1.2, 2.0, rotateReveal);
|
||||
magentaPoint.intensity = 14 + scenePulse * 5;
|
||||
cyanPoint.intensity = 16 + (1 - scenePulse) * 5;
|
||||
|
||||
for (var gi = 0; gi < gridLines.length; gi++) {
|
||||
var gridFade = smoothStep(2.6 + gi * 0.03, 5.4 + gi * 0.03, t);
|
||||
gridLines[gi].material.opacity = 0.08 + 0.18 * gridFade;
|
||||
}
|
||||
|
||||
xAxis.material.opacity = smoothStep(2.0, 3.8, t);
|
||||
yAxis.material.opacity = smoothStep(2.1, 3.9, t);
|
||||
zAxis.material.opacity = smoothStep(2.3, 4.1, t);
|
||||
|
||||
var topPoints = [];
|
||||
|
||||
for (var i = 0; i < dataNodes.length; i++) {
|
||||
var node = dataNodes[i];
|
||||
var lift = 1.3 + i * 0.25;
|
||||
var intro = clamp01(t / 1.8);
|
||||
var orbit = Math.sin(t * 1.2 + i * 1.35) * 0.8;
|
||||
var spiralX = Math.cos(t * 1.4 + i * 1.7) * (3.8 - i * 0.25);
|
||||
var spiralZ = Math.sin(t * 1.05 + i * 1.9) * 2.6;
|
||||
var floatY = 1.6 + Math.sin(t * 1.8 + i) * 0.7 + lift;
|
||||
|
||||
var targetX = node.targetX;
|
||||
var targetZ = node.targetZ;
|
||||
var targetHeight = node.height;
|
||||
var barHeight = 0.001 + targetHeight * morph;
|
||||
|
||||
node.group.position.set(
|
||||
mix(spiralX, targetX, morph),
|
||||
0,
|
||||
mix(spiralZ, targetZ, morph),
|
||||
);
|
||||
|
||||
node.bar.scale.set(0.88, barHeight, 0.88);
|
||||
node.bar.position.set(0, barHeight * 0.5, 0);
|
||||
|
||||
var capY = mix(floatY, targetHeight + 0.24, morph);
|
||||
var stretchY = mix(1.0 + intro * 0.35, 0.52 + targetHeight * 0.12, morph);
|
||||
var squashXZ = mix(1.0, 0.74, morph);
|
||||
|
||||
node.sphere.position.set(0, capY, 0);
|
||||
node.sphere.scale.set(squashXZ, stretchY, squashXZ);
|
||||
node.sphere.rotation.x = t * 0.7 + i * 0.3;
|
||||
node.sphere.rotation.y = t * 1.1 + i * 0.45;
|
||||
|
||||
node.ring.position.set(0, mix(floatY - 0.12, targetHeight + 0.16, morph), 0);
|
||||
node.ring.rotation.z = t * 0.8 + i;
|
||||
node.ring.rotation.x = Math.PI / 2 + t * 0.35;
|
||||
node.ring.scale.set(
|
||||
mix(1.2, 0.68, morph),
|
||||
mix(1.2, 0.68, morph),
|
||||
mix(1.2, 0.68, morph),
|
||||
);
|
||||
node.ring.material.opacity = mix(0.8, 0.12, morph) * smoothStep(0.0, 0.7, t);
|
||||
|
||||
node.bar.material.opacity = smoothStep(1.0 + i * 0.15, 2.8 + i * 0.15, t);
|
||||
node.bar.material.emissiveIntensity =
|
||||
mix(0.65, 1.15, rotateReveal) + Math.sin(t * 2.5 + i) * 0.04;
|
||||
node.sphere.material.opacity = mix(1.0, 0.55, morph);
|
||||
node.sphere.material.emissiveIntensity = 0.9 + scenePulse * 0.35;
|
||||
|
||||
topPoints.push(new THREE.Vector3(targetX, targetHeight + 0.24, targetZ));
|
||||
}
|
||||
|
||||
for (var si = 0; si < lineSegments.length; si++) {
|
||||
var start = topPoints[si];
|
||||
var end = topPoints[si + 1];
|
||||
var segProgress = clamp01((lineReveal - si * 0.16) / 0.6);
|
||||
var visibleEnd = start.clone().lerp(end, segProgress);
|
||||
setSegment(lineSegments[si], start, visibleEnd, segProgress * 0.95);
|
||||
}
|
||||
|
||||
for (var mi = 0; mi < pointMarkers.length; mi++) {
|
||||
var markerProgress = clamp01((lineReveal - mi * 0.12) / 0.5);
|
||||
pointMarkers[mi].position.copy(topPoints[mi]);
|
||||
pointMarkers[mi].material.opacity = markerProgress;
|
||||
pointMarkers[mi].scale.setScalar(
|
||||
0.8 + markerProgress * 0.9 + Math.sin(t * 3.5 + mi) * 0.06,
|
||||
);
|
||||
}
|
||||
|
||||
if (settle > 0) {
|
||||
chartGroup.rotation.y += Math.sin(t * 0.9) * 0.05 * (1 - settle * 0.5);
|
||||
chartGroup.rotation.x += Math.cos(t * 0.8) * 0.025 * (1 - settle * 0.65);
|
||||
}
|
||||
}
|
||||
|
||||
function renderAscii(t) {
|
||||
updateSceneAtTime(t);
|
||||
|
||||
renderer.setRenderTarget(target);
|
||||
renderer.render(scene, camera);
|
||||
renderer.readRenderTargetPixels(target, 0, 0, COLS, ROWS, pixels);
|
||||
renderer.setRenderTarget(null);
|
||||
|
||||
ctx.fillStyle = "#030506";
|
||||
ctx.fillRect(0, 0, W, H);
|
||||
ctx.font = CELL_H - 1 + "px Menlo, Consolas, monospace";
|
||||
ctx.textBaseline = "top";
|
||||
|
||||
var lastFill = "";
|
||||
for (var row = 0; row < ROWS; row++) {
|
||||
for (var col = 0; col < COLS; col++) {
|
||||
var py = ROWS - 1 - row;
|
||||
var idx = (py * COLS + col) * 4;
|
||||
var r = pixels[idx];
|
||||
var g = pixels[idx + 1];
|
||||
var b = pixels[idx + 2];
|
||||
|
||||
var luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255;
|
||||
var glow = Math.max(r, Math.max(g, b)) / 255;
|
||||
var dither = BAYER[row & 3][col & 3];
|
||||
|
||||
var wave =
|
||||
Math.sin(col * 0.055 + t * 1.6) * 0.035 + Math.cos(row * 0.21 + t * 1.1) * 0.02;
|
||||
var bright = clamp01(0.06 + luminance * 1.85 + glow * 0.28 + wave);
|
||||
var scaled = bright * GLYPH_MAX;
|
||||
var base = Math.floor(scaled);
|
||||
var frac = scaled - base;
|
||||
var level = base + (frac > dither ? 1 : 0);
|
||||
if (level < 1 && bright > 0.035) level = 1;
|
||||
if (level > GLYPH_MAX) level = GLYPH_MAX;
|
||||
|
||||
var scan = 0.9 + 0.1 * Math.sin(row * 0.65 + t * 1.25);
|
||||
var vx = col / COLS - 0.5;
|
||||
var vy = row / ROWS - 0.5;
|
||||
var vignette = 1 - (vx * vx + vy * vy) * 0.45;
|
||||
if (vignette < 0.52) vignette = 0.52;
|
||||
|
||||
var tint = 0.95 + hash(col * 13 + row * 17) * 0.1;
|
||||
var colorBoost = 1.22 + glow * 0.18;
|
||||
var finalR = Math.min(255, Math.round(r * scan * vignette * tint * colorBoost));
|
||||
var finalG = Math.min(255, Math.round(g * scan * vignette * colorBoost));
|
||||
var finalB = Math.min(
|
||||
255,
|
||||
Math.round(b * scan * vignette * (1.04 + glow * 0.1) * colorBoost),
|
||||
);
|
||||
|
||||
var fill = "rgb(" + finalR + "," + finalG + "," + finalB + ")";
|
||||
if (fill !== lastFill) {
|
||||
ctx.fillStyle = fill;
|
||||
lastFill = fill;
|
||||
}
|
||||
ctx.fillText(GLYPHS[level], col * CELL_W, row * CELL_H);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderAscii(0);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["ascii-dashboard"] = {
|
||||
_time: 0,
|
||||
pause: function () {},
|
||||
seek: function (time) {
|
||||
this._time = Math.max(0, Math.min(10, Number(time) || 0));
|
||||
renderAscii(this._time);
|
||||
},
|
||||
duration: function () {
|
||||
return 10;
|
||||
},
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "ascii-dashboard",
|
||||
"type": "hyperframes:block",
|
||||
"title": "ASCII Dashboard",
|
||||
"description": "Retro terminal-style data visualization with charts and metrics",
|
||||
"tags": ["data", "ascii", "dashboard"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 10,
|
||||
"files": [
|
||||
{
|
||||
"path": "ascii-dashboard.html",
|
||||
"target": "compositions/ascii-dashboard.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,652 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>ascii-lightning</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
background-color: #0a0a0f;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
data-composition-id="ascii-lightning"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
data-duration="9"
|
||||
>
|
||||
<canvas id="al-canvas" width="1920" height="1080"></canvas>
|
||||
|
||||
<style>
|
||||
[data-composition-id="ascii-lightning"] {
|
||||
position: relative;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #000;
|
||||
}
|
||||
#al-canvas {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<script>
|
||||
(function initAsciiLightning() {
|
||||
var root = document.querySelector('[data-composition-id="ascii-lightning"]');
|
||||
if (!root) {
|
||||
setTimeout(initAsciiLightning, 50);
|
||||
return;
|
||||
}
|
||||
var canvas = root.querySelector("#al-canvas");
|
||||
if (!canvas) {
|
||||
setTimeout(initAsciiLightning, 50);
|
||||
return;
|
||||
}
|
||||
|
||||
var W = 1920,
|
||||
H = 1080;
|
||||
var ctx = canvas.getContext("2d");
|
||||
var CELL_W = 10,
|
||||
CELL_H = 16;
|
||||
var COLS = Math.floor(W / CELL_W);
|
||||
var ROWS = Math.floor(H / CELL_H);
|
||||
var GLYPHS = " .,:;+*#@W";
|
||||
var GLYPH_MAX = GLYPHS.length - 1;
|
||||
var BAYER = [
|
||||
[0.03125, 0.53125, 0.15625, 0.65625],
|
||||
[0.78125, 0.28125, 0.90625, 0.40625],
|
||||
[0.21875, 0.71875, 0.09375, 0.59375],
|
||||
[0.96875, 0.46875, 0.84375, 0.34375],
|
||||
];
|
||||
|
||||
// ═══════════════════════════════════════════════════════
|
||||
// DETERMINISTIC HASH & NOISE
|
||||
// ═══════════════════════════════════════════════════════
|
||||
function hash(x, y) {
|
||||
var n = x * 374761393 + y * 668265263;
|
||||
n = (n ^ (n >> 13)) * 1274126177;
|
||||
return ((n ^ (n >> 16)) & 0x7fffffff) / 0x7fffffff;
|
||||
}
|
||||
function vnoise(x, y) {
|
||||
var ix = Math.floor(x),
|
||||
iy = Math.floor(y);
|
||||
var fx = x - ix,
|
||||
fy = y - iy;
|
||||
fx = fx * fx * (3 - 2 * fx);
|
||||
fy = fy * fy * (3 - 2 * fy);
|
||||
var a = hash(ix, iy),
|
||||
b = hash(ix + 1, iy);
|
||||
var c = hash(ix, iy + 1),
|
||||
d = hash(ix + 1, iy + 1);
|
||||
return a + (b - a) * fx + (c - a) * fy + (a - b - c + d) * fx * fy;
|
||||
}
|
||||
function fbm(x, y) {
|
||||
return (
|
||||
vnoise(x, y) * 0.5 +
|
||||
vnoise(x * 2.1 + 5.3, y * 2.1 + 3.7) * 0.3 +
|
||||
vnoise(x * 4.3 + 11.7, y * 4.3 + 7.1) * 0.2
|
||||
);
|
||||
}
|
||||
function clamp01(v) {
|
||||
return v < 0 ? 0 : v > 1 ? 1 : v;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════
|
||||
// BITMAP FONT 5x5 at 2x scale
|
||||
// ═══════════════════════════════════════════════════════
|
||||
var BFONT = {
|
||||
A: [0b01110, 0b10001, 0b11111, 0b10001, 0b10001],
|
||||
B: [0b11110, 0b10001, 0b11110, 0b10001, 0b11110],
|
||||
C: [0b01111, 0b10000, 0b10000, 0b10000, 0b01111],
|
||||
D: [0b11110, 0b10001, 0b10001, 0b10001, 0b11110],
|
||||
E: [0b11111, 0b10000, 0b11110, 0b10000, 0b11111],
|
||||
F: [0b11111, 0b10000, 0b11110, 0b10000, 0b10000],
|
||||
G: [0b01111, 0b10000, 0b10011, 0b10001, 0b01111],
|
||||
H: [0b10001, 0b10001, 0b11111, 0b10001, 0b10001],
|
||||
I: [0b11111, 0b00100, 0b00100, 0b00100, 0b11111],
|
||||
J: [0b00111, 0b00010, 0b00010, 0b10010, 0b01100],
|
||||
K: [0b10001, 0b10010, 0b11100, 0b10010, 0b10001],
|
||||
L: [0b10000, 0b10000, 0b10000, 0b10000, 0b11111],
|
||||
M: [0b10001, 0b11011, 0b10101, 0b10001, 0b10001],
|
||||
N: [0b10001, 0b11001, 0b10101, 0b10011, 0b10001],
|
||||
O: [0b01110, 0b10001, 0b10001, 0b10001, 0b01110],
|
||||
P: [0b11110, 0b10001, 0b11110, 0b10000, 0b10000],
|
||||
R: [0b11110, 0b10001, 0b11110, 0b10010, 0b10001],
|
||||
S: [0b01111, 0b10000, 0b01110, 0b00001, 0b11110],
|
||||
T: [0b11111, 0b00100, 0b00100, 0b00100, 0b00100],
|
||||
U: [0b10001, 0b10001, 0b10001, 0b10001, 0b01110],
|
||||
V: [0b10001, 0b10001, 0b10001, 0b01010, 0b00100],
|
||||
W: [0b10001, 0b10001, 0b10101, 0b11011, 0b10001],
|
||||
X: [0b10001, 0b01010, 0b00100, 0b01010, 0b10001],
|
||||
Y: [0b10001, 0b01010, 0b00100, 0b00100, 0b00100],
|
||||
Z: [0b11111, 0b00010, 0b00100, 0b01000, 0b11111],
|
||||
" ": [0b00000, 0b00000, 0b00000, 0b00000, 0b00000],
|
||||
};
|
||||
|
||||
var SCALE = 2;
|
||||
var CHAR_W = 5 * SCALE,
|
||||
CHAR_H = 5 * SCALE;
|
||||
var CHAR_STRIDE = CHAR_W + SCALE;
|
||||
|
||||
function textW(text) {
|
||||
return text.length * CHAR_STRIDE - SCALE;
|
||||
}
|
||||
function textHit(text, sx, sy, c, r) {
|
||||
if (r < sy || r >= sy + CHAR_H || c < sx) return 0;
|
||||
var lc2 = c - sx;
|
||||
if (lc2 >= textW(text)) return 0;
|
||||
var ci = Math.floor(lc2 / CHAR_STRIDE);
|
||||
var ic = lc2 - ci * CHAR_STRIDE;
|
||||
if (ci >= text.length || ic >= CHAR_W) return 0;
|
||||
var bx = Math.floor(ic / SCALE);
|
||||
var by = Math.floor((r - sy) / SCALE);
|
||||
var g = BFONT[text[ci]];
|
||||
if (!g) return 0;
|
||||
return (g[by] >> (4 - bx)) & 1;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════
|
||||
// TEXT LAYOUT & MASK
|
||||
// ═══════════════════════════════════════════════════════
|
||||
var TEXT = "HYPERFRAMES";
|
||||
var textX = Math.floor((COLS - textW(TEXT)) / 2);
|
||||
var textY = Math.floor((ROWS - CHAR_H) / 2);
|
||||
var textMask = new Uint8Array(ROWS * COLS);
|
||||
var tw = textW(TEXT);
|
||||
for (var r = textY; r < textY + CHAR_H && r < ROWS; r++) {
|
||||
for (var c = textX; c < textX + tw && c < COLS; c++) {
|
||||
if (textHit(TEXT, textX, textY, c, r)) {
|
||||
textMask[r * COLS + c] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════
|
||||
// PROCEDURAL LIGHTNING — bolts strike TOP of text, energy crawls along letters
|
||||
// ═══════════════════════════════════════════════════════
|
||||
var textTopY = textY;
|
||||
|
||||
function generateBolt(startX, targetX, seed, branchCount) {
|
||||
// Bolt zigzags from top of screen down to the TOP of the text
|
||||
var segments = [];
|
||||
var x = startX,
|
||||
y = 0;
|
||||
var step = 0;
|
||||
while (y < textTopY) {
|
||||
var stepY = 3 + Math.floor(hash(seed + step, 100) * 4);
|
||||
var progress = Math.min(1.0, y / textTopY);
|
||||
var attract = (targetX - x) * progress * 0.35;
|
||||
var jitter = (hash(seed + step, 200) - 0.5) * 14 * (1.0 - progress * 0.8);
|
||||
var stepX = attract + jitter;
|
||||
var newX = Math.max(3, Math.min(COLS - 3, Math.floor(x + stepX)));
|
||||
var newY = Math.min(textTopY, y + stepY);
|
||||
segments.push({ x1: x, y1: y, x2: newX, y2: newY });
|
||||
x = newX;
|
||||
y = newY;
|
||||
step++;
|
||||
}
|
||||
// Final segment connects directly to the target on the text top edge
|
||||
if (segments.length > 0) {
|
||||
var last = segments[segments.length - 1];
|
||||
if (last.y2 < textTopY) {
|
||||
segments.push({ x1: last.x2, y1: last.y2, x2: targetX, y2: textTopY });
|
||||
}
|
||||
}
|
||||
// Strike point: where bolt meets the text
|
||||
var strikeCol = segments.length > 0 ? segments[segments.length - 1].x2 : targetX;
|
||||
var strikeRow = textTopY;
|
||||
|
||||
// Branches — only above the text
|
||||
var branches = [];
|
||||
var bc = branchCount || Math.floor(hash(seed, 300) * 3) + 2;
|
||||
for (var bi = 0; bi < bc; bi++) {
|
||||
var segIdx = Math.floor(hash(seed + bi * 13, 400) * segments.length);
|
||||
var seg = segments[Math.min(segIdx, segments.length - 1)];
|
||||
var bx = seg.x2,
|
||||
by = seg.y2;
|
||||
var bsegs = [];
|
||||
var bseed = seed + 1000 + bi * 77;
|
||||
var bstep = 0;
|
||||
var blen = 3 + Math.floor(hash(bseed, 500) * 4);
|
||||
var dir = hash(bseed, 600) > 0.5 ? 1 : -1;
|
||||
for (var bs = 0; bs < blen && by < textTopY; bs++) {
|
||||
var bStepY = 2 + Math.floor(hash(bseed + bstep, 700) * 3);
|
||||
var bStepX = dir * (2 + hash(bseed + bstep, 800) * 6);
|
||||
var nbx = Math.max(2, Math.min(COLS - 2, Math.floor(bx + bStepX)));
|
||||
var nby = Math.min(textTopY, by + bStepY);
|
||||
bsegs.push({ x1: bx, y1: by, x2: nbx, y2: nby });
|
||||
bx = nbx;
|
||||
by = nby;
|
||||
bstep++;
|
||||
}
|
||||
branches.push({ segments: bsegs, brightness: 0.3 + hash(bseed, 900) * 0.35 });
|
||||
}
|
||||
return {
|
||||
segments: segments,
|
||||
branches: branches,
|
||||
strikeCol: strikeCol,
|
||||
strikeRow: strikeRow,
|
||||
};
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════
|
||||
// BFS CRAWL MAPS — electricity crawls through text pixels from strike point
|
||||
// ═══════════════════════════════════════════════════════
|
||||
function buildCrawlMap(startCol, startRow) {
|
||||
// BFS through textMask from the strike point
|
||||
// Can jump gaps up to 3 cells (bridges between letters)
|
||||
var dist = new Float32Array(ROWS * COLS);
|
||||
for (var i = 0; i < dist.length; i++) dist[i] = -1;
|
||||
// Find nearest text pixel to the strike point (wide search)
|
||||
var bestD = 9999,
|
||||
bestC = startCol,
|
||||
bestR = startRow;
|
||||
for (var dr = -8; dr <= 8; dr++) {
|
||||
for (var dc = -8; dc <= 8; dc++) {
|
||||
var nr = startRow + dr,
|
||||
nc = startCol + dc;
|
||||
if (nr >= 0 && nr < ROWS && nc >= 0 && nc < COLS && textMask[nr * COLS + nc]) {
|
||||
var d2 = dr * dr + dc * dc;
|
||||
if (d2 < bestD) {
|
||||
bestD = d2;
|
||||
bestC = nc;
|
||||
bestR = nr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bestD === 9999) return dist;
|
||||
// BFS with gap-jumping: check neighbors up to 3 cells away
|
||||
var queue = [bestR * COLS + bestC];
|
||||
dist[bestR * COLS + bestC] = 0;
|
||||
var head = 0;
|
||||
var GAP = 3;
|
||||
while (head < queue.length) {
|
||||
var cur = queue[head++];
|
||||
var curDist = dist[cur];
|
||||
var cr2 = Math.floor(cur / COLS),
|
||||
cc = cur % COLS;
|
||||
for (var dr2 = -GAP; dr2 <= GAP; dr2++) {
|
||||
for (var dc2 = -GAP; dc2 <= GAP; dc2++) {
|
||||
if (dr2 === 0 && dc2 === 0) continue;
|
||||
var nr3 = cr2 + dr2,
|
||||
nc3 = cc + dc2;
|
||||
if (nr3 < 0 || nr3 >= ROWS || nc3 < 0 || nc3 >= COLS) continue;
|
||||
var ni = nr3 * COLS + nc3;
|
||||
if (dist[ni] >= 0) continue;
|
||||
if (!textMask[ni]) continue;
|
||||
var stepDist = Math.sqrt(dr2 * dr2 + dc2 * dc2);
|
||||
var newDist = curDist + stepDist;
|
||||
dist[ni] = newDist;
|
||||
queue.push(ni);
|
||||
}
|
||||
}
|
||||
}
|
||||
return dist;
|
||||
}
|
||||
|
||||
var letterCenterX = function (idx) {
|
||||
return textX + idx * CHAR_STRIDE + Math.floor(CHAR_W / 2);
|
||||
};
|
||||
|
||||
// 5 quick strikes → 1 mega strike that holds for 3s
|
||||
var BOLTS = [
|
||||
{
|
||||
strikeTime: 0.6,
|
||||
decayRate: 7,
|
||||
bolt: generateBolt(15, letterCenterX(0), 1001, 3),
|
||||
mega: false,
|
||||
crawlSpeed: 60,
|
||||
},
|
||||
{
|
||||
strikeTime: 1.3,
|
||||
decayRate: 7,
|
||||
bolt: generateBolt(175, letterCenterX(10), 2002, 3),
|
||||
mega: false,
|
||||
crawlSpeed: 60,
|
||||
},
|
||||
{
|
||||
strikeTime: 2.0,
|
||||
decayRate: 7,
|
||||
bolt: generateBolt(120, letterCenterX(6), 3003, 3),
|
||||
mega: false,
|
||||
crawlSpeed: 60,
|
||||
},
|
||||
{
|
||||
strikeTime: 2.7,
|
||||
decayRate: 7,
|
||||
bolt: generateBolt(50, letterCenterX(2), 4004, 3),
|
||||
mega: false,
|
||||
crawlSpeed: 60,
|
||||
},
|
||||
{
|
||||
strikeTime: 3.4,
|
||||
decayRate: 7,
|
||||
bolt: generateBolt(150, letterCenterX(8), 5005, 3),
|
||||
mega: false,
|
||||
crawlSpeed: 60,
|
||||
},
|
||||
// MEGA: strikes center, fast crawl fills all text, holds bright for 3s
|
||||
{
|
||||
strikeTime: 4.2,
|
||||
decayRate: 0,
|
||||
bolt: generateBolt(96, letterCenterX(5), 7777, 10),
|
||||
mega: true,
|
||||
crawlSpeed: 250,
|
||||
holdTime: 3.0,
|
||||
},
|
||||
];
|
||||
|
||||
// Pre-compute crawl maps and bounding boxes for each bolt
|
||||
for (var bi = 0; bi < BOLTS.length; bi++) {
|
||||
var b = BOLTS[bi].bolt;
|
||||
BOLTS[bi].crawlMap = buildCrawlMap(b.strikeCol, b.strikeRow);
|
||||
var minC = COLS,
|
||||
maxC = 0;
|
||||
for (var si = 0; si < b.segments.length; si++) {
|
||||
var s = b.segments[si];
|
||||
if (s.x1 < minC) minC = s.x1;
|
||||
if (s.x2 < minC) minC = s.x2;
|
||||
if (s.x1 > maxC) maxC = s.x1;
|
||||
if (s.x2 > maxC) maxC = s.x2;
|
||||
}
|
||||
for (var bri = 0; bri < b.branches.length; bri++) {
|
||||
var br = b.branches[bri];
|
||||
for (var bsi = 0; bsi < br.segments.length; bsi++) {
|
||||
var bs2 = br.segments[bsi];
|
||||
if (bs2.x1 < minC) minC = bs2.x1;
|
||||
if (bs2.x2 < minC) minC = bs2.x2;
|
||||
if (bs2.x1 > maxC) maxC = bs2.x1;
|
||||
if (bs2.x2 > maxC) maxC = bs2.x2;
|
||||
}
|
||||
}
|
||||
BOLTS[bi].minCol = minC - 35;
|
||||
BOLTS[bi].maxCol = maxC + 35;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════
|
||||
// ILLUMINATION BUFFER & BOLT BRIGHTNESS
|
||||
// ═══════════════════════════════════════════════════════
|
||||
var illumBuf = new Float32Array(ROWS * COLS);
|
||||
|
||||
function boltBrightness(bolt, t) {
|
||||
var dt = t - bolt.strikeTime;
|
||||
if (dt < 0) return 0;
|
||||
if (bolt.mega) {
|
||||
// Mega bolt: bright flash, then gentle glow during hold
|
||||
if (dt > (bolt.holdTime || 0) + 1.0) return 0;
|
||||
var attack = clamp01(dt / 0.02);
|
||||
var decay = Math.exp(-dt * 4.0);
|
||||
var flicker = 0;
|
||||
if (dt > 0.04 && dt < 0.08) flicker = 0.5 * Math.exp(-Math.pow(dt - 0.06, 2) * 8000);
|
||||
if (dt > 0.1 && dt < 0.16) flicker = 0.3 * Math.exp(-Math.pow(dt - 0.13, 2) * 5000);
|
||||
// Keep a subtle glow during the hold period
|
||||
var holdGlow = dt < (bolt.holdTime || 0) ? 0.15 : 0;
|
||||
return attack * Math.max(decay + flicker, holdGlow);
|
||||
}
|
||||
if (dt > 1.5) return 0;
|
||||
var attack = clamp01(dt / 0.02);
|
||||
var decay = Math.exp(-dt * bolt.decayRate);
|
||||
var flicker = 0;
|
||||
if (dt > 0.04 && dt < 0.08) flicker = 0.5 * Math.exp(-Math.pow(dt - 0.06, 2) * 8000);
|
||||
if (dt > 0.1 && dt < 0.16) flicker = 0.3 * Math.exp(-Math.pow(dt - 0.13, 2) * 5000);
|
||||
return attack * (decay + flicker);
|
||||
}
|
||||
|
||||
// Paint a single segment's glow into illumBuf
|
||||
function paintSegGlow(x1, y1, x2, y2, strength, radius) {
|
||||
var mnR = Math.max(0, Math.floor(Math.min(y1, y2) - radius));
|
||||
var mxR = Math.min(ROWS - 1, Math.ceil(Math.max(y1, y2) + radius));
|
||||
var mnC = Math.max(0, Math.floor(Math.min(x1, x2) - radius));
|
||||
var mxC = Math.min(COLS - 1, Math.ceil(Math.max(x1, x2) + radius));
|
||||
var dx = x2 - x1,
|
||||
dy = y2 - y1;
|
||||
var lenSq = dx * dx + dy * dy;
|
||||
for (var r = mnR; r <= mxR; r++) {
|
||||
for (var c = mnC; c <= mxC; c++) {
|
||||
var dist;
|
||||
if (lenSq < 0.001) {
|
||||
var ex = c - x1,
|
||||
ey = r - y1;
|
||||
dist = Math.sqrt(ex * ex + ey * ey);
|
||||
} else {
|
||||
var t2 = ((c - x1) * dx + (r - y1) * dy) / lenSq;
|
||||
if (t2 < 0) t2 = 0;
|
||||
if (t2 > 1) t2 = 1;
|
||||
var px = x1 + t2 * dx,
|
||||
py = y1 + t2 * dy;
|
||||
var ex2 = c - px,
|
||||
ey2 = r - py;
|
||||
dist = Math.sqrt(ex2 * ex2 + ey2 * ey2);
|
||||
}
|
||||
if (dist < radius) {
|
||||
var val = strength * (1.0 - dist / radius);
|
||||
var idx = r * COLS + c;
|
||||
if (val > illumBuf[idx]) illumBuf[idx] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Paint a radial impact bloom at the strike point
|
||||
function paintImpact(cx, cy, strength, radius) {
|
||||
var mnR = Math.max(0, Math.floor(cy - radius));
|
||||
var mxR = Math.min(ROWS - 1, Math.ceil(cy + radius));
|
||||
var mnC = Math.max(0, Math.floor(cx - radius));
|
||||
var mxC = Math.min(COLS - 1, Math.ceil(cx + radius));
|
||||
for (var r = mnR; r <= mxR; r++) {
|
||||
for (var c = mnC; c <= mxC; c++) {
|
||||
var dx = c - cx,
|
||||
dy = r - cy;
|
||||
var dist = Math.sqrt(dx * dx + dy * dy);
|
||||
if (dist < radius) {
|
||||
var falloff = 1.0 - dist / radius;
|
||||
var val = strength * falloff * falloff;
|
||||
var idx = r * COLS + c;
|
||||
if (val > illumBuf[idx]) illumBuf[idx] = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function paintBolt(boltData, bb, mega) {
|
||||
var radius = mega ? 45 : 20;
|
||||
var segs = boltData.segments;
|
||||
for (var i = 0; i < segs.length; i++) {
|
||||
paintSegGlow(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2, bb, radius);
|
||||
}
|
||||
var brs = boltData.branches;
|
||||
for (var j = 0; j < brs.length; j++) {
|
||||
var br = brs[j];
|
||||
var brSegs = br.segments;
|
||||
var brStr = bb * br.brightness;
|
||||
var brRad = radius * 0.6;
|
||||
for (var k = 0; k < brSegs.length; k++) {
|
||||
paintSegGlow(brSegs[k].x1, brSegs[k].y1, brSegs[k].x2, brSegs[k].y2, brStr, brRad);
|
||||
}
|
||||
}
|
||||
// Impact bloom at the strike point — extra bright glow where bolt meets text
|
||||
var impactRadius = mega ? 55 : 28;
|
||||
paintImpact(boltData.strikeCol, boltData.strikeRow, bb * 1.2, impactRadius);
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════
|
||||
// RENDER
|
||||
// ═══════════════════════════════════════════════════════
|
||||
function renderAtTime(t) {
|
||||
ctx.fillStyle = "#000";
|
||||
ctx.fillRect(0, 0, W, H);
|
||||
ctx.font = CELL_H - 2 + "px monospace";
|
||||
ctx.textBaseline = "top";
|
||||
|
||||
// Fade out in the last 1.5s of the composition
|
||||
var TOTAL_DUR = 9.0;
|
||||
var globalFade = clamp01((TOTAL_DUR - t) / 1.5);
|
||||
|
||||
// Clear and fill illumination buffer (for bolt glow in the sky)
|
||||
for (var i = 0; i < illumBuf.length; i++) illumBuf[i] = 0;
|
||||
// Also build per-cell crawl illumination for text
|
||||
var crawlBuf = new Float32Array(ROWS * COLS);
|
||||
for (var bi = 0; bi < BOLTS.length; bi++) {
|
||||
var bb = boltBrightness(BOLTS[bi], t);
|
||||
// For mega bolt, keep painting even after the flash fades (for the hold)
|
||||
var dt = t - BOLTS[bi].strikeTime;
|
||||
if (bb > 0.001) {
|
||||
paintBolt(BOLTS[bi].bolt, bb, BOLTS[bi].mega);
|
||||
}
|
||||
// Crawl effect: electricity spreads through text pixels from strike point
|
||||
if (dt > 0) {
|
||||
var crawlMap = BOLTS[bi].crawlMap;
|
||||
var crawlRadius = dt * BOLTS[bi].crawlSpeed;
|
||||
var holdTime = BOLTS[bi].holdTime || 0;
|
||||
var crawlDecay;
|
||||
if (BOLTS[bi].mega) {
|
||||
// Mega bolt: stays at full brightness during hold, then fades
|
||||
if (dt < holdTime) {
|
||||
crawlDecay = 1.0;
|
||||
} else {
|
||||
crawlDecay = Math.exp(-(dt - holdTime) * 3.0);
|
||||
}
|
||||
} else {
|
||||
crawlDecay = Math.exp(-dt * 5.0);
|
||||
}
|
||||
if (crawlDecay < 0.005) continue;
|
||||
for (var ci = 0; ci < crawlMap.length; ci++) {
|
||||
if (crawlMap[ci] < 0) continue;
|
||||
if (crawlMap[ci] > crawlRadius) continue;
|
||||
var waveDist = crawlRadius - crawlMap[ci];
|
||||
var waveBright = crawlDecay;
|
||||
// Extra bright at the wavefront (leading edge of crawl)
|
||||
if (waveDist < 8 && dt < 1.0) {
|
||||
waveBright *= 1.0 + (1.0 - waveDist / 8) * 2.0;
|
||||
}
|
||||
if (waveBright > crawlBuf[ci]) crawlBuf[ci] = waveBright;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var lastFill = "";
|
||||
|
||||
for (var row = 0; row < ROWS; row++) {
|
||||
for (var col = 0; col < COLS; col++) {
|
||||
var ambN = fbm(col * 0.03 + t * 0.08, row * 0.04 + t * 0.06);
|
||||
var ambBright = 0.02 + ambN * 0.04;
|
||||
|
||||
if (t < 0.6) {
|
||||
var flickerN = hash(col * 7 + Math.floor(t * 15), row * 11 + Math.floor(t * 15));
|
||||
if (flickerN > 0.997) {
|
||||
ambBright += 0.15 * (1.0 - t / 0.6);
|
||||
}
|
||||
}
|
||||
|
||||
var localIllum = illumBuf[row * COLS + col];
|
||||
var crawlIllum = crawlBuf[row * COLS + col];
|
||||
var isText = textMask[row * COLS + col];
|
||||
var brightness, cr, cg, cb;
|
||||
|
||||
if (isText && crawlIllum > 0.01) {
|
||||
// Text pixel illuminated by crawling electricity
|
||||
var ci2 = clamp01(crawlIllum);
|
||||
brightness = ci2 * globalFade;
|
||||
// Bright crawl front is white-green, trailing is green
|
||||
var whiteness = clamp01(crawlIllum - 0.8) * 3.0;
|
||||
cr = Math.round((10 + whiteness * 220) * brightness);
|
||||
cg = Math.round((60 + ci2 * 195) * brightness);
|
||||
cb = Math.round((5 + whiteness * 180) * brightness);
|
||||
// Also blend in any direct bolt proximity
|
||||
if (localIllum > 0.1) {
|
||||
var boost = localIllum * 0.4;
|
||||
cr = Math.min(255, cr + Math.round(boost * 200));
|
||||
cg = Math.min(255, cg + Math.round(boost * 100));
|
||||
cb = Math.min(255, cb + Math.round(boost * 180));
|
||||
brightness = Math.min(1.0, brightness + boost);
|
||||
}
|
||||
} else if (localIllum > 0.03) {
|
||||
// Non-text cell near a bolt — bolt glow
|
||||
brightness = localIllum * globalFade;
|
||||
var coreAmt = clamp01((localIllum - 0.4) * 2.5);
|
||||
cr = Math.round(coreAmt * 230 * brightness);
|
||||
cg = Math.round((80 + localIllum * 175) * brightness);
|
||||
cb = Math.round(coreAmt * 190 * brightness);
|
||||
} else {
|
||||
brightness = ambBright * globalFade;
|
||||
cr = 0;
|
||||
cg = Math.round((10 + ambN * 20) * brightness);
|
||||
cb = 0;
|
||||
}
|
||||
|
||||
var dither = BAYER[row & 3][col & 3];
|
||||
var sl = brightness * GLYPH_MAX;
|
||||
var bl2 = Math.floor(sl);
|
||||
var fr = sl - bl2;
|
||||
var rl = bl2 + (fr > dither ? 1 : 0);
|
||||
if (rl > GLYPH_MAX) rl = GLYPH_MAX;
|
||||
if (rl < 1 && brightness > 0.01) rl = 1;
|
||||
if (brightness < 0.01) rl = 0;
|
||||
var ch = GLYPHS[rl];
|
||||
|
||||
if (rl === 0) continue;
|
||||
|
||||
var scanline = 0.92 + 0.08 * Math.sin(row * 0.6 + t * 0.8);
|
||||
var vx = col / COLS - 0.5,
|
||||
vy = row / ROWS - 0.5;
|
||||
var vig = 1.0 - (vx * vx + vy * vy) * 0.35;
|
||||
if (vig < 0.55) vig = 0.55;
|
||||
|
||||
var m = scanline * vig;
|
||||
var fr2 = Math.round(cr * m);
|
||||
var fg = Math.round(cg * m);
|
||||
var fb2 = Math.round(cb * m);
|
||||
if (fr2 > 255) fr2 = 255;
|
||||
if (fg > 255) fg = 255;
|
||||
if (fb2 > 255) fb2 = 255;
|
||||
|
||||
var fill = "rgb(" + fr2 + "," + fg + "," + fb2 + ")";
|
||||
if (fill !== lastFill) {
|
||||
ctx.fillStyle = fill;
|
||||
lastFill = fill;
|
||||
}
|
||||
ctx.fillText(ch, col * CELL_W, row * CELL_H);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderAtTime(0);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
var proxy = { time: 0 };
|
||||
tl.to(
|
||||
proxy,
|
||||
{
|
||||
time: 9,
|
||||
duration: 9,
|
||||
ease: "none",
|
||||
onUpdate: function () {
|
||||
renderAtTime(proxy.time);
|
||||
},
|
||||
},
|
||||
0,
|
||||
);
|
||||
window.__timelines["ascii-lightning"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "ascii-lightning",
|
||||
"type": "hyperframes:block",
|
||||
"title": "ASCII Lightning",
|
||||
"description": "Pure ASCII art lightning bolt animation on dark background",
|
||||
"tags": ["title", "ascii", "animation"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 9,
|
||||
"files": [
|
||||
{
|
||||
"path": "ascii-lightning.html",
|
||||
"target": "compositions/ascii-lightning.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,365 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;700&family=Lato:wght@400;700&display=block");
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<style>
|
||||
[data-composition-id="main"] {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #22223b;
|
||||
}
|
||||
|
||||
/* Blueprint grid */
|
||||
.bp-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.bp-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bp-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 60px 60px 60px 40px;
|
||||
}
|
||||
.bp-divider {
|
||||
position: absolute;
|
||||
left: 1200px;
|
||||
top: 60px;
|
||||
bottom: 60px;
|
||||
width: 1px;
|
||||
background: #7678ed;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.bp-number {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.4em;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 60px;
|
||||
color: #7678ed;
|
||||
}
|
||||
|
||||
/* Right panel typography */
|
||||
.bp-name {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 38px;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 20px;
|
||||
color: #7678ed;
|
||||
}
|
||||
.bp-plabel {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 10px;
|
||||
color: #7678ed;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.bp-prompt {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
padding: 16px 20px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #7678ed;
|
||||
background: rgba(118, 120, 237, 0.06);
|
||||
border: 1px solid rgba(118, 120, 237, 0.12);
|
||||
}
|
||||
.bp-desc {
|
||||
font-family: "Lato", sans-serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.6;
|
||||
color: #9a8c98;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* GL scenes (hidden, just for texture capture) */
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 140px;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.12;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="bp-grid"></div>
|
||||
<div class="bp-divider"></div>
|
||||
<div class="bp-number">08 / 14</div>
|
||||
|
||||
<!-- GL demo scenes (captured as textures, then hidden) -->
|
||||
<div id="s1" class="scene" style="background: #22223b">
|
||||
<div class="scene-label" style="color: #7678ed">SCENE A</div>
|
||||
</div>
|
||||
<div id="s2" class="scene" style="background: #7678ed; opacity: 0">
|
||||
<div class="scene-label" style="color: #22223b">SCENE B</div>
|
||||
</div>
|
||||
|
||||
<!-- GL canvas (left panel only) -->
|
||||
<canvas
|
||||
id="gl-canvas"
|
||||
width="1200"
|
||||
height="1080"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
</canvas>
|
||||
|
||||
<!-- Right panel metadata -->
|
||||
<div class="bp-right">
|
||||
<div class="bp-name">Chromatic Radial Split</div>
|
||||
<div class="bp-plabel">Prompt</div>
|
||||
<div class="bp-prompt">"use chromatic radial split shader transition"</div>
|
||||
<div class="bp-desc">
|
||||
RGB channels separate and converge radially. From-scene splits outward, to-scene converges
|
||||
inward.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="driver"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
style="position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
var glCanvas = document.getElementById("gl-canvas");
|
||||
var gl = glCanvas.getContext("webgl", { preserveDrawingBuffer: true });
|
||||
if (!gl) {
|
||||
console.warn("WebGL not available");
|
||||
window.__timelines["main"] = gsap.timeline({ paused: true });
|
||||
} else {
|
||||
gl.viewport(0, 0, 1200, 1080);
|
||||
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
||||
var sceneTextures = {};
|
||||
|
||||
function captureScene(sceneId) {
|
||||
var scene = document.getElementById(sceneId);
|
||||
var origOpacity = scene.style.opacity;
|
||||
var origZ = scene.style.zIndex;
|
||||
scene.style.opacity = "1";
|
||||
scene.style.zIndex = "999";
|
||||
scene.offsetHeight;
|
||||
var c = document.createElement("canvas");
|
||||
c.width = 1200;
|
||||
c.height = 1080;
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = window.getComputedStyle(scene).backgroundColor;
|
||||
ctx.fillRect(0, 0, 1200, 1080);
|
||||
var sr = scene.getBoundingClientRect();
|
||||
var els = scene.querySelectorAll("*");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i],
|
||||
cs = window.getComputedStyle(el);
|
||||
if (cs.display === "none" || cs.visibility === "hidden") continue;
|
||||
var r = el.getBoundingClientRect();
|
||||
if (r.width < 1 || r.height < 1) continue;
|
||||
var x = r.left - sr.left,
|
||||
y = r.top - sr.top,
|
||||
w = r.width,
|
||||
h = r.height;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = parseFloat(cs.opacity) || 1;
|
||||
var bg = cs.backgroundColor;
|
||||
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(x, y, w, h);
|
||||
}
|
||||
var hasChildEls = el.querySelector("div,span,img,video");
|
||||
var text = "";
|
||||
for (var j = 0; j < el.childNodes.length; j++)
|
||||
if (el.childNodes[j].nodeType === 3) text += el.childNodes[j].textContent;
|
||||
text = text.trim();
|
||||
if (text && !hasChildEls) {
|
||||
ctx.font = cs.fontWeight + " " + cs.fontSize + " " + cs.fontFamily;
|
||||
ctx.fillStyle = cs.color;
|
||||
if (cs.letterSpacing && cs.letterSpacing !== "normal")
|
||||
ctx.letterSpacing = cs.letterSpacing;
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + w / 2, y + h / 2);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
scene.style.opacity = origOpacity;
|
||||
scene.style.zIndex = origZ;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
|
||||
sceneTextures[sceneId] = tex;
|
||||
}
|
||||
|
||||
var vertSrc =
|
||||
"attribute vec2 a_pos; varying vec2 v_uv; void main(){" +
|
||||
"v_uv=a_pos*0.5+0.5; v_uv.y=1.0-v_uv.y; gl_Position=vec4(a_pos,0,1);}";
|
||||
var quadBuf = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.bufferData(
|
||||
gl.ARRAY_BUFFER,
|
||||
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
||||
gl.STATIC_DRAW,
|
||||
);
|
||||
function compileShader(src, type) {
|
||||
var s = gl.createShader(type);
|
||||
gl.shaderSource(s, src);
|
||||
gl.compileShader(s);
|
||||
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
|
||||
console.error("Shader:", gl.getShaderInfoLog(s));
|
||||
return s;
|
||||
}
|
||||
function mkProg(fragSrc) {
|
||||
var p = gl.createProgram();
|
||||
gl.attachShader(p, compileShader(vertSrc, gl.VERTEX_SHADER));
|
||||
gl.attachShader(p, compileShader(fragSrc, gl.FRAGMENT_SHADER));
|
||||
gl.linkProgram(p);
|
||||
if (!gl.getProgramParameter(p, gl.LINK_STATUS))
|
||||
console.error("Link:", gl.getProgramInfoLog(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
var H =
|
||||
"precision mediump float;" +
|
||||
"varying vec2 v_uv;" +
|
||||
"uniform sampler2D u_from, u_to;" +
|
||||
"uniform float u_progress;" +
|
||||
"uniform vec2 u_resolution;\n";
|
||||
|
||||
var progPass = mkProg(H + "void main(){gl_FragColor=texture2D(u_from,v_uv);}");
|
||||
var progTrans = mkProg(
|
||||
H +
|
||||
"void main(){vec2 c=v_uv-.5;float fromShift=u_progress*.06;float fr=texture2D(u_from,clamp(v_uv+c*fromShift,0.,1.)).r;float fg=texture2D(u_from,v_uv).g;float fb=texture2D(u_from,clamp(v_uv-c*fromShift,0.,1.)).b;vec3 fromSplit=vec3(fr,fg,fb);float toShift=(1.-u_progress)*.06;float tr=texture2D(u_to,clamp(v_uv-c*toShift,0.,1.)).r;float tg=texture2D(u_to,v_uv).g;float tb=texture2D(u_to,clamp(v_uv+c*toShift,0.,1.)).b;vec3 toSplit=vec3(tr,tg,tb);gl_FragColor=vec4(mix(fromSplit,toSplit,u_progress),1.);}",
|
||||
);
|
||||
|
||||
function renderShader(prog, texFrom, texTo, progress) {
|
||||
gl.useProgram(prog);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texFrom);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_from"), 0);
|
||||
gl.activeTexture(gl.TEXTURE1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texTo);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_to"), 1);
|
||||
gl.uniform1f(gl.getUniformLocation(prog, "u_progress"), progress);
|
||||
gl.uniform2f(gl.getUniformLocation(prog, "u_resolution"), 1200, 1080);
|
||||
var pos = gl.getAttribLocation(prog, "a_pos");
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.enableVertexAttribArray(pos);
|
||||
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function easeInOut(p) {
|
||||
return p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2;
|
||||
}
|
||||
|
||||
captureScene("s1");
|
||||
captureScene("s2");
|
||||
glCanvas.style.display = "block";
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
document.querySelectorAll(".scene").forEach(function (s) {
|
||||
s.style.opacity = "0";
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
var t = tl.time();
|
||||
if (t >= 1.0 && t < 3.0) {
|
||||
renderShader(
|
||||
progTrans,
|
||||
sceneTextures["s1"],
|
||||
sceneTextures["s2"],
|
||||
easeInOut((t - 1.0) / 2.0),
|
||||
);
|
||||
} else if (t >= 3.0) {
|
||||
renderShader(progPass, sceneTextures["s2"], sceneTextures["s2"], 0);
|
||||
} else {
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
tl.to({ v: 0 }, { v: 1, duration: 4, ease: "none" }, 0);
|
||||
window.__timelines["main"] = tl;
|
||||
} // end if (gl)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "chromatic-radial-split",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Chromatic Radial Split",
|
||||
"description": "Shader transition with chromatic aberration radial split",
|
||||
"tags": ["transition", "shader"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 4,
|
||||
"files": [
|
||||
{
|
||||
"path": "chromatic-radial-split.html",
|
||||
"target": "compositions/chromatic-radial-split.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,365 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;700&family=Lato:wght@400;700&display=block");
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<style>
|
||||
[data-composition-id="main"] {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #3d348b;
|
||||
}
|
||||
|
||||
/* Blueprint grid */
|
||||
.bp-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.bp-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bp-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 60px 60px 60px 40px;
|
||||
}
|
||||
.bp-divider {
|
||||
position: absolute;
|
||||
left: 1200px;
|
||||
top: 60px;
|
||||
bottom: 60px;
|
||||
width: 1px;
|
||||
background: #f7b801;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.bp-number {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.4em;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 60px;
|
||||
color: #f7b801;
|
||||
}
|
||||
|
||||
/* Right panel typography */
|
||||
.bp-name {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 38px;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 20px;
|
||||
color: #f7b801;
|
||||
}
|
||||
.bp-plabel {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 10px;
|
||||
color: #f7b801;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.bp-prompt {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
padding: 16px 20px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #f7b801;
|
||||
background: rgba(247, 184, 1, 0.06);
|
||||
border: 1px solid rgba(247, 184, 1, 0.12);
|
||||
}
|
||||
.bp-desc {
|
||||
font-family: "Lato", sans-serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.6;
|
||||
color: #a0a0c0;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* GL scenes (hidden, just for texture capture) */
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 140px;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.12;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="bp-grid"></div>
|
||||
<div class="bp-divider"></div>
|
||||
<div class="bp-number">07 / 14</div>
|
||||
|
||||
<!-- GL demo scenes (captured as textures, then hidden) -->
|
||||
<div id="s1" class="scene" style="background: #3d348b">
|
||||
<div class="scene-label" style="color: #f7b801">SCENE A</div>
|
||||
</div>
|
||||
<div id="s2" class="scene" style="background: #f7b801; opacity: 0">
|
||||
<div class="scene-label" style="color: #3d348b">SCENE B</div>
|
||||
</div>
|
||||
|
||||
<!-- GL canvas (left panel only) -->
|
||||
<canvas
|
||||
id="gl-canvas"
|
||||
width="1200"
|
||||
height="1080"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
</canvas>
|
||||
|
||||
<!-- Right panel metadata -->
|
||||
<div class="bp-right">
|
||||
<div class="bp-name">Cinematic Zoom</div>
|
||||
<div class="bp-plabel">Prompt</div>
|
||||
<div class="bp-prompt">"use cinematic zoom shader transition"</div>
|
||||
<div class="bp-desc">
|
||||
Both scenes zoom-blur with per-channel radial offset. From zooms outward, to zooms inward
|
||||
from tight.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="driver"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
style="position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
var glCanvas = document.getElementById("gl-canvas");
|
||||
var gl = glCanvas.getContext("webgl", { preserveDrawingBuffer: true });
|
||||
if (!gl) {
|
||||
console.warn("WebGL not available");
|
||||
window.__timelines["main"] = gsap.timeline({ paused: true });
|
||||
} else {
|
||||
gl.viewport(0, 0, 1200, 1080);
|
||||
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
||||
var sceneTextures = {};
|
||||
|
||||
function captureScene(sceneId) {
|
||||
var scene = document.getElementById(sceneId);
|
||||
var origOpacity = scene.style.opacity;
|
||||
var origZ = scene.style.zIndex;
|
||||
scene.style.opacity = "1";
|
||||
scene.style.zIndex = "999";
|
||||
scene.offsetHeight;
|
||||
var c = document.createElement("canvas");
|
||||
c.width = 1200;
|
||||
c.height = 1080;
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = window.getComputedStyle(scene).backgroundColor;
|
||||
ctx.fillRect(0, 0, 1200, 1080);
|
||||
var sr = scene.getBoundingClientRect();
|
||||
var els = scene.querySelectorAll("*");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i],
|
||||
cs = window.getComputedStyle(el);
|
||||
if (cs.display === "none" || cs.visibility === "hidden") continue;
|
||||
var r = el.getBoundingClientRect();
|
||||
if (r.width < 1 || r.height < 1) continue;
|
||||
var x = r.left - sr.left,
|
||||
y = r.top - sr.top,
|
||||
w = r.width,
|
||||
h = r.height;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = parseFloat(cs.opacity) || 1;
|
||||
var bg = cs.backgroundColor;
|
||||
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(x, y, w, h);
|
||||
}
|
||||
var hasChildEls = el.querySelector("div,span,img,video");
|
||||
var text = "";
|
||||
for (var j = 0; j < el.childNodes.length; j++)
|
||||
if (el.childNodes[j].nodeType === 3) text += el.childNodes[j].textContent;
|
||||
text = text.trim();
|
||||
if (text && !hasChildEls) {
|
||||
ctx.font = cs.fontWeight + " " + cs.fontSize + " " + cs.fontFamily;
|
||||
ctx.fillStyle = cs.color;
|
||||
if (cs.letterSpacing && cs.letterSpacing !== "normal")
|
||||
ctx.letterSpacing = cs.letterSpacing;
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + w / 2, y + h / 2);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
scene.style.opacity = origOpacity;
|
||||
scene.style.zIndex = origZ;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
|
||||
sceneTextures[sceneId] = tex;
|
||||
}
|
||||
|
||||
var vertSrc =
|
||||
"attribute vec2 a_pos; varying vec2 v_uv; void main(){" +
|
||||
"v_uv=a_pos*0.5+0.5; v_uv.y=1.0-v_uv.y; gl_Position=vec4(a_pos,0,1);}";
|
||||
var quadBuf = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.bufferData(
|
||||
gl.ARRAY_BUFFER,
|
||||
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
||||
gl.STATIC_DRAW,
|
||||
);
|
||||
function compileShader(src, type) {
|
||||
var s = gl.createShader(type);
|
||||
gl.shaderSource(s, src);
|
||||
gl.compileShader(s);
|
||||
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
|
||||
console.error("Shader:", gl.getShaderInfoLog(s));
|
||||
return s;
|
||||
}
|
||||
function mkProg(fragSrc) {
|
||||
var p = gl.createProgram();
|
||||
gl.attachShader(p, compileShader(vertSrc, gl.VERTEX_SHADER));
|
||||
gl.attachShader(p, compileShader(fragSrc, gl.FRAGMENT_SHADER));
|
||||
gl.linkProgram(p);
|
||||
if (!gl.getProgramParameter(p, gl.LINK_STATUS))
|
||||
console.error("Link:", gl.getProgramInfoLog(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
var H =
|
||||
"precision mediump float;" +
|
||||
"varying vec2 v_uv;" +
|
||||
"uniform sampler2D u_from, u_to;" +
|
||||
"uniform float u_progress;" +
|
||||
"uniform vec2 u_resolution;\n";
|
||||
|
||||
var progPass = mkProg(H + "void main(){gl_FragColor=texture2D(u_from,v_uv);}");
|
||||
var progTrans = mkProg(
|
||||
H +
|
||||
"void main(){vec2 d=v_uv-vec2(.5);float fromS=u_progress*.08;float toS=(1.-u_progress)*.06;float fr=0.,fg=0.,fb=0.;for(int i=0;i<12;i++){float f=float(i)/12.;fr+=texture2D(u_from,v_uv-d*(fromS*1.06)*f).r;fg+=texture2D(u_from,v_uv-d*fromS*f).g;fb+=texture2D(u_from,v_uv-d*(fromS*.94)*f).b;}vec3 fromBl=vec3(fr,fg,fb)/12.;float tr=0.,tg=0.,tb=0.;for(int i=0;i<12;i++){float f=float(i)/12.;tr+=texture2D(u_to,v_uv+d*(toS*1.06)*f).r;tg+=texture2D(u_to,v_uv+d*toS*f).g;tb+=texture2D(u_to,v_uv+d*(toS*.94)*f).b;}vec3 toBl=vec3(tr,tg,tb)/12.;gl_FragColor=vec4(mix(fromBl,toBl,u_progress),1.);}",
|
||||
);
|
||||
|
||||
function renderShader(prog, texFrom, texTo, progress) {
|
||||
gl.useProgram(prog);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texFrom);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_from"), 0);
|
||||
gl.activeTexture(gl.TEXTURE1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texTo);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_to"), 1);
|
||||
gl.uniform1f(gl.getUniformLocation(prog, "u_progress"), progress);
|
||||
gl.uniform2f(gl.getUniformLocation(prog, "u_resolution"), 1200, 1080);
|
||||
var pos = gl.getAttribLocation(prog, "a_pos");
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.enableVertexAttribArray(pos);
|
||||
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function easeInOut(p) {
|
||||
return p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2;
|
||||
}
|
||||
|
||||
captureScene("s1");
|
||||
captureScene("s2");
|
||||
glCanvas.style.display = "block";
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
document.querySelectorAll(".scene").forEach(function (s) {
|
||||
s.style.opacity = "0";
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
var t = tl.time();
|
||||
if (t >= 1.0 && t < 3.0) {
|
||||
renderShader(
|
||||
progTrans,
|
||||
sceneTextures["s1"],
|
||||
sceneTextures["s2"],
|
||||
easeInOut((t - 1.0) / 2.0),
|
||||
);
|
||||
} else if (t >= 3.0) {
|
||||
renderShader(progPass, sceneTextures["s2"], sceneTextures["s2"], 0);
|
||||
} else {
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
tl.to({ v: 0 }, { v: 1, duration: 4, ease: "none" }, 0);
|
||||
window.__timelines["main"] = tl;
|
||||
} // end if (gl)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "cinematic-zoom",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Cinematic Zoom",
|
||||
"description": "Shader transition with dramatic zoom blur",
|
||||
"tags": ["transition", "shader"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 4,
|
||||
"files": [
|
||||
{
|
||||
"path": "cinematic-zoom.html",
|
||||
"target": "compositions/cinematic-zoom.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,376 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;700&family=Lato:wght@400;700&display=block");
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<style>
|
||||
[data-composition-id="main"] {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #283618;
|
||||
}
|
||||
|
||||
/* Blueprint grid */
|
||||
.bp-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.bp-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bp-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 60px 60px 60px 40px;
|
||||
}
|
||||
.bp-divider {
|
||||
position: absolute;
|
||||
left: 1200px;
|
||||
top: 60px;
|
||||
bottom: 60px;
|
||||
width: 1px;
|
||||
background: #a7c957;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.bp-number {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.4em;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 60px;
|
||||
color: #a7c957;
|
||||
}
|
||||
|
||||
/* Right panel typography */
|
||||
.bp-name {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 38px;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 20px;
|
||||
color: #a7c957;
|
||||
}
|
||||
.bp-plabel {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 10px;
|
||||
color: #a7c957;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.bp-prompt {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
padding: 16px 20px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #a7c957;
|
||||
background: rgba(167, 201, 87, 0.06);
|
||||
border: 1px solid rgba(167, 201, 87, 0.12);
|
||||
}
|
||||
.bp-desc {
|
||||
font-family: "Lato", sans-serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.6;
|
||||
color: #8aaa9a;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* GL scenes (hidden, just for texture capture) */
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 140px;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.12;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="bp-grid"></div>
|
||||
<div class="bp-divider"></div>
|
||||
<div class="bp-number">13 / 14</div>
|
||||
|
||||
<!-- GL demo scenes (captured as textures, then hidden) -->
|
||||
<div id="s1" class="scene" style="background: #283618">
|
||||
<div class="scene-label" style="color: #a7c957">SCENE A</div>
|
||||
</div>
|
||||
<div id="s2" class="scene" style="background: #a7c957; opacity: 0">
|
||||
<div class="scene-label" style="color: #283618">SCENE B</div>
|
||||
</div>
|
||||
|
||||
<!-- GL canvas (left panel only) -->
|
||||
<canvas
|
||||
id="gl-canvas"
|
||||
width="1200"
|
||||
height="1080"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
</canvas>
|
||||
|
||||
<!-- Right panel metadata -->
|
||||
<div class="bp-right">
|
||||
<div class="bp-name">Cross-Warp Morph</div>
|
||||
<div class="bp-plabel">Prompt</div>
|
||||
<div class="bp-prompt">"use cross-warp morph shader transition"</div>
|
||||
<div class="bp-desc">
|
||||
Both scenes displace along a shared FBM noise field in opposite directions. Noise-driven
|
||||
blend boundary.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="driver"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
style="position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
var glCanvas = document.getElementById("gl-canvas");
|
||||
var gl = glCanvas.getContext("webgl", { preserveDrawingBuffer: true });
|
||||
if (!gl) {
|
||||
console.warn("WebGL not available");
|
||||
window.__timelines["main"] = gsap.timeline({ paused: true });
|
||||
} else {
|
||||
gl.viewport(0, 0, 1200, 1080);
|
||||
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
||||
var sceneTextures = {};
|
||||
|
||||
function captureScene(sceneId) {
|
||||
var scene = document.getElementById(sceneId);
|
||||
var origOpacity = scene.style.opacity;
|
||||
var origZ = scene.style.zIndex;
|
||||
scene.style.opacity = "1";
|
||||
scene.style.zIndex = "999";
|
||||
scene.offsetHeight;
|
||||
var c = document.createElement("canvas");
|
||||
c.width = 1200;
|
||||
c.height = 1080;
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = window.getComputedStyle(scene).backgroundColor;
|
||||
ctx.fillRect(0, 0, 1200, 1080);
|
||||
var sr = scene.getBoundingClientRect();
|
||||
var els = scene.querySelectorAll("*");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i],
|
||||
cs = window.getComputedStyle(el);
|
||||
if (cs.display === "none" || cs.visibility === "hidden") continue;
|
||||
var r = el.getBoundingClientRect();
|
||||
if (r.width < 1 || r.height < 1) continue;
|
||||
var x = r.left - sr.left,
|
||||
y = r.top - sr.top,
|
||||
w = r.width,
|
||||
h = r.height;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = parseFloat(cs.opacity) || 1;
|
||||
var bg = cs.backgroundColor;
|
||||
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(x, y, w, h);
|
||||
}
|
||||
var hasChildEls = el.querySelector("div,span,img,video");
|
||||
var text = "";
|
||||
for (var j = 0; j < el.childNodes.length; j++)
|
||||
if (el.childNodes[j].nodeType === 3) text += el.childNodes[j].textContent;
|
||||
text = text.trim();
|
||||
if (text && !hasChildEls) {
|
||||
ctx.font = cs.fontWeight + " " + cs.fontSize + " " + cs.fontFamily;
|
||||
ctx.fillStyle = cs.color;
|
||||
if (cs.letterSpacing && cs.letterSpacing !== "normal")
|
||||
ctx.letterSpacing = cs.letterSpacing;
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + w / 2, y + h / 2);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
scene.style.opacity = origOpacity;
|
||||
scene.style.zIndex = origZ;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
|
||||
sceneTextures[sceneId] = tex;
|
||||
}
|
||||
|
||||
var vertSrc =
|
||||
"attribute vec2 a_pos; varying vec2 v_uv; void main(){" +
|
||||
"v_uv=a_pos*0.5+0.5; v_uv.y=1.0-v_uv.y; gl_Position=vec4(a_pos,0,1);}";
|
||||
var quadBuf = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.bufferData(
|
||||
gl.ARRAY_BUFFER,
|
||||
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
||||
gl.STATIC_DRAW,
|
||||
);
|
||||
function compileShader(src, type) {
|
||||
var s = gl.createShader(type);
|
||||
gl.shaderSource(s, src);
|
||||
gl.compileShader(s);
|
||||
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
|
||||
console.error("Shader:", gl.getShaderInfoLog(s));
|
||||
return s;
|
||||
}
|
||||
function mkProg(fragSrc) {
|
||||
var p = gl.createProgram();
|
||||
gl.attachShader(p, compileShader(vertSrc, gl.VERTEX_SHADER));
|
||||
gl.attachShader(p, compileShader(fragSrc, gl.FRAGMENT_SHADER));
|
||||
gl.linkProgram(p);
|
||||
if (!gl.getProgramParameter(p, gl.LINK_STATUS))
|
||||
console.error("Link:", gl.getProgramInfoLog(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
var H =
|
||||
"precision mediump float;" +
|
||||
"varying vec2 v_uv;" +
|
||||
"uniform sampler2D u_from, u_to;" +
|
||||
"uniform float u_progress;" +
|
||||
"uniform vec2 u_resolution;\n";
|
||||
|
||||
var NQ =
|
||||
"float hash(vec2 p){return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453);}" +
|
||||
"float vnoise(vec2 p){vec2 i=floor(p),f=fract(p);" +
|
||||
"f=f*f*f*(f*(f*6.-15.)+10.);" +
|
||||
"return mix(mix(hash(i),hash(i+vec2(1,0)),f.x)," +
|
||||
"mix(hash(i+vec2(0,1)),hash(i+vec2(1,1)),f.x),f.y);}" +
|
||||
"float fbm(vec2 p){float v=0.,a=.5;" +
|
||||
"mat2 R=mat2(.8,.6,-.6,.8);" +
|
||||
"for(int i=0;i<5;i++){v+=a*vnoise(p);p=R*p*2.02;a*=.5;}return v;}";
|
||||
|
||||
var progPass = mkProg(H + "void main(){gl_FragColor=texture2D(u_from,v_uv);}");
|
||||
var progTrans = mkProg(
|
||||
H +
|
||||
NQ +
|
||||
"void main(){vec2 disp=vec2(fbm(v_uv*3.),fbm(v_uv*3.+vec2(7.3,3.7)))-.5;vec2 fromUv=clamp(v_uv+disp*u_progress*.5,0.,1.);vec2 toUv=clamp(v_uv-disp*(1.-u_progress)*.5,0.,1.);vec4 A=texture2D(u_from,fromUv);vec4 B=texture2D(u_to,toUv);float n=fbm(v_uv*4.+vec2(3.1,1.7));float blend=smoothstep(.4,.6,n+u_progress*1.2-.6);gl_FragColor=mix(A,B,blend);}",
|
||||
);
|
||||
|
||||
function renderShader(prog, texFrom, texTo, progress) {
|
||||
gl.useProgram(prog);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texFrom);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_from"), 0);
|
||||
gl.activeTexture(gl.TEXTURE1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texTo);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_to"), 1);
|
||||
gl.uniform1f(gl.getUniformLocation(prog, "u_progress"), progress);
|
||||
gl.uniform2f(gl.getUniformLocation(prog, "u_resolution"), 1200, 1080);
|
||||
var pos = gl.getAttribLocation(prog, "a_pos");
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.enableVertexAttribArray(pos);
|
||||
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function easeInOut(p) {
|
||||
return p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2;
|
||||
}
|
||||
|
||||
captureScene("s1");
|
||||
captureScene("s2");
|
||||
glCanvas.style.display = "block";
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
document.querySelectorAll(".scene").forEach(function (s) {
|
||||
s.style.opacity = "0";
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
var t = tl.time();
|
||||
if (t >= 1.0 && t < 3.0) {
|
||||
renderShader(
|
||||
progTrans,
|
||||
sceneTextures["s1"],
|
||||
sceneTextures["s2"],
|
||||
easeInOut((t - 1.0) / 2.0),
|
||||
);
|
||||
} else if (t >= 3.0) {
|
||||
renderShader(progPass, sceneTextures["s2"], sceneTextures["s2"], 0);
|
||||
} else {
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
tl.to({ v: 0 }, { v: 1, duration: 4, ease: "none" }, 0);
|
||||
window.__timelines["main"] = tl;
|
||||
} // end if (gl)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "cross-warp-morph",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Cross Warp Morph",
|
||||
"description": "Shader transition with cross-warped morphing",
|
||||
"tags": ["transition", "shader"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 4,
|
||||
"files": [
|
||||
{
|
||||
"path": "cross-warp-morph.html",
|
||||
"target": "compositions/cross-warp-morph.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -122,7 +122,7 @@
|
||||
|
||||
[data-composition-id="data-chart"] .subtitle {
|
||||
font-size: 16px;
|
||||
color: #d4d4d4;
|
||||
color: #666;
|
||||
margin: 8px 0 16px 0;
|
||||
clip-path: inset(0 100% 0 0);
|
||||
white-space: nowrap;
|
||||
@@ -205,12 +205,8 @@
|
||||
</style>
|
||||
|
||||
<script>
|
||||
(function initChart() {
|
||||
(function () {
|
||||
const svg = document.querySelector('[data-composition-id="data-chart"] .chart-svg');
|
||||
if (!svg) {
|
||||
setTimeout(initChart, 50);
|
||||
return;
|
||||
}
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
|
||||
// Data
|
||||
|
||||
@@ -0,0 +1,379 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;700&family=Lato:wght@400;700&display=block");
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<style>
|
||||
[data-composition-id="main"] {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #0d1b2a;
|
||||
}
|
||||
|
||||
/* Blueprint grid */
|
||||
.bp-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.bp-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bp-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 60px 60px 60px 40px;
|
||||
}
|
||||
.bp-divider {
|
||||
position: absolute;
|
||||
left: 1200px;
|
||||
top: 60px;
|
||||
bottom: 60px;
|
||||
width: 1px;
|
||||
background: #00f5d4;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.bp-number {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.4em;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 60px;
|
||||
color: #00f5d4;
|
||||
}
|
||||
|
||||
/* Right panel typography */
|
||||
.bp-name {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 38px;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 20px;
|
||||
color: #00f5d4;
|
||||
}
|
||||
.bp-plabel {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 10px;
|
||||
color: #00f5d4;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.bp-prompt {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
padding: 16px 20px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #00f5d4;
|
||||
background: rgba(0, 245, 212, 0.06);
|
||||
border: 1px solid rgba(0, 245, 212, 0.12);
|
||||
}
|
||||
.bp-desc {
|
||||
font-family: "Lato", sans-serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.6;
|
||||
color: #8aa8c0;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* GL scenes (hidden, just for texture capture) */
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 140px;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.12;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="bp-grid"></div>
|
||||
<div class="bp-divider"></div>
|
||||
<div class="bp-number">01 / 14</div>
|
||||
|
||||
<!-- GL demo scenes (captured as textures, then hidden) -->
|
||||
<div id="s1" class="scene" style="background: #0d1b2a">
|
||||
<div class="scene-label" style="color: #00f5d4">SCENE A</div>
|
||||
</div>
|
||||
<div id="s2" class="scene" style="background: #00f5d4; opacity: 0">
|
||||
<div class="scene-label" style="color: #0d1b2a">SCENE B</div>
|
||||
</div>
|
||||
|
||||
<!-- GL canvas (left panel only) -->
|
||||
<canvas
|
||||
id="gl-canvas"
|
||||
width="1200"
|
||||
height="1080"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
</canvas>
|
||||
|
||||
<!-- Right panel metadata -->
|
||||
<div class="bp-right">
|
||||
<div class="bp-name">Domain Warp Dissolve</div>
|
||||
<div class="bp-plabel">Prompt</div>
|
||||
<div class="bp-prompt">"use domain warp dissolve shader transition"</div>
|
||||
<div class="bp-desc">
|
||||
Cascaded fbm(p + fbm(p)) displaces both scenes along a warp field. Iridescent
|
||||
cosine-palette edge glow.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="driver"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
style="position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
var glCanvas = document.getElementById("gl-canvas");
|
||||
var gl = glCanvas.getContext("webgl", { preserveDrawingBuffer: true });
|
||||
if (!gl) {
|
||||
console.warn("WebGL not available");
|
||||
window.__timelines["main"] = gsap.timeline({ paused: true });
|
||||
} else {
|
||||
gl.viewport(0, 0, 1200, 1080);
|
||||
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
||||
var sceneTextures = {};
|
||||
|
||||
function captureScene(sceneId) {
|
||||
var scene = document.getElementById(sceneId);
|
||||
var origOpacity = scene.style.opacity;
|
||||
var origZ = scene.style.zIndex;
|
||||
scene.style.opacity = "1";
|
||||
scene.style.zIndex = "999";
|
||||
scene.offsetHeight;
|
||||
var c = document.createElement("canvas");
|
||||
c.width = 1200;
|
||||
c.height = 1080;
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = window.getComputedStyle(scene).backgroundColor;
|
||||
ctx.fillRect(0, 0, 1200, 1080);
|
||||
var sr = scene.getBoundingClientRect();
|
||||
var els = scene.querySelectorAll("*");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i],
|
||||
cs = window.getComputedStyle(el);
|
||||
if (cs.display === "none" || cs.visibility === "hidden") continue;
|
||||
var r = el.getBoundingClientRect();
|
||||
if (r.width < 1 || r.height < 1) continue;
|
||||
var x = r.left - sr.left,
|
||||
y = r.top - sr.top,
|
||||
w = r.width,
|
||||
h = r.height;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = parseFloat(cs.opacity) || 1;
|
||||
var bg = cs.backgroundColor;
|
||||
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(x, y, w, h);
|
||||
}
|
||||
var hasChildEls = el.querySelector("div,span,img,video");
|
||||
var text = "";
|
||||
for (var j = 0; j < el.childNodes.length; j++)
|
||||
if (el.childNodes[j].nodeType === 3) text += el.childNodes[j].textContent;
|
||||
text = text.trim();
|
||||
if (text && !hasChildEls) {
|
||||
ctx.font = cs.fontWeight + " " + cs.fontSize + " " + cs.fontFamily;
|
||||
ctx.fillStyle = cs.color;
|
||||
if (cs.letterSpacing && cs.letterSpacing !== "normal")
|
||||
ctx.letterSpacing = cs.letterSpacing;
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + w / 2, y + h / 2);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
scene.style.opacity = origOpacity;
|
||||
scene.style.zIndex = origZ;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
|
||||
sceneTextures[sceneId] = tex;
|
||||
}
|
||||
|
||||
var vertSrc =
|
||||
"attribute vec2 a_pos; varying vec2 v_uv; void main(){" +
|
||||
"v_uv=a_pos*0.5+0.5; v_uv.y=1.0-v_uv.y; gl_Position=vec4(a_pos,0,1);}";
|
||||
var quadBuf = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.bufferData(
|
||||
gl.ARRAY_BUFFER,
|
||||
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
||||
gl.STATIC_DRAW,
|
||||
);
|
||||
function compileShader(src, type) {
|
||||
var s = gl.createShader(type);
|
||||
gl.shaderSource(s, src);
|
||||
gl.compileShader(s);
|
||||
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
|
||||
console.error("Shader:", gl.getShaderInfoLog(s));
|
||||
return s;
|
||||
}
|
||||
function mkProg(fragSrc) {
|
||||
var p = gl.createProgram();
|
||||
gl.attachShader(p, compileShader(vertSrc, gl.VERTEX_SHADER));
|
||||
gl.attachShader(p, compileShader(fragSrc, gl.FRAGMENT_SHADER));
|
||||
gl.linkProgram(p);
|
||||
if (!gl.getProgramParameter(p, gl.LINK_STATUS))
|
||||
console.error("Link:", gl.getProgramInfoLog(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
var H =
|
||||
"precision mediump float;" +
|
||||
"varying vec2 v_uv;" +
|
||||
"uniform sampler2D u_from, u_to;" +
|
||||
"uniform float u_progress;" +
|
||||
"uniform vec2 u_resolution;\n";
|
||||
|
||||
var NQ =
|
||||
"float hash(vec2 p){return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453);}" +
|
||||
"float vnoise(vec2 p){vec2 i=floor(p),f=fract(p);" +
|
||||
"f=f*f*f*(f*(f*6.-15.)+10.);" +
|
||||
"return mix(mix(hash(i),hash(i+vec2(1,0)),f.x)," +
|
||||
"mix(hash(i+vec2(0,1)),hash(i+vec2(1,1)),f.x),f.y);}" +
|
||||
"float fbm(vec2 p){float v=0.,a=.5;" +
|
||||
"mat2 R=mat2(.8,.6,-.6,.8);" +
|
||||
"for(int i=0;i<5;i++){v+=a*vnoise(p);p=R*p*2.02;a*=.5;}return v;}";
|
||||
var CP =
|
||||
"vec3 palette(float t,vec3 a,vec3 b,vec3 c,vec3 d){" + "return a+b*cos(6.2832*(c*t+d));}";
|
||||
|
||||
var progPass = mkProg(H + "void main(){gl_FragColor=texture2D(u_from,v_uv);}");
|
||||
var progTrans = mkProg(
|
||||
H +
|
||||
NQ +
|
||||
CP +
|
||||
"void main(){vec2 q=vec2(fbm(v_uv*3.),fbm(v_uv*3.+vec2(5.2,1.3)));vec2 r=vec2(fbm(v_uv*3.+q*4.+vec2(1.7,9.2)),fbm(v_uv*3.+q*4.+vec2(8.3,2.8)));float n=fbm(v_uv*3.+r*2.);vec2 warpDir=(q-.5)*.4;vec4 A=texture2D(u_from,clamp(v_uv+warpDir*u_progress,0.,1.));vec4 B=texture2D(u_to,clamp(v_uv-warpDir*(1.-u_progress),0.,1.));float e=smoothstep(u_progress-.08,u_progress+.08,n);float ed=abs(n-u_progress);float em=smoothstep(.1,0.,ed)*(1.-step(1.,u_progress));vec3 ec=palette(ed*8.,vec3(.5),vec3(.5),vec3(1.),vec3(0.,.33,.67));gl_FragColor=vec4(mix(B,A,e).rgb+ec*em*2.,1.);}",
|
||||
);
|
||||
|
||||
function renderShader(prog, texFrom, texTo, progress) {
|
||||
gl.useProgram(prog);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texFrom);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_from"), 0);
|
||||
gl.activeTexture(gl.TEXTURE1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texTo);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_to"), 1);
|
||||
gl.uniform1f(gl.getUniformLocation(prog, "u_progress"), progress);
|
||||
gl.uniform2f(gl.getUniformLocation(prog, "u_resolution"), 1200, 1080);
|
||||
var pos = gl.getAttribLocation(prog, "a_pos");
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.enableVertexAttribArray(pos);
|
||||
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function easeInOut(p) {
|
||||
return p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2;
|
||||
}
|
||||
|
||||
captureScene("s1");
|
||||
captureScene("s2");
|
||||
glCanvas.style.display = "block";
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
document.querySelectorAll(".scene").forEach(function (s) {
|
||||
s.style.opacity = "0";
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
var t = tl.time();
|
||||
if (t >= 1.0 && t < 3.0) {
|
||||
renderShader(
|
||||
progTrans,
|
||||
sceneTextures["s1"],
|
||||
sceneTextures["s2"],
|
||||
easeInOut((t - 1.0) / 2.0),
|
||||
);
|
||||
} else if (t >= 3.0) {
|
||||
renderShader(progPass, sceneTextures["s2"], sceneTextures["s2"], 0);
|
||||
} else {
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
tl.to({ v: 0 }, { v: 1, duration: 4, ease: "none" }, 0);
|
||||
window.__timelines["main"] = tl;
|
||||
} // end if (gl)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "domain-warp-dissolve",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Domain Warp Dissolve",
|
||||
"description": "Shader transition with fractal noise domain warping",
|
||||
"tags": ["transition", "shader"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 4,
|
||||
"files": [
|
||||
{
|
||||
"path": "domain-warp-dissolve.html",
|
||||
"target": "compositions/domain-warp-dissolve.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,365 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;700&family=Lato:wght@400;700&display=block");
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<style>
|
||||
[data-composition-id="main"] {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #03071e;
|
||||
}
|
||||
|
||||
/* Blueprint grid */
|
||||
.bp-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.bp-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bp-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 60px 60px 60px 40px;
|
||||
}
|
||||
.bp-divider {
|
||||
position: absolute;
|
||||
left: 1200px;
|
||||
top: 60px;
|
||||
bottom: 60px;
|
||||
width: 1px;
|
||||
background: #ffba08;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.bp-number {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.4em;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 60px;
|
||||
color: #ffba08;
|
||||
}
|
||||
|
||||
/* Right panel typography */
|
||||
.bp-name {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 38px;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 20px;
|
||||
color: #ffba08;
|
||||
}
|
||||
.bp-plabel {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 10px;
|
||||
color: #ffba08;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.bp-prompt {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
padding: 16px 20px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #ffba08;
|
||||
background: rgba(255, 186, 8, 0.06);
|
||||
border: 1px solid rgba(255, 186, 8, 0.12);
|
||||
}
|
||||
.bp-desc {
|
||||
font-family: "Lato", sans-serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.6;
|
||||
color: #888;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* GL scenes (hidden, just for texture capture) */
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 140px;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.12;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="bp-grid"></div>
|
||||
<div class="bp-divider"></div>
|
||||
<div class="bp-number">12 / 14</div>
|
||||
|
||||
<!-- GL demo scenes (captured as textures, then hidden) -->
|
||||
<div id="s1" class="scene" style="background: #03071e">
|
||||
<div class="scene-label" style="color: #ffba08">SCENE A</div>
|
||||
</div>
|
||||
<div id="s2" class="scene" style="background: #ffba08; opacity: 0">
|
||||
<div class="scene-label" style="color: #03071e">SCENE B</div>
|
||||
</div>
|
||||
|
||||
<!-- GL canvas (left panel only) -->
|
||||
<canvas
|
||||
id="gl-canvas"
|
||||
width="1200"
|
||||
height="1080"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
</canvas>
|
||||
|
||||
<!-- Right panel metadata -->
|
||||
<div class="bp-right">
|
||||
<div class="bp-name">Flash Through White</div>
|
||||
<div class="bp-plabel">Prompt</div>
|
||||
<div class="bp-prompt">"use flash through white shader transition"</div>
|
||||
<div class="bp-desc">
|
||||
Both scenes brighten to a white midpoint. Works on dark backgrounds where
|
||||
color-dip-to-black is invisible.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="driver"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
style="position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
var glCanvas = document.getElementById("gl-canvas");
|
||||
var gl = glCanvas.getContext("webgl", { preserveDrawingBuffer: true });
|
||||
if (!gl) {
|
||||
console.warn("WebGL not available");
|
||||
window.__timelines["main"] = gsap.timeline({ paused: true });
|
||||
} else {
|
||||
gl.viewport(0, 0, 1200, 1080);
|
||||
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
||||
var sceneTextures = {};
|
||||
|
||||
function captureScene(sceneId) {
|
||||
var scene = document.getElementById(sceneId);
|
||||
var origOpacity = scene.style.opacity;
|
||||
var origZ = scene.style.zIndex;
|
||||
scene.style.opacity = "1";
|
||||
scene.style.zIndex = "999";
|
||||
scene.offsetHeight;
|
||||
var c = document.createElement("canvas");
|
||||
c.width = 1200;
|
||||
c.height = 1080;
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = window.getComputedStyle(scene).backgroundColor;
|
||||
ctx.fillRect(0, 0, 1200, 1080);
|
||||
var sr = scene.getBoundingClientRect();
|
||||
var els = scene.querySelectorAll("*");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i],
|
||||
cs = window.getComputedStyle(el);
|
||||
if (cs.display === "none" || cs.visibility === "hidden") continue;
|
||||
var r = el.getBoundingClientRect();
|
||||
if (r.width < 1 || r.height < 1) continue;
|
||||
var x = r.left - sr.left,
|
||||
y = r.top - sr.top,
|
||||
w = r.width,
|
||||
h = r.height;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = parseFloat(cs.opacity) || 1;
|
||||
var bg = cs.backgroundColor;
|
||||
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(x, y, w, h);
|
||||
}
|
||||
var hasChildEls = el.querySelector("div,span,img,video");
|
||||
var text = "";
|
||||
for (var j = 0; j < el.childNodes.length; j++)
|
||||
if (el.childNodes[j].nodeType === 3) text += el.childNodes[j].textContent;
|
||||
text = text.trim();
|
||||
if (text && !hasChildEls) {
|
||||
ctx.font = cs.fontWeight + " " + cs.fontSize + " " + cs.fontFamily;
|
||||
ctx.fillStyle = cs.color;
|
||||
if (cs.letterSpacing && cs.letterSpacing !== "normal")
|
||||
ctx.letterSpacing = cs.letterSpacing;
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + w / 2, y + h / 2);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
scene.style.opacity = origOpacity;
|
||||
scene.style.zIndex = origZ;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
|
||||
sceneTextures[sceneId] = tex;
|
||||
}
|
||||
|
||||
var vertSrc =
|
||||
"attribute vec2 a_pos; varying vec2 v_uv; void main(){" +
|
||||
"v_uv=a_pos*0.5+0.5; v_uv.y=1.0-v_uv.y; gl_Position=vec4(a_pos,0,1);}";
|
||||
var quadBuf = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.bufferData(
|
||||
gl.ARRAY_BUFFER,
|
||||
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
||||
gl.STATIC_DRAW,
|
||||
);
|
||||
function compileShader(src, type) {
|
||||
var s = gl.createShader(type);
|
||||
gl.shaderSource(s, src);
|
||||
gl.compileShader(s);
|
||||
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
|
||||
console.error("Shader:", gl.getShaderInfoLog(s));
|
||||
return s;
|
||||
}
|
||||
function mkProg(fragSrc) {
|
||||
var p = gl.createProgram();
|
||||
gl.attachShader(p, compileShader(vertSrc, gl.VERTEX_SHADER));
|
||||
gl.attachShader(p, compileShader(fragSrc, gl.FRAGMENT_SHADER));
|
||||
gl.linkProgram(p);
|
||||
if (!gl.getProgramParameter(p, gl.LINK_STATUS))
|
||||
console.error("Link:", gl.getProgramInfoLog(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
var H =
|
||||
"precision mediump float;" +
|
||||
"varying vec2 v_uv;" +
|
||||
"uniform sampler2D u_from, u_to;" +
|
||||
"uniform float u_progress;" +
|
||||
"uniform vec2 u_resolution;\n";
|
||||
|
||||
var progPass = mkProg(H + "void main(){gl_FragColor=texture2D(u_from,v_uv);}");
|
||||
var progTrans = mkProg(
|
||||
H +
|
||||
"void main(){vec4 A=texture2D(u_from,v_uv),B=texture2D(u_to,v_uv);float toWhite=smoothstep(0.,.45,u_progress);vec3 fromC=mix(A.rgb,vec3(1.),toWhite);float fromWhite=1.-smoothstep(.5,1.,u_progress);vec3 toC=mix(B.rgb,vec3(1.),fromWhite);gl_FragColor=vec4(mix(fromC,toC,smoothstep(.35,.65,u_progress)),1.);}",
|
||||
);
|
||||
|
||||
function renderShader(prog, texFrom, texTo, progress) {
|
||||
gl.useProgram(prog);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texFrom);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_from"), 0);
|
||||
gl.activeTexture(gl.TEXTURE1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texTo);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_to"), 1);
|
||||
gl.uniform1f(gl.getUniformLocation(prog, "u_progress"), progress);
|
||||
gl.uniform2f(gl.getUniformLocation(prog, "u_resolution"), 1200, 1080);
|
||||
var pos = gl.getAttribLocation(prog, "a_pos");
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.enableVertexAttribArray(pos);
|
||||
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function easeInOut(p) {
|
||||
return p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2;
|
||||
}
|
||||
|
||||
captureScene("s1");
|
||||
captureScene("s2");
|
||||
glCanvas.style.display = "block";
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
document.querySelectorAll(".scene").forEach(function (s) {
|
||||
s.style.opacity = "0";
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
var t = tl.time();
|
||||
if (t >= 1.0 && t < 3.0) {
|
||||
renderShader(
|
||||
progTrans,
|
||||
sceneTextures["s1"],
|
||||
sceneTextures["s2"],
|
||||
easeInOut((t - 1.0) / 2.0),
|
||||
);
|
||||
} else if (t >= 3.0) {
|
||||
renderShader(progPass, sceneTextures["s2"], sceneTextures["s2"], 0);
|
||||
} else {
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
tl.to({ v: 0 }, { v: 1, duration: 4, ease: "none" }, 0);
|
||||
window.__timelines["main"] = tl;
|
||||
} // end if (gl)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "flash-through-white",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Flash Through White",
|
||||
"description": "Shader transition with white flash crossfade",
|
||||
"tags": ["transition", "shader"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 4,
|
||||
"files": [
|
||||
{
|
||||
"path": "flash-through-white.html",
|
||||
"target": "compositions/flash-through-white.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -308,40 +308,54 @@
|
||||
<script>
|
||||
(function () {
|
||||
const tl = gsap.timeline({ paused: true });
|
||||
const nodePython = document.querySelector("#node-python");
|
||||
const pythonText = document.querySelector("#python-text");
|
||||
const S = '[data-composition-id="flowchart"]';
|
||||
const nodePython = document.querySelector(`${S} #node-python`);
|
||||
const pythonText = document.querySelector(`${S} #python-text`);
|
||||
|
||||
// 1. Root node scales in
|
||||
tl.to("#node-root", { scale: 1, duration: 0.4, ease: "power2.out" });
|
||||
tl.to(`${S} #node-root`, { scale: 1, duration: 0.4, ease: "power2.out" });
|
||||
|
||||
// 2. Hold
|
||||
tl.addLabel("hold1", "+=0.6");
|
||||
|
||||
// 3. Connectors draw
|
||||
tl.to(
|
||||
".connector#path-1-L, .connector#path-1-R",
|
||||
`${S} .connector#path-1-L, ${S} .connector#path-1-R`,
|
||||
{ strokeDashoffset: 0, duration: 0.5, ease: "none" },
|
||||
"hold1",
|
||||
);
|
||||
|
||||
tl.to("#label-yes, #label-not-sure", { opacity: 1, duration: 0.2 }, "hold1+=0.25");
|
||||
tl.to(
|
||||
`${S} #label-yes, ${S} #label-not-sure`,
|
||||
{ opacity: 1, duration: 0.2 },
|
||||
"hold1+=0.25",
|
||||
);
|
||||
|
||||
// 4. Level 2 nodes
|
||||
tl.to("#node-yes", { scale: 1, duration: 0.4, ease: "back.out(1.7)" }, "hold1+=0.4");
|
||||
tl.to("#node-not-sure", { scale: 1, duration: 0.4, ease: "back.out(1.7)" }, "hold1+=0.6");
|
||||
tl.to(`${S} #node-yes`, { scale: 1, duration: 0.4, ease: "back.out(1.7)" }, "hold1+=0.4");
|
||||
tl.to(
|
||||
`${S} #node-not-sure`,
|
||||
{ scale: 1, duration: 0.4, ease: "back.out(1.7)" },
|
||||
"hold1+=0.6",
|
||||
);
|
||||
|
||||
// 5. Hold
|
||||
tl.addLabel("hold2", "+=0.5");
|
||||
|
||||
// 6. Level 2→3 connectors
|
||||
tl.to(
|
||||
".connector#path-2-LL, .connector#path-2-LR, .connector#path-2-RL, .connector#path-2-RR",
|
||||
`${S} .connector#path-2-LL, ${S} .connector#path-2-LR, ${S} .connector#path-2-RL, ${S} .connector#path-2-RR`,
|
||||
{ strokeDashoffset: 0, duration: 0.4, ease: "none" },
|
||||
"hold2",
|
||||
);
|
||||
|
||||
// 7. Leaf nodes
|
||||
const leafNodes = ["#node-python", "#node-nocode", "#node-website", "#node-course"];
|
||||
const leafNodes = [
|
||||
`${S} #node-python`,
|
||||
`${S} #node-nocode`,
|
||||
`${S} #node-website`,
|
||||
`${S} #node-course`,
|
||||
];
|
||||
leafNodes.forEach((id, i) => {
|
||||
tl.to(
|
||||
id,
|
||||
@@ -350,13 +364,17 @@
|
||||
);
|
||||
});
|
||||
|
||||
tl.to(".squiggle-container", { opacity: 1, duration: 0.1 }, "hold2+=0.3");
|
||||
tl.to(`${S} .squiggle-container`, { opacity: 1, duration: 0.1 }, "hold2+=0.3");
|
||||
|
||||
// 8. Hold
|
||||
tl.addLabel("hold3", "+=0.8");
|
||||
|
||||
// 9. Cursor drifts in
|
||||
tl.to("#cursor", { left: 450, top: 540, duration: 1, ease: "power1.inOut" }, "hold3");
|
||||
tl.to(
|
||||
`${S} #cursor`,
|
||||
{ left: 450, top: 540, duration: 1, ease: "power1.inOut" },
|
||||
"hold3",
|
||||
);
|
||||
|
||||
// 10. Cursor clicks — selection border
|
||||
tl.add(() => {
|
||||
@@ -366,11 +384,11 @@
|
||||
border.className = "selection-border";
|
||||
nodePython.appendChild(border);
|
||||
}
|
||||
gsap.set(".selection-border", { opacity: 1 });
|
||||
gsap.set(`${S} .selection-border`, { opacity: 1 });
|
||||
}, "hold3+=1");
|
||||
|
||||
tl.to(
|
||||
"#cursor",
|
||||
`${S} #cursor`,
|
||||
{ scale: 0.8, duration: 0.05, yoyo: true, repeat: 1, overwrite: "auto" },
|
||||
"hold3+=1",
|
||||
);
|
||||
@@ -380,7 +398,7 @@
|
||||
|
||||
// 12. Double-click to highlight "Pythom"
|
||||
tl.to(
|
||||
"#cursor",
|
||||
`${S} #cursor`,
|
||||
{ scale: 0.8, duration: 0.05, yoyo: true, repeat: 3, overwrite: "auto" },
|
||||
"hold4",
|
||||
);
|
||||
@@ -408,29 +426,33 @@
|
||||
const typingEnd = typingStart + words.length * 0.05;
|
||||
tl.add(() => {
|
||||
if (pythonText) pythonText.innerHTML = "Start with Python";
|
||||
gsap.set(".squiggle-container", { opacity: 0 });
|
||||
gsap.set(`${S} .squiggle-container`, { opacity: 0 });
|
||||
}, typingEnd);
|
||||
|
||||
// 15. Hold
|
||||
tl.addLabel("hold6", typingEnd + 0.5);
|
||||
|
||||
// 16. Cursor clicks away to deselect
|
||||
tl.to("#cursor", { left: 500, top: 580, duration: 0.3, overwrite: "auto" }, "hold6");
|
||||
tl.to(`${S} #cursor`, { left: 500, top: 580, duration: 0.3, overwrite: "auto" }, "hold6");
|
||||
tl.to(
|
||||
"#cursor",
|
||||
`${S} #cursor`,
|
||||
{ scale: 0.8, duration: 0.05, yoyo: true, repeat: 1, overwrite: "auto" },
|
||||
"hold6+=0.3",
|
||||
);
|
||||
tl.to(".selection-border", { opacity: 0, duration: 0.1 }, "hold6+=0.3");
|
||||
tl.to(`${S} .selection-border`, { opacity: 0, duration: 0.1 }, "hold6+=0.3");
|
||||
|
||||
// 17. Emoji pop
|
||||
tl.to("#emoji-thumb", { scale: 1, duration: 0.15, ease: "back.out(2)" }, "hold6+=0.4");
|
||||
tl.to(
|
||||
`${S} #emoji-thumb`,
|
||||
{ scale: 1, duration: 0.15, ease: "back.out(2)" },
|
||||
"hold6+=0.4",
|
||||
);
|
||||
|
||||
// 18. Hold
|
||||
tl.addLabel("hold7", "+=2");
|
||||
|
||||
// 19. Fade out
|
||||
tl.to("#fade-overlay", { opacity: 1, duration: 0.5 }, "hold7");
|
||||
tl.to(`${S} #fade-overlay`, { opacity: 1, duration: 0.5 }, "hold7");
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["flowchart"] = tl;
|
||||
|
||||
@@ -0,0 +1,365 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;700&family=Lato:wght@400;700&display=block");
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<style>
|
||||
[data-composition-id="main"] {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #293241;
|
||||
}
|
||||
|
||||
/* Blueprint grid */
|
||||
.bp-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.bp-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bp-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 60px 60px 60px 40px;
|
||||
}
|
||||
.bp-divider {
|
||||
position: absolute;
|
||||
left: 1200px;
|
||||
top: 60px;
|
||||
bottom: 60px;
|
||||
width: 1px;
|
||||
background: #ee6c4d;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.bp-number {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.4em;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 60px;
|
||||
color: #ee6c4d;
|
||||
}
|
||||
|
||||
/* Right panel typography */
|
||||
.bp-name {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 38px;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 20px;
|
||||
color: #ee6c4d;
|
||||
}
|
||||
.bp-plabel {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 10px;
|
||||
color: #ee6c4d;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.bp-prompt {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
padding: 16px 20px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #ee6c4d;
|
||||
background: rgba(238, 108, 77, 0.06);
|
||||
border: 1px solid rgba(238, 108, 77, 0.12);
|
||||
}
|
||||
.bp-desc {
|
||||
font-family: "Lato", sans-serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.6;
|
||||
color: #98c1d9;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* GL scenes (hidden, just for texture capture) */
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 140px;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.12;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="bp-grid"></div>
|
||||
<div class="bp-divider"></div>
|
||||
<div class="bp-number">09 / 14</div>
|
||||
|
||||
<!-- GL demo scenes (captured as textures, then hidden) -->
|
||||
<div id="s1" class="scene" style="background: #293241">
|
||||
<div class="scene-label" style="color: #ee6c4d">SCENE A</div>
|
||||
</div>
|
||||
<div id="s2" class="scene" style="background: #ee6c4d; opacity: 0">
|
||||
<div class="scene-label" style="color: #293241">SCENE B</div>
|
||||
</div>
|
||||
|
||||
<!-- GL canvas (left panel only) -->
|
||||
<canvas
|
||||
id="gl-canvas"
|
||||
width="1200"
|
||||
height="1080"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
</canvas>
|
||||
|
||||
<!-- Right panel metadata -->
|
||||
<div class="bp-right">
|
||||
<div class="bp-name">Glitch</div>
|
||||
<div class="bp-plabel">Prompt</div>
|
||||
<div class="bp-prompt">"use glitch shader transition"</div>
|
||||
<div class="bp-desc">
|
||||
Scan lines, block scramble, chromatic aberration, brightness flicker, and color
|
||||
posterization.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="driver"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
style="position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
var glCanvas = document.getElementById("gl-canvas");
|
||||
var gl = glCanvas.getContext("webgl", { preserveDrawingBuffer: true });
|
||||
if (!gl) {
|
||||
console.warn("WebGL not available");
|
||||
window.__timelines["main"] = gsap.timeline({ paused: true });
|
||||
} else {
|
||||
gl.viewport(0, 0, 1200, 1080);
|
||||
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
||||
var sceneTextures = {};
|
||||
|
||||
function captureScene(sceneId) {
|
||||
var scene = document.getElementById(sceneId);
|
||||
var origOpacity = scene.style.opacity;
|
||||
var origZ = scene.style.zIndex;
|
||||
scene.style.opacity = "1";
|
||||
scene.style.zIndex = "999";
|
||||
scene.offsetHeight;
|
||||
var c = document.createElement("canvas");
|
||||
c.width = 1200;
|
||||
c.height = 1080;
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = window.getComputedStyle(scene).backgroundColor;
|
||||
ctx.fillRect(0, 0, 1200, 1080);
|
||||
var sr = scene.getBoundingClientRect();
|
||||
var els = scene.querySelectorAll("*");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i],
|
||||
cs = window.getComputedStyle(el);
|
||||
if (cs.display === "none" || cs.visibility === "hidden") continue;
|
||||
var r = el.getBoundingClientRect();
|
||||
if (r.width < 1 || r.height < 1) continue;
|
||||
var x = r.left - sr.left,
|
||||
y = r.top - sr.top,
|
||||
w = r.width,
|
||||
h = r.height;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = parseFloat(cs.opacity) || 1;
|
||||
var bg = cs.backgroundColor;
|
||||
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(x, y, w, h);
|
||||
}
|
||||
var hasChildEls = el.querySelector("div,span,img,video");
|
||||
var text = "";
|
||||
for (var j = 0; j < el.childNodes.length; j++)
|
||||
if (el.childNodes[j].nodeType === 3) text += el.childNodes[j].textContent;
|
||||
text = text.trim();
|
||||
if (text && !hasChildEls) {
|
||||
ctx.font = cs.fontWeight + " " + cs.fontSize + " " + cs.fontFamily;
|
||||
ctx.fillStyle = cs.color;
|
||||
if (cs.letterSpacing && cs.letterSpacing !== "normal")
|
||||
ctx.letterSpacing = cs.letterSpacing;
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + w / 2, y + h / 2);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
scene.style.opacity = origOpacity;
|
||||
scene.style.zIndex = origZ;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
|
||||
sceneTextures[sceneId] = tex;
|
||||
}
|
||||
|
||||
var vertSrc =
|
||||
"attribute vec2 a_pos; varying vec2 v_uv; void main(){" +
|
||||
"v_uv=a_pos*0.5+0.5; v_uv.y=1.0-v_uv.y; gl_Position=vec4(a_pos,0,1);}";
|
||||
var quadBuf = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.bufferData(
|
||||
gl.ARRAY_BUFFER,
|
||||
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
||||
gl.STATIC_DRAW,
|
||||
);
|
||||
function compileShader(src, type) {
|
||||
var s = gl.createShader(type);
|
||||
gl.shaderSource(s, src);
|
||||
gl.compileShader(s);
|
||||
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
|
||||
console.error("Shader:", gl.getShaderInfoLog(s));
|
||||
return s;
|
||||
}
|
||||
function mkProg(fragSrc) {
|
||||
var p = gl.createProgram();
|
||||
gl.attachShader(p, compileShader(vertSrc, gl.VERTEX_SHADER));
|
||||
gl.attachShader(p, compileShader(fragSrc, gl.FRAGMENT_SHADER));
|
||||
gl.linkProgram(p);
|
||||
if (!gl.getProgramParameter(p, gl.LINK_STATUS))
|
||||
console.error("Link:", gl.getProgramInfoLog(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
var H =
|
||||
"precision mediump float;" +
|
||||
"varying vec2 v_uv;" +
|
||||
"uniform sampler2D u_from, u_to;" +
|
||||
"uniform float u_progress;" +
|
||||
"uniform vec2 u_resolution;\n";
|
||||
|
||||
var progPass = mkProg(H + "void main(){gl_FragColor=texture2D(u_from,v_uv);}");
|
||||
var progTrans = mkProg(
|
||||
H +
|
||||
"float rand(vec2 co){return fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453);}void main(){float inten=u_progress*(1.-u_progress)*4.;float lineY=floor(v_uv.y*60.)/60.;float lineDisp=(rand(vec2(lineY,floor(u_progress*17.)))-.5)*.18*inten;vec2 block=floor(v_uv*vec2(12.,8.));float br=rand(block+vec2(floor(u_progress*11.)));float ba=step(.83,br)*inten;vec2 bd=(vec2(rand(block*2.1),rand(block*3.7))-.5)*.35*ba;vec2 uv=clamp(v_uv+vec2(lineDisp,0.)+bd,0.,1.);float shift=inten*.035;float r=texture2D(u_from,uv+vec2(shift,0.)).r;float g=texture2D(u_from,uv).g;float b=texture2D(u_from,uv-vec2(shift,0.)).b;vec3 col=vec3(r,g,b);col-=step(.5,fract(v_uv.y*u_resolution.y*.5))*.05*inten;col*=1.+(rand(vec2(floor(u_progress*23.)))-.5)*.3*inten;float levels=mix(256.,8.,inten*.5);col=floor(col*levels)/levels;gl_FragColor=mix(vec4(col,1.),texture2D(u_to,v_uv),u_progress);}",
|
||||
);
|
||||
|
||||
function renderShader(prog, texFrom, texTo, progress) {
|
||||
gl.useProgram(prog);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texFrom);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_from"), 0);
|
||||
gl.activeTexture(gl.TEXTURE1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texTo);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_to"), 1);
|
||||
gl.uniform1f(gl.getUniformLocation(prog, "u_progress"), progress);
|
||||
gl.uniform2f(gl.getUniformLocation(prog, "u_resolution"), 1200, 1080);
|
||||
var pos = gl.getAttribLocation(prog, "a_pos");
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.enableVertexAttribArray(pos);
|
||||
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function easeInOut(p) {
|
||||
return p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2;
|
||||
}
|
||||
|
||||
captureScene("s1");
|
||||
captureScene("s2");
|
||||
glCanvas.style.display = "block";
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
document.querySelectorAll(".scene").forEach(function (s) {
|
||||
s.style.opacity = "0";
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
var t = tl.time();
|
||||
if (t >= 1.0 && t < 3.0) {
|
||||
renderShader(
|
||||
progTrans,
|
||||
sceneTextures["s1"],
|
||||
sceneTextures["s2"],
|
||||
easeInOut((t - 1.0) / 2.0),
|
||||
);
|
||||
} else if (t >= 3.0) {
|
||||
renderShader(progPass, sceneTextures["s2"], sceneTextures["s2"], 0);
|
||||
} else {
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
tl.to({ v: 0 }, { v: 1, duration: 4, ease: "none" }, 0);
|
||||
window.__timelines["main"] = tl;
|
||||
} // end if (gl)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "glitch",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Glitch",
|
||||
"description": "Shader transition with digital glitch artifacts",
|
||||
"tags": ["transition", "shader"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 4,
|
||||
"files": [
|
||||
{
|
||||
"path": "glitch.html",
|
||||
"target": "compositions/glitch.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,364 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;700&family=Lato:wght@400;700&display=block");
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<style>
|
||||
[data-composition-id="main"] {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #10002b;
|
||||
}
|
||||
|
||||
/* Blueprint grid */
|
||||
.bp-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.bp-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bp-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 60px 60px 60px 40px;
|
||||
}
|
||||
.bp-divider {
|
||||
position: absolute;
|
||||
left: 1200px;
|
||||
top: 60px;
|
||||
bottom: 60px;
|
||||
width: 1px;
|
||||
background: #f20089;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.bp-number {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.4em;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 60px;
|
||||
color: #f20089;
|
||||
}
|
||||
|
||||
/* Right panel typography */
|
||||
.bp-name {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 38px;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 20px;
|
||||
color: #f20089;
|
||||
}
|
||||
.bp-plabel {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 10px;
|
||||
color: #f20089;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.bp-prompt {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
padding: 16px 20px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #f20089;
|
||||
background: rgba(242, 0, 137, 0.06);
|
||||
border: 1px solid rgba(242, 0, 137, 0.12);
|
||||
}
|
||||
.bp-desc {
|
||||
font-family: "Lato", sans-serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.6;
|
||||
color: #a080a0;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* GL scenes (hidden, just for texture capture) */
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 140px;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.12;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="bp-grid"></div>
|
||||
<div class="bp-divider"></div>
|
||||
<div class="bp-number">06 / 14</div>
|
||||
|
||||
<!-- GL demo scenes (captured as textures, then hidden) -->
|
||||
<div id="s1" class="scene" style="background: #10002b">
|
||||
<div class="scene-label" style="color: #f20089">SCENE A</div>
|
||||
</div>
|
||||
<div id="s2" class="scene" style="background: #f20089; opacity: 0">
|
||||
<div class="scene-label" style="color: #10002b">SCENE B</div>
|
||||
</div>
|
||||
|
||||
<!-- GL canvas (left panel only) -->
|
||||
<canvas
|
||||
id="gl-canvas"
|
||||
width="1200"
|
||||
height="1080"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
</canvas>
|
||||
|
||||
<!-- Right panel metadata -->
|
||||
<div class="bp-right">
|
||||
<div class="bp-name">Gravitational Lens</div>
|
||||
<div class="bp-plabel">Prompt</div>
|
||||
<div class="bp-prompt">"use gravitational lens shader transition"</div>
|
||||
<div class="bp-desc">
|
||||
Content warps toward a gravity well with chromatic aberration and event horizon darkening.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="driver"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
style="position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
var glCanvas = document.getElementById("gl-canvas");
|
||||
var gl = glCanvas.getContext("webgl", { preserveDrawingBuffer: true });
|
||||
if (!gl) {
|
||||
console.warn("WebGL not available");
|
||||
window.__timelines["main"] = gsap.timeline({ paused: true });
|
||||
} else {
|
||||
gl.viewport(0, 0, 1200, 1080);
|
||||
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
||||
var sceneTextures = {};
|
||||
|
||||
function captureScene(sceneId) {
|
||||
var scene = document.getElementById(sceneId);
|
||||
var origOpacity = scene.style.opacity;
|
||||
var origZ = scene.style.zIndex;
|
||||
scene.style.opacity = "1";
|
||||
scene.style.zIndex = "999";
|
||||
scene.offsetHeight;
|
||||
var c = document.createElement("canvas");
|
||||
c.width = 1200;
|
||||
c.height = 1080;
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = window.getComputedStyle(scene).backgroundColor;
|
||||
ctx.fillRect(0, 0, 1200, 1080);
|
||||
var sr = scene.getBoundingClientRect();
|
||||
var els = scene.querySelectorAll("*");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i],
|
||||
cs = window.getComputedStyle(el);
|
||||
if (cs.display === "none" || cs.visibility === "hidden") continue;
|
||||
var r = el.getBoundingClientRect();
|
||||
if (r.width < 1 || r.height < 1) continue;
|
||||
var x = r.left - sr.left,
|
||||
y = r.top - sr.top,
|
||||
w = r.width,
|
||||
h = r.height;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = parseFloat(cs.opacity) || 1;
|
||||
var bg = cs.backgroundColor;
|
||||
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(x, y, w, h);
|
||||
}
|
||||
var hasChildEls = el.querySelector("div,span,img,video");
|
||||
var text = "";
|
||||
for (var j = 0; j < el.childNodes.length; j++)
|
||||
if (el.childNodes[j].nodeType === 3) text += el.childNodes[j].textContent;
|
||||
text = text.trim();
|
||||
if (text && !hasChildEls) {
|
||||
ctx.font = cs.fontWeight + " " + cs.fontSize + " " + cs.fontFamily;
|
||||
ctx.fillStyle = cs.color;
|
||||
if (cs.letterSpacing && cs.letterSpacing !== "normal")
|
||||
ctx.letterSpacing = cs.letterSpacing;
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + w / 2, y + h / 2);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
scene.style.opacity = origOpacity;
|
||||
scene.style.zIndex = origZ;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
|
||||
sceneTextures[sceneId] = tex;
|
||||
}
|
||||
|
||||
var vertSrc =
|
||||
"attribute vec2 a_pos; varying vec2 v_uv; void main(){" +
|
||||
"v_uv=a_pos*0.5+0.5; v_uv.y=1.0-v_uv.y; gl_Position=vec4(a_pos,0,1);}";
|
||||
var quadBuf = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.bufferData(
|
||||
gl.ARRAY_BUFFER,
|
||||
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
||||
gl.STATIC_DRAW,
|
||||
);
|
||||
function compileShader(src, type) {
|
||||
var s = gl.createShader(type);
|
||||
gl.shaderSource(s, src);
|
||||
gl.compileShader(s);
|
||||
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
|
||||
console.error("Shader:", gl.getShaderInfoLog(s));
|
||||
return s;
|
||||
}
|
||||
function mkProg(fragSrc) {
|
||||
var p = gl.createProgram();
|
||||
gl.attachShader(p, compileShader(vertSrc, gl.VERTEX_SHADER));
|
||||
gl.attachShader(p, compileShader(fragSrc, gl.FRAGMENT_SHADER));
|
||||
gl.linkProgram(p);
|
||||
if (!gl.getProgramParameter(p, gl.LINK_STATUS))
|
||||
console.error("Link:", gl.getProgramInfoLog(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
var H =
|
||||
"precision mediump float;" +
|
||||
"varying vec2 v_uv;" +
|
||||
"uniform sampler2D u_from, u_to;" +
|
||||
"uniform float u_progress;" +
|
||||
"uniform vec2 u_resolution;\n";
|
||||
|
||||
var progPass = mkProg(H + "void main(){gl_FragColor=texture2D(u_from,v_uv);}");
|
||||
var progTrans = mkProg(
|
||||
H +
|
||||
"void main(){vec4 B=texture2D(u_to,v_uv);vec2 uv=v_uv-.5;float dist=length(uv);float pull=u_progress*2.;float warpStr=pull*.3/(dist+.1);vec2 warped=clamp(v_uv-uv*warpStr,0.,1.);vec4 A=texture2D(u_from,warped);float horizon=smoothstep(0.,.3,dist/(1.-u_progress*.85+.001));float shift=pull*.02/(dist+.2);float r=texture2D(u_from,clamp(v_uv-uv*(warpStr+shift),0.,1.)).r;float b=texture2D(u_from,clamp(v_uv-uv*(warpStr-shift),0.,1.)).b;vec3 lensed=vec3(r,A.g,b)*horizon;gl_FragColor=vec4(mix(lensed,B.rgb,smoothstep(.3,.9,u_progress)),1.);}",
|
||||
);
|
||||
|
||||
function renderShader(prog, texFrom, texTo, progress) {
|
||||
gl.useProgram(prog);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texFrom);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_from"), 0);
|
||||
gl.activeTexture(gl.TEXTURE1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texTo);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_to"), 1);
|
||||
gl.uniform1f(gl.getUniformLocation(prog, "u_progress"), progress);
|
||||
gl.uniform2f(gl.getUniformLocation(prog, "u_resolution"), 1200, 1080);
|
||||
var pos = gl.getAttribLocation(prog, "a_pos");
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.enableVertexAttribArray(pos);
|
||||
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function easeInOut(p) {
|
||||
return p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2;
|
||||
}
|
||||
|
||||
captureScene("s1");
|
||||
captureScene("s2");
|
||||
glCanvas.style.display = "block";
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
document.querySelectorAll(".scene").forEach(function (s) {
|
||||
s.style.opacity = "0";
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
var t = tl.time();
|
||||
if (t >= 1.0 && t < 3.0) {
|
||||
renderShader(
|
||||
progTrans,
|
||||
sceneTextures["s1"],
|
||||
sceneTextures["s2"],
|
||||
easeInOut((t - 1.0) / 2.0),
|
||||
);
|
||||
} else if (t >= 3.0) {
|
||||
renderShader(progPass, sceneTextures["s2"], sceneTextures["s2"], 0);
|
||||
} else {
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
tl.to({ v: 0 }, { v: 1, duration: 4, ease: "none" }, 0);
|
||||
window.__timelines["main"] = tl;
|
||||
} // end if (gl)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "gravitational-lens",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Gravitational Lens",
|
||||
"description": "Shader transition with gravitational lensing distortion",
|
||||
"tags": ["transition", "shader"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 4,
|
||||
"files": [
|
||||
{
|
||||
"path": "gravitational-lens.html",
|
||||
"target": "compositions/gravitational-lens.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
font-family: "DM Sans", sans-serif;
|
||||
}
|
||||
|
||||
.lower-third {
|
||||
[data-composition-id="instagram-follow"] .lower-third {
|
||||
position: absolute;
|
||||
bottom: 160px;
|
||||
left: 50%;
|
||||
@@ -39,7 +39,7 @@
|
||||
box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
.avatar {
|
||||
[data-composition-id="instagram-follow"] .avatar {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
border-radius: 50%;
|
||||
@@ -48,20 +48,20 @@
|
||||
border: 3px solid #333;
|
||||
}
|
||||
|
||||
.profile-info {
|
||||
[data-composition-id="instagram-follow"] .profile-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.name-row {
|
||||
[data-composition-id="instagram-follow"] .name-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.display-name {
|
||||
[data-composition-id="instagram-follow"] .display-name {
|
||||
font-size: 42px;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
@@ -69,33 +69,33 @@
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
.verified-badge {
|
||||
[data-composition-id="instagram-follow"] .verified-badge {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.verified-badge svg {
|
||||
[data-composition-id="instagram-follow"] .verified-badge svg {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.handle {
|
||||
[data-composition-id="instagram-follow"] .handle {
|
||||
font-size: 28px;
|
||||
font-weight: 400;
|
||||
color: #a0a0a0;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.follower-count {
|
||||
[data-composition-id="instagram-follow"] .follower-count {
|
||||
font-size: 25px;
|
||||
font-weight: 400;
|
||||
color: #737373;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.follow-btn {
|
||||
[data-composition-id="instagram-follow"] .follow-btn {
|
||||
position: relative;
|
||||
width: 250px;
|
||||
height: 80px;
|
||||
@@ -108,7 +108,7 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
[data-composition-id="instagram-follow"] .btn-text {
|
||||
position: absolute;
|
||||
font-family: "DM Sans", sans-serif;
|
||||
font-size: 30px;
|
||||
@@ -118,24 +118,24 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.btn-text-follow {
|
||||
[data-composition-id="instagram-follow"] .btn-text-follow {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.btn-text-following {
|
||||
[data-composition-id="instagram-follow"] .btn-text-following {
|
||||
opacity: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.chevron-icon {
|
||||
[data-composition-id="instagram-follow"] .chevron-icon {
|
||||
display: inline-block;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.chevron-icon svg {
|
||||
[data-composition-id="instagram-follow"] .chevron-icon svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
display: block;
|
||||
@@ -145,7 +145,7 @@
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="instagram-follow-overlay"
|
||||
data-composition-id="instagram-follow"
|
||||
data-width="1080"
|
||||
data-height="1920"
|
||||
data-start="0"
|
||||
@@ -282,7 +282,7 @@
|
||||
3.8,
|
||||
);
|
||||
|
||||
window.__timelines["instagram-follow-overlay"] = tl;
|
||||
window.__timelines["instagram-follow"] = tl;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,364 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;700&family=Lato:wght@400;700&display=block");
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<style>
|
||||
[data-composition-id="main"] {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #001524;
|
||||
}
|
||||
|
||||
/* Blueprint grid */
|
||||
.bp-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.bp-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bp-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 60px 60px 60px 40px;
|
||||
}
|
||||
.bp-divider {
|
||||
position: absolute;
|
||||
left: 1200px;
|
||||
top: 60px;
|
||||
bottom: 60px;
|
||||
width: 1px;
|
||||
background: #fb8b24;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.bp-number {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.4em;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 60px;
|
||||
color: #fb8b24;
|
||||
}
|
||||
|
||||
/* Right panel typography */
|
||||
.bp-name {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 38px;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 20px;
|
||||
color: #fb8b24;
|
||||
}
|
||||
.bp-plabel {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 10px;
|
||||
color: #fb8b24;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.bp-prompt {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
padding: 16px 20px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #fb8b24;
|
||||
background: rgba(251, 139, 36, 0.06);
|
||||
border: 1px solid rgba(251, 139, 36, 0.12);
|
||||
}
|
||||
.bp-desc {
|
||||
font-family: "Lato", sans-serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.6;
|
||||
color: #708d81;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* GL scenes (hidden, just for texture capture) */
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 140px;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.12;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="bp-grid"></div>
|
||||
<div class="bp-divider"></div>
|
||||
<div class="bp-number">14 / 14</div>
|
||||
|
||||
<!-- GL demo scenes (captured as textures, then hidden) -->
|
||||
<div id="s1" class="scene" style="background: #001524">
|
||||
<div class="scene-label" style="color: #fb8b24">SCENE A</div>
|
||||
</div>
|
||||
<div id="s2" class="scene" style="background: #fb8b24; opacity: 0">
|
||||
<div class="scene-label" style="color: #001524">SCENE B</div>
|
||||
</div>
|
||||
|
||||
<!-- GL canvas (left panel only) -->
|
||||
<canvas
|
||||
id="gl-canvas"
|
||||
width="1200"
|
||||
height="1080"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
</canvas>
|
||||
|
||||
<!-- Right panel metadata -->
|
||||
<div class="bp-right">
|
||||
<div class="bp-name">Light Leak</div>
|
||||
<div class="bp-plabel">Prompt</div>
|
||||
<div class="bp-prompt">"use light leak shader transition"</div>
|
||||
<div class="bp-desc">
|
||||
Beer-Lambert exponential falloff with ACES tone mapping and directional flare streak.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="driver"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
style="position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
var glCanvas = document.getElementById("gl-canvas");
|
||||
var gl = glCanvas.getContext("webgl", { preserveDrawingBuffer: true });
|
||||
if (!gl) {
|
||||
console.warn("WebGL not available");
|
||||
window.__timelines["main"] = gsap.timeline({ paused: true });
|
||||
} else {
|
||||
gl.viewport(0, 0, 1200, 1080);
|
||||
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
||||
var sceneTextures = {};
|
||||
|
||||
function captureScene(sceneId) {
|
||||
var scene = document.getElementById(sceneId);
|
||||
var origOpacity = scene.style.opacity;
|
||||
var origZ = scene.style.zIndex;
|
||||
scene.style.opacity = "1";
|
||||
scene.style.zIndex = "999";
|
||||
scene.offsetHeight;
|
||||
var c = document.createElement("canvas");
|
||||
c.width = 1200;
|
||||
c.height = 1080;
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = window.getComputedStyle(scene).backgroundColor;
|
||||
ctx.fillRect(0, 0, 1200, 1080);
|
||||
var sr = scene.getBoundingClientRect();
|
||||
var els = scene.querySelectorAll("*");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i],
|
||||
cs = window.getComputedStyle(el);
|
||||
if (cs.display === "none" || cs.visibility === "hidden") continue;
|
||||
var r = el.getBoundingClientRect();
|
||||
if (r.width < 1 || r.height < 1) continue;
|
||||
var x = r.left - sr.left,
|
||||
y = r.top - sr.top,
|
||||
w = r.width,
|
||||
h = r.height;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = parseFloat(cs.opacity) || 1;
|
||||
var bg = cs.backgroundColor;
|
||||
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(x, y, w, h);
|
||||
}
|
||||
var hasChildEls = el.querySelector("div,span,img,video");
|
||||
var text = "";
|
||||
for (var j = 0; j < el.childNodes.length; j++)
|
||||
if (el.childNodes[j].nodeType === 3) text += el.childNodes[j].textContent;
|
||||
text = text.trim();
|
||||
if (text && !hasChildEls) {
|
||||
ctx.font = cs.fontWeight + " " + cs.fontSize + " " + cs.fontFamily;
|
||||
ctx.fillStyle = cs.color;
|
||||
if (cs.letterSpacing && cs.letterSpacing !== "normal")
|
||||
ctx.letterSpacing = cs.letterSpacing;
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + w / 2, y + h / 2);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
scene.style.opacity = origOpacity;
|
||||
scene.style.zIndex = origZ;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
|
||||
sceneTextures[sceneId] = tex;
|
||||
}
|
||||
|
||||
var vertSrc =
|
||||
"attribute vec2 a_pos; varying vec2 v_uv; void main(){" +
|
||||
"v_uv=a_pos*0.5+0.5; v_uv.y=1.0-v_uv.y; gl_Position=vec4(a_pos,0,1);}";
|
||||
var quadBuf = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.bufferData(
|
||||
gl.ARRAY_BUFFER,
|
||||
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
||||
gl.STATIC_DRAW,
|
||||
);
|
||||
function compileShader(src, type) {
|
||||
var s = gl.createShader(type);
|
||||
gl.shaderSource(s, src);
|
||||
gl.compileShader(s);
|
||||
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
|
||||
console.error("Shader:", gl.getShaderInfoLog(s));
|
||||
return s;
|
||||
}
|
||||
function mkProg(fragSrc) {
|
||||
var p = gl.createProgram();
|
||||
gl.attachShader(p, compileShader(vertSrc, gl.VERTEX_SHADER));
|
||||
gl.attachShader(p, compileShader(fragSrc, gl.FRAGMENT_SHADER));
|
||||
gl.linkProgram(p);
|
||||
if (!gl.getProgramParameter(p, gl.LINK_STATUS))
|
||||
console.error("Link:", gl.getProgramInfoLog(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
var H =
|
||||
"precision mediump float;" +
|
||||
"varying vec2 v_uv;" +
|
||||
"uniform sampler2D u_from, u_to;" +
|
||||
"uniform float u_progress;" +
|
||||
"uniform vec2 u_resolution;\n";
|
||||
|
||||
var progPass = mkProg(H + "void main(){gl_FragColor=texture2D(u_from,v_uv);}");
|
||||
var progTrans = mkProg(
|
||||
H +
|
||||
"vec3 aces(vec3 x){return clamp((x*(2.51*x+.03))/(x*(2.43*x+.59)+.14),0.,1.);}void main(){vec4 A=texture2D(u_from,v_uv),B=texture2D(u_to,v_uv);vec2 lp=vec2(1.3,-.2);float dist=length(v_uv-lp);float leak=clamp(exp(-dist*1.8)*u_progress*4.,0.,1.);vec3 warmColor=mix(vec3(1.,.5,.15),vec3(1.,.9,.75),dist*.7);float flare=exp(-abs(v_uv.y-(-.2+v_uv.x*.3))*15.)*leak*.3;vec3 overexposed=A.rgb+warmColor*leak*3.+vec3(1.,.8,.5)*flare;overexposed=aces(overexposed);gl_FragColor=vec4(mix(overexposed,B.rgb,smoothstep(.15,.85,u_progress)),1.);}",
|
||||
);
|
||||
|
||||
function renderShader(prog, texFrom, texTo, progress) {
|
||||
gl.useProgram(prog);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texFrom);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_from"), 0);
|
||||
gl.activeTexture(gl.TEXTURE1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texTo);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_to"), 1);
|
||||
gl.uniform1f(gl.getUniformLocation(prog, "u_progress"), progress);
|
||||
gl.uniform2f(gl.getUniformLocation(prog, "u_resolution"), 1200, 1080);
|
||||
var pos = gl.getAttribLocation(prog, "a_pos");
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.enableVertexAttribArray(pos);
|
||||
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function easeInOut(p) {
|
||||
return p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2;
|
||||
}
|
||||
|
||||
captureScene("s1");
|
||||
captureScene("s2");
|
||||
glCanvas.style.display = "block";
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
document.querySelectorAll(".scene").forEach(function (s) {
|
||||
s.style.opacity = "0";
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
var t = tl.time();
|
||||
if (t >= 1.0 && t < 3.0) {
|
||||
renderShader(
|
||||
progTrans,
|
||||
sceneTextures["s1"],
|
||||
sceneTextures["s2"],
|
||||
easeInOut((t - 1.0) / 2.0),
|
||||
);
|
||||
} else if (t >= 3.0) {
|
||||
renderShader(progPass, sceneTextures["s2"], sceneTextures["s2"], 0);
|
||||
} else {
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
tl.to({ v: 0 }, { v: 1, duration: 4, ease: "none" }, 0);
|
||||
window.__timelines["main"] = tl;
|
||||
} // end if (gl)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "light-leak",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Light Leak",
|
||||
"description": "Shader transition with cinematic light leak overlay",
|
||||
"tags": ["transition", "shader"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 4,
|
||||
"files": [
|
||||
{
|
||||
"path": "light-leak.html",
|
||||
"target": "compositions/light-leak.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -26,7 +26,7 @@
|
||||
font-family: "Inter", sans-serif;
|
||||
}
|
||||
|
||||
.notification-card {
|
||||
[data-composition-id="macos-notification"] .notification-card {
|
||||
position: absolute;
|
||||
top: 24px;
|
||||
right: 24px;
|
||||
@@ -44,7 +44,7 @@
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.app-icon {
|
||||
[data-composition-id="macos-notification"] .app-icon {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 8px;
|
||||
@@ -52,25 +52,25 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.app-icon svg {
|
||||
[data-composition-id="macos-notification"] .app-icon svg {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.notification-content {
|
||||
[data-composition-id="macos-notification"] .notification-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.notification-header {
|
||||
[data-composition-id="macos-notification"] .notification-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.app-name {
|
||||
[data-composition-id="macos-notification"] .app-name {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
@@ -78,13 +78,13 @@
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.time-label {
|
||||
[data-composition-id="macos-notification"] .time-label {
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.35);
|
||||
}
|
||||
|
||||
.notification-title {
|
||||
[data-composition-id="macos-notification"] .notification-title {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: #ffffff;
|
||||
@@ -92,7 +92,7 @@
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.notification-body {
|
||||
[data-composition-id="macos-notification"] .notification-body {
|
||||
font-size: 13px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
font-family: "DM Sans", sans-serif;
|
||||
}
|
||||
|
||||
.reddit-card {
|
||||
[data-composition-id="reddit-post"] .reddit-card {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
@@ -39,39 +39,39 @@
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.post-header {
|
||||
[data-composition-id="reddit-post"] .post-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.subreddit-icon {
|
||||
[data-composition-id="reddit-post"] .subreddit-icon {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.subreddit-icon svg {
|
||||
[data-composition-id="reddit-post"] .subreddit-icon svg {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.post-meta {
|
||||
[data-composition-id="reddit-post"] .post-meta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.subreddit-name {
|
||||
[data-composition-id="reddit-post"] .subreddit-name {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
color: #d7dadc;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.post-author {
|
||||
[data-composition-id="reddit-post"] .post-author {
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: #818384;
|
||||
@@ -79,7 +79,7 @@
|
||||
}
|
||||
|
||||
/* Content */
|
||||
.post-title {
|
||||
[data-composition-id="reddit-post"] .post-title {
|
||||
font-size: 38px;
|
||||
font-weight: 700;
|
||||
color: #d7dadc;
|
||||
@@ -91,7 +91,7 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.post-body {
|
||||
[data-composition-id="reddit-post"] .post-body {
|
||||
font-size: 28px;
|
||||
font-weight: 400;
|
||||
color: #818384;
|
||||
@@ -104,7 +104,7 @@
|
||||
}
|
||||
|
||||
/* Action bar */
|
||||
.action-bar {
|
||||
[data-composition-id="reddit-post"] .action-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 28px;
|
||||
@@ -112,7 +112,7 @@
|
||||
border-top: 1px solid #343536;
|
||||
}
|
||||
|
||||
.vote-group {
|
||||
[data-composition-id="reddit-post"] .vote-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
@@ -121,7 +121,7 @@
|
||||
padding: 8px 16px;
|
||||
}
|
||||
|
||||
.vote-btn {
|
||||
[data-composition-id="reddit-post"] .vote-btn {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
display: flex;
|
||||
@@ -130,13 +130,13 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.vote-btn svg {
|
||||
[data-composition-id="reddit-post"] .vote-btn svg {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.vote-count {
|
||||
[data-composition-id="reddit-post"] .vote-count {
|
||||
font-size: 26px;
|
||||
font-weight: 700;
|
||||
color: #d7dadc;
|
||||
@@ -144,7 +144,7 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
[data-composition-id="reddit-post"] .action-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
@@ -153,13 +153,13 @@
|
||||
padding: 10px 20px;
|
||||
}
|
||||
|
||||
.action-btn svg {
|
||||
[data-composition-id="reddit-post"] .action-btn svg {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.action-btn span {
|
||||
[data-composition-id="reddit-post"] .action-btn span {
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: #818384;
|
||||
@@ -169,7 +169,7 @@
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="reddit-post-overlay"
|
||||
data-composition-id="reddit-post"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
data-start="0"
|
||||
@@ -340,7 +340,7 @@
|
||||
4.2,
|
||||
);
|
||||
|
||||
window.__timelines["reddit-post-overlay"] = tl;
|
||||
window.__timelines["reddit-post"] = tl;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "ridged-burn",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Ridged Burn",
|
||||
"description": "Shader transition with ridged turbulence burn effect",
|
||||
"tags": ["transition", "shader"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 4,
|
||||
"files": [
|
||||
{
|
||||
"path": "ridged-burn.html",
|
||||
"target": "compositions/ridged-burn.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,376 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;700&family=Lato:wght@400;700&display=block");
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<style>
|
||||
[data-composition-id="main"] {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #0b090a;
|
||||
}
|
||||
|
||||
/* Blueprint grid */
|
||||
.bp-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.bp-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bp-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 60px 60px 60px 40px;
|
||||
}
|
||||
.bp-divider {
|
||||
position: absolute;
|
||||
left: 1200px;
|
||||
top: 60px;
|
||||
bottom: 60px;
|
||||
width: 1px;
|
||||
background: #e5383b;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.bp-number {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.4em;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 60px;
|
||||
color: #e5383b;
|
||||
}
|
||||
|
||||
/* Right panel typography */
|
||||
.bp-name {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 38px;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 20px;
|
||||
color: #e5383b;
|
||||
}
|
||||
.bp-plabel {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 10px;
|
||||
color: #e5383b;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.bp-prompt {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
padding: 16px 20px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #e5383b;
|
||||
background: rgba(229, 56, 59, 0.06);
|
||||
border: 1px solid rgba(229, 56, 59, 0.12);
|
||||
}
|
||||
.bp-desc {
|
||||
font-family: "Lato", sans-serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.6;
|
||||
color: #777;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* GL scenes (hidden, just for texture capture) */
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 140px;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.12;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="bp-grid"></div>
|
||||
<div class="bp-divider"></div>
|
||||
<div class="bp-number">02 / 14</div>
|
||||
|
||||
<!-- GL demo scenes (captured as textures, then hidden) -->
|
||||
<div id="s1" class="scene" style="background: #0b090a">
|
||||
<div class="scene-label" style="color: #e5383b">SCENE A</div>
|
||||
</div>
|
||||
<div id="s2" class="scene" style="background: #e5383b; opacity: 0">
|
||||
<div class="scene-label" style="color: #0b090a">SCENE B</div>
|
||||
</div>
|
||||
|
||||
<!-- GL canvas (left panel only) -->
|
||||
<canvas
|
||||
id="gl-canvas"
|
||||
width="1200"
|
||||
height="1080"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
</canvas>
|
||||
|
||||
<!-- Right panel metadata -->
|
||||
<div class="bp-right">
|
||||
<div class="bp-name">Ridged Burn</div>
|
||||
<div class="bp-plabel">Prompt</div>
|
||||
<div class="bp-prompt">"use ridged burn shader transition"</div>
|
||||
<div class="bp-desc">
|
||||
abs(noise) creates sharp lightning-crack edges. Blackbody color gradient with
|
||||
high-frequency ember sparks.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="driver"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
style="position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
var glCanvas = document.getElementById("gl-canvas");
|
||||
var gl = glCanvas.getContext("webgl", { preserveDrawingBuffer: true });
|
||||
if (!gl) {
|
||||
console.warn("WebGL not available");
|
||||
window.__timelines["main"] = gsap.timeline({ paused: true });
|
||||
} else {
|
||||
gl.viewport(0, 0, 1200, 1080);
|
||||
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
||||
var sceneTextures = {};
|
||||
|
||||
function captureScene(sceneId) {
|
||||
var scene = document.getElementById(sceneId);
|
||||
var origOpacity = scene.style.opacity;
|
||||
var origZ = scene.style.zIndex;
|
||||
scene.style.opacity = "1";
|
||||
scene.style.zIndex = "999";
|
||||
scene.offsetHeight;
|
||||
var c = document.createElement("canvas");
|
||||
c.width = 1200;
|
||||
c.height = 1080;
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = window.getComputedStyle(scene).backgroundColor;
|
||||
ctx.fillRect(0, 0, 1200, 1080);
|
||||
var sr = scene.getBoundingClientRect();
|
||||
var els = scene.querySelectorAll("*");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i],
|
||||
cs = window.getComputedStyle(el);
|
||||
if (cs.display === "none" || cs.visibility === "hidden") continue;
|
||||
var r = el.getBoundingClientRect();
|
||||
if (r.width < 1 || r.height < 1) continue;
|
||||
var x = r.left - sr.left,
|
||||
y = r.top - sr.top,
|
||||
w = r.width,
|
||||
h = r.height;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = parseFloat(cs.opacity) || 1;
|
||||
var bg = cs.backgroundColor;
|
||||
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(x, y, w, h);
|
||||
}
|
||||
var hasChildEls = el.querySelector("div,span,img,video");
|
||||
var text = "";
|
||||
for (var j = 0; j < el.childNodes.length; j++)
|
||||
if (el.childNodes[j].nodeType === 3) text += el.childNodes[j].textContent;
|
||||
text = text.trim();
|
||||
if (text && !hasChildEls) {
|
||||
ctx.font = cs.fontWeight + " " + cs.fontSize + " " + cs.fontFamily;
|
||||
ctx.fillStyle = cs.color;
|
||||
if (cs.letterSpacing && cs.letterSpacing !== "normal")
|
||||
ctx.letterSpacing = cs.letterSpacing;
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + w / 2, y + h / 2);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
scene.style.opacity = origOpacity;
|
||||
scene.style.zIndex = origZ;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
|
||||
sceneTextures[sceneId] = tex;
|
||||
}
|
||||
|
||||
var vertSrc =
|
||||
"attribute vec2 a_pos; varying vec2 v_uv; void main(){" +
|
||||
"v_uv=a_pos*0.5+0.5; v_uv.y=1.0-v_uv.y; gl_Position=vec4(a_pos,0,1);}";
|
||||
var quadBuf = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.bufferData(
|
||||
gl.ARRAY_BUFFER,
|
||||
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
||||
gl.STATIC_DRAW,
|
||||
);
|
||||
function compileShader(src, type) {
|
||||
var s = gl.createShader(type);
|
||||
gl.shaderSource(s, src);
|
||||
gl.compileShader(s);
|
||||
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
|
||||
console.error("Shader:", gl.getShaderInfoLog(s));
|
||||
return s;
|
||||
}
|
||||
function mkProg(fragSrc) {
|
||||
var p = gl.createProgram();
|
||||
gl.attachShader(p, compileShader(vertSrc, gl.VERTEX_SHADER));
|
||||
gl.attachShader(p, compileShader(fragSrc, gl.FRAGMENT_SHADER));
|
||||
gl.linkProgram(p);
|
||||
if (!gl.getProgramParameter(p, gl.LINK_STATUS))
|
||||
console.error("Link:", gl.getProgramInfoLog(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
var H =
|
||||
"precision mediump float;" +
|
||||
"varying vec2 v_uv;" +
|
||||
"uniform sampler2D u_from, u_to;" +
|
||||
"uniform float u_progress;" +
|
||||
"uniform vec2 u_resolution;\n";
|
||||
|
||||
var NQ =
|
||||
"float hash(vec2 p){return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453);}" +
|
||||
"float vnoise(vec2 p){vec2 i=floor(p),f=fract(p);" +
|
||||
"f=f*f*f*(f*(f*6.-15.)+10.);" +
|
||||
"return mix(mix(hash(i),hash(i+vec2(1,0)),f.x)," +
|
||||
"mix(hash(i+vec2(0,1)),hash(i+vec2(1,1)),f.x),f.y);}" +
|
||||
"float fbm(vec2 p){float v=0.,a=.5;" +
|
||||
"mat2 R=mat2(.8,.6,-.6,.8);" +
|
||||
"for(int i=0;i<5;i++){v+=a*vnoise(p);p=R*p*2.02;a*=.5;}return v;}";
|
||||
|
||||
var progPass = mkProg(H + "void main(){gl_FragColor=texture2D(u_from,v_uv);}");
|
||||
var progTrans = mkProg(
|
||||
H +
|
||||
NQ +
|
||||
"float ridged(vec2 p){float v=0.,a=.5;mat2 R=mat2(.8,.6,-.6,.8);for(int i=0;i<5;i++){v+=a*abs(vnoise(p)*2.-1.);p=R*p*2.02;a*=.5;}return v;}void main(){vec4 A=texture2D(u_from,v_uv),B=texture2D(u_to,v_uv);float n=ridged(v_uv*4.);float e=smoothstep(u_progress-.04,u_progress+.04,n);float heat=smoothstep(.12,0.,abs(n-u_progress))*(1.-step(1.,u_progress));vec3 burn=mix(vec3(.4,0,0),vec3(1,.4,0),smoothstep(0.,.25,heat));burn=mix(burn,vec3(1,.85,.3),smoothstep(.25,.5,heat));burn=mix(burn,vec3(1),smoothstep(.5,1.,heat));float sparks=step(.92,vnoise(v_uv*80.))*heat*3.;gl_FragColor=vec4(mix(B,A,e).rgb+burn*heat*3.5+vec3(1.,.7,.3)*sparks,1.);}",
|
||||
);
|
||||
|
||||
function renderShader(prog, texFrom, texTo, progress) {
|
||||
gl.useProgram(prog);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texFrom);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_from"), 0);
|
||||
gl.activeTexture(gl.TEXTURE1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texTo);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_to"), 1);
|
||||
gl.uniform1f(gl.getUniformLocation(prog, "u_progress"), progress);
|
||||
gl.uniform2f(gl.getUniformLocation(prog, "u_resolution"), 1200, 1080);
|
||||
var pos = gl.getAttribLocation(prog, "a_pos");
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.enableVertexAttribArray(pos);
|
||||
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function easeInOut(p) {
|
||||
return p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2;
|
||||
}
|
||||
|
||||
captureScene("s1");
|
||||
captureScene("s2");
|
||||
glCanvas.style.display = "block";
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
document.querySelectorAll(".scene").forEach(function (s) {
|
||||
s.style.opacity = "0";
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
var t = tl.time();
|
||||
if (t >= 1.0 && t < 3.0) {
|
||||
renderShader(
|
||||
progTrans,
|
||||
sceneTextures["s1"],
|
||||
sceneTextures["s2"],
|
||||
easeInOut((t - 1.0) / 2.0),
|
||||
);
|
||||
} else if (t >= 3.0) {
|
||||
renderShader(progPass, sceneTextures["s2"], sceneTextures["s2"], 0);
|
||||
} else {
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
tl.to({ v: 0 }, { v: 1, duration: 4, ease: "none" }, 0);
|
||||
window.__timelines["main"] = tl;
|
||||
} // end if (gl)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "ripple-waves",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Ripple Waves",
|
||||
"description": "Shader transition with concentric ripple wave distortion",
|
||||
"tags": ["transition", "shader"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 4,
|
||||
"files": [
|
||||
{
|
||||
"path": "ripple-waves.html",
|
||||
"target": "compositions/ripple-waves.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,365 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;700&family=Lato:wght@400;700&display=block");
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<style>
|
||||
[data-composition-id="main"] {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #264653;
|
||||
}
|
||||
|
||||
/* Blueprint grid */
|
||||
.bp-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.bp-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bp-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 60px 60px 60px 40px;
|
||||
}
|
||||
.bp-divider {
|
||||
position: absolute;
|
||||
left: 1200px;
|
||||
top: 60px;
|
||||
bottom: 60px;
|
||||
width: 1px;
|
||||
background: #e9c46a;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.bp-number {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.4em;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 60px;
|
||||
color: #e9c46a;
|
||||
}
|
||||
|
||||
/* Right panel typography */
|
||||
.bp-name {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 38px;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 20px;
|
||||
color: #e9c46a;
|
||||
}
|
||||
.bp-plabel {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 10px;
|
||||
color: #e9c46a;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.bp-prompt {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
padding: 16px 20px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #e9c46a;
|
||||
background: rgba(233, 196, 106, 0.06);
|
||||
border: 1px solid rgba(233, 196, 106, 0.12);
|
||||
}
|
||||
.bp-desc {
|
||||
font-family: "Lato", sans-serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.6;
|
||||
color: #8aaa9a;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* GL scenes (hidden, just for texture capture) */
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 140px;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.12;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="bp-grid"></div>
|
||||
<div class="bp-divider"></div>
|
||||
<div class="bp-number">05 / 14</div>
|
||||
|
||||
<!-- GL demo scenes (captured as textures, then hidden) -->
|
||||
<div id="s1" class="scene" style="background: #264653">
|
||||
<div class="scene-label" style="color: #e9c46a">SCENE A</div>
|
||||
</div>
|
||||
<div id="s2" class="scene" style="background: #e9c46a; opacity: 0">
|
||||
<div class="scene-label" style="color: #264653">SCENE B</div>
|
||||
</div>
|
||||
|
||||
<!-- GL canvas (left panel only) -->
|
||||
<canvas
|
||||
id="gl-canvas"
|
||||
width="1200"
|
||||
height="1080"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
</canvas>
|
||||
|
||||
<!-- Right panel metadata -->
|
||||
<div class="bp-right">
|
||||
<div class="bp-name">Ripple Waves</div>
|
||||
<div class="bp-plabel">Prompt</div>
|
||||
<div class="bp-prompt">"use ripple waves shader transition"</div>
|
||||
<div class="bp-desc">
|
||||
Exponential sine waves with sharp crests and broad troughs. Both scenes ripple in opposite
|
||||
phases.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="driver"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
style="position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
var glCanvas = document.getElementById("gl-canvas");
|
||||
var gl = glCanvas.getContext("webgl", { preserveDrawingBuffer: true });
|
||||
if (!gl) {
|
||||
console.warn("WebGL not available");
|
||||
window.__timelines["main"] = gsap.timeline({ paused: true });
|
||||
} else {
|
||||
gl.viewport(0, 0, 1200, 1080);
|
||||
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
||||
var sceneTextures = {};
|
||||
|
||||
function captureScene(sceneId) {
|
||||
var scene = document.getElementById(sceneId);
|
||||
var origOpacity = scene.style.opacity;
|
||||
var origZ = scene.style.zIndex;
|
||||
scene.style.opacity = "1";
|
||||
scene.style.zIndex = "999";
|
||||
scene.offsetHeight;
|
||||
var c = document.createElement("canvas");
|
||||
c.width = 1200;
|
||||
c.height = 1080;
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = window.getComputedStyle(scene).backgroundColor;
|
||||
ctx.fillRect(0, 0, 1200, 1080);
|
||||
var sr = scene.getBoundingClientRect();
|
||||
var els = scene.querySelectorAll("*");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i],
|
||||
cs = window.getComputedStyle(el);
|
||||
if (cs.display === "none" || cs.visibility === "hidden") continue;
|
||||
var r = el.getBoundingClientRect();
|
||||
if (r.width < 1 || r.height < 1) continue;
|
||||
var x = r.left - sr.left,
|
||||
y = r.top - sr.top,
|
||||
w = r.width,
|
||||
h = r.height;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = parseFloat(cs.opacity) || 1;
|
||||
var bg = cs.backgroundColor;
|
||||
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(x, y, w, h);
|
||||
}
|
||||
var hasChildEls = el.querySelector("div,span,img,video");
|
||||
var text = "";
|
||||
for (var j = 0; j < el.childNodes.length; j++)
|
||||
if (el.childNodes[j].nodeType === 3) text += el.childNodes[j].textContent;
|
||||
text = text.trim();
|
||||
if (text && !hasChildEls) {
|
||||
ctx.font = cs.fontWeight + " " + cs.fontSize + " " + cs.fontFamily;
|
||||
ctx.fillStyle = cs.color;
|
||||
if (cs.letterSpacing && cs.letterSpacing !== "normal")
|
||||
ctx.letterSpacing = cs.letterSpacing;
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + w / 2, y + h / 2);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
scene.style.opacity = origOpacity;
|
||||
scene.style.zIndex = origZ;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
|
||||
sceneTextures[sceneId] = tex;
|
||||
}
|
||||
|
||||
var vertSrc =
|
||||
"attribute vec2 a_pos; varying vec2 v_uv; void main(){" +
|
||||
"v_uv=a_pos*0.5+0.5; v_uv.y=1.0-v_uv.y; gl_Position=vec4(a_pos,0,1);}";
|
||||
var quadBuf = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.bufferData(
|
||||
gl.ARRAY_BUFFER,
|
||||
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
||||
gl.STATIC_DRAW,
|
||||
);
|
||||
function compileShader(src, type) {
|
||||
var s = gl.createShader(type);
|
||||
gl.shaderSource(s, src);
|
||||
gl.compileShader(s);
|
||||
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
|
||||
console.error("Shader:", gl.getShaderInfoLog(s));
|
||||
return s;
|
||||
}
|
||||
function mkProg(fragSrc) {
|
||||
var p = gl.createProgram();
|
||||
gl.attachShader(p, compileShader(vertSrc, gl.VERTEX_SHADER));
|
||||
gl.attachShader(p, compileShader(fragSrc, gl.FRAGMENT_SHADER));
|
||||
gl.linkProgram(p);
|
||||
if (!gl.getProgramParameter(p, gl.LINK_STATUS))
|
||||
console.error("Link:", gl.getProgramInfoLog(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
var H =
|
||||
"precision mediump float;" +
|
||||
"varying vec2 v_uv;" +
|
||||
"uniform sampler2D u_from, u_to;" +
|
||||
"uniform float u_progress;" +
|
||||
"uniform vec2 u_resolution;\n";
|
||||
|
||||
var progPass = mkProg(H + "void main(){gl_FragColor=texture2D(u_from,v_uv);}");
|
||||
var progTrans = mkProg(
|
||||
H +
|
||||
"void main(){vec2 uv=v_uv-.5;float dist=length(uv);vec2 dir=normalize(uv+.001);float fromAmp=u_progress*.04;float fw1=exp(sin(dist*25.-u_progress*12.)-1.);float fw2=exp(sin(dist*50.-u_progress*18.)-1.)*.5;vec2 fromUv=clamp(v_uv+dir*(fw1+fw2)*fromAmp,0.,1.);float toAmp=(1.-u_progress)*.04;float tw1=exp(sin(dist*25.+u_progress*12.)-1.);float tw2=exp(sin(dist*50.+u_progress*18.)-1.)*.5;vec2 toUv=clamp(v_uv-dir*(tw1+tw2)*toAmp,0.,1.);vec4 A=texture2D(u_from,fromUv);vec4 B=texture2D(u_to,toUv);float peak=fw1*u_progress;vec3 tint=vec3(.9,.95,1.)*peak*.1;gl_FragColor=vec4(mix(A.rgb+tint,B.rgb,u_progress),1.);}",
|
||||
);
|
||||
|
||||
function renderShader(prog, texFrom, texTo, progress) {
|
||||
gl.useProgram(prog);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texFrom);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_from"), 0);
|
||||
gl.activeTexture(gl.TEXTURE1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texTo);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_to"), 1);
|
||||
gl.uniform1f(gl.getUniformLocation(prog, "u_progress"), progress);
|
||||
gl.uniform2f(gl.getUniformLocation(prog, "u_resolution"), 1200, 1080);
|
||||
var pos = gl.getAttribLocation(prog, "a_pos");
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.enableVertexAttribArray(pos);
|
||||
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function easeInOut(p) {
|
||||
return p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2;
|
||||
}
|
||||
|
||||
captureScene("s1");
|
||||
captureScene("s2");
|
||||
glCanvas.style.display = "block";
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
document.querySelectorAll(".scene").forEach(function (s) {
|
||||
s.style.opacity = "0";
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
var t = tl.time();
|
||||
if (t >= 1.0 && t < 3.0) {
|
||||
renderShader(
|
||||
progTrans,
|
||||
sceneTextures["s1"],
|
||||
sceneTextures["s2"],
|
||||
easeInOut((t - 1.0) / 2.0),
|
||||
);
|
||||
} else if (t >= 3.0) {
|
||||
renderShader(progPass, sceneTextures["s2"], sceneTextures["s2"], 0);
|
||||
} else {
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
tl.to({ v: 0 }, { v: 1, duration: 4, ease: "none" }, 0);
|
||||
window.__timelines["main"] = tl;
|
||||
} // end if (gl)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "sdf-iris",
|
||||
"type": "hyperframes:block",
|
||||
"title": "SDF Iris",
|
||||
"description": "Shader transition with signed distance field iris reveal",
|
||||
"tags": ["transition", "shader"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 4,
|
||||
"files": [
|
||||
{
|
||||
"path": "sdf-iris.html",
|
||||
"target": "compositions/sdf-iris.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,365 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;700&family=Lato:wght@400;700&display=block");
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<style>
|
||||
[data-composition-id="main"] {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #003049;
|
||||
}
|
||||
|
||||
/* Blueprint grid */
|
||||
.bp-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.bp-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bp-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 60px 60px 60px 40px;
|
||||
}
|
||||
.bp-divider {
|
||||
position: absolute;
|
||||
left: 1200px;
|
||||
top: 60px;
|
||||
bottom: 60px;
|
||||
width: 1px;
|
||||
background: #ffc300;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.bp-number {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.4em;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 60px;
|
||||
color: #ffc300;
|
||||
}
|
||||
|
||||
/* Right panel typography */
|
||||
.bp-name {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 38px;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 20px;
|
||||
color: #ffc300;
|
||||
}
|
||||
.bp-plabel {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 10px;
|
||||
color: #ffc300;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.bp-prompt {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
padding: 16px 20px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #ffc300;
|
||||
background: rgba(255, 195, 0, 0.06);
|
||||
border: 1px solid rgba(255, 195, 0, 0.12);
|
||||
}
|
||||
.bp-desc {
|
||||
font-family: "Lato", sans-serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.6;
|
||||
color: #7a9ab0;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* GL scenes (hidden, just for texture capture) */
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 140px;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.12;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="bp-grid"></div>
|
||||
<div class="bp-divider"></div>
|
||||
<div class="bp-number">04 / 14</div>
|
||||
|
||||
<!-- GL demo scenes (captured as textures, then hidden) -->
|
||||
<div id="s1" class="scene" style="background: #003049">
|
||||
<div class="scene-label" style="color: #ffc300">SCENE A</div>
|
||||
</div>
|
||||
<div id="s2" class="scene" style="background: #ffc300; opacity: 0">
|
||||
<div class="scene-label" style="color: #003049">SCENE B</div>
|
||||
</div>
|
||||
|
||||
<!-- GL canvas (left panel only) -->
|
||||
<canvas
|
||||
id="gl-canvas"
|
||||
width="1200"
|
||||
height="1080"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
</canvas>
|
||||
|
||||
<!-- Right panel metadata -->
|
||||
<div class="bp-right">
|
||||
<div class="bp-name">SDF Iris</div>
|
||||
<div class="bp-plabel">Prompt</div>
|
||||
<div class="bp-prompt">"use sdf iris shader transition"</div>
|
||||
<div class="bp-desc">
|
||||
Aspect-corrected circle SDF opening from center. Triple onion ring glow with warm
|
||||
exponential falloff.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="driver"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
style="position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
var glCanvas = document.getElementById("gl-canvas");
|
||||
var gl = glCanvas.getContext("webgl", { preserveDrawingBuffer: true });
|
||||
if (!gl) {
|
||||
console.warn("WebGL not available");
|
||||
window.__timelines["main"] = gsap.timeline({ paused: true });
|
||||
} else {
|
||||
gl.viewport(0, 0, 1200, 1080);
|
||||
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
||||
var sceneTextures = {};
|
||||
|
||||
function captureScene(sceneId) {
|
||||
var scene = document.getElementById(sceneId);
|
||||
var origOpacity = scene.style.opacity;
|
||||
var origZ = scene.style.zIndex;
|
||||
scene.style.opacity = "1";
|
||||
scene.style.zIndex = "999";
|
||||
scene.offsetHeight;
|
||||
var c = document.createElement("canvas");
|
||||
c.width = 1200;
|
||||
c.height = 1080;
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = window.getComputedStyle(scene).backgroundColor;
|
||||
ctx.fillRect(0, 0, 1200, 1080);
|
||||
var sr = scene.getBoundingClientRect();
|
||||
var els = scene.querySelectorAll("*");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i],
|
||||
cs = window.getComputedStyle(el);
|
||||
if (cs.display === "none" || cs.visibility === "hidden") continue;
|
||||
var r = el.getBoundingClientRect();
|
||||
if (r.width < 1 || r.height < 1) continue;
|
||||
var x = r.left - sr.left,
|
||||
y = r.top - sr.top,
|
||||
w = r.width,
|
||||
h = r.height;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = parseFloat(cs.opacity) || 1;
|
||||
var bg = cs.backgroundColor;
|
||||
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(x, y, w, h);
|
||||
}
|
||||
var hasChildEls = el.querySelector("div,span,img,video");
|
||||
var text = "";
|
||||
for (var j = 0; j < el.childNodes.length; j++)
|
||||
if (el.childNodes[j].nodeType === 3) text += el.childNodes[j].textContent;
|
||||
text = text.trim();
|
||||
if (text && !hasChildEls) {
|
||||
ctx.font = cs.fontWeight + " " + cs.fontSize + " " + cs.fontFamily;
|
||||
ctx.fillStyle = cs.color;
|
||||
if (cs.letterSpacing && cs.letterSpacing !== "normal")
|
||||
ctx.letterSpacing = cs.letterSpacing;
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + w / 2, y + h / 2);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
scene.style.opacity = origOpacity;
|
||||
scene.style.zIndex = origZ;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
|
||||
sceneTextures[sceneId] = tex;
|
||||
}
|
||||
|
||||
var vertSrc =
|
||||
"attribute vec2 a_pos; varying vec2 v_uv; void main(){" +
|
||||
"v_uv=a_pos*0.5+0.5; v_uv.y=1.0-v_uv.y; gl_Position=vec4(a_pos,0,1);}";
|
||||
var quadBuf = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.bufferData(
|
||||
gl.ARRAY_BUFFER,
|
||||
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
||||
gl.STATIC_DRAW,
|
||||
);
|
||||
function compileShader(src, type) {
|
||||
var s = gl.createShader(type);
|
||||
gl.shaderSource(s, src);
|
||||
gl.compileShader(s);
|
||||
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
|
||||
console.error("Shader:", gl.getShaderInfoLog(s));
|
||||
return s;
|
||||
}
|
||||
function mkProg(fragSrc) {
|
||||
var p = gl.createProgram();
|
||||
gl.attachShader(p, compileShader(vertSrc, gl.VERTEX_SHADER));
|
||||
gl.attachShader(p, compileShader(fragSrc, gl.FRAGMENT_SHADER));
|
||||
gl.linkProgram(p);
|
||||
if (!gl.getProgramParameter(p, gl.LINK_STATUS))
|
||||
console.error("Link:", gl.getProgramInfoLog(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
var H =
|
||||
"precision mediump float;" +
|
||||
"varying vec2 v_uv;" +
|
||||
"uniform sampler2D u_from, u_to;" +
|
||||
"uniform float u_progress;" +
|
||||
"uniform vec2 u_resolution;\n";
|
||||
|
||||
var progPass = mkProg(H + "void main(){gl_FragColor=texture2D(u_from,v_uv);}");
|
||||
var progTrans = mkProg(
|
||||
H +
|
||||
"void main(){vec4 A=texture2D(u_from,v_uv),B=texture2D(u_to,v_uv);vec2 uv=(v_uv-.5)*vec2(u_resolution.x/u_resolution.y,1.);float d=length(uv);float radius=u_progress*1.2;float fw=.003;float edge=smoothstep(radius+fw,radius-fw,d);float ring1=exp(-abs(d-radius)*25.);float ring2=exp(-abs(d-radius+.04)*20.)*.5;float ring3=exp(-abs(d-radius+.08)*15.)*.25;float glow=(ring1+ring2+ring3)*u_progress*(1.-u_progress)*4.;gl_FragColor=vec4(mix(A,B,edge).rgb+vec3(1.,.85,.6)*glow*.6,1.);}",
|
||||
);
|
||||
|
||||
function renderShader(prog, texFrom, texTo, progress) {
|
||||
gl.useProgram(prog);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texFrom);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_from"), 0);
|
||||
gl.activeTexture(gl.TEXTURE1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texTo);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_to"), 1);
|
||||
gl.uniform1f(gl.getUniformLocation(prog, "u_progress"), progress);
|
||||
gl.uniform2f(gl.getUniformLocation(prog, "u_resolution"), 1200, 1080);
|
||||
var pos = gl.getAttribLocation(prog, "a_pos");
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.enableVertexAttribArray(pos);
|
||||
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function easeInOut(p) {
|
||||
return p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2;
|
||||
}
|
||||
|
||||
captureScene("s1");
|
||||
captureScene("s2");
|
||||
glCanvas.style.display = "block";
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
document.querySelectorAll(".scene").forEach(function (s) {
|
||||
s.style.opacity = "0";
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
var t = tl.time();
|
||||
if (t >= 1.0 && t < 3.0) {
|
||||
renderShader(
|
||||
progTrans,
|
||||
sceneTextures["s1"],
|
||||
sceneTextures["s2"],
|
||||
easeInOut((t - 1.0) / 2.0),
|
||||
);
|
||||
} else if (t >= 3.0) {
|
||||
renderShader(progPass, sceneTextures["s2"], sceneTextures["s2"], 0);
|
||||
} else {
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
tl.to({ v: 0 }, { v: 1, duration: 4, ease: "none" }, 0);
|
||||
window.__timelines["main"] = tl;
|
||||
} // end if (gl)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -26,7 +26,7 @@
|
||||
font-family: "Inter", sans-serif;
|
||||
}
|
||||
|
||||
.card {
|
||||
[data-composition-id="spotify-card"] .card {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
@@ -54,7 +54,7 @@
|
||||
}
|
||||
|
||||
/* Specular highlight — light refraction across top */
|
||||
.card::before {
|
||||
[data-composition-id="spotify-card"] .card::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
@@ -72,7 +72,7 @@
|
||||
}
|
||||
|
||||
/* Edge shine — bottom rim catch light */
|
||||
.card::after {
|
||||
[data-composition-id="spotify-card"] .card::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
@@ -91,7 +91,7 @@
|
||||
}
|
||||
|
||||
/* Album Art */
|
||||
.album-art {
|
||||
[data-composition-id="spotify-card"] .album-art {
|
||||
width: 708px;
|
||||
height: 708px;
|
||||
border-radius: 16px;
|
||||
@@ -102,7 +102,7 @@
|
||||
margin-bottom: 36px;
|
||||
}
|
||||
|
||||
.album-art-icon {
|
||||
[data-composition-id="spotify-card"] .album-art-icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
@@ -111,14 +111,14 @@
|
||||
}
|
||||
|
||||
/* Track Info */
|
||||
.track-info {
|
||||
[data-composition-id="spotify-card"] .track-info {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
margin-bottom: 28px;
|
||||
padding: 0 8px;
|
||||
}
|
||||
|
||||
.track-name {
|
||||
[data-composition-id="spotify-card"] .track-name {
|
||||
font-size: 52px;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
@@ -127,7 +127,7 @@
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.artist-name {
|
||||
[data-composition-id="spotify-card"] .artist-name {
|
||||
font-size: 34px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
@@ -135,7 +135,7 @@
|
||||
}
|
||||
|
||||
/* Spotify Branding */
|
||||
.spotify-brand {
|
||||
[data-composition-id="spotify-card"] .spotify-brand {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
@@ -144,13 +144,13 @@
|
||||
padding: 0 8px;
|
||||
}
|
||||
|
||||
.spotify-logo {
|
||||
[data-composition-id="spotify-card"] .spotify-logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.spotify-brand-text {
|
||||
[data-composition-id="spotify-card"] .spotify-brand-text {
|
||||
font-size: 26px;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.55);
|
||||
@@ -161,7 +161,7 @@
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="spotify-now-playing"
|
||||
data-composition-id="spotify-card"
|
||||
data-width="1080"
|
||||
data-height="1920"
|
||||
data-start="0"
|
||||
@@ -293,7 +293,7 @@
|
||||
4.2,
|
||||
);
|
||||
|
||||
window.__timelines["spotify-now-playing"] = tl;
|
||||
window.__timelines["spotify-card"] = tl;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "swirl-vortex",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Swirl Vortex",
|
||||
"description": "Shader transition with swirling vortex distortion",
|
||||
"tags": ["transition", "shader"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 4,
|
||||
"files": [
|
||||
{
|
||||
"path": "swirl-vortex.html",
|
||||
"target": "compositions/swirl-vortex.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,375 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;700&family=Lato:wght@400;700&display=block");
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<style>
|
||||
[data-composition-id="main"] {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #073b4c;
|
||||
}
|
||||
|
||||
/* Blueprint grid */
|
||||
.bp-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.bp-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bp-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 60px 60px 60px 40px;
|
||||
}
|
||||
.bp-divider {
|
||||
position: absolute;
|
||||
left: 1200px;
|
||||
top: 60px;
|
||||
bottom: 60px;
|
||||
width: 1px;
|
||||
background: #06d6a0;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.bp-number {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.4em;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 60px;
|
||||
color: #06d6a0;
|
||||
}
|
||||
|
||||
/* Right panel typography */
|
||||
.bp-name {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 38px;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 20px;
|
||||
color: #06d6a0;
|
||||
}
|
||||
.bp-plabel {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 10px;
|
||||
color: #06d6a0;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.bp-prompt {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
padding: 16px 20px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #06d6a0;
|
||||
background: rgba(6, 214, 160, 0.06);
|
||||
border: 1px solid rgba(6, 214, 160, 0.12);
|
||||
}
|
||||
.bp-desc {
|
||||
font-family: "Lato", sans-serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.6;
|
||||
color: #7a9ab0;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* GL scenes (hidden, just for texture capture) */
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 140px;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.12;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="bp-grid"></div>
|
||||
<div class="bp-divider"></div>
|
||||
<div class="bp-number">10 / 14</div>
|
||||
|
||||
<!-- GL demo scenes (captured as textures, then hidden) -->
|
||||
<div id="s1" class="scene" style="background: #073b4c">
|
||||
<div class="scene-label" style="color: #06d6a0">SCENE A</div>
|
||||
</div>
|
||||
<div id="s2" class="scene" style="background: #06d6a0; opacity: 0">
|
||||
<div class="scene-label" style="color: #073b4c">SCENE B</div>
|
||||
</div>
|
||||
|
||||
<!-- GL canvas (left panel only) -->
|
||||
<canvas
|
||||
id="gl-canvas"
|
||||
width="1200"
|
||||
height="1080"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
</canvas>
|
||||
|
||||
<!-- Right panel metadata -->
|
||||
<div class="bp-right">
|
||||
<div class="bp-name">Swirl Vortex</div>
|
||||
<div class="bp-plabel">Prompt</div>
|
||||
<div class="bp-prompt">"use swirl vortex shader transition"</div>
|
||||
<div class="bp-desc">
|
||||
Both scenes swirl in opposite directions with FBM-warped spiral path. Organic distortion.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="driver"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
style="position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
var glCanvas = document.getElementById("gl-canvas");
|
||||
var gl = glCanvas.getContext("webgl", { preserveDrawingBuffer: true });
|
||||
if (!gl) {
|
||||
console.warn("WebGL not available");
|
||||
window.__timelines["main"] = gsap.timeline({ paused: true });
|
||||
} else {
|
||||
gl.viewport(0, 0, 1200, 1080);
|
||||
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
||||
var sceneTextures = {};
|
||||
|
||||
function captureScene(sceneId) {
|
||||
var scene = document.getElementById(sceneId);
|
||||
var origOpacity = scene.style.opacity;
|
||||
var origZ = scene.style.zIndex;
|
||||
scene.style.opacity = "1";
|
||||
scene.style.zIndex = "999";
|
||||
scene.offsetHeight;
|
||||
var c = document.createElement("canvas");
|
||||
c.width = 1200;
|
||||
c.height = 1080;
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = window.getComputedStyle(scene).backgroundColor;
|
||||
ctx.fillRect(0, 0, 1200, 1080);
|
||||
var sr = scene.getBoundingClientRect();
|
||||
var els = scene.querySelectorAll("*");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i],
|
||||
cs = window.getComputedStyle(el);
|
||||
if (cs.display === "none" || cs.visibility === "hidden") continue;
|
||||
var r = el.getBoundingClientRect();
|
||||
if (r.width < 1 || r.height < 1) continue;
|
||||
var x = r.left - sr.left,
|
||||
y = r.top - sr.top,
|
||||
w = r.width,
|
||||
h = r.height;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = parseFloat(cs.opacity) || 1;
|
||||
var bg = cs.backgroundColor;
|
||||
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(x, y, w, h);
|
||||
}
|
||||
var hasChildEls = el.querySelector("div,span,img,video");
|
||||
var text = "";
|
||||
for (var j = 0; j < el.childNodes.length; j++)
|
||||
if (el.childNodes[j].nodeType === 3) text += el.childNodes[j].textContent;
|
||||
text = text.trim();
|
||||
if (text && !hasChildEls) {
|
||||
ctx.font = cs.fontWeight + " " + cs.fontSize + " " + cs.fontFamily;
|
||||
ctx.fillStyle = cs.color;
|
||||
if (cs.letterSpacing && cs.letterSpacing !== "normal")
|
||||
ctx.letterSpacing = cs.letterSpacing;
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + w / 2, y + h / 2);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
scene.style.opacity = origOpacity;
|
||||
scene.style.zIndex = origZ;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
|
||||
sceneTextures[sceneId] = tex;
|
||||
}
|
||||
|
||||
var vertSrc =
|
||||
"attribute vec2 a_pos; varying vec2 v_uv; void main(){" +
|
||||
"v_uv=a_pos*0.5+0.5; v_uv.y=1.0-v_uv.y; gl_Position=vec4(a_pos,0,1);}";
|
||||
var quadBuf = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.bufferData(
|
||||
gl.ARRAY_BUFFER,
|
||||
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
||||
gl.STATIC_DRAW,
|
||||
);
|
||||
function compileShader(src, type) {
|
||||
var s = gl.createShader(type);
|
||||
gl.shaderSource(s, src);
|
||||
gl.compileShader(s);
|
||||
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
|
||||
console.error("Shader:", gl.getShaderInfoLog(s));
|
||||
return s;
|
||||
}
|
||||
function mkProg(fragSrc) {
|
||||
var p = gl.createProgram();
|
||||
gl.attachShader(p, compileShader(vertSrc, gl.VERTEX_SHADER));
|
||||
gl.attachShader(p, compileShader(fragSrc, gl.FRAGMENT_SHADER));
|
||||
gl.linkProgram(p);
|
||||
if (!gl.getProgramParameter(p, gl.LINK_STATUS))
|
||||
console.error("Link:", gl.getProgramInfoLog(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
var H =
|
||||
"precision mediump float;" +
|
||||
"varying vec2 v_uv;" +
|
||||
"uniform sampler2D u_from, u_to;" +
|
||||
"uniform float u_progress;" +
|
||||
"uniform vec2 u_resolution;\n";
|
||||
|
||||
var NQ =
|
||||
"float hash(vec2 p){return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453);}" +
|
||||
"float vnoise(vec2 p){vec2 i=floor(p),f=fract(p);" +
|
||||
"f=f*f*f*(f*(f*6.-15.)+10.);" +
|
||||
"return mix(mix(hash(i),hash(i+vec2(1,0)),f.x)," +
|
||||
"mix(hash(i+vec2(0,1)),hash(i+vec2(1,1)),f.x),f.y);}" +
|
||||
"float fbm(vec2 p){float v=0.,a=.5;" +
|
||||
"mat2 R=mat2(.8,.6,-.6,.8);" +
|
||||
"for(int i=0;i<5;i++){v+=a*vnoise(p);p=R*p*2.02;a*=.5;}return v;}";
|
||||
|
||||
var progPass = mkProg(H + "void main(){gl_FragColor=texture2D(u_from,v_uv);}");
|
||||
var progTrans = mkProg(
|
||||
H +
|
||||
NQ +
|
||||
"void main(){vec2 uv=v_uv-.5;float dist=length(uv);float warp=fbm(v_uv*4.)*.5;float fromAng=u_progress*(1.-dist)*10.+warp*u_progress*3.;float fs=sin(fromAng),fc=cos(fromAng);vec2 fromUv=clamp(vec2(uv.x*fc-uv.y*fs,uv.x*fs+uv.y*fc)+.5,0.,1.);float toAng=-(1.-u_progress)*(1.-dist)*10.-warp*(1.-u_progress)*3.;float ts=sin(toAng),tc=cos(toAng);vec2 toUv=clamp(vec2(uv.x*tc-uv.y*ts,uv.x*ts+uv.y*tc)+.5,0.,1.);vec4 A=texture2D(u_from,fromUv);vec4 B=texture2D(u_to,toUv);gl_FragColor=mix(A,B,u_progress);}",
|
||||
);
|
||||
|
||||
function renderShader(prog, texFrom, texTo, progress) {
|
||||
gl.useProgram(prog);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texFrom);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_from"), 0);
|
||||
gl.activeTexture(gl.TEXTURE1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texTo);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_to"), 1);
|
||||
gl.uniform1f(gl.getUniformLocation(prog, "u_progress"), progress);
|
||||
gl.uniform2f(gl.getUniformLocation(prog, "u_resolution"), 1200, 1080);
|
||||
var pos = gl.getAttribLocation(prog, "a_pos");
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.enableVertexAttribArray(pos);
|
||||
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function easeInOut(p) {
|
||||
return p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2;
|
||||
}
|
||||
|
||||
captureScene("s1");
|
||||
captureScene("s2");
|
||||
glCanvas.style.display = "block";
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
document.querySelectorAll(".scene").forEach(function (s) {
|
||||
s.style.opacity = "0";
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
var t = tl.time();
|
||||
if (t >= 1.0 && t < 3.0) {
|
||||
renderShader(
|
||||
progTrans,
|
||||
sceneTextures["s1"],
|
||||
sceneTextures["s2"],
|
||||
easeInOut((t - 1.0) / 2.0),
|
||||
);
|
||||
} else if (t >= 3.0) {
|
||||
renderShader(progPass, sceneTextures["s2"], sceneTextures["s2"], 0);
|
||||
} else {
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
tl.to({ v: 0 }, { v: 1, duration: 4, ease: "none" }, 0);
|
||||
window.__timelines["main"] = tl;
|
||||
} // end if (gl)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "thermal-distortion",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Thermal Distortion",
|
||||
"description": "Shader transition with heat haze thermal distortion",
|
||||
"tags": ["transition", "shader"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 4,
|
||||
"files": [
|
||||
{
|
||||
"path": "thermal-distortion.html",
|
||||
"target": "compositions/thermal-distortion.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,376 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;700&family=Lato:wght@400;700&display=block");
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<style>
|
||||
[data-composition-id="main"] {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #3d405b;
|
||||
}
|
||||
|
||||
/* Blueprint grid */
|
||||
.bp-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.bp-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bp-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 60px 60px 60px 40px;
|
||||
}
|
||||
.bp-divider {
|
||||
position: absolute;
|
||||
left: 1200px;
|
||||
top: 60px;
|
||||
bottom: 60px;
|
||||
width: 1px;
|
||||
background: #e07a5f;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.bp-number {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.4em;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 60px;
|
||||
color: #e07a5f;
|
||||
}
|
||||
|
||||
/* Right panel typography */
|
||||
.bp-name {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 38px;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 20px;
|
||||
color: #e07a5f;
|
||||
}
|
||||
.bp-plabel {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 10px;
|
||||
color: #e07a5f;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.bp-prompt {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
padding: 16px 20px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #e07a5f;
|
||||
background: rgba(224, 122, 95, 0.06);
|
||||
border: 1px solid rgba(224, 122, 95, 0.12);
|
||||
}
|
||||
.bp-desc {
|
||||
font-family: "Lato", sans-serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.6;
|
||||
color: #a0a0b0;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* GL scenes (hidden, just for texture capture) */
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 140px;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.12;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="bp-grid"></div>
|
||||
<div class="bp-divider"></div>
|
||||
<div class="bp-number">11 / 14</div>
|
||||
|
||||
<!-- GL demo scenes (captured as textures, then hidden) -->
|
||||
<div id="s1" class="scene" style="background: #3d405b">
|
||||
<div class="scene-label" style="color: #e07a5f">SCENE A</div>
|
||||
</div>
|
||||
<div id="s2" class="scene" style="background: #e07a5f; opacity: 0">
|
||||
<div class="scene-label" style="color: #3d405b">SCENE B</div>
|
||||
</div>
|
||||
|
||||
<!-- GL canvas (left panel only) -->
|
||||
<canvas
|
||||
id="gl-canvas"
|
||||
width="1200"
|
||||
height="1080"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
</canvas>
|
||||
|
||||
<!-- Right panel metadata -->
|
||||
<div class="bp-right">
|
||||
<div class="bp-name">Thermal Distortion</div>
|
||||
<div class="bp-plabel">Prompt</div>
|
||||
<div class="bp-prompt">"use thermal distortion shader transition"</div>
|
||||
<div class="bp-desc">
|
||||
FBM-driven heat shimmer rising from the bottom. Sine displacement modulated by noise with
|
||||
warm haze.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="driver"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
style="position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
var glCanvas = document.getElementById("gl-canvas");
|
||||
var gl = glCanvas.getContext("webgl", { preserveDrawingBuffer: true });
|
||||
if (!gl) {
|
||||
console.warn("WebGL not available");
|
||||
window.__timelines["main"] = gsap.timeline({ paused: true });
|
||||
} else {
|
||||
gl.viewport(0, 0, 1200, 1080);
|
||||
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
||||
var sceneTextures = {};
|
||||
|
||||
function captureScene(sceneId) {
|
||||
var scene = document.getElementById(sceneId);
|
||||
var origOpacity = scene.style.opacity;
|
||||
var origZ = scene.style.zIndex;
|
||||
scene.style.opacity = "1";
|
||||
scene.style.zIndex = "999";
|
||||
scene.offsetHeight;
|
||||
var c = document.createElement("canvas");
|
||||
c.width = 1200;
|
||||
c.height = 1080;
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = window.getComputedStyle(scene).backgroundColor;
|
||||
ctx.fillRect(0, 0, 1200, 1080);
|
||||
var sr = scene.getBoundingClientRect();
|
||||
var els = scene.querySelectorAll("*");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i],
|
||||
cs = window.getComputedStyle(el);
|
||||
if (cs.display === "none" || cs.visibility === "hidden") continue;
|
||||
var r = el.getBoundingClientRect();
|
||||
if (r.width < 1 || r.height < 1) continue;
|
||||
var x = r.left - sr.left,
|
||||
y = r.top - sr.top,
|
||||
w = r.width,
|
||||
h = r.height;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = parseFloat(cs.opacity) || 1;
|
||||
var bg = cs.backgroundColor;
|
||||
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(x, y, w, h);
|
||||
}
|
||||
var hasChildEls = el.querySelector("div,span,img,video");
|
||||
var text = "";
|
||||
for (var j = 0; j < el.childNodes.length; j++)
|
||||
if (el.childNodes[j].nodeType === 3) text += el.childNodes[j].textContent;
|
||||
text = text.trim();
|
||||
if (text && !hasChildEls) {
|
||||
ctx.font = cs.fontWeight + " " + cs.fontSize + " " + cs.fontFamily;
|
||||
ctx.fillStyle = cs.color;
|
||||
if (cs.letterSpacing && cs.letterSpacing !== "normal")
|
||||
ctx.letterSpacing = cs.letterSpacing;
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + w / 2, y + h / 2);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
scene.style.opacity = origOpacity;
|
||||
scene.style.zIndex = origZ;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
|
||||
sceneTextures[sceneId] = tex;
|
||||
}
|
||||
|
||||
var vertSrc =
|
||||
"attribute vec2 a_pos; varying vec2 v_uv; void main(){" +
|
||||
"v_uv=a_pos*0.5+0.5; v_uv.y=1.0-v_uv.y; gl_Position=vec4(a_pos,0,1);}";
|
||||
var quadBuf = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.bufferData(
|
||||
gl.ARRAY_BUFFER,
|
||||
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
||||
gl.STATIC_DRAW,
|
||||
);
|
||||
function compileShader(src, type) {
|
||||
var s = gl.createShader(type);
|
||||
gl.shaderSource(s, src);
|
||||
gl.compileShader(s);
|
||||
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
|
||||
console.error("Shader:", gl.getShaderInfoLog(s));
|
||||
return s;
|
||||
}
|
||||
function mkProg(fragSrc) {
|
||||
var p = gl.createProgram();
|
||||
gl.attachShader(p, compileShader(vertSrc, gl.VERTEX_SHADER));
|
||||
gl.attachShader(p, compileShader(fragSrc, gl.FRAGMENT_SHADER));
|
||||
gl.linkProgram(p);
|
||||
if (!gl.getProgramParameter(p, gl.LINK_STATUS))
|
||||
console.error("Link:", gl.getProgramInfoLog(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
var H =
|
||||
"precision mediump float;" +
|
||||
"varying vec2 v_uv;" +
|
||||
"uniform sampler2D u_from, u_to;" +
|
||||
"uniform float u_progress;" +
|
||||
"uniform vec2 u_resolution;\n";
|
||||
|
||||
var NQ =
|
||||
"float hash(vec2 p){return fract(sin(dot(p,vec2(127.1,311.7)))*43758.5453);}" +
|
||||
"float vnoise(vec2 p){vec2 i=floor(p),f=fract(p);" +
|
||||
"f=f*f*f*(f*(f*6.-15.)+10.);" +
|
||||
"return mix(mix(hash(i),hash(i+vec2(1,0)),f.x)," +
|
||||
"mix(hash(i+vec2(0,1)),hash(i+vec2(1,1)),f.x),f.y);}" +
|
||||
"float fbm(vec2 p){float v=0.,a=.5;" +
|
||||
"mat2 R=mat2(.8,.6,-.6,.8);" +
|
||||
"for(int i=0;i<5;i++){v+=a*vnoise(p);p=R*p*2.02;a*=.5;}return v;}";
|
||||
|
||||
var progPass = mkProg(H + "void main(){gl_FragColor=texture2D(u_from,v_uv);}");
|
||||
var progTrans = mkProg(
|
||||
H +
|
||||
NQ +
|
||||
"void main(){float heat=u_progress*1.5;float yFade=smoothstep(1.,0.,v_uv.y);float shimmer=sin(v_uv.y*40.+fbm(v_uv*6.)*8.)*fbm(v_uv*3.+vec2(0.,u_progress*2.));float dispX=shimmer*heat*.03*yFade;vec2 fromUv=clamp(v_uv+vec2(dispX,0.),0.,1.);vec4 A=texture2D(u_from,fromUv);float invShimmer=sin(v_uv.y*40.+fbm(v_uv*6.+3.)*8.)*fbm(v_uv*3.+vec2(3.,u_progress*2.));float dispX2=invShimmer*(1.-u_progress)*.03*yFade;vec2 toUv=clamp(v_uv+vec2(dispX2,0.),0.,1.);vec4 B=texture2D(u_to,toUv);float haze=heat*yFade*.15*(1.-u_progress);gl_FragColor=vec4(mix(A.rgb,B.rgb,u_progress)+vec3(1.,.9,.7)*haze,1.);}",
|
||||
);
|
||||
|
||||
function renderShader(prog, texFrom, texTo, progress) {
|
||||
gl.useProgram(prog);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texFrom);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_from"), 0);
|
||||
gl.activeTexture(gl.TEXTURE1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texTo);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_to"), 1);
|
||||
gl.uniform1f(gl.getUniformLocation(prog, "u_progress"), progress);
|
||||
gl.uniform2f(gl.getUniformLocation(prog, "u_resolution"), 1200, 1080);
|
||||
var pos = gl.getAttribLocation(prog, "a_pos");
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.enableVertexAttribArray(pos);
|
||||
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function easeInOut(p) {
|
||||
return p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2;
|
||||
}
|
||||
|
||||
captureScene("s1");
|
||||
captureScene("s2");
|
||||
glCanvas.style.display = "block";
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
document.querySelectorAll(".scene").forEach(function (s) {
|
||||
s.style.opacity = "0";
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
var t = tl.time();
|
||||
if (t >= 1.0 && t < 3.0) {
|
||||
renderShader(
|
||||
progTrans,
|
||||
sceneTextures["s1"],
|
||||
sceneTextures["s2"],
|
||||
easeInOut((t - 1.0) / 2.0),
|
||||
);
|
||||
} else if (t >= 3.0) {
|
||||
renderShader(progPass, sceneTextures["s2"], sceneTextures["s2"], 0);
|
||||
} else {
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
tl.to({ v: 0 }, { v: 1, duration: 4, ease: "none" }, 0);
|
||||
window.__timelines["main"] = tl;
|
||||
} // end if (gl)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -25,7 +25,7 @@
|
||||
font-family: "DM Sans", sans-serif;
|
||||
}
|
||||
|
||||
.lower-third {
|
||||
[data-composition-id="tiktok-follow"] .lower-third {
|
||||
position: absolute;
|
||||
bottom: 160px;
|
||||
left: 50%;
|
||||
@@ -39,7 +39,7 @@
|
||||
box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
.avatar {
|
||||
[data-composition-id="tiktok-follow"] .avatar {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
border-radius: 50%;
|
||||
@@ -48,14 +48,14 @@
|
||||
border: 3px solid #333;
|
||||
}
|
||||
|
||||
.profile-info {
|
||||
[data-composition-id="tiktok-follow"] .profile-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.display-name {
|
||||
[data-composition-id="tiktok-follow"] .display-name {
|
||||
font-size: 42px;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
@@ -63,21 +63,21 @@
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
.handle {
|
||||
[data-composition-id="tiktok-follow"] .handle {
|
||||
font-size: 28px;
|
||||
font-weight: 400;
|
||||
color: #a0a0a0;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.follower-count {
|
||||
[data-composition-id="tiktok-follow"] .follower-count {
|
||||
font-size: 25px;
|
||||
font-weight: 400;
|
||||
color: #737373;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.follow-btn {
|
||||
[data-composition-id="tiktok-follow"] .follow-btn {
|
||||
position: relative;
|
||||
width: 250px;
|
||||
height: 80px;
|
||||
@@ -90,7 +90,7 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
[data-composition-id="tiktok-follow"] .btn-text {
|
||||
position: absolute;
|
||||
font-family: "DM Sans", sans-serif;
|
||||
font-size: 30px;
|
||||
@@ -100,24 +100,24 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.btn-text-follow {
|
||||
[data-composition-id="tiktok-follow"] .btn-text-follow {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.btn-text-following {
|
||||
[data-composition-id="tiktok-follow"] .btn-text-following {
|
||||
opacity: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.check-icon {
|
||||
[data-composition-id="tiktok-follow"] .check-icon {
|
||||
display: inline-block;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
.check-icon svg {
|
||||
[data-composition-id="tiktok-follow"] .check-icon svg {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
display: block;
|
||||
@@ -127,7 +127,7 @@
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="tiktok-follow-overlay"
|
||||
data-composition-id="tiktok-follow"
|
||||
data-width="1080"
|
||||
data-height="1920"
|
||||
data-start="0"
|
||||
@@ -257,7 +257,7 @@
|
||||
3.8,
|
||||
);
|
||||
|
||||
window.__timelines["tiktok-follow-overlay"] = tl;
|
||||
window.__timelines["tiktok-follow"] = tl;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "transitions-3d",
|
||||
"type": "hyperframes:block",
|
||||
"title": "3D Transitions",
|
||||
"description": "Showcase of 3D perspective flip and rotate transitions",
|
||||
"tags": ["transition", "showcase"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 11,
|
||||
"files": [
|
||||
{
|
||||
"path": "transitions-3d.html",
|
||||
"target": "compositions/transitions-3d.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,297 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920" />
|
||||
<title>3D Transitions</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
background: #000;
|
||||
overflow: hidden;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
transform-style: preserve-3d;
|
||||
}
|
||||
|
||||
.scene-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
#scene1 {
|
||||
z-index: 1;
|
||||
}
|
||||
#scene2 {
|
||||
z-index: 2;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
#s1 {
|
||||
background: #1b263b;
|
||||
}
|
||||
#s2 {
|
||||
background: #e07a5f;
|
||||
}
|
||||
|
||||
.big-text {
|
||||
font-size: 200px;
|
||||
font-weight: 900;
|
||||
line-height: 1;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
#s1 .big-text {
|
||||
color: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
#s2 .big-text {
|
||||
color: rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 32px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 6px;
|
||||
text-transform: uppercase;
|
||||
margin-top: 12px;
|
||||
}
|
||||
#s1 .label {
|
||||
color: #778da9;
|
||||
}
|
||||
#s2 .label {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#info-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 80px;
|
||||
background: rgba(0, 0, 0, 0.88);
|
||||
z-index: 100;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
opacity: 0;
|
||||
}
|
||||
#info-bar span {
|
||||
color: #fff;
|
||||
font-size: 22px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
#title-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
z-index: 200;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
opacity: 0;
|
||||
}
|
||||
#title-card .category {
|
||||
font-size: 64px;
|
||||
font-weight: 800;
|
||||
color: #fff;
|
||||
letter-spacing: 8px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
#title-card .subtitle {
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: #778da9;
|
||||
margin-top: 16px;
|
||||
letter-spacing: 4px;
|
||||
}
|
||||
|
||||
#outro-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
z-index: 200;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
opacity: 0;
|
||||
}
|
||||
#outro-card .category {
|
||||
font-size: 48px;
|
||||
font-weight: 700;
|
||||
color: #778da9;
|
||||
letter-spacing: 6px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* 3D perspective wrapper */
|
||||
#composition {
|
||||
perspective: 1200px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="composition"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="11"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<div id="title-card">
|
||||
<div class="category">3D Transitions</div>
|
||||
<div class="subtitle">1 Transition</div>
|
||||
</div>
|
||||
|
||||
<div id="scene1" class="scene">
|
||||
<div id="s1" class="scene-inner">
|
||||
<div class="big-text">ONE</div>
|
||||
<div class="label">Scene A</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="scene2" class="scene">
|
||||
<div id="s2" class="scene-inner">
|
||||
<div class="big-text">TWO</div>
|
||||
<div class="label">Scene B</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="info-bar"><span id="info-text">Transition Name</span></div>
|
||||
|
||||
<div id="outro-card">
|
||||
<div class="category">End of 3D Transitions</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
|
||||
(function () {
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
var t = 0;
|
||||
|
||||
function resetScenes() {
|
||||
tl.set(
|
||||
"#scene1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
rotationY: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 1,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#scene2",
|
||||
{
|
||||
opacity: 0,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
rotationY: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 2,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
rotationY: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
clipPath: "none",
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s2",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
rotationY: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
clipPath: "none",
|
||||
},
|
||||
t,
|
||||
);
|
||||
}
|
||||
|
||||
/* ── Title card (3s) ── */
|
||||
tl.set("#title-card", { opacity: 1 }, 0);
|
||||
tl.to("#title-card", { opacity: 0, duration: 0.5 }, 2.5);
|
||||
t = 3;
|
||||
|
||||
/* ── Demo 1: 3D Card Flip ── */
|
||||
resetScenes();
|
||||
tl.set("#info-text", { textContent: "3D Card Flip" }, t);
|
||||
tl.to("#info-bar", { opacity: 1, duration: 0.3 }, t);
|
||||
t += 1.5;
|
||||
var T = t;
|
||||
tl.set("#scene2", { opacity: 1 }, T);
|
||||
tl.set("#s2", { rotationY: -180 }, T);
|
||||
tl.to("#s1", { rotationY: 180, duration: 0.6, ease: "power2.inOut" }, T);
|
||||
tl.to("#s2", { rotationY: 0, duration: 0.6, ease: "power2.inOut" }, T);
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.65);
|
||||
t = T + 1.5;
|
||||
tl.to("#info-bar", { opacity: 0, duration: 0.3 }, t);
|
||||
t += 0.5;
|
||||
|
||||
/* ── Outro (3s) ── */
|
||||
tl.set("#outro-card", { opacity: 1 }, t);
|
||||
tl.to("#outro-card", { opacity: 0, duration: 0.5 }, t + 2.5);
|
||||
|
||||
window.__timelines["main"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "transitions-blur",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Blur Transitions",
|
||||
"description": "Showcase of blur-based transitions between scenes",
|
||||
"tags": ["transition", "showcase"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 20,
|
||||
"files": [
|
||||
{
|
||||
"path": "transitions-blur.html",
|
||||
"target": "compositions/transitions-blur.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,387 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #000;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.scene-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
.info-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
background: rgba(0, 0, 0, 0.88);
|
||||
padding: 24px 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 40px;
|
||||
opacity: 0;
|
||||
}
|
||||
.info-num {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
.info-name {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
}
|
||||
.info-desc {
|
||||
font-size: 14px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
#title-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 50;
|
||||
}
|
||||
#outro-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 50;
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="20"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<!-- Title Card -->
|
||||
<div id="title-card">
|
||||
<div
|
||||
id="title-label"
|
||||
style="
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
TRANSITION CATALOG
|
||||
</div>
|
||||
<div
|
||||
id="title-main"
|
||||
style="font-size: 72px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0"
|
||||
>
|
||||
Blur Transitions
|
||||
</div>
|
||||
<div
|
||||
id="title-count"
|
||||
style="
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
margin-top: 12px;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
3 transitions
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene A -->
|
||||
<div id="scene1" class="scene" style="z-index: 1">
|
||||
<div class="scene-inner" id="s1" style="background: #1b263b">
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.08)">
|
||||
ONE
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #778da9;
|
||||
letter-spacing: 0.15em;
|
||||
margin-top: -20px;
|
||||
"
|
||||
>
|
||||
SCENE A
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene B -->
|
||||
<div id="scene2" class="scene" style="z-index: 2; opacity: 0">
|
||||
<div class="scene-inner" id="s2" style="background: #e07a5f">
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.15)">
|
||||
TWO
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
letter-spacing: 0.15em;
|
||||
margin-top: -20px;
|
||||
"
|
||||
>
|
||||
SCENE B
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info Bars -->
|
||||
<div id="info-1" class="info-bar">
|
||||
<div class="info-num">01</div>
|
||||
<div class="info-name">Blur Through</div>
|
||||
<div class="info-desc">Use a blur through transition</div>
|
||||
</div>
|
||||
<div id="info-2" class="info-bar">
|
||||
<div class="info-num">02</div>
|
||||
<div class="info-name">Directional Blur</div>
|
||||
<div class="info-desc">Use a directional blur transition with motion skew</div>
|
||||
</div>
|
||||
<div id="info-3" class="info-bar">
|
||||
<div class="info-num">03</div>
|
||||
<div class="info-name">Calm Blur Through</div>
|
||||
<div class="info-desc">Use a slow calm blur through transition</div>
|
||||
</div>
|
||||
|
||||
<!-- Outro Card -->
|
||||
<div id="outro-card">
|
||||
<div
|
||||
id="outro-label"
|
||||
style="
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
BLUR TRANSITIONS
|
||||
</div>
|
||||
<div
|
||||
id="outro-main"
|
||||
style="font-size: 56px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0"
|
||||
>
|
||||
3 Transitions
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
var t = 0;
|
||||
|
||||
// === TITLE CARD (3s) ===
|
||||
tl.to("#title-label", { opacity: 1, y: 0, duration: 0.4, ease: "power2.out" }, t + 0.3);
|
||||
tl.fromTo(
|
||||
"#title-main",
|
||||
{ opacity: 0, y: 20 },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power2.out" },
|
||||
t + 0.6,
|
||||
);
|
||||
tl.fromTo(
|
||||
"#title-count",
|
||||
{ opacity: 0 },
|
||||
{ opacity: 1, duration: 0.4, ease: "power2.out" },
|
||||
t + 1.0,
|
||||
);
|
||||
tl.to("#title-card", { opacity: 0, duration: 0.4, ease: "power2.inOut" }, t + 2.4);
|
||||
t += 3;
|
||||
|
||||
function resetScenes() {
|
||||
tl.set(
|
||||
"#scene1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 1,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#scene2",
|
||||
{
|
||||
opacity: 0,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 2,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
scaleX: 1,
|
||||
transformOrigin: "50% 50%",
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s2",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
scaleX: 1,
|
||||
transformOrigin: "50% 50%",
|
||||
},
|
||||
t,
|
||||
);
|
||||
}
|
||||
|
||||
// === TRANSITION 1: Blur Through ===
|
||||
resetScenes();
|
||||
tl.to("#info-1", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
var T = t + 1.5;
|
||||
tl.to(
|
||||
"#s1",
|
||||
{ filter: "blur(15px)", scale: 1.05, opacity: 0, duration: 0.4, ease: "power2.in" },
|
||||
T,
|
||||
);
|
||||
tl.set("#scene2", { opacity: 1 }, T);
|
||||
tl.fromTo(
|
||||
"#s2",
|
||||
{ filter: "blur(15px)", scale: 0.95, opacity: 0 },
|
||||
{ filter: "blur(0px)", scale: 1, opacity: 1, duration: 0.4, ease: "power2.out" },
|
||||
T + 0.2,
|
||||
);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-1", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === TRANSITION 2: Directional Blur ===
|
||||
resetScenes();
|
||||
tl.to("#info-2", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
T = t + 1.5;
|
||||
tl.to(
|
||||
"#s1",
|
||||
{
|
||||
filter: "blur(12px)",
|
||||
skewX: -8,
|
||||
x: -200,
|
||||
opacity: 0,
|
||||
duration: 0.4,
|
||||
ease: "power3.in",
|
||||
},
|
||||
T,
|
||||
);
|
||||
tl.set("#scene2", { opacity: 1 }, T);
|
||||
tl.fromTo(
|
||||
"#s2",
|
||||
{ filter: "blur(12px)", skewX: 8, x: 200, opacity: 0 },
|
||||
{ filter: "blur(0px)", skewX: 0, x: 0, opacity: 1, duration: 0.4, ease: "power3.out" },
|
||||
T + 0.15,
|
||||
);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-2", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === TRANSITION 3: Calm Blur Through ===
|
||||
resetScenes();
|
||||
tl.to("#info-3", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
T = t + 1.5;
|
||||
tl.to("#s1", { filter: "blur(30px)", scale: 1.08, duration: 0.5, ease: "power1.in" }, T);
|
||||
tl.to("#s1", { opacity: 0, duration: 0.3, ease: "power1.in" }, T + 0.3);
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.3);
|
||||
tl.fromTo(
|
||||
"#s2",
|
||||
{ filter: "blur(30px)", scale: 0.92, opacity: 0 },
|
||||
{ filter: "blur(30px)", scale: 0.92, opacity: 1, duration: 0.2, ease: "none" },
|
||||
T + 0.5,
|
||||
);
|
||||
tl.to("#s2", { filter: "blur(0px)", scale: 1, duration: 0.7, ease: "power1.out" }, T + 0.7);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-3", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === OUTRO (3s) ===
|
||||
tl.set("#scene1", { opacity: 0 }, t);
|
||||
tl.set("#scene2", { opacity: 0 }, t);
|
||||
tl.to("#outro-card", { opacity: 1, duration: 0.4, ease: "power2.inOut" }, t);
|
||||
tl.to("#outro-label", { opacity: 1, duration: 0.4, ease: "power2.out" }, t + 0.3);
|
||||
tl.fromTo(
|
||||
"#outro-main",
|
||||
{ opacity: 0, y: 20 },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power2.out" },
|
||||
t + 0.6,
|
||||
);
|
||||
tl.to("#outro-card", { opacity: 0, duration: 0.4, ease: "power2.inOut" }, t + 2.4);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["main"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "transitions-cover",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Cover Transitions",
|
||||
"description": "Showcase of cover/uncover slide transitions",
|
||||
"tags": ["transition", "showcase"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 21,
|
||||
"files": [
|
||||
{
|
||||
"path": "transitions-cover.html",
|
||||
"target": "compositions/transitions-cover.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,385 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Cover Transitions Showcase</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
background: #000;
|
||||
overflow: hidden;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
/* Title Card */
|
||||
#title-card {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 10;
|
||||
background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 100%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
opacity: 1;
|
||||
}
|
||||
#title-card h1 {
|
||||
font-size: 72px;
|
||||
font-weight: 800;
|
||||
color: #fff;
|
||||
letter-spacing: -1px;
|
||||
opacity: 0;
|
||||
transform: translateY(30px);
|
||||
}
|
||||
#title-card .subtitle {
|
||||
font-size: 28px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
margin-top: 12px;
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
|
||||
/* Scenes */
|
||||
#scene1,
|
||||
#scene2 {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
#scene1 {
|
||||
background: #1b263b;
|
||||
z-index: 2;
|
||||
opacity: 0;
|
||||
}
|
||||
#scene2 {
|
||||
background: #e07a5f;
|
||||
z-index: 1;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.scene-number {
|
||||
font-size: 180px;
|
||||
font-weight: 900;
|
||||
line-height: 1;
|
||||
opacity: 0.12;
|
||||
letter-spacing: -6px;
|
||||
}
|
||||
#scene1 .scene-number {
|
||||
color: #fff;
|
||||
}
|
||||
#scene2 .scene-number {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.scene-label {
|
||||
font-size: 48px;
|
||||
font-weight: 700;
|
||||
margin-top: -20px;
|
||||
}
|
||||
#scene1 .scene-label {
|
||||
color: #fff;
|
||||
}
|
||||
#scene2 .scene-label {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Info bar */
|
||||
.info-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 80px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 48px;
|
||||
}
|
||||
#scene1 .info-bar {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
#scene2 .info-bar {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.info-bar .label {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
.info-bar .desc {
|
||||
font-size: 16px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Outro */
|
||||
#outro {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 10;
|
||||
background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 100%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
opacity: 0;
|
||||
}
|
||||
#outro h2 {
|
||||
font-size: 56px;
|
||||
font-weight: 800;
|
||||
color: #fff;
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
#outro .tag {
|
||||
font-size: 22px;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
margin-top: 10px;
|
||||
opacity: 0;
|
||||
transform: translateY(15px);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="comp"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="21"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
style="position: relative; width: 1920px; height: 1080px; overflow: hidden; background: #000"
|
||||
>
|
||||
<!-- Title Card -->
|
||||
<div id="title-card">
|
||||
<h1 id="title-h1">Cover Transitions</h1>
|
||||
<div class="subtitle" id="title-sub">3 transition styles</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene A -->
|
||||
<div id="scene1">
|
||||
<div class="scene-number">ONE</div>
|
||||
<div class="scene-label">SCENE A</div>
|
||||
<div class="info-bar">
|
||||
<span class="label" id="info-label-a"></span>
|
||||
<span class="desc" id="info-desc-a"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene B -->
|
||||
<div id="scene2">
|
||||
<div class="scene-number">TWO</div>
|
||||
<div class="scene-label">SCENE B</div>
|
||||
<div class="info-bar">
|
||||
<span class="label" id="info-label-b"></span>
|
||||
<span class="desc" id="info-desc-b"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Staggered Blocks Wipes -->
|
||||
<div
|
||||
id="wipe-a"
|
||||
style="
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: #f72585;
|
||||
z-index: 50;
|
||||
transform: translateX(-1920px);
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
id="wipe-b"
|
||||
style="
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: #7209b7;
|
||||
z-index: 49;
|
||||
transform: translateX(-1920px);
|
||||
"
|
||||
></div>
|
||||
|
||||
<!-- Horizontal Blinds Container -->
|
||||
<div
|
||||
id="blinds-container"
|
||||
style="position: absolute; inset: 0; z-index: 50; pointer-events: none"
|
||||
></div>
|
||||
|
||||
<!-- Vertical Blinds Container -->
|
||||
<div
|
||||
id="vblinds-container"
|
||||
style="position: absolute; inset: 0; z-index: 50; pointer-events: none"
|
||||
></div>
|
||||
|
||||
<!-- Outro -->
|
||||
<div id="outro">
|
||||
<h2 id="outro-h2">Cover Transitions</h2>
|
||||
<div class="tag" id="outro-tag">End of showcase</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
// Generate horizontal blind strips
|
||||
var blindsHTML = "";
|
||||
for (var i = 0; i < 8; i++) {
|
||||
blindsHTML +=
|
||||
'<div id="blind-' +
|
||||
i +
|
||||
'" style="position:absolute; left:0; width:1920px; height:135px; top:' +
|
||||
i * 135 +
|
||||
"px; background:" +
|
||||
[
|
||||
"#3A0CA3",
|
||||
"#4361EE",
|
||||
"#4CC9F0",
|
||||
"#F72585",
|
||||
"#3A0CA3",
|
||||
"#4361EE",
|
||||
"#4CC9F0",
|
||||
"#F72585",
|
||||
][i] +
|
||||
'; transform:translateX(-1920px);"></div>';
|
||||
}
|
||||
document.getElementById("blinds-container").innerHTML = blindsHTML;
|
||||
|
||||
// Generate vertical blind strips
|
||||
var vblindsHTML = "";
|
||||
for (var i = 0; i < 8; i++) {
|
||||
vblindsHTML +=
|
||||
'<div id="vblind-' +
|
||||
i +
|
||||
'" style="position:absolute; top:0; height:1080px; width:240px; left:' +
|
||||
i * 240 +
|
||||
"px; background:" +
|
||||
[
|
||||
"#3A0CA3",
|
||||
"#4361EE",
|
||||
"#4CC9F0",
|
||||
"#F72585",
|
||||
"#3A0CA3",
|
||||
"#4361EE",
|
||||
"#4CC9F0",
|
||||
"#F72585",
|
||||
][i] +
|
||||
'; transform:translateY(-1080px);"></div>';
|
||||
}
|
||||
document.getElementById("vblinds-container").innerHTML = vblindsHTML;
|
||||
|
||||
var tl = gsap.timeline({ paused: false });
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["main"] = tl;
|
||||
|
||||
// Transition demos config
|
||||
var demos = [
|
||||
{ label: "STAGGERED BLOCKS", desc: "Use a staggered color blocks transition" },
|
||||
{ label: "HORIZONTAL BLINDS", desc: "Use a horizontal blinds transition" },
|
||||
{ label: "VERTICAL BLINDS", desc: "Use a vertical blinds transition" },
|
||||
];
|
||||
|
||||
// Reset scenes helper
|
||||
function resetScenes(t, demoIndex) {
|
||||
tl.set("#scene1", { opacity: 1 }, t);
|
||||
tl.set("#scene2", { opacity: 0 }, t);
|
||||
tl.set("#info-label-a", { textContent: demos[demoIndex].label }, t);
|
||||
tl.set("#info-desc-a", { textContent: demos[demoIndex].desc }, t);
|
||||
tl.set("#info-label-b", { textContent: demos[demoIndex].label }, t);
|
||||
tl.set("#info-desc-b", { textContent: demos[demoIndex].desc }, t);
|
||||
// Reset wipes
|
||||
tl.set("#wipe-a", { x: -1920 }, t);
|
||||
tl.set("#wipe-b", { x: -1920 }, t);
|
||||
// Reset horizontal blinds
|
||||
for (var i = 0; i < 8; i++) {
|
||||
tl.set("#blind-" + i, { x: -1920 }, t);
|
||||
}
|
||||
// Reset vertical blinds
|
||||
for (var i = 0; i < 8; i++) {
|
||||
tl.set("#vblind-" + i, { y: -1080 }, t);
|
||||
}
|
||||
}
|
||||
|
||||
// ===== TITLE CARD (0s - 3s) =====
|
||||
tl.to("#title-h1", { opacity: 1, y: 0, duration: 0.6, ease: "power2.out" }, 0.3);
|
||||
tl.to("#title-sub", { opacity: 1, y: 0, duration: 0.5, ease: "power2.out" }, 0.6);
|
||||
tl.to("#title-card", { opacity: 0, duration: 0.4, ease: "power1.inOut" }, 2.5);
|
||||
|
||||
// ===== DEMO 1: STAGGERED BLOCKS (3s - 8s) =====
|
||||
var T1 = 3;
|
||||
resetScenes(T1, 0);
|
||||
// Show Scene A for a beat, then transition at midpoint
|
||||
var T = T1 + 2;
|
||||
tl.set("#wipe-a", { x: -1920 }, T - 0.01);
|
||||
tl.set("#wipe-b", { x: -1920 }, T - 0.01);
|
||||
tl.to("#wipe-a", { x: 0, duration: 0.25, ease: "power3.inOut" }, T);
|
||||
tl.to("#wipe-b", { x: 0, duration: 0.25, ease: "power3.inOut" }, T + 0.06);
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.2);
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.2);
|
||||
tl.to("#wipe-a", { x: 1920, duration: 0.25, ease: "power3.inOut" }, T + 0.28);
|
||||
tl.to("#wipe-b", { x: 1920, duration: 0.25, ease: "power3.inOut" }, T + 0.34);
|
||||
|
||||
// ===== DEMO 2: HORIZONTAL BLINDS (8s - 13s) =====
|
||||
var T2 = 8;
|
||||
resetScenes(T2, 1);
|
||||
T = T2 + 2;
|
||||
var stagger = 0.03;
|
||||
for (var i = 0; i < 8; i++) {
|
||||
tl.fromTo(
|
||||
"#blind-" + i,
|
||||
{ x: -1920 },
|
||||
{ x: 0, duration: 0.2, ease: "power3.inOut" },
|
||||
T + i * stagger,
|
||||
);
|
||||
}
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.5);
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.5);
|
||||
for (var i = 0; i < 8; i++) {
|
||||
tl.to(
|
||||
"#blind-" + i,
|
||||
{ x: 1920, duration: 0.2, ease: "power3.inOut" },
|
||||
T + 0.55 + i * stagger,
|
||||
);
|
||||
}
|
||||
|
||||
// ===== DEMO 3: VERTICAL BLINDS (13s - 18s) =====
|
||||
var T3 = 13;
|
||||
resetScenes(T3, 2);
|
||||
T = T3 + 2;
|
||||
for (var i = 0; i < 8; i++) {
|
||||
tl.fromTo(
|
||||
"#vblind-" + i,
|
||||
{ y: -1080 },
|
||||
{ y: 0, duration: 0.2, ease: "power3.inOut" },
|
||||
T + i * 0.03,
|
||||
);
|
||||
}
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.5);
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.5);
|
||||
for (var i = 0; i < 8; i++) {
|
||||
tl.to(
|
||||
"#vblind-" + i,
|
||||
{ y: 1080, duration: 0.2, ease: "power3.inOut" },
|
||||
T + 0.55 + i * 0.03,
|
||||
);
|
||||
}
|
||||
|
||||
// ===== OUTRO (18s - 21s) =====
|
||||
tl.to("#scene1", { opacity: 0, duration: 0.3 }, 18);
|
||||
tl.to("#scene2", { opacity: 0, duration: 0.3 }, 18);
|
||||
tl.to("#outro", { opacity: 1, duration: 0.4, ease: "power1.inOut" }, 18.2);
|
||||
tl.to("#outro-h2", { opacity: 1, y: 0, duration: 0.5, ease: "power2.out" }, 18.5);
|
||||
tl.to("#outro-tag", { opacity: 1, y: 0, duration: 0.4, ease: "power2.out" }, 18.8);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "transitions-destruction",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Destruction Transitions",
|
||||
"description": "Showcase of destructive break-apart transitions",
|
||||
"tags": ["transition", "showcase"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 14,
|
||||
"files": [
|
||||
{
|
||||
"path": "transitions-destruction.html",
|
||||
"target": "compositions/transitions-destruction.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,414 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #000;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.scene-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
.info-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
background: rgba(0, 0, 0, 0.88);
|
||||
padding: 24px 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 40px;
|
||||
opacity: 0;
|
||||
}
|
||||
.info-num {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
.info-name {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
}
|
||||
.info-desc {
|
||||
font-size: 14px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
#title-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 50;
|
||||
}
|
||||
#outro-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 50;
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="14"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<!-- Title Card -->
|
||||
<div id="title-card">
|
||||
<div
|
||||
id="title-label"
|
||||
style="
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
TRANSITION CATALOG
|
||||
</div>
|
||||
<div
|
||||
id="title-main"
|
||||
style="font-size: 72px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0"
|
||||
>
|
||||
Destruction Transitions
|
||||
</div>
|
||||
<div
|
||||
id="title-count"
|
||||
style="
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
margin-top: 12px;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
1 transition
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene A -->
|
||||
<div id="scene1" class="scene" style="z-index: 1">
|
||||
<div class="scene-inner" id="s1" style="background: #1b263b">
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.08)">
|
||||
ONE
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #778da9;
|
||||
letter-spacing: 0.15em;
|
||||
margin-top: -20px;
|
||||
"
|
||||
>
|
||||
SCENE A
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene B -->
|
||||
<div id="scene2" class="scene" style="z-index: 2; opacity: 0">
|
||||
<div class="scene-inner" id="s2" style="background: #e07a5f">
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.15)">
|
||||
TWO
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
letter-spacing: 0.15em;
|
||||
margin-top: -20px;
|
||||
"
|
||||
>
|
||||
SCENE B
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Burn Canvas -->
|
||||
<canvas
|
||||
id="burn-canvas"
|
||||
width="1920"
|
||||
height="1080"
|
||||
style="position: absolute; inset: 0; z-index: 40; pointer-events: none"
|
||||
></canvas>
|
||||
|
||||
<!-- Info Bar -->
|
||||
<div id="info-1" class="info-bar">
|
||||
<div class="info-num">01</div>
|
||||
<div class="info-name">Page Burn</div>
|
||||
<div class="info-desc">Use a page burn destruction transition</div>
|
||||
</div>
|
||||
|
||||
<!-- Outro Card -->
|
||||
<div id="outro-card">
|
||||
<div
|
||||
id="outro-label"
|
||||
style="
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
DESTRUCTION TRANSITIONS
|
||||
</div>
|
||||
<div
|
||||
id="outro-main"
|
||||
style="font-size: 56px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0"
|
||||
>
|
||||
1 Transition
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
var t = 0;
|
||||
|
||||
// === TITLE CARD (3s) ===
|
||||
tl.to("#title-label", { opacity: 1, y: 0, duration: 0.4, ease: "power2.out" }, t + 0.3);
|
||||
tl.fromTo(
|
||||
"#title-main",
|
||||
{ opacity: 0, y: 20 },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power2.out" },
|
||||
t + 0.6,
|
||||
);
|
||||
tl.fromTo(
|
||||
"#title-count",
|
||||
{ opacity: 0 },
|
||||
{ opacity: 1, duration: 0.4, ease: "power2.out" },
|
||||
t + 1.0,
|
||||
);
|
||||
tl.to("#title-card", { opacity: 0, duration: 0.4, ease: "power2.inOut" }, t + 2.4);
|
||||
t += 3;
|
||||
|
||||
// === TRANSITION 1: Page Burn (8s total: 2s build, 3s burn, 3s settle) ===
|
||||
tl.set(
|
||||
"#scene1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 1,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#scene2",
|
||||
{
|
||||
opacity: 0,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 2,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set("#s1", { opacity: 1, x: 0, y: 0, scale: 1, rotation: 0, filter: "none" }, t);
|
||||
tl.set("#s2", { opacity: 1, x: 0, y: 0, scale: 1, rotation: 0, filter: "none" }, t);
|
||||
|
||||
// Show info bar
|
||||
tl.to("#info-1", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
|
||||
// Burn transition starts at t+2
|
||||
var T = t + 2;
|
||||
|
||||
var burnCanvas = document.getElementById("burn-canvas");
|
||||
var burnCtx = burnCanvas.getContext("2d");
|
||||
var burnState = { progress: 0 };
|
||||
|
||||
function noise(x) {
|
||||
var ix = Math.floor(x),
|
||||
fx = x - ix;
|
||||
var a = Math.sin(ix * 127.1 + 311.7) * 43758.5453;
|
||||
var b = Math.sin((ix + 1) * 127.1 + 311.7) * 43758.5453;
|
||||
var t2 = fx * fx * (3 - 2 * fx);
|
||||
return a - Math.floor(a) + (b - Math.floor(b) - (a - Math.floor(a))) * t2;
|
||||
}
|
||||
|
||||
function drawBurn(progress) {
|
||||
burnCtx.clearRect(0, 0, 1920, 1080);
|
||||
if (progress <= 0 || progress >= 1) return;
|
||||
|
||||
var maxR = 1400;
|
||||
var cx = 960,
|
||||
cy = 540;
|
||||
|
||||
// Draw fire edge glow
|
||||
burnCtx.beginPath();
|
||||
var steps = 60;
|
||||
for (var i = 0; i <= steps; i++) {
|
||||
var angle = (i / steps) * Math.PI * 2;
|
||||
var baseR = progress * maxR;
|
||||
var r =
|
||||
baseR + noise(angle * 3 + progress * 4) * 80 + noise(angle * 8 + progress * 9) * 30;
|
||||
var px = cx + Math.cos(angle) * r;
|
||||
var py = cy + Math.sin(angle) * r;
|
||||
if (i === 0) burnCtx.moveTo(px, py);
|
||||
else burnCtx.lineTo(px, py);
|
||||
}
|
||||
burnCtx.closePath();
|
||||
|
||||
// Orange/red edge glow
|
||||
var grad = burnCtx.createRadialGradient(
|
||||
cx,
|
||||
cy,
|
||||
progress * maxR * 0.8,
|
||||
cx,
|
||||
cy,
|
||||
progress * maxR * 1.1,
|
||||
);
|
||||
grad.addColorStop(0, "rgba(0,0,0,0)");
|
||||
grad.addColorStop(0.7, "rgba(255,100,0,0.6)");
|
||||
grad.addColorStop(0.9, "rgba(255,50,0,0.8)");
|
||||
grad.addColorStop(1, "rgba(200,30,0,0.4)");
|
||||
burnCtx.fillStyle = grad;
|
||||
burnCtx.fill();
|
||||
|
||||
// Inner ember particles
|
||||
var particleCount = Math.floor(progress * 40);
|
||||
for (var p = 0; p < particleCount; p++) {
|
||||
var pAngle = noise(p * 0.7 + progress * 2) * Math.PI * 2;
|
||||
var pDist = progress * maxR * (0.85 + noise(p * 1.3 + progress * 5) * 0.15);
|
||||
var ex = cx + Math.cos(pAngle) * pDist;
|
||||
var ey = cy + Math.sin(pAngle) * pDist;
|
||||
var pSize = 2 + noise(p * 2.1) * 4;
|
||||
burnCtx.beginPath();
|
||||
burnCtx.arc(ex, ey, pSize, 0, Math.PI * 2);
|
||||
burnCtx.fillStyle =
|
||||
"rgba(255," +
|
||||
Math.floor(80 + noise(p * 3) * 120) +
|
||||
",0," +
|
||||
(0.4 + noise(p * 1.7) * 0.4) +
|
||||
")";
|
||||
burnCtx.fill();
|
||||
}
|
||||
}
|
||||
|
||||
// Animate burn progress over 3 seconds
|
||||
tl.to(
|
||||
burnState,
|
||||
{
|
||||
progress: 1,
|
||||
duration: 3.0,
|
||||
ease: "power1.in",
|
||||
onUpdate: function () {
|
||||
var p = burnState.progress;
|
||||
drawBurn(p);
|
||||
var scene1El = document.getElementById("scene1");
|
||||
if (p <= 0) {
|
||||
scene1El.style.clipPath = "none";
|
||||
} else if (p < 1) {
|
||||
// Shrink scene1 with circular clip from center
|
||||
var radius = Math.max(0, 75 - p * 80);
|
||||
scene1El.style.clipPath = "circle(" + radius + "% at 50% 50%)";
|
||||
} else {
|
||||
scene1El.style.clipPath = "circle(0% at 50% 50%)";
|
||||
}
|
||||
},
|
||||
},
|
||||
T,
|
||||
);
|
||||
|
||||
// Scene 2 fades in from behind as burn progresses
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.5);
|
||||
tl.fromTo(
|
||||
"#s2",
|
||||
{ opacity: 0 },
|
||||
{ opacity: 1, duration: 2.0, ease: "power1.out" },
|
||||
T + 0.5,
|
||||
);
|
||||
|
||||
// Clean up after burn completes
|
||||
tl.set("#scene1", { opacity: 0, clipPath: "none" }, T + 3.0);
|
||||
tl.call(
|
||||
function () {
|
||||
burnCtx.clearRect(0, 0, 1920, 1080);
|
||||
},
|
||||
null,
|
||||
T + 3.0,
|
||||
);
|
||||
|
||||
// Settle time (hold scene B)
|
||||
t = T + 3.0 + 2.0;
|
||||
tl.to("#info-1", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === OUTRO (3s) ===
|
||||
tl.set("#scene1", { opacity: 0 }, t);
|
||||
tl.set("#scene2", { opacity: 0 }, t);
|
||||
tl.to("#outro-card", { opacity: 1, duration: 0.4, ease: "power2.inOut" }, t);
|
||||
tl.to("#outro-label", { opacity: 1, duration: 0.4, ease: "power2.out" }, t + 0.3);
|
||||
tl.fromTo(
|
||||
"#outro-main",
|
||||
{ opacity: 0, y: 20 },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power2.out" },
|
||||
t + 0.6,
|
||||
);
|
||||
tl.to("#outro-card", { opacity: 0, duration: 0.4, ease: "power2.inOut" }, t + 2.4);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["main"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "transitions-dissolve",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Dissolve Transitions",
|
||||
"description": "Showcase of dissolve and fade transitions",
|
||||
"tags": ["transition", "showcase"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 24,
|
||||
"files": [
|
||||
{
|
||||
"path": "transitions-dissolve.html",
|
||||
"target": "compositions/transitions-dissolve.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,391 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #000;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.scene-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
.info-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
background: rgba(0, 0, 0, 0.88);
|
||||
padding: 24px 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 40px;
|
||||
opacity: 0;
|
||||
}
|
||||
.info-num {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
.info-name {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
}
|
||||
.info-desc {
|
||||
font-size: 14px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
#title-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 50;
|
||||
}
|
||||
#outro-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 50;
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="24"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<!-- Title Card -->
|
||||
<div id="title-card">
|
||||
<div
|
||||
id="title-label"
|
||||
style="
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
TRANSITION CATALOG
|
||||
</div>
|
||||
<div
|
||||
id="title-main"
|
||||
style="font-size: 72px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0"
|
||||
>
|
||||
Dissolve Transitions
|
||||
</div>
|
||||
<div
|
||||
id="title-count"
|
||||
style="
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
margin-top: 12px;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
4 transitions
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene A -->
|
||||
<div id="scene1" class="scene" style="z-index: 1">
|
||||
<div class="scene-inner" id="s1" style="background: #1b263b">
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.08)">
|
||||
ONE
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #778da9;
|
||||
letter-spacing: 0.15em;
|
||||
margin-top: -20px;
|
||||
"
|
||||
>
|
||||
SCENE A
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene B -->
|
||||
<div id="scene2" class="scene" style="z-index: 2; opacity: 0">
|
||||
<div class="scene-inner" id="s2" style="background: #e07a5f">
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.15)">
|
||||
TWO
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
letter-spacing: 0.15em;
|
||||
margin-top: -20px;
|
||||
"
|
||||
>
|
||||
SCENE B
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info Bars -->
|
||||
<div id="info-1" class="info-bar">
|
||||
<div class="info-num">01</div>
|
||||
<div class="info-name">Crossfade</div>
|
||||
<div class="info-desc">Use a crossfade transition</div>
|
||||
</div>
|
||||
<div id="info-2" class="info-bar">
|
||||
<div class="info-num">02</div>
|
||||
<div class="info-name">Blur Crossfade</div>
|
||||
<div class="info-desc">Use a blur crossfade transition</div>
|
||||
</div>
|
||||
<div id="info-3" class="info-bar">
|
||||
<div class="info-num">03</div>
|
||||
<div class="info-name">Focus Pull</div>
|
||||
<div class="info-desc">Use a focus pull transition</div>
|
||||
</div>
|
||||
<div id="info-4" class="info-bar">
|
||||
<div class="info-num">04</div>
|
||||
<div class="info-name">Color Dip</div>
|
||||
<div class="info-desc">Use a color dip to black transition</div>
|
||||
</div>
|
||||
|
||||
<!-- Outro Card -->
|
||||
<div id="outro-card">
|
||||
<div
|
||||
id="outro-label"
|
||||
style="
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
DISSOLVE TRANSITIONS
|
||||
</div>
|
||||
<div
|
||||
id="outro-main"
|
||||
style="font-size: 56px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0"
|
||||
>
|
||||
4 Transitions
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
var t = 0;
|
||||
|
||||
// === TITLE CARD (3s) ===
|
||||
tl.to("#title-label", { opacity: 1, y: 0, duration: 0.4, ease: "power2.out" }, t + 0.3);
|
||||
tl.fromTo(
|
||||
"#title-main",
|
||||
{ opacity: 0, y: 20 },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power2.out" },
|
||||
t + 0.6,
|
||||
);
|
||||
tl.fromTo(
|
||||
"#title-count",
|
||||
{ opacity: 0 },
|
||||
{ opacity: 1, duration: 0.4, ease: "power2.out" },
|
||||
t + 1.0,
|
||||
);
|
||||
tl.to("#title-card", { opacity: 0, duration: 0.4, ease: "power2.inOut" }, t + 2.4);
|
||||
t += 3;
|
||||
|
||||
function resetScenes() {
|
||||
tl.set(
|
||||
"#scene1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 1,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#scene2",
|
||||
{
|
||||
opacity: 0,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 2,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
scaleX: 1,
|
||||
transformOrigin: "50% 50%",
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s2",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
scaleX: 1,
|
||||
transformOrigin: "50% 50%",
|
||||
},
|
||||
t,
|
||||
);
|
||||
}
|
||||
|
||||
// === TRANSITION 1: Crossfade ===
|
||||
resetScenes();
|
||||
tl.to("#info-1", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
var T = t + 1.5;
|
||||
tl.to("#s1", { opacity: 0, duration: 0.5, ease: "power2.inOut" }, T);
|
||||
tl.set("#scene2", { opacity: 1 }, T);
|
||||
tl.fromTo("#s2", { opacity: 0 }, { opacity: 1, duration: 0.5, ease: "power2.inOut" }, T);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-1", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === TRANSITION 2: Blur Crossfade ===
|
||||
resetScenes();
|
||||
tl.to("#info-2", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
T = t + 1.5;
|
||||
tl.to(
|
||||
"#s1",
|
||||
{ filter: "blur(10px)", scale: 1.03, opacity: 0, duration: 0.5, ease: "power2.inOut" },
|
||||
T,
|
||||
);
|
||||
tl.set("#scene2", { opacity: 1 }, T);
|
||||
tl.fromTo(
|
||||
"#s2",
|
||||
{ filter: "blur(10px)", scale: 0.97, opacity: 0 },
|
||||
{ filter: "blur(0px)", scale: 1, opacity: 1, duration: 0.5, ease: "power2.inOut" },
|
||||
T + 0.1,
|
||||
);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-2", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === TRANSITION 3: Focus Pull ===
|
||||
resetScenes();
|
||||
tl.to("#info-3", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
T = t + 1.5;
|
||||
tl.to("#s1", { filter: "blur(15px)", duration: 0.5, ease: "power1.in" }, T);
|
||||
tl.to("#s1", { opacity: 0, duration: 0.3, ease: "power2.in" }, T + 0.25);
|
||||
tl.set("#scene2", { opacity: 1 }, T);
|
||||
tl.fromTo(
|
||||
"#s2",
|
||||
{ opacity: 0 },
|
||||
{ opacity: 1, duration: 0.3, ease: "power2.out" },
|
||||
T + 0.25,
|
||||
);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-3", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === TRANSITION 4: Color Dip ===
|
||||
resetScenes();
|
||||
tl.to("#info-4", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
T = t + 1.5;
|
||||
tl.to("#s1", { opacity: 0, duration: 0.2, ease: "power2.in" }, T);
|
||||
tl.set("#scene2", { opacity: 1 }, T);
|
||||
tl.fromTo(
|
||||
"#s2",
|
||||
{ opacity: 0 },
|
||||
{ opacity: 1, duration: 0.2, ease: "power2.out" },
|
||||
T + 0.25,
|
||||
);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-4", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === OUTRO (3s) ===
|
||||
tl.set("#scene1", { opacity: 0 }, t);
|
||||
tl.set("#scene2", { opacity: 0 }, t);
|
||||
tl.to("#outro-card", { opacity: 1, duration: 0.4, ease: "power2.inOut" }, t);
|
||||
tl.to("#outro-label", { opacity: 1, duration: 0.4, ease: "power2.out" }, t + 0.3);
|
||||
tl.fromTo(
|
||||
"#outro-main",
|
||||
{ opacity: 0, y: 20 },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power2.out" },
|
||||
t + 0.6,
|
||||
);
|
||||
tl.to("#outro-card", { opacity: 0, duration: 0.4, ease: "power2.inOut" }, t + 2.4);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["main"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "transitions-distortion",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Distortion Transitions",
|
||||
"description": "Showcase of warp and distortion transitions",
|
||||
"tags": ["transition", "showcase"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 21,
|
||||
"files": [
|
||||
{
|
||||
"path": "transitions-distortion.html",
|
||||
"target": "compositions/transitions-distortion.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,385 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>Distortion Transitions</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
background: #000;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.scene {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.scene-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#scene1 .scene-inner {
|
||||
background: #1b263b;
|
||||
}
|
||||
#scene2 .scene-inner {
|
||||
background: #e07a5f;
|
||||
}
|
||||
|
||||
.scene-num {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
font-size: 200px;
|
||||
font-weight: 900;
|
||||
color: rgba(255, 255, 255, 0.08);
|
||||
line-height: 1;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
font-size: 48px;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.25);
|
||||
letter-spacing: 12px;
|
||||
text-transform: uppercase;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.info-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
background: rgba(0, 0, 0, 0.88);
|
||||
padding: 28px 60px;
|
||||
opacity: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.info-bar .info-name {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
}
|
||||
.info-bar .info-cat {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
letter-spacing: 4px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* Title / Outro */
|
||||
#title-card,
|
||||
#outro-card {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 200;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
background: #0d1117;
|
||||
opacity: 0;
|
||||
}
|
||||
.card-title {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
font-size: 72px;
|
||||
font-weight: 800;
|
||||
color: #fff;
|
||||
}
|
||||
.card-sub {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
font-size: 28px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
margin-top: 16px;
|
||||
letter-spacing: 6px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="main"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="21"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
style="position: relative; width: 1920px; height: 1080px; overflow: hidden; background: #000"
|
||||
>
|
||||
<!-- Title Card -->
|
||||
<div id="title-card">
|
||||
<div class="card-title">Distortion Transitions</div>
|
||||
<div class="card-sub">Glitch • Chromatic • Ripple</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene A -->
|
||||
<div id="scene1" class="scene" style="opacity: 0">
|
||||
<div id="s1" class="scene-inner">
|
||||
<div class="scene-num">ONE</div>
|
||||
<div class="scene-label">Scene A</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene B -->
|
||||
<div id="scene2" class="scene" style="opacity: 0">
|
||||
<div id="s2" class="scene-inner">
|
||||
<div class="scene-num">TWO</div>
|
||||
<div class="scene-label">Scene B</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- RGB channel overlays for glitch/chromatic -->
|
||||
<div
|
||||
id="glitch-r"
|
||||
style="
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 30;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
mix-blend-mode: screen;
|
||||
"
|
||||
>
|
||||
<div
|
||||
class="scene-inner"
|
||||
style="
|
||||
background: rgba(229, 56, 59, 0.35);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
"
|
||||
>
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.08)">
|
||||
ONE
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
id="glitch-b"
|
||||
style="
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 30;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
mix-blend-mode: screen;
|
||||
"
|
||||
>
|
||||
<div
|
||||
class="scene-inner"
|
||||
style="
|
||||
background: rgba(72, 191, 227, 0.35);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
"
|
||||
>
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.08)">
|
||||
ONE
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info Bars -->
|
||||
<div id="info1" class="info-bar">
|
||||
<div class="info-name">Glitch</div>
|
||||
<div class="info-cat">Distortion</div>
|
||||
</div>
|
||||
<div id="info2" class="info-bar">
|
||||
<div class="info-name">Chromatic Aberration</div>
|
||||
<div class="info-cat">Distortion</div>
|
||||
</div>
|
||||
<div id="info3" class="info-bar">
|
||||
<div class="info-name">Ripple</div>
|
||||
<div class="info-cat">Distortion</div>
|
||||
</div>
|
||||
|
||||
<!-- Outro Card -->
|
||||
<div id="outro-card">
|
||||
<div class="card-title">Distortion Transitions</div>
|
||||
<div class="card-sub">End</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var tl = gsap.timeline({ defaults: { ease: "none" } });
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["main"] = tl;
|
||||
|
||||
function resetScenes() {
|
||||
tl.set("#scene1", { opacity: 1 });
|
||||
tl.set("#scene2", { opacity: 0 });
|
||||
tl.set("#s1", { x: 0, y: 0, scale: 1, filter: "blur(0px)", opacity: 1 });
|
||||
tl.set("#s2", { x: 0, y: 0, scale: 1, filter: "blur(0px)", opacity: 1 });
|
||||
tl.set("#glitch-r", { opacity: 0, x: 0, y: 0 });
|
||||
tl.set("#glitch-b", { opacity: 0, x: 0, y: 0 });
|
||||
}
|
||||
|
||||
// ===== TITLE CARD (0–3s) =====
|
||||
tl.set("#title-card", { opacity: 1 }, 0);
|
||||
tl.fromTo(
|
||||
".card-title",
|
||||
{ y: 30, opacity: 0 },
|
||||
{ y: 0, opacity: 1, duration: 0.6, ease: "power2.out" },
|
||||
0.4,
|
||||
);
|
||||
tl.fromTo(
|
||||
".card-sub",
|
||||
{ y: 20, opacity: 0 },
|
||||
{ y: 0, opacity: 1, duration: 0.5, ease: "power2.out" },
|
||||
0.8,
|
||||
);
|
||||
tl.to("#title-card", { opacity: 0, duration: 0.4, ease: "power2.in" }, 2.6);
|
||||
|
||||
// ===== DEMO 1: Glitch (3–8s) =====
|
||||
var T;
|
||||
|
||||
// Reset & show scene A
|
||||
tl.call(function () {}, [], 3);
|
||||
resetScenes();
|
||||
|
||||
// Show info bar
|
||||
tl.to("#info1", { opacity: 1, duration: 0.3, ease: "power2.out" }, 3);
|
||||
|
||||
// Hold 1.5s, transition at T=4.5
|
||||
T = 4.5;
|
||||
|
||||
// Glitch transition
|
||||
tl.set("#glitch-r", { opacity: 1, x: 40, y: -8 }, T);
|
||||
tl.set("#glitch-b", { opacity: 1, x: -30, y: 12 }, T);
|
||||
tl.set("#s1", { x: -15 }, T);
|
||||
|
||||
tl.set("#glitch-r", { x: -30, y: 15 }, T + 0.03);
|
||||
tl.set("#glitch-b", { x: 50, y: -10 }, T + 0.03);
|
||||
tl.set("#s1", { x: 20 }, T + 0.03);
|
||||
|
||||
tl.set("#glitch-r", { x: 60, y: -20 }, T + 0.06);
|
||||
tl.set("#glitch-b", { x: -40, y: 8 }, T + 0.06);
|
||||
tl.set("#s1", { x: -25 }, T + 0.06);
|
||||
|
||||
tl.set("#glitch-r", { x: -20, y: 5 }, T + 0.09);
|
||||
tl.set("#glitch-b", { x: 35, y: -15 }, T + 0.09);
|
||||
|
||||
// Swap at T + 0.12
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.12);
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.12);
|
||||
|
||||
// Clear
|
||||
tl.set("#glitch-r", { opacity: 0, x: 0, y: 0 }, T + 0.15);
|
||||
tl.set("#glitch-b", { opacity: 0, x: 0, y: 0 }, T + 0.15);
|
||||
tl.set("#s1", { x: 0 }, T + 0.15);
|
||||
|
||||
// Hold 1.0s, hide info, gap 0.5s
|
||||
tl.to("#info1", { opacity: 0, duration: 0.3, ease: "power2.in" }, 7.0);
|
||||
|
||||
// ===== DEMO 2: Chromatic Aberration (8–13s) =====
|
||||
tl.call(function () {}, [], 8);
|
||||
resetScenes();
|
||||
|
||||
tl.to("#info2", { opacity: 1, duration: 0.3, ease: "power2.out" }, 8);
|
||||
|
||||
T = 9.5;
|
||||
|
||||
// Chromatic aberration transition
|
||||
tl.set("#glitch-r", { opacity: 0.6, x: 0 }, T);
|
||||
tl.set("#glitch-b", { opacity: 0.6, x: 0 }, T);
|
||||
tl.to("#glitch-r", { x: -80, opacity: 0.8, duration: 0.3, ease: "power2.in" }, T);
|
||||
tl.to("#glitch-b", { x: 80, opacity: 0.8, duration: 0.3, ease: "power2.in" }, T);
|
||||
|
||||
// Swap
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.3);
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.3);
|
||||
|
||||
// Converge back
|
||||
tl.to("#glitch-r", { x: 0, opacity: 0, duration: 0.3, ease: "power2.out" }, T + 0.3);
|
||||
tl.to("#glitch-b", { x: 0, opacity: 0, duration: 0.3, ease: "power2.out" }, T + 0.3);
|
||||
|
||||
tl.to("#info2", { opacity: 0, duration: 0.3, ease: "power2.in" }, 12.0);
|
||||
|
||||
// ===== DEMO 3: Ripple (13–18s) =====
|
||||
tl.call(function () {}, [], 13);
|
||||
resetScenes();
|
||||
|
||||
tl.to("#info3", { opacity: 1, duration: 0.3, ease: "power2.out" }, 13);
|
||||
|
||||
T = 14.5;
|
||||
|
||||
// Ripple distortion transition
|
||||
tl.to("#s1", { x: 30, scale: 1.02, duration: 0.04, ease: "none" }, T);
|
||||
tl.to(
|
||||
"#s1",
|
||||
{ x: -25, scale: 0.98, filter: "blur(4px)", duration: 0.04, ease: "none" },
|
||||
T + 0.04,
|
||||
);
|
||||
tl.to(
|
||||
"#s1",
|
||||
{ x: 20, scale: 1.01, filter: "blur(6px)", duration: 0.04, ease: "none" },
|
||||
T + 0.08,
|
||||
);
|
||||
tl.to(
|
||||
"#s1",
|
||||
{ x: -15, scale: 0.99, filter: "blur(8px)", duration: 0.04, ease: "none" },
|
||||
T + 0.12,
|
||||
);
|
||||
tl.to(
|
||||
"#s1",
|
||||
{ x: 10, opacity: 0, filter: "blur(10px)", duration: 0.04, ease: "none" },
|
||||
T + 0.16,
|
||||
);
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.16);
|
||||
tl.fromTo(
|
||||
"#s2",
|
||||
{ x: -15, scale: 1.02, filter: "blur(8px)" },
|
||||
{ x: 0, scale: 1, filter: "blur(0px)", duration: 0.2, ease: "power2.out" },
|
||||
T + 0.2,
|
||||
);
|
||||
|
||||
tl.to("#info3", { opacity: 0, duration: 0.3, ease: "power2.in" }, 17.0);
|
||||
|
||||
// ===== OUTRO (18–21s) =====
|
||||
tl.set("#scene1", { opacity: 0 }, 18);
|
||||
tl.set("#scene2", { opacity: 0 }, 18);
|
||||
tl.set("#outro-card", { opacity: 1 }, 18);
|
||||
tl.fromTo(
|
||||
"#outro-card .card-title",
|
||||
{ y: 30, opacity: 0 },
|
||||
{ y: 0, opacity: 1, duration: 0.6, ease: "power2.out" },
|
||||
18.3,
|
||||
);
|
||||
tl.fromTo(
|
||||
"#outro-card .card-sub",
|
||||
{ y: 20, opacity: 0 },
|
||||
{ y: 0, opacity: 1, duration: 0.5, ease: "power2.out" },
|
||||
18.7,
|
||||
);
|
||||
tl.to("#outro-card", { opacity: 0, duration: 0.4, ease: "power2.in" }, 20.5);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "transitions-grid",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Grid Transitions",
|
||||
"description": "Showcase of grid-based tile transitions",
|
||||
"tags": ["transition", "showcase"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 11,
|
||||
"files": [
|
||||
{
|
||||
"path": "transitions-grid.html",
|
||||
"target": "compositions/transitions-grid.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920, height=1080" />
|
||||
<title>Grid Transitions</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
background: #000;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.scene {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.scene-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#scene1 .scene-inner {
|
||||
background: #1b263b;
|
||||
}
|
||||
#scene2 .scene-inner {
|
||||
background: #e07a5f;
|
||||
}
|
||||
|
||||
.scene-num {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
font-size: 200px;
|
||||
font-weight: 900;
|
||||
color: rgba(255, 255, 255, 0.08);
|
||||
line-height: 1;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
font-size: 48px;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.25);
|
||||
letter-spacing: 12px;
|
||||
text-transform: uppercase;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.info-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
background: rgba(0, 0, 0, 0.88);
|
||||
padding: 28px 60px;
|
||||
opacity: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.info-bar .info-name {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
}
|
||||
.info-bar .info-cat {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
letter-spacing: 4px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* Title / Outro */
|
||||
#title-card,
|
||||
#outro-card {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 200;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
background: #0d1117;
|
||||
opacity: 0;
|
||||
}
|
||||
.card-title {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
font-size: 72px;
|
||||
font-weight: 800;
|
||||
color: #fff;
|
||||
}
|
||||
.card-sub {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
font-size: 28px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
margin-top: 16px;
|
||||
letter-spacing: 6px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="main"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="11"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
style="position: relative; width: 1920px; height: 1080px; overflow: hidden; background: #000"
|
||||
>
|
||||
<!-- Title Card -->
|
||||
<div id="title-card">
|
||||
<div class="card-title">Grid Transitions</div>
|
||||
<div class="card-sub">Grid Dissolve</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene A -->
|
||||
<div id="scene1" class="scene" style="opacity: 0">
|
||||
<div id="s1" class="scene-inner">
|
||||
<div class="scene-num">ONE</div>
|
||||
<div class="scene-label">Scene A</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene B -->
|
||||
<div id="scene2" class="scene" style="opacity: 0">
|
||||
<div id="s2" class="scene-inner">
|
||||
<div class="scene-num">TWO</div>
|
||||
<div class="scene-label">Scene B</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Grid container -->
|
||||
<div
|
||||
id="grid-container"
|
||||
style="
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 50;
|
||||
pointer-events: none;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 480px);
|
||||
grid-template-rows: repeat(3, 360px);
|
||||
"
|
||||
></div>
|
||||
|
||||
<!-- Info Bar -->
|
||||
<div id="info1" class="info-bar">
|
||||
<div class="info-name">Grid Dissolve</div>
|
||||
<div class="info-cat">Grid</div>
|
||||
</div>
|
||||
|
||||
<!-- Outro Card -->
|
||||
<div id="outro-card">
|
||||
<div class="card-title">Grid Transitions</div>
|
||||
<div class="card-sub">End</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var tl = gsap.timeline({ defaults: { ease: "none" } });
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["main"] = tl;
|
||||
|
||||
// Generate grid cells
|
||||
var gridColors = [
|
||||
"#F72585",
|
||||
"#7209B7",
|
||||
"#3A0CA3",
|
||||
"#4361EE",
|
||||
"#4CC9F0",
|
||||
"#F72585",
|
||||
"#7209B7",
|
||||
"#3A0CA3",
|
||||
"#4361EE",
|
||||
"#4CC9F0",
|
||||
"#F72585",
|
||||
"#7209B7",
|
||||
];
|
||||
var gridHTML = "";
|
||||
for (var g = 0; g < 12; g++) {
|
||||
gridHTML +=
|
||||
'<div id="cell-' +
|
||||
g +
|
||||
'" style="background:' +
|
||||
gridColors[g % gridColors.length] +
|
||||
'; opacity:0;"></div>';
|
||||
}
|
||||
document.getElementById("grid-container").innerHTML = gridHTML;
|
||||
|
||||
function resetScenes() {
|
||||
tl.set("#scene1", { opacity: 1 });
|
||||
tl.set("#scene2", { opacity: 0 });
|
||||
tl.set("#s1", { x: 0, y: 0, scale: 1, filter: "blur(0px)", opacity: 1 });
|
||||
tl.set("#s2", { x: 0, y: 0, scale: 1, filter: "blur(0px)", opacity: 1 });
|
||||
for (var g = 0; g < 12; g++) {
|
||||
tl.set("#cell-" + g, { opacity: 0 });
|
||||
}
|
||||
}
|
||||
|
||||
// ===== TITLE CARD (0–3s) =====
|
||||
tl.set("#title-card", { opacity: 1 }, 0);
|
||||
tl.fromTo(
|
||||
".card-title",
|
||||
{ y: 30, opacity: 0 },
|
||||
{ y: 0, opacity: 1, duration: 0.6, ease: "power2.out" },
|
||||
0.4,
|
||||
);
|
||||
tl.fromTo(
|
||||
".card-sub",
|
||||
{ y: 20, opacity: 0 },
|
||||
{ y: 0, opacity: 1, duration: 0.5, ease: "power2.out" },
|
||||
0.8,
|
||||
);
|
||||
tl.to("#title-card", { opacity: 0, duration: 0.4, ease: "power2.in" }, 2.6);
|
||||
|
||||
// ===== DEMO 1: Grid Dissolve (3–8s) =====
|
||||
var T;
|
||||
|
||||
tl.call(function () {}, [], 3);
|
||||
resetScenes();
|
||||
|
||||
// Show info bar
|
||||
tl.to("#info1", { opacity: 1, duration: 0.3, ease: "power2.out" }, 3);
|
||||
|
||||
// Hold 1.5s, transition at T=4.5
|
||||
T = 4.5;
|
||||
|
||||
// Cell positions (col, row) and distance from center (1.5, 1)
|
||||
var cells = [];
|
||||
for (var g = 0; g < 12; g++) {
|
||||
var col = g % 4;
|
||||
var row = Math.floor(g / 4);
|
||||
var dist = Math.sqrt(Math.pow(col - 1.5, 2) + Math.pow(row - 1, 2));
|
||||
cells.push({ id: g, dist: dist });
|
||||
}
|
||||
cells.sort(function (a, b) {
|
||||
return a.dist - b.dist;
|
||||
});
|
||||
|
||||
// Ripple in from center
|
||||
var stag = 0.04;
|
||||
for (var c = 0; c < cells.length; c++) {
|
||||
tl.to(
|
||||
"#cell-" + cells[c].id,
|
||||
{ opacity: 1, duration: 0.15, ease: "power2.out" },
|
||||
T + c * stag,
|
||||
);
|
||||
}
|
||||
|
||||
// Swap scenes at midpoint
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.35);
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.35);
|
||||
|
||||
// Ripple out
|
||||
for (var c = 0; c < cells.length; c++) {
|
||||
tl.to(
|
||||
"#cell-" + cells[c].id,
|
||||
{ opacity: 0, duration: 0.15, ease: "power2.in" },
|
||||
T + 0.5 + c * stag,
|
||||
);
|
||||
}
|
||||
|
||||
// Hold 1.0s, hide info, gap 0.5s
|
||||
tl.to("#info1", { opacity: 0, duration: 0.3, ease: "power2.in" }, 7.0);
|
||||
|
||||
// ===== OUTRO (8–11s) =====
|
||||
tl.set("#scene1", { opacity: 0 }, 8);
|
||||
tl.set("#scene2", { opacity: 0 }, 8);
|
||||
tl.set("#outro-card", { opacity: 1 }, 8);
|
||||
tl.fromTo(
|
||||
"#outro-card .card-title",
|
||||
{ y: 30, opacity: 0 },
|
||||
{ y: 0, opacity: 1, duration: 0.6, ease: "power2.out" },
|
||||
8.3,
|
||||
);
|
||||
tl.fromTo(
|
||||
"#outro-card .card-sub",
|
||||
{ y: 20, opacity: 0 },
|
||||
{ y: 0, opacity: 1, duration: 0.5, ease: "power2.out" },
|
||||
8.7,
|
||||
);
|
||||
tl.to("#outro-card", { opacity: 0, duration: 0.4, ease: "power2.in" }, 10.5);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "transitions-light",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Light Transitions",
|
||||
"description": "Showcase of light-based glow and flash transitions",
|
||||
"tags": ["transition", "showcase"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 21,
|
||||
"files": [
|
||||
{
|
||||
"path": "transitions-light.html",
|
||||
"target": "compositions/transitions-light.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,391 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Light Transitions Showcase</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
background: #000;
|
||||
overflow: hidden;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
/* Title Card */
|
||||
#title-card {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 10;
|
||||
background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 100%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
opacity: 1;
|
||||
}
|
||||
#title-card h1 {
|
||||
font-size: 72px;
|
||||
font-weight: 800;
|
||||
color: #fff;
|
||||
letter-spacing: -1px;
|
||||
opacity: 0;
|
||||
transform: translateY(30px);
|
||||
}
|
||||
#title-card .subtitle {
|
||||
font-size: 28px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
margin-top: 12px;
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
|
||||
/* Scenes */
|
||||
#scene1,
|
||||
#scene2 {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
#scene1 {
|
||||
background: #1b263b;
|
||||
z-index: 2;
|
||||
opacity: 0;
|
||||
}
|
||||
#scene2 {
|
||||
background: #e07a5f;
|
||||
z-index: 1;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.scene-number {
|
||||
font-size: 180px;
|
||||
font-weight: 900;
|
||||
line-height: 1;
|
||||
opacity: 0.12;
|
||||
letter-spacing: -6px;
|
||||
}
|
||||
#scene1 .scene-number {
|
||||
color: #fff;
|
||||
}
|
||||
#scene2 .scene-number {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.scene-label {
|
||||
font-size: 48px;
|
||||
font-weight: 700;
|
||||
margin-top: -20px;
|
||||
}
|
||||
#scene1 .scene-label {
|
||||
color: #fff;
|
||||
}
|
||||
#scene2 .scene-label {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Info bar */
|
||||
.info-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 80px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 48px;
|
||||
}
|
||||
#scene1 .info-bar {
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
#scene2 .info-bar {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.info-bar .label {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
.info-bar .desc {
|
||||
font-size: 16px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Outro */
|
||||
#outro {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 10;
|
||||
background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 100%);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
opacity: 0;
|
||||
}
|
||||
#outro h2 {
|
||||
font-size: 56px;
|
||||
font-weight: 800;
|
||||
color: #fff;
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
#outro .tag {
|
||||
font-size: 22px;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
margin-top: 10px;
|
||||
opacity: 0;
|
||||
transform: translateY(15px);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="comp"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="21"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
style="position: relative; width: 1920px; height: 1080px; overflow: hidden; background: #000"
|
||||
>
|
||||
<!-- Title Card -->
|
||||
<div id="title-card">
|
||||
<h1 id="title-h1">Light Transitions</h1>
|
||||
<div class="subtitle" id="title-sub">3 transition styles</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene A -->
|
||||
<div id="scene1">
|
||||
<div class="scene-number">ONE</div>
|
||||
<div class="scene-label">SCENE A</div>
|
||||
<div class="info-bar">
|
||||
<span class="label" id="info-label-a"></span>
|
||||
<span class="desc" id="info-desc-a"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene B -->
|
||||
<div id="scene2">
|
||||
<div class="scene-number">TWO</div>
|
||||
<div class="scene-label">SCENE B</div>
|
||||
<div class="info-bar">
|
||||
<span class="label" id="info-label-b"></span>
|
||||
<span class="desc" id="info-desc-b"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Light Leak Overlays -->
|
||||
<div
|
||||
id="leak-warm"
|
||||
style="
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(135deg, rgba(255, 165, 0, 0.6), transparent 60%);
|
||||
z-index: 50;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
id="leak-1"
|
||||
style="
|
||||
position: absolute;
|
||||
top: -200px;
|
||||
left: -400px;
|
||||
width: 2400px;
|
||||
height: 1500px;
|
||||
background: radial-gradient(ellipse at 30% 40%, rgba(255, 140, 0, 0.5), transparent 50%);
|
||||
z-index: 51;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
id="leak-2"
|
||||
style="
|
||||
position: absolute;
|
||||
top: -100px;
|
||||
left: -200px;
|
||||
width: 2400px;
|
||||
height: 1400px;
|
||||
background: radial-gradient(ellipse at 60% 50%, rgba(255, 200, 0, 0.4), transparent 50%);
|
||||
z-index: 51;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
"
|
||||
></div>
|
||||
|
||||
<!-- Flash Overlay -->
|
||||
<div
|
||||
id="flash-overlay"
|
||||
style="
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: #fff;
|
||||
z-index: 50;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
"
|
||||
></div>
|
||||
|
||||
<!-- Film Burn Overlays -->
|
||||
<div
|
||||
id="burn-a"
|
||||
style="
|
||||
position: absolute;
|
||||
top: -300px;
|
||||
right: -800px;
|
||||
width: 2400px;
|
||||
height: 1800px;
|
||||
background: radial-gradient(ellipse at 70% 40%, rgba(255, 100, 0, 0.5), transparent 50%);
|
||||
z-index: 51;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
id="burn-b"
|
||||
style="
|
||||
position: absolute;
|
||||
top: -200px;
|
||||
right: -600px;
|
||||
width: 2400px;
|
||||
height: 1600px;
|
||||
background: radial-gradient(ellipse at 80% 50%, rgba(255, 160, 0, 0.4), transparent 50%);
|
||||
z-index: 51;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
id="burn-c"
|
||||
style="
|
||||
position: absolute;
|
||||
top: -100px;
|
||||
right: -500px;
|
||||
width: 2200px;
|
||||
height: 1400px;
|
||||
background: radial-gradient(ellipse at 60% 60%, rgba(255, 200, 50, 0.3), transparent 50%);
|
||||
z-index: 51;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
"
|
||||
></div>
|
||||
|
||||
<!-- Outro -->
|
||||
<div id="outro">
|
||||
<h2 id="outro-h2">Light Transitions</h2>
|
||||
<div class="tag" id="outro-tag">End of showcase</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var tl = gsap.timeline({ paused: false });
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["main"] = tl;
|
||||
|
||||
// Transition demos config
|
||||
var demos = [
|
||||
{ label: "LIGHT LEAK", desc: "Use a light leak transition with warm overlays" },
|
||||
{ label: "OVEREXPOSURE BURN", desc: "Use an overexposure burn transition" },
|
||||
{ label: "FILM BURN", desc: "Use a film burn transition with warm edge bleeds" },
|
||||
];
|
||||
|
||||
// Reset scenes helper
|
||||
function resetScenes(t, demoIndex) {
|
||||
tl.set("#scene1", { opacity: 1, filter: "none", scale: 1 }, t);
|
||||
tl.set("#scene2", { opacity: 0 }, t);
|
||||
tl.set("#info-label-a", { textContent: demos[demoIndex].label }, t);
|
||||
tl.set("#info-desc-a", { textContent: demos[demoIndex].desc }, t);
|
||||
tl.set("#info-label-b", { textContent: demos[demoIndex].label }, t);
|
||||
tl.set("#info-desc-b", { textContent: demos[demoIndex].desc }, t);
|
||||
// Reset light leak overlays
|
||||
tl.set("#leak-warm", { opacity: 0 }, t);
|
||||
tl.set("#leak-1", { opacity: 0, x: 0 }, t);
|
||||
tl.set("#leak-2", { opacity: 0, x: 0 }, t);
|
||||
// Reset flash
|
||||
tl.set("#flash-overlay", { opacity: 0 }, t);
|
||||
// Reset burn overlays
|
||||
tl.set("#burn-a", { opacity: 0, x: 0 }, t);
|
||||
tl.set("#burn-b", { opacity: 0, x: 0 }, t);
|
||||
tl.set("#burn-c", { opacity: 0, x: 0 }, t);
|
||||
}
|
||||
|
||||
// ===== TITLE CARD (0s - 3s) =====
|
||||
tl.to("#title-h1", { opacity: 1, y: 0, duration: 0.6, ease: "power2.out" }, 0.3);
|
||||
tl.to("#title-sub", { opacity: 1, y: 0, duration: 0.5, ease: "power2.out" }, 0.6);
|
||||
tl.to("#title-card", { opacity: 0, duration: 0.4, ease: "power1.inOut" }, 2.5);
|
||||
|
||||
// ===== DEMO 1: LIGHT LEAK (3s - 8s) =====
|
||||
var T1 = 3;
|
||||
resetScenes(T1, 0);
|
||||
var T = T1 + 2;
|
||||
tl.to("#leak-warm", { opacity: 0.4, duration: 0.3, ease: "power1.in" }, T);
|
||||
tl.to("#leak-1", { opacity: 0.9, x: 300, duration: 0.5, ease: "sine.inOut" }, T + 0.05);
|
||||
tl.to("#leak-2", { opacity: 0.8, x: 200, duration: 0.6, ease: "sine.inOut" }, T + 0.1);
|
||||
tl.to("#leak-warm", { opacity: 0.6, duration: 0.15, ease: "power2.in" }, T + 0.35);
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.45);
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.45);
|
||||
tl.to("#leak-warm", { opacity: 0, duration: 0.4, ease: "power2.out" }, T + 0.5);
|
||||
tl.to("#leak-1", { opacity: 0, x: 600, duration: 0.35, ease: "power1.out" }, T + 0.5);
|
||||
tl.to("#leak-2", { opacity: 0, x: 400, duration: 0.35, ease: "power1.out" }, T + 0.55);
|
||||
|
||||
// ===== DEMO 2: OVEREXPOSURE BURN (8s - 13s) =====
|
||||
var T2 = 8;
|
||||
resetScenes(T2, 1);
|
||||
T = T2 + 2;
|
||||
tl.to(
|
||||
"#scene1",
|
||||
{ filter: "brightness(1.5)", scale: 1.03, duration: 0.2, ease: "power1.in" },
|
||||
T,
|
||||
);
|
||||
tl.to(
|
||||
"#scene1",
|
||||
{ filter: "brightness(3)", scale: 1.06, duration: 0.2, ease: "power2.in" },
|
||||
T + 0.2,
|
||||
);
|
||||
tl.to("#flash-overlay", { opacity: 0.5, duration: 0.25, ease: "power1.in" }, T + 0.15);
|
||||
tl.to("#flash-overlay", { opacity: 1, duration: 0.15, ease: "power2.in" }, T + 0.4);
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.55);
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.55);
|
||||
tl.set("#scene1", { filter: "none", scale: 1 }, T + 0.55);
|
||||
tl.to("#flash-overlay", { opacity: 0, duration: 0.35, ease: "power2.out" }, T + 0.55);
|
||||
|
||||
// ===== DEMO 3: FILM BURN (13s - 18s) =====
|
||||
var T3 = 13;
|
||||
resetScenes(T3, 2);
|
||||
T = T3 + 2;
|
||||
tl.to("#burn-a", { opacity: 1, x: -300, duration: 0.4, ease: "power1.in" }, T);
|
||||
tl.to("#burn-b", { opacity: 1, x: -500, duration: 0.5, ease: "power1.in" }, T + 0.05);
|
||||
tl.to("#burn-c", { opacity: 1, x: -200, duration: 0.45, ease: "power1.in" }, T + 0.1);
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.35);
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.35);
|
||||
tl.to("#burn-a", { opacity: 0, duration: 0.3, ease: "power2.out" }, T + 0.45);
|
||||
tl.to("#burn-b", { opacity: 0, duration: 0.3, ease: "power2.out" }, T + 0.5);
|
||||
tl.to("#burn-c", { opacity: 0, duration: 0.3, ease: "power2.out" }, T + 0.55);
|
||||
|
||||
// ===== OUTRO (18s - 21s) =====
|
||||
tl.to("#scene1", { opacity: 0, duration: 0.3 }, 18);
|
||||
tl.to("#scene2", { opacity: 0, duration: 0.3 }, 18);
|
||||
tl.to("#outro", { opacity: 1, duration: 0.4, ease: "power1.inOut" }, 18.2);
|
||||
tl.to("#outro-h2", { opacity: 1, y: 0, duration: 0.5, ease: "power2.out" }, 18.5);
|
||||
tl.to("#outro-tag", { opacity: 1, y: 0, duration: 0.4, ease: "power2.out" }, 18.8);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "transitions-mechanical",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Mechanical Transitions",
|
||||
"description": "Showcase of mechanical shutter and iris transitions",
|
||||
"tags": ["transition", "showcase"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 15,
|
||||
"files": [
|
||||
{
|
||||
"path": "transitions-mechanical.html",
|
||||
"target": "compositions/transitions-mechanical.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,423 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #000;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.scene-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
.info-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
background: rgba(0, 0, 0, 0.88);
|
||||
padding: 24px 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 40px;
|
||||
opacity: 0;
|
||||
}
|
||||
.info-num {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
.info-name {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
}
|
||||
.info-desc {
|
||||
font-size: 14px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
#title-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 50;
|
||||
}
|
||||
#outro-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 50;
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="15"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<!-- Title Card -->
|
||||
<div id="title-card">
|
||||
<div
|
||||
id="title-label"
|
||||
style="
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
TRANSITION CATALOG
|
||||
</div>
|
||||
<div
|
||||
id="title-main"
|
||||
style="font-size: 72px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0"
|
||||
>
|
||||
Mechanical Transitions
|
||||
</div>
|
||||
<div
|
||||
id="title-count"
|
||||
style="
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
margin-top: 12px;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
2 transitions
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene A -->
|
||||
<div id="scene1" class="scene" style="z-index: 1">
|
||||
<div class="scene-inner" id="s1" style="background: #1b263b">
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.08)">
|
||||
ONE
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #778da9;
|
||||
letter-spacing: 0.15em;
|
||||
margin-top: -20px;
|
||||
"
|
||||
>
|
||||
SCENE A
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene B -->
|
||||
<div id="scene2" class="scene" style="z-index: 2; opacity: 0">
|
||||
<div class="scene-inner" id="s2" style="background: #e07a5f">
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.15)">
|
||||
TWO
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
letter-spacing: 0.15em;
|
||||
margin-top: -20px;
|
||||
"
|
||||
>
|
||||
SCENE B
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Shutter Halves -->
|
||||
<div
|
||||
id="shutter-top"
|
||||
style="
|
||||
position: absolute;
|
||||
top: -540px;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 540px;
|
||||
background: #111;
|
||||
z-index: 50;
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
id="shutter-bot"
|
||||
style="
|
||||
position: absolute;
|
||||
bottom: -540px;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 540px;
|
||||
background: #111;
|
||||
z-index: 50;
|
||||
"
|
||||
></div>
|
||||
|
||||
<!-- Info Bars -->
|
||||
<div id="info-1" class="info-bar">
|
||||
<div class="info-num">01</div>
|
||||
<div class="info-name">Shutter</div>
|
||||
<div class="info-desc">Use a shutter close/open transition</div>
|
||||
</div>
|
||||
<div id="info-2" class="info-bar">
|
||||
<div class="info-num">02</div>
|
||||
<div class="info-name">Clock Wipe</div>
|
||||
<div class="info-desc">Use a clock wipe transition</div>
|
||||
</div>
|
||||
|
||||
<!-- Outro Card -->
|
||||
<div id="outro-card">
|
||||
<div
|
||||
id="outro-label"
|
||||
style="
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
MECHANICAL TRANSITIONS
|
||||
</div>
|
||||
<div
|
||||
id="outro-main"
|
||||
style="font-size: 56px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0"
|
||||
>
|
||||
2 Transitions
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
var t = 0;
|
||||
|
||||
// === TITLE CARD (3s) ===
|
||||
tl.to("#title-label", { opacity: 1, y: 0, duration: 0.4, ease: "power2.out" }, t + 0.3);
|
||||
tl.fromTo(
|
||||
"#title-main",
|
||||
{ opacity: 0, y: 20 },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power2.out" },
|
||||
t + 0.6,
|
||||
);
|
||||
tl.fromTo(
|
||||
"#title-count",
|
||||
{ opacity: 0 },
|
||||
{ opacity: 1, duration: 0.4, ease: "power2.out" },
|
||||
t + 1.0,
|
||||
);
|
||||
tl.to("#title-card", { opacity: 0, duration: 0.4, ease: "power2.inOut" }, t + 2.4);
|
||||
t += 3;
|
||||
|
||||
function resetScenes() {
|
||||
tl.set(
|
||||
"#scene1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 1,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#scene2",
|
||||
{
|
||||
opacity: 0,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 2,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
scaleX: 1,
|
||||
transformOrigin: "50% 50%",
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s2",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
scaleX: 1,
|
||||
transformOrigin: "50% 50%",
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set("#shutter-top", { y: 0 }, t);
|
||||
tl.set("#shutter-bot", { y: 0 }, t);
|
||||
}
|
||||
|
||||
// === TRANSITION 1: Shutter ===
|
||||
resetScenes();
|
||||
tl.to("#info-1", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
var T = t + 1.5;
|
||||
tl.to("#shutter-top", { y: 540, duration: 0.25, ease: "power3.in" }, T);
|
||||
tl.to("#shutter-bot", { y: -540, duration: 0.25, ease: "power3.in" }, T);
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.25);
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.25);
|
||||
tl.to("#shutter-top", { y: 0, duration: 0.25, ease: "power3.out" }, T + 0.3);
|
||||
tl.to("#shutter-bot", { y: 0, duration: 0.25, ease: "power3.out" }, T + 0.3);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-1", { opacity: 0, duration: 0.2 }, t);
|
||||
// Reset shutters after demo
|
||||
tl.set("#shutter-top", { y: 0 }, t + 0.2);
|
||||
tl.set("#shutter-bot", { y: 0 }, t + 0.2);
|
||||
t += 0.5;
|
||||
|
||||
// === TRANSITION 2: Clock Wipe ===
|
||||
resetScenes();
|
||||
tl.to("#info-2", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
T = t + 1.5;
|
||||
var d = 0.1;
|
||||
tl.set(
|
||||
"#scene2",
|
||||
{
|
||||
opacity: 1,
|
||||
zIndex: 10,
|
||||
clipPath:
|
||||
"polygon(50% 50%, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%, 50% 0%)",
|
||||
},
|
||||
T,
|
||||
);
|
||||
tl.to(
|
||||
"#scene2",
|
||||
{
|
||||
clipPath:
|
||||
"polygon(50% 50%, 50% 0%, 100% 0%, 100% 50%, 100% 50%, 100% 50%, 100% 50%, 100% 50%, 100% 50%)",
|
||||
duration: d,
|
||||
ease: "none",
|
||||
},
|
||||
T,
|
||||
);
|
||||
tl.to(
|
||||
"#scene2",
|
||||
{
|
||||
clipPath:
|
||||
"polygon(50% 50%, 50% 0%, 100% 0%, 100% 50%, 100% 100%, 50% 100%, 50% 100%, 50% 100%, 50% 100%)",
|
||||
duration: d,
|
||||
ease: "none",
|
||||
},
|
||||
T + d,
|
||||
);
|
||||
tl.to(
|
||||
"#scene2",
|
||||
{
|
||||
clipPath:
|
||||
"polygon(50% 50%, 50% 0%, 100% 0%, 100% 50%, 100% 100%, 50% 100%, 0% 100%, 0% 50%, 0% 50%)",
|
||||
duration: d,
|
||||
ease: "none",
|
||||
},
|
||||
T + d * 2,
|
||||
);
|
||||
tl.to(
|
||||
"#scene2",
|
||||
{
|
||||
clipPath:
|
||||
"polygon(50% 50%, 50% 0%, 100% 0%, 100% 50%, 100% 100%, 50% 100%, 0% 100%, 0% 50%, 0% 0%)",
|
||||
duration: d,
|
||||
ease: "none",
|
||||
},
|
||||
T + d * 3,
|
||||
);
|
||||
tl.set("#scene2", { clipPath: "none", zIndex: 2 }, T + d * 4 + 0.02);
|
||||
tl.set("#scene1", { opacity: 0 }, T + d * 4 + 0.02);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-2", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === OUTRO (3s) ===
|
||||
tl.set("#scene1", { opacity: 0 }, t);
|
||||
tl.set("#scene2", { opacity: 0 }, t);
|
||||
tl.to("#outro-card", { opacity: 1, duration: 0.4, ease: "power2.inOut" }, t);
|
||||
tl.to("#outro-label", { opacity: 1, duration: 0.4, ease: "power2.out" }, t + 0.3);
|
||||
tl.fromTo(
|
||||
"#outro-main",
|
||||
{ opacity: 0, y: 20 },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power2.out" },
|
||||
t + 0.6,
|
||||
);
|
||||
tl.to("#outro-card", { opacity: 0, duration: 0.4, ease: "power2.inOut" }, t + 2.4);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["main"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "transitions-other",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Other Transitions",
|
||||
"description": "Showcase of miscellaneous creative transitions",
|
||||
"tags": ["transition", "showcase"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 20,
|
||||
"files": [
|
||||
{
|
||||
"path": "transitions-other.html",
|
||||
"target": "compositions/transitions-other.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,392 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #000;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.scene-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
.info-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
background: rgba(0, 0, 0, 0.88);
|
||||
padding: 24px 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 40px;
|
||||
opacity: 0;
|
||||
}
|
||||
.info-num {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
.info-name {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
}
|
||||
.info-desc {
|
||||
font-size: 14px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
#title-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 50;
|
||||
}
|
||||
#outro-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 50;
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="20"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<!-- Title Card -->
|
||||
<div id="title-card">
|
||||
<div
|
||||
id="title-label"
|
||||
style="
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
TRANSITION CATALOG
|
||||
</div>
|
||||
<div
|
||||
id="title-main"
|
||||
style="font-size: 72px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0"
|
||||
>
|
||||
Other Transitions
|
||||
</div>
|
||||
<div
|
||||
id="title-count"
|
||||
style="
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
margin-top: 12px;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
3 transitions
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene A -->
|
||||
<div id="scene1" class="scene" style="z-index: 1">
|
||||
<div class="scene-inner" id="s1" style="background: #1b263b">
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.08)">
|
||||
ONE
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #778da9;
|
||||
letter-spacing: 0.15em;
|
||||
margin-top: -20px;
|
||||
"
|
||||
>
|
||||
SCENE A
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene B -->
|
||||
<div id="scene2" class="scene" style="z-index: 2; opacity: 0">
|
||||
<div class="scene-inner" id="s2" style="background: #e07a5f">
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.15)">
|
||||
TWO
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
letter-spacing: 0.15em;
|
||||
margin-top: -20px;
|
||||
"
|
||||
>
|
||||
SCENE B
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Flash Overlay -->
|
||||
<div
|
||||
id="flash-overlay"
|
||||
style="
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: #fff;
|
||||
z-index: 50;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
"
|
||||
></div>
|
||||
|
||||
<!-- Morph Circle -->
|
||||
<div
|
||||
id="morph-circle"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
transform: translate(-50%, -50%) scale(0);
|
||||
z-index: 50;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
background: #e07a5f;
|
||||
"
|
||||
></div>
|
||||
|
||||
<!-- Info Bars -->
|
||||
<div id="info-1" class="info-bar">
|
||||
<div class="info-num">01</div>
|
||||
<div class="info-name">Flash Cut</div>
|
||||
<div class="info-desc">Use a flash cut transition</div>
|
||||
</div>
|
||||
<div id="info-2" class="info-bar">
|
||||
<div class="info-num">02</div>
|
||||
<div class="info-name">Gravity Drop</div>
|
||||
<div class="info-desc">Use a gravity drop transition</div>
|
||||
</div>
|
||||
<div id="info-3" class="info-bar">
|
||||
<div class="info-num">03</div>
|
||||
<div class="info-name">Morph Circle</div>
|
||||
<div class="info-desc">Use a morph circle expanding transition</div>
|
||||
</div>
|
||||
|
||||
<!-- Outro Card -->
|
||||
<div id="outro-card">
|
||||
<div
|
||||
id="outro-label"
|
||||
style="
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
OTHER TRANSITIONS
|
||||
</div>
|
||||
<div
|
||||
id="outro-main"
|
||||
style="font-size: 56px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0"
|
||||
>
|
||||
3 Transitions
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
var t = 0;
|
||||
|
||||
// === TITLE CARD (3s) ===
|
||||
tl.to("#title-label", { opacity: 1, y: 0, duration: 0.4, ease: "power2.out" }, t + 0.3);
|
||||
tl.fromTo(
|
||||
"#title-main",
|
||||
{ opacity: 0, y: 20 },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power2.out" },
|
||||
t + 0.6,
|
||||
);
|
||||
tl.fromTo(
|
||||
"#title-count",
|
||||
{ opacity: 0 },
|
||||
{ opacity: 1, duration: 0.4, ease: "power2.out" },
|
||||
t + 1.0,
|
||||
);
|
||||
tl.to("#title-card", { opacity: 0, duration: 0.4, ease: "power2.inOut" }, t + 2.4);
|
||||
t += 3;
|
||||
|
||||
function resetScenes() {
|
||||
tl.set(
|
||||
"#scene1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 1,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#scene2",
|
||||
{
|
||||
opacity: 0,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 2,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
scaleX: 1,
|
||||
transformOrigin: "50% 50%",
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s2",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
scaleX: 1,
|
||||
transformOrigin: "50% 50%",
|
||||
},
|
||||
t,
|
||||
);
|
||||
}
|
||||
|
||||
// === TRANSITION 1: Flash Cut ===
|
||||
resetScenes();
|
||||
tl.to("#info-1", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
var T = t + 1.5;
|
||||
tl.to("#flash-overlay", { opacity: 1, duration: 0.03, ease: "power4.out" }, T);
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.03);
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.03);
|
||||
tl.to("#flash-overlay", { opacity: 0, duration: 0.1, ease: "power2.out" }, T + 0.05);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-1", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === TRANSITION 2: Gravity Drop ===
|
||||
resetScenes();
|
||||
tl.to("#info-2", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
T = t + 1.5;
|
||||
tl.set("#scene2", { opacity: 1, zIndex: 1 }, T);
|
||||
tl.set("#scene1", { zIndex: 10 }, T);
|
||||
tl.to("#s1", { y: 1200, rotation: 4, duration: 0.5, ease: "power3.in" }, T);
|
||||
tl.set("#scene1", { opacity: 0, zIndex: 1 }, T + 0.55);
|
||||
tl.set("#scene2", { zIndex: 2 }, T + 0.55);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-2", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === TRANSITION 3: Morph Circle ===
|
||||
resetScenes();
|
||||
tl.to("#info-3", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
T = t + 1.5;
|
||||
tl.set("#morph-circle", { opacity: 1, scale: 0 }, T);
|
||||
tl.to("#morph-circle", { scale: 60, duration: 0.5, ease: "power3.in" }, T);
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.4);
|
||||
tl.set("#scene2", { opacity: 1 }, T + 0.4);
|
||||
tl.to("#morph-circle", { opacity: 0, duration: 0.15, ease: "power2.out" }, T + 0.5);
|
||||
tl.set("#morph-circle", { scale: 0 }, T + 0.7);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-3", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === OUTRO (3s) ===
|
||||
tl.set("#scene1", { opacity: 0 }, t);
|
||||
tl.set("#scene2", { opacity: 0 }, t);
|
||||
tl.to("#outro-card", { opacity: 1, duration: 0.4, ease: "power2.inOut" }, t);
|
||||
tl.to("#outro-label", { opacity: 1, duration: 0.4, ease: "power2.out" }, t + 0.3);
|
||||
tl.fromTo(
|
||||
"#outro-main",
|
||||
{ opacity: 0, y: 20 },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power2.out" },
|
||||
t + 0.6,
|
||||
);
|
||||
tl.to("#outro-card", { opacity: 0, duration: 0.4, ease: "power2.inOut" }, t + 2.4);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["main"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "transitions-push",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Push Transitions",
|
||||
"description": "Showcase of push and slide transitions",
|
||||
"tags": ["transition", "showcase"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 24,
|
||||
"files": [
|
||||
{
|
||||
"path": "transitions-push.html",
|
||||
"target": "compositions/transitions-push.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,383 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #000;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.scene-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
.info-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
background: rgba(0, 0, 0, 0.88);
|
||||
padding: 24px 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 40px;
|
||||
opacity: 0;
|
||||
}
|
||||
.info-num {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
.info-name {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
}
|
||||
.info-desc {
|
||||
font-size: 14px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
#title-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 50;
|
||||
}
|
||||
#outro-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 50;
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="24"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<!-- Title Card -->
|
||||
<div id="title-card">
|
||||
<div
|
||||
id="title-label"
|
||||
style="
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
TRANSITION CATALOG
|
||||
</div>
|
||||
<div
|
||||
id="title-main"
|
||||
style="font-size: 72px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0"
|
||||
>
|
||||
Push Transitions
|
||||
</div>
|
||||
<div
|
||||
id="title-count"
|
||||
style="
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
margin-top: 12px;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
4 transitions
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene A -->
|
||||
<div id="scene1" class="scene" style="z-index: 1">
|
||||
<div class="scene-inner" id="s1" style="background: #1b263b">
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.08)">
|
||||
ONE
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #778da9;
|
||||
letter-spacing: 0.15em;
|
||||
margin-top: -20px;
|
||||
"
|
||||
>
|
||||
SCENE A
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene B -->
|
||||
<div id="scene2" class="scene" style="z-index: 2; opacity: 0">
|
||||
<div class="scene-inner" id="s2" style="background: #e07a5f">
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.15)">
|
||||
TWO
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
letter-spacing: 0.15em;
|
||||
margin-top: -20px;
|
||||
"
|
||||
>
|
||||
SCENE B
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info Bars -->
|
||||
<div id="info-1" class="info-bar">
|
||||
<div class="info-num">01</div>
|
||||
<div class="info-name">Push Slide</div>
|
||||
<div class="info-desc">Use a push slide transition</div>
|
||||
</div>
|
||||
<div id="info-2" class="info-bar">
|
||||
<div class="info-num">02</div>
|
||||
<div class="info-name">Vertical Push</div>
|
||||
<div class="info-desc">Use a vertical push transition</div>
|
||||
</div>
|
||||
<div id="info-3" class="info-bar">
|
||||
<div class="info-num">03</div>
|
||||
<div class="info-name">Elastic Push</div>
|
||||
<div class="info-desc">Use an elastic push transition with overshoot</div>
|
||||
</div>
|
||||
<div id="info-4" class="info-bar">
|
||||
<div class="info-num">04</div>
|
||||
<div class="info-name">Squeeze</div>
|
||||
<div class="info-desc">Use a squeeze transition</div>
|
||||
</div>
|
||||
|
||||
<!-- Outro Card -->
|
||||
<div id="outro-card">
|
||||
<div
|
||||
id="outro-label"
|
||||
style="
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
PUSH TRANSITIONS
|
||||
</div>
|
||||
<div
|
||||
id="outro-main"
|
||||
style="font-size: 56px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0"
|
||||
>
|
||||
4 Transitions
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
var t = 0;
|
||||
|
||||
// === TITLE CARD (3s) ===
|
||||
tl.to("#title-label", { opacity: 1, y: 0, duration: 0.4, ease: "power2.out" }, t + 0.3);
|
||||
tl.fromTo(
|
||||
"#title-main",
|
||||
{ opacity: 0, y: 20 },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power2.out" },
|
||||
t + 0.6,
|
||||
);
|
||||
tl.fromTo(
|
||||
"#title-count",
|
||||
{ opacity: 0 },
|
||||
{ opacity: 1, duration: 0.4, ease: "power2.out" },
|
||||
t + 1.0,
|
||||
);
|
||||
tl.to("#title-card", { opacity: 0, duration: 0.4, ease: "power2.inOut" }, t + 2.4);
|
||||
t += 3;
|
||||
|
||||
function resetScenes() {
|
||||
tl.set(
|
||||
"#scene1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 1,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#scene2",
|
||||
{
|
||||
opacity: 0,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 2,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
scaleX: 1,
|
||||
transformOrigin: "50% 50%",
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s2",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
scaleX: 1,
|
||||
transformOrigin: "50% 50%",
|
||||
},
|
||||
t,
|
||||
);
|
||||
}
|
||||
|
||||
// === TRANSITION 1: Push Slide ===
|
||||
resetScenes();
|
||||
tl.to("#info-1", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
var T = t + 1.5;
|
||||
tl.to("#s1", { x: -1920, duration: 0.5, ease: "power3.inOut" }, T);
|
||||
tl.fromTo("#s2", { x: 1920 }, { x: 0, duration: 0.5, ease: "power3.inOut" }, T);
|
||||
tl.set("#scene2", { opacity: 1 }, T);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-1", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === TRANSITION 2: Vertical Push ===
|
||||
resetScenes();
|
||||
tl.to("#info-2", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
T = t + 1.5;
|
||||
tl.to("#s1", { y: -1080, duration: 0.5, ease: "power3.inOut" }, T);
|
||||
tl.fromTo("#s2", { y: 1080 }, { y: 0, duration: 0.5, ease: "power3.inOut" }, T);
|
||||
tl.set("#scene2", { opacity: 1 }, T);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-2", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === TRANSITION 3: Elastic Push ===
|
||||
resetScenes();
|
||||
tl.to("#info-3", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
T = t + 1.5;
|
||||
tl.set("#scene2", { opacity: 1 }, T);
|
||||
tl.to("#s1", { x: -1920, duration: 0.5, ease: "power3.in" }, T);
|
||||
tl.fromTo("#s2", { x: 1920 }, { x: 30, duration: 0.4, ease: "power4.out" }, T + 0.1);
|
||||
tl.to("#s2", { x: -15, duration: 0.15, ease: "sine.inOut" }, T + 0.5);
|
||||
tl.to("#s2", { x: 0, duration: 0.1, ease: "sine.out" }, T + 0.65);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-3", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === TRANSITION 4: Squeeze ===
|
||||
resetScenes();
|
||||
tl.to("#info-4", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
T = t + 1.5;
|
||||
tl.to(
|
||||
"#s1",
|
||||
{ scaleX: 0, transformOrigin: "left center", duration: 0.4, ease: "power3.inOut" },
|
||||
T,
|
||||
);
|
||||
tl.set("#scene2", { opacity: 1 }, T);
|
||||
tl.fromTo(
|
||||
"#s2",
|
||||
{ scaleX: 0, transformOrigin: "right center" },
|
||||
{ scaleX: 1, duration: 0.4, ease: "power3.inOut" },
|
||||
T + 0.1,
|
||||
);
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.5);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-4", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === OUTRO (3s) ===
|
||||
tl.set("#scene1", { opacity: 0 }, t);
|
||||
tl.set("#scene2", { opacity: 0 }, t);
|
||||
tl.to("#outro-card", { opacity: 1, duration: 0.4, ease: "power2.inOut" }, t);
|
||||
tl.to("#outro-label", { opacity: 1, duration: 0.4, ease: "power2.out" }, t + 0.3);
|
||||
tl.fromTo(
|
||||
"#outro-main",
|
||||
{ opacity: 0, y: 20 },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power2.out" },
|
||||
t + 0.6,
|
||||
);
|
||||
tl.to("#outro-card", { opacity: 0, duration: 0.4, ease: "power2.inOut" }, t + 2.4);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["main"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "transitions-radial",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Radial Transitions",
|
||||
"description": "Showcase of radial wipe and reveal transitions",
|
||||
"tags": ["transition", "showcase"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 20,
|
||||
"files": [
|
||||
{
|
||||
"path": "transitions-radial.html",
|
||||
"target": "compositions/transitions-radial.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,355 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920" />
|
||||
<title>Radial Transitions</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
background: #000;
|
||||
overflow: hidden;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.scene-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#scene1 {
|
||||
z-index: 1;
|
||||
}
|
||||
#scene2 {
|
||||
z-index: 2;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
#s1 {
|
||||
background: #1b263b;
|
||||
}
|
||||
#s2 {
|
||||
background: #e07a5f;
|
||||
}
|
||||
|
||||
.big-text {
|
||||
font-size: 200px;
|
||||
font-weight: 900;
|
||||
line-height: 1;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
#s1 .big-text {
|
||||
color: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
#s2 .big-text {
|
||||
color: rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 32px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 6px;
|
||||
text-transform: uppercase;
|
||||
margin-top: 12px;
|
||||
}
|
||||
#s1 .label {
|
||||
color: #778da9;
|
||||
}
|
||||
#s2 .label {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#info-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 80px;
|
||||
background: rgba(0, 0, 0, 0.88);
|
||||
z-index: 100;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
opacity: 0;
|
||||
}
|
||||
#info-bar span {
|
||||
color: #fff;
|
||||
font-size: 22px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
#title-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
z-index: 200;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
opacity: 0;
|
||||
}
|
||||
#title-card .category {
|
||||
font-size: 64px;
|
||||
font-weight: 800;
|
||||
color: #fff;
|
||||
letter-spacing: 8px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
#title-card .subtitle {
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: #778da9;
|
||||
margin-top: 16px;
|
||||
letter-spacing: 4px;
|
||||
}
|
||||
|
||||
#outro-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
z-index: 200;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
opacity: 0;
|
||||
}
|
||||
#outro-card .category {
|
||||
font-size: 48px;
|
||||
font-weight: 700;
|
||||
color: #778da9;
|
||||
letter-spacing: 6px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="composition"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="20"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<div id="title-card">
|
||||
<div class="category">Radial Transitions</div>
|
||||
<div class="subtitle">3 Transitions</div>
|
||||
</div>
|
||||
|
||||
<div id="scene1" class="scene">
|
||||
<div id="s1" class="scene-inner">
|
||||
<div class="big-text">ONE</div>
|
||||
<div class="label">Scene A</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="scene2" class="scene">
|
||||
<div id="s2" class="scene-inner">
|
||||
<div class="big-text">TWO</div>
|
||||
<div class="label">Scene B</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="info-bar"><span id="info-text">Transition Name</span></div>
|
||||
|
||||
<div id="outro-card">
|
||||
<div class="category">End of Radial Transitions</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
|
||||
(function () {
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
var t = 0;
|
||||
|
||||
var demos = [
|
||||
{ name: "Circle Iris", time: 0 },
|
||||
{ name: "Diamond Iris", time: 0 },
|
||||
{ name: "Diagonal Split", time: 0 },
|
||||
];
|
||||
|
||||
function resetScenes() {
|
||||
tl.set(
|
||||
"#scene1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
rotationY: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 1,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#scene2",
|
||||
{
|
||||
opacity: 0,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
rotationY: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 2,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
rotationY: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
clipPath: "none",
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s2",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
rotationY: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
clipPath: "none",
|
||||
},
|
||||
t,
|
||||
);
|
||||
}
|
||||
|
||||
/* ── Title card (3s) ── */
|
||||
tl.set("#title-card", { opacity: 1 }, 0);
|
||||
tl.to("#title-card", { opacity: 0, duration: 0.5 }, 2.5);
|
||||
t = 3;
|
||||
|
||||
/* ── Demo 1: Circle Iris ── */
|
||||
resetScenes();
|
||||
tl.set("#info-text", { textContent: "Circle Iris" }, t);
|
||||
tl.to("#info-bar", { opacity: 1, duration: 0.3 }, t);
|
||||
t += 1.5;
|
||||
var T = t;
|
||||
demos[0].time = T;
|
||||
tl.set("#scene2", { opacity: 1, clipPath: "circle(0% at 50% 50%)" }, T);
|
||||
tl.to(
|
||||
"#scene2",
|
||||
{ clipPath: "circle(75% at 50% 50%)", duration: 0.5, ease: "power2.out" },
|
||||
T,
|
||||
);
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.5);
|
||||
tl.set("#scene2", { clipPath: "none" }, T + 0.55);
|
||||
t = T + 1.5;
|
||||
tl.to("#info-bar", { opacity: 0, duration: 0.3 }, t);
|
||||
t += 0.5;
|
||||
|
||||
/* ── Demo 2: Diamond Iris ── */
|
||||
resetScenes();
|
||||
tl.set("#info-text", { textContent: "Diamond Iris" }, t);
|
||||
tl.to("#info-bar", { opacity: 1, duration: 0.3 }, t);
|
||||
t += 1.5;
|
||||
T = t;
|
||||
demos[1].time = T;
|
||||
tl.set(
|
||||
"#scene2",
|
||||
{ opacity: 1, clipPath: "polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%)" },
|
||||
T,
|
||||
);
|
||||
tl.to(
|
||||
"#scene2",
|
||||
{
|
||||
clipPath: "polygon(50% -20%, 120% 50%, 50% 120%, -20% 50%)",
|
||||
duration: 0.5,
|
||||
ease: "power2.out",
|
||||
},
|
||||
T,
|
||||
);
|
||||
tl.set("#scene1", { opacity: 0 }, T + 0.5);
|
||||
tl.set("#scene2", { clipPath: "none" }, T + 0.55);
|
||||
t = T + 1.5;
|
||||
tl.to("#info-bar", { opacity: 0, duration: 0.3 }, t);
|
||||
t += 0.5;
|
||||
|
||||
/* ── Demo 3: Diagonal Split ── */
|
||||
resetScenes();
|
||||
tl.set("#info-text", { textContent: "Diagonal Split" }, t);
|
||||
tl.to("#info-bar", { opacity: 1, duration: 0.3 }, t);
|
||||
t += 1.5;
|
||||
T = t;
|
||||
demos[2].time = T;
|
||||
tl.set("#scene2", { opacity: 1, zIndex: 1 }, T);
|
||||
tl.set(
|
||||
"#scene1",
|
||||
{ zIndex: 10, clipPath: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)" },
|
||||
T,
|
||||
);
|
||||
tl.to(
|
||||
"#scene1",
|
||||
{
|
||||
clipPath: "polygon(60% 0%, 100% 0%, 100% 40%, 60% 0%)",
|
||||
duration: 0.5,
|
||||
ease: "power3.inOut",
|
||||
},
|
||||
T,
|
||||
);
|
||||
tl.set("#scene1", { opacity: 0, zIndex: 1, clipPath: "none" }, T + 0.55);
|
||||
tl.set("#scene2", { zIndex: 2 }, T + 0.55);
|
||||
t = T + 1.5;
|
||||
tl.to("#info-bar", { opacity: 0, duration: 0.3 }, t);
|
||||
t += 0.5;
|
||||
|
||||
/* ── Outro (3s) ── */
|
||||
tl.set("#outro-card", { opacity: 1 }, t);
|
||||
tl.to("#outro-card", { opacity: 0, duration: 0.5 }, t + 2.5);
|
||||
|
||||
window.__timelines["main"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "transitions-scale",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Scale Transitions",
|
||||
"description": "Showcase of scale and zoom transitions",
|
||||
"tags": ["transition", "showcase"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 15,
|
||||
"files": [
|
||||
{
|
||||
"path": "transitions-scale.html",
|
||||
"target": "compositions/transitions-scale.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,350 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=1920" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
background: #000;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.scene-inner {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
.info-bar {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 100;
|
||||
background: rgba(0, 0, 0, 0.88);
|
||||
padding: 24px 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 40px;
|
||||
opacity: 0;
|
||||
}
|
||||
.info-num {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
.info-name {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
}
|
||||
.info-desc {
|
||||
font-size: 14px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
#title-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 50;
|
||||
}
|
||||
#outro-card {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
background: #0d1b2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
z-index: 50;
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="15"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<!-- Title Card -->
|
||||
<div id="title-card">
|
||||
<div
|
||||
id="title-label"
|
||||
style="
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
TRANSITION CATALOG
|
||||
</div>
|
||||
<div
|
||||
id="title-main"
|
||||
style="font-size: 72px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0"
|
||||
>
|
||||
Scale Transitions
|
||||
</div>
|
||||
<div
|
||||
id="title-count"
|
||||
style="
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
margin-top: 12px;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
2 transitions
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene A -->
|
||||
<div id="scene1" class="scene" style="z-index: 1">
|
||||
<div class="scene-inner" id="s1" style="background: #1b263b">
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.08)">
|
||||
ONE
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #778da9;
|
||||
letter-spacing: 0.15em;
|
||||
margin-top: -20px;
|
||||
"
|
||||
>
|
||||
SCENE A
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scene B -->
|
||||
<div id="scene2" class="scene" style="z-index: 2; opacity: 0">
|
||||
<div class="scene-inner" id="s2" style="background: #e07a5f">
|
||||
<div style="font-size: 200px; font-weight: 900; color: rgba(255, 255, 255, 0.15)">
|
||||
TWO
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
letter-spacing: 0.15em;
|
||||
margin-top: -20px;
|
||||
"
|
||||
>
|
||||
SCENE B
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info Bars -->
|
||||
<div id="info-1" class="info-bar">
|
||||
<div class="info-num">01</div>
|
||||
<div class="info-name">Zoom Through</div>
|
||||
<div class="info-desc">Use a zoom through transition</div>
|
||||
</div>
|
||||
<div id="info-2" class="info-bar">
|
||||
<div class="info-num">02</div>
|
||||
<div class="info-name">Zoom Out</div>
|
||||
<div class="info-desc">Use a zoom out transition</div>
|
||||
</div>
|
||||
|
||||
<!-- Outro Card -->
|
||||
<div id="outro-card">
|
||||
<div
|
||||
id="outro-label"
|
||||
style="
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #e07a5f;
|
||||
letter-spacing: 0.2em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0;
|
||||
"
|
||||
>
|
||||
SCALE TRANSITIONS
|
||||
</div>
|
||||
<div
|
||||
id="outro-main"
|
||||
style="font-size: 56px; font-weight: 900; color: #fff; margin-top: 16px; opacity: 0"
|
||||
>
|
||||
2 Transitions
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
var tl = gsap.timeline({ paused: true });
|
||||
var t = 0;
|
||||
|
||||
// === TITLE CARD (3s) ===
|
||||
tl.to("#title-label", { opacity: 1, y: 0, duration: 0.4, ease: "power2.out" }, t + 0.3);
|
||||
tl.fromTo(
|
||||
"#title-main",
|
||||
{ opacity: 0, y: 20 },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power2.out" },
|
||||
t + 0.6,
|
||||
);
|
||||
tl.fromTo(
|
||||
"#title-count",
|
||||
{ opacity: 0 },
|
||||
{ opacity: 1, duration: 0.4, ease: "power2.out" },
|
||||
t + 1.0,
|
||||
);
|
||||
tl.to("#title-card", { opacity: 0, duration: 0.4, ease: "power2.inOut" }, t + 2.4);
|
||||
t += 3;
|
||||
|
||||
function resetScenes() {
|
||||
tl.set(
|
||||
"#scene1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 1,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#scene2",
|
||||
{
|
||||
opacity: 0,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
scaleX: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
clipPath: "none",
|
||||
zIndex: 2,
|
||||
skewX: 0,
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s1",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
scaleX: 1,
|
||||
transformOrigin: "50% 50%",
|
||||
},
|
||||
t,
|
||||
);
|
||||
tl.set(
|
||||
"#s2",
|
||||
{
|
||||
opacity: 1,
|
||||
x: 0,
|
||||
y: 0,
|
||||
scale: 1,
|
||||
rotation: 0,
|
||||
filter: "none",
|
||||
skewX: 0,
|
||||
scaleX: 1,
|
||||
transformOrigin: "50% 50%",
|
||||
},
|
||||
t,
|
||||
);
|
||||
}
|
||||
|
||||
// === TRANSITION 1: Zoom Through ===
|
||||
resetScenes();
|
||||
tl.to("#info-1", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
var T = t + 1.5;
|
||||
tl.to(
|
||||
"#s1",
|
||||
{ scale: 2.5, opacity: 0, filter: "blur(8px)", duration: 0.4, ease: "power3.in" },
|
||||
T,
|
||||
);
|
||||
tl.set("#scene2", { opacity: 1 }, T);
|
||||
tl.fromTo(
|
||||
"#s2",
|
||||
{ scale: 0.5, opacity: 0, filter: "blur(8px)" },
|
||||
{ scale: 1, opacity: 1, filter: "blur(0px)", duration: 0.4, ease: "power3.out" },
|
||||
T + 0.15,
|
||||
);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-1", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === TRANSITION 2: Zoom Out ===
|
||||
resetScenes();
|
||||
tl.to("#info-2", { opacity: 1, duration: 0.3 }, t + 0.2);
|
||||
T = t + 1.5;
|
||||
tl.set("#scene2", { opacity: 1, zIndex: 1 }, T);
|
||||
tl.set("#scene1", { zIndex: 10, transformOrigin: "50% 50%" }, T);
|
||||
tl.to("#s1", { scale: 0.3, opacity: 0, duration: 0.4, ease: "power3.in" }, T);
|
||||
tl.set("#scene1", { zIndex: 1 }, T + 0.5);
|
||||
tl.set("#scene2", { zIndex: 2 }, T + 0.5);
|
||||
t = T + 1.5 + 1.0;
|
||||
tl.to("#info-2", { opacity: 0, duration: 0.2 }, t);
|
||||
t += 0.5;
|
||||
|
||||
// === OUTRO (3s) ===
|
||||
tl.set("#scene1", { opacity: 0 }, t);
|
||||
tl.set("#scene2", { opacity: 0 }, t);
|
||||
tl.to("#outro-card", { opacity: 1, duration: 0.4, ease: "power2.inOut" }, t);
|
||||
tl.to("#outro-label", { opacity: 1, duration: 0.4, ease: "power2.out" }, t + 0.3);
|
||||
tl.fromTo(
|
||||
"#outro-main",
|
||||
{ opacity: 0, y: 20 },
|
||||
{ opacity: 1, y: 0, duration: 0.5, ease: "power2.out" },
|
||||
t + 0.6,
|
||||
);
|
||||
tl.to("#outro-card", { opacity: 0, duration: 0.4, ease: "power2.inOut" }, t + 2.4);
|
||||
|
||||
window.__timelines = window.__timelines || {};
|
||||
window.__timelines["main"] = tl;
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
|
||||
"name": "whip-pan",
|
||||
"type": "hyperframes:block",
|
||||
"title": "Whip Pan",
|
||||
"description": "Shader transition simulating a fast camera whip pan",
|
||||
"tags": ["transition", "shader"],
|
||||
"dimensions": {
|
||||
"width": 1920,
|
||||
"height": 1080
|
||||
},
|
||||
"duration": 4,
|
||||
"files": [
|
||||
{
|
||||
"path": "whip-pan.html",
|
||||
"target": "compositions/whip-pan.html",
|
||||
"type": "hyperframes:composition"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,365 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
||||
<style>
|
||||
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;700&family=Lato:wght@400;700&display=block");
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
html,
|
||||
body {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="main"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
>
|
||||
<style>
|
||||
[data-composition-id="main"] {
|
||||
width: 1920px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background: #0b132b;
|
||||
}
|
||||
|
||||
/* Blueprint grid */
|
||||
.bp-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
|
||||
background-size: 40px 40px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.bp-left {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 1200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.bp-right {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
padding: 60px 60px 60px 40px;
|
||||
}
|
||||
.bp-divider {
|
||||
position: absolute;
|
||||
left: 1200px;
|
||||
top: 60px;
|
||||
bottom: 60px;
|
||||
width: 1px;
|
||||
background: #48bfe3;
|
||||
opacity: 0.15;
|
||||
}
|
||||
.bp-number {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.4em;
|
||||
text-transform: uppercase;
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
left: 60px;
|
||||
color: #48bfe3;
|
||||
}
|
||||
|
||||
/* Right panel typography */
|
||||
.bp-name {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 38px;
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 20px;
|
||||
color: #48bfe3;
|
||||
}
|
||||
.bp-plabel {
|
||||
font-family: "Space Mono", monospace;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.3em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 10px;
|
||||
color: #48bfe3;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.bp-prompt {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
font-size: 20px;
|
||||
line-height: 1.6;
|
||||
padding: 16px 20px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
color: #48bfe3;
|
||||
background: rgba(72, 191, 227, 0.06);
|
||||
border: 1px solid rgba(72, 191, 227, 0.12);
|
||||
}
|
||||
.bp-desc {
|
||||
font-family: "Lato", sans-serif;
|
||||
font-size: 17px;
|
||||
line-height: 1.6;
|
||||
color: #7a9ab0;
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
/* GL scenes (hidden, just for texture capture) */
|
||||
.scene {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.scene-label {
|
||||
font-family: "Bebas Neue", sans-serif;
|
||||
font-size: 140px;
|
||||
letter-spacing: 0.06em;
|
||||
opacity: 0.12;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="bp-grid"></div>
|
||||
<div class="bp-divider"></div>
|
||||
<div class="bp-number">03 / 14</div>
|
||||
|
||||
<!-- GL demo scenes (captured as textures, then hidden) -->
|
||||
<div id="s1" class="scene" style="background: #0b132b">
|
||||
<div class="scene-label" style="color: #48bfe3">SCENE A</div>
|
||||
</div>
|
||||
<div id="s2" class="scene" style="background: #48bfe3; opacity: 0">
|
||||
<div class="scene-label" style="color: #0b132b">SCENE B</div>
|
||||
</div>
|
||||
|
||||
<!-- GL canvas (left panel only) -->
|
||||
<canvas
|
||||
id="gl-canvas"
|
||||
width="1200"
|
||||
height="1080"
|
||||
style="
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 1200px;
|
||||
height: 1080px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
"
|
||||
>
|
||||
</canvas>
|
||||
|
||||
<!-- Right panel metadata -->
|
||||
<div class="bp-right">
|
||||
<div class="bp-name">Whip Pan</div>
|
||||
<div class="bp-plabel">Prompt</div>
|
||||
<div class="bp-prompt">"use whip pan shader transition"</div>
|
||||
<div class="bp-desc">
|
||||
Both scenes slide horizontally with 10-sample directional motion blur simulating a fast
|
||||
camera pan.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="driver"
|
||||
data-start="0"
|
||||
data-duration="4"
|
||||
data-track-index="0"
|
||||
style="position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.__timelines = window.__timelines || {};
|
||||
var glCanvas = document.getElementById("gl-canvas");
|
||||
var gl = glCanvas.getContext("webgl", { preserveDrawingBuffer: true });
|
||||
if (!gl) {
|
||||
console.warn("WebGL not available");
|
||||
window.__timelines["main"] = gsap.timeline({ paused: true });
|
||||
} else {
|
||||
gl.viewport(0, 0, 1200, 1080);
|
||||
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
|
||||
var sceneTextures = {};
|
||||
|
||||
function captureScene(sceneId) {
|
||||
var scene = document.getElementById(sceneId);
|
||||
var origOpacity = scene.style.opacity;
|
||||
var origZ = scene.style.zIndex;
|
||||
scene.style.opacity = "1";
|
||||
scene.style.zIndex = "999";
|
||||
scene.offsetHeight;
|
||||
var c = document.createElement("canvas");
|
||||
c.width = 1200;
|
||||
c.height = 1080;
|
||||
var ctx = c.getContext("2d");
|
||||
ctx.fillStyle = window.getComputedStyle(scene).backgroundColor;
|
||||
ctx.fillRect(0, 0, 1200, 1080);
|
||||
var sr = scene.getBoundingClientRect();
|
||||
var els = scene.querySelectorAll("*");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i],
|
||||
cs = window.getComputedStyle(el);
|
||||
if (cs.display === "none" || cs.visibility === "hidden") continue;
|
||||
var r = el.getBoundingClientRect();
|
||||
if (r.width < 1 || r.height < 1) continue;
|
||||
var x = r.left - sr.left,
|
||||
y = r.top - sr.top,
|
||||
w = r.width,
|
||||
h = r.height;
|
||||
ctx.save();
|
||||
ctx.globalAlpha = parseFloat(cs.opacity) || 1;
|
||||
var bg = cs.backgroundColor;
|
||||
if (bg && bg !== "rgba(0, 0, 0, 0)" && bg !== "transparent") {
|
||||
ctx.fillStyle = bg;
|
||||
ctx.fillRect(x, y, w, h);
|
||||
}
|
||||
var hasChildEls = el.querySelector("div,span,img,video");
|
||||
var text = "";
|
||||
for (var j = 0; j < el.childNodes.length; j++)
|
||||
if (el.childNodes[j].nodeType === 3) text += el.childNodes[j].textContent;
|
||||
text = text.trim();
|
||||
if (text && !hasChildEls) {
|
||||
ctx.font = cs.fontWeight + " " + cs.fontSize + " " + cs.fontFamily;
|
||||
ctx.fillStyle = cs.color;
|
||||
if (cs.letterSpacing && cs.letterSpacing !== "normal")
|
||||
ctx.letterSpacing = cs.letterSpacing;
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + w / 2, y + h / 2);
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
scene.style.opacity = origOpacity;
|
||||
scene.style.zIndex = origZ;
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);
|
||||
sceneTextures[sceneId] = tex;
|
||||
}
|
||||
|
||||
var vertSrc =
|
||||
"attribute vec2 a_pos; varying vec2 v_uv; void main(){" +
|
||||
"v_uv=a_pos*0.5+0.5; v_uv.y=1.0-v_uv.y; gl_Position=vec4(a_pos,0,1);}";
|
||||
var quadBuf = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.bufferData(
|
||||
gl.ARRAY_BUFFER,
|
||||
new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]),
|
||||
gl.STATIC_DRAW,
|
||||
);
|
||||
function compileShader(src, type) {
|
||||
var s = gl.createShader(type);
|
||||
gl.shaderSource(s, src);
|
||||
gl.compileShader(s);
|
||||
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS))
|
||||
console.error("Shader:", gl.getShaderInfoLog(s));
|
||||
return s;
|
||||
}
|
||||
function mkProg(fragSrc) {
|
||||
var p = gl.createProgram();
|
||||
gl.attachShader(p, compileShader(vertSrc, gl.VERTEX_SHADER));
|
||||
gl.attachShader(p, compileShader(fragSrc, gl.FRAGMENT_SHADER));
|
||||
gl.linkProgram(p);
|
||||
if (!gl.getProgramParameter(p, gl.LINK_STATUS))
|
||||
console.error("Link:", gl.getProgramInfoLog(p));
|
||||
return p;
|
||||
}
|
||||
|
||||
var H =
|
||||
"precision mediump float;" +
|
||||
"varying vec2 v_uv;" +
|
||||
"uniform sampler2D u_from, u_to;" +
|
||||
"uniform float u_progress;" +
|
||||
"uniform vec2 u_resolution;\n";
|
||||
|
||||
var progPass = mkProg(H + "void main(){gl_FragColor=texture2D(u_from,v_uv);}");
|
||||
var progTrans = mkProg(
|
||||
H +
|
||||
"void main(){float fromOff=u_progress*1.5;vec3 fromC=vec3(0.);for(int i=0;i<10;i++){float f=float(i)/10.;vec2 fuv=vec2(v_uv.x+fromOff+u_progress*.08*f,v_uv.y);fromC+=texture2D(u_from,clamp(fuv,0.,1.)).rgb;}fromC/=10.;float toOff=(1.-u_progress)*1.5;vec3 toC=vec3(0.);for(int i=0;i<10;i++){float f=float(i)/10.;vec2 tuv=vec2(v_uv.x-toOff-(1.-u_progress)*.08*f,v_uv.y);toC+=texture2D(u_to,clamp(tuv,0.,1.)).rgb;}toC/=10.;gl_FragColor=vec4(mix(fromC,toC,u_progress),1.);}",
|
||||
);
|
||||
|
||||
function renderShader(prog, texFrom, texTo, progress) {
|
||||
gl.useProgram(prog);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texFrom);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_from"), 0);
|
||||
gl.activeTexture(gl.TEXTURE1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texTo);
|
||||
gl.uniform1i(gl.getUniformLocation(prog, "u_to"), 1);
|
||||
gl.uniform1f(gl.getUniformLocation(prog, "u_progress"), progress);
|
||||
gl.uniform2f(gl.getUniformLocation(prog, "u_resolution"), 1200, 1080);
|
||||
var pos = gl.getAttribLocation(prog, "a_pos");
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuf);
|
||||
gl.enableVertexAttribArray(pos);
|
||||
gl.vertexAttribPointer(pos, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function easeInOut(p) {
|
||||
return p < 0.5 ? 2 * p * p : 1 - Math.pow(-2 * p + 2, 2) / 2;
|
||||
}
|
||||
|
||||
captureScene("s1");
|
||||
captureScene("s2");
|
||||
glCanvas.style.display = "block";
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
document.querySelectorAll(".scene").forEach(function (s) {
|
||||
s.style.opacity = "0";
|
||||
});
|
||||
|
||||
var tl = gsap.timeline({
|
||||
paused: true,
|
||||
onUpdate: function () {
|
||||
var t = tl.time();
|
||||
if (t >= 1.0 && t < 3.0) {
|
||||
renderShader(
|
||||
progTrans,
|
||||
sceneTextures["s1"],
|
||||
sceneTextures["s2"],
|
||||
easeInOut((t - 1.0) / 2.0),
|
||||
);
|
||||
} else if (t >= 3.0) {
|
||||
renderShader(progPass, sceneTextures["s2"], sceneTextures["s2"], 0);
|
||||
} else {
|
||||
renderShader(progPass, sceneTextures["s1"], sceneTextures["s1"], 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
tl.to({ v: 0 }, { v: 1, duration: 4, ease: "none" }, 0);
|
||||
window.__timelines["main"] = tl;
|
||||
} // end if (gl)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -26,7 +26,7 @@
|
||||
font-family: "Inter", sans-serif;
|
||||
}
|
||||
|
||||
.x-card {
|
||||
[data-composition-id="x-post"] .x-card {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
@@ -41,7 +41,7 @@
|
||||
}
|
||||
|
||||
/* Bottom glow */
|
||||
.x-card::after {
|
||||
[data-composition-id="x-post"] .x-card::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
@@ -53,7 +53,7 @@
|
||||
}
|
||||
|
||||
/* Header row */
|
||||
.post-header {
|
||||
[data-composition-id="x-post"] .post-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 14px;
|
||||
@@ -61,7 +61,7 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
[data-composition-id="x-post"] .avatar {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
flex-shrink: 0;
|
||||
@@ -69,39 +69,39 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.avatar svg {
|
||||
[data-composition-id="x-post"] .avatar svg {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
[data-composition-id="x-post"] .user-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.name-row {
|
||||
[data-composition-id="x-post"] .name-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.display-name {
|
||||
[data-composition-id="x-post"] .display-name {
|
||||
font-size: 26px;
|
||||
font-weight: 700;
|
||||
color: #e7e9ea;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.verified-badge svg {
|
||||
[data-composition-id="x-post"] .verified-badge svg {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.handle {
|
||||
[data-composition-id="x-post"] .handle {
|
||||
font-size: 22px;
|
||||
font-weight: 400;
|
||||
color: #8b98a5;
|
||||
@@ -109,7 +109,7 @@
|
||||
}
|
||||
|
||||
/* X logo top-right */
|
||||
.x-logo {
|
||||
[data-composition-id="x-post"] .x-logo {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 0;
|
||||
@@ -117,14 +117,14 @@
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.x-logo svg {
|
||||
[data-composition-id="x-post"] .x-logo svg {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Tweet body */
|
||||
.tweet-body {
|
||||
[data-composition-id="x-post"] .tweet-body {
|
||||
font-size: 30px;
|
||||
font-weight: 400;
|
||||
color: #e7e9ea;
|
||||
@@ -136,12 +136,12 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.hashtag {
|
||||
[data-composition-id="x-post"] .hashtag {
|
||||
color: #1d9bf0;
|
||||
}
|
||||
|
||||
/* Timestamp */
|
||||
.timestamp {
|
||||
[data-composition-id="x-post"] .timestamp {
|
||||
font-size: 22px;
|
||||
color: #8b98a5;
|
||||
padding-bottom: 20px;
|
||||
@@ -150,7 +150,7 @@
|
||||
}
|
||||
|
||||
/* Metrics bar — matches real X spacing */
|
||||
.metrics-bar {
|
||||
[data-composition-id="x-post"] .metrics-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0;
|
||||
@@ -158,7 +158,7 @@
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.metrics-left {
|
||||
[data-composition-id="x-post"] .metrics-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
@@ -166,19 +166,19 @@
|
||||
padding-right: 60px;
|
||||
}
|
||||
|
||||
.metrics-right {
|
||||
[data-composition-id="x-post"] .metrics-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.metric {
|
||||
[data-composition-id="x-post"] .metric {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.metric-icon {
|
||||
[data-composition-id="x-post"] .metric-icon {
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
display: flex;
|
||||
@@ -186,13 +186,13 @@
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.metric-icon svg {
|
||||
[data-composition-id="x-post"] .metric-icon svg {
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.metric-count {
|
||||
[data-composition-id="x-post"] .metric-count {
|
||||
font-size: 20px;
|
||||
font-weight: 400;
|
||||
color: #8b98a5;
|
||||
@@ -202,7 +202,7 @@
|
||||
<body>
|
||||
<div
|
||||
id="root"
|
||||
data-composition-id="x-post-overlay"
|
||||
data-composition-id="x-post"
|
||||
data-width="1920"
|
||||
data-height="1080"
|
||||
data-start="0"
|
||||
@@ -436,7 +436,7 @@
|
||||
4.2,
|
||||
);
|
||||
|
||||
window.__timelines["x-post-overlay"] = tl;
|
||||
window.__timelines["x-post"] = tl;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
font-family: "DM Sans", sans-serif;
|
||||
}
|
||||
|
||||
.lower-third {
|
||||
[data-composition-id="yt-lower-third"] .lower-third {
|
||||
position: absolute;
|
||||
bottom: 80px;
|
||||
left: 50%;
|
||||
@@ -39,7 +39,7 @@
|
||||
box-shadow: 0 6px 32px rgba(0, 0, 0, 0.14);
|
||||
}
|
||||
|
||||
.avatar {
|
||||
[data-composition-id="yt-lower-third"] .avatar {
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
border-radius: 50%;
|
||||
@@ -47,14 +47,14 @@
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.channel-info {
|
||||
[data-composition-id="yt-lower-third"] .channel-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.channel-name {
|
||||
[data-composition-id="yt-lower-third"] .channel-name {
|
||||
font-size: 34px;
|
||||
font-weight: 700;
|
||||
color: #0f0f0f;
|
||||
@@ -62,14 +62,14 @@
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
.subscriber-count {
|
||||
[data-composition-id="yt-lower-third"] .subscriber-count {
|
||||
font-size: 22px;
|
||||
font-weight: 400;
|
||||
color: #606060;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.subscribe-btn {
|
||||
[data-composition-id="yt-lower-third"] .subscribe-btn {
|
||||
position: relative;
|
||||
width: 220px;
|
||||
height: 68px;
|
||||
@@ -82,7 +82,7 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
[data-composition-id="yt-lower-third"] .btn-text {
|
||||
position: absolute;
|
||||
font-family: "DM Sans", sans-serif;
|
||||
font-size: 24px;
|
||||
@@ -92,24 +92,24 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.btn-text-subscribe {
|
||||
[data-composition-id="yt-lower-third"] .btn-text-subscribe {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.btn-text-subscribed {
|
||||
[data-composition-id="yt-lower-third"] .btn-text-subscribed {
|
||||
opacity: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.check-icon {
|
||||
[data-composition-id="yt-lower-third"] .check-icon {
|
||||
display: inline-block;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.check-icon svg {
|
||||
[data-composition-id="yt-lower-third"] .check-icon svg {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
display: block;
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@keyframes grain-noise {
|
||||
@keyframes hf-grain-noise {
|
||||
0%,
|
||||
100% {
|
||||
transform: translate(0, 0);
|
||||
@@ -116,7 +116,7 @@
|
||||
height: 200%;
|
||||
background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
|
||||
opacity: 0.15;
|
||||
animation: grain-noise 0.5s steps(1) infinite;
|
||||
animation: hf-grain-noise 0.5s steps(1) infinite;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@keyframes grain-noise {
|
||||
@keyframes hf-grain-noise {
|
||||
0%,
|
||||
100% {
|
||||
transform: translate(0, 0);
|
||||
@@ -70,6 +70,6 @@
|
||||
height: 200%;
|
||||
background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
|
||||
opacity: 0.15;
|
||||
animation: grain-noise 0.5s steps(1) infinite;
|
||||
animation: hf-grain-noise 0.5s steps(1) infinite;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
Timeline integration example:
|
||||
|
||||
// Cover screen with grid (transition out of scene A)
|
||||
tl.to(".grid-cell", {
|
||||
tl.to("#grid-pixelate-overlay .grid-cell", {
|
||||
scale: 1,
|
||||
duration: 0.6,
|
||||
stagger: { amount: 0.6, from: "center" },
|
||||
@@ -71,7 +71,7 @@
|
||||
tl.set("#scene-b", { opacity: 1 }, 3.6);
|
||||
|
||||
// Reveal scene B by removing grid
|
||||
tl.to(".grid-cell", {
|
||||
tl.to("#grid-pixelate-overlay .grid-cell", {
|
||||
scale: 0,
|
||||
duration: 0.6,
|
||||
stagger: { amount: 0.6, from: "edges" },
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<!--
|
||||
Shimmer Sweep — animated light pass across text or elements.
|
||||
|
||||
Usage: wrap your text element with class="shimmer-sweep-target" and
|
||||
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.
|
||||
|
||||
|
||||
+108
-8
@@ -87,14 +87,6 @@
|
||||
"name": "macos-notification",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "ascii-dashboard",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "ascii-lightning",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "app-showcase",
|
||||
"type": "hyperframes:block"
|
||||
@@ -102,6 +94,114 @@
|
||||
{
|
||||
"name": "ui-3d-reveal",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "domain-warp-dissolve",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "ridged-burn",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "whip-pan",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "sdf-iris",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "ripple-waves",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "gravitational-lens",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "cinematic-zoom",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "chromatic-radial-split",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "glitch",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "swirl-vortex",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "thermal-distortion",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "flash-through-white",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "cross-warp-morph",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "light-leak",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "transitions-3d",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "transitions-blur",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "transitions-cover",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "transitions-destruction",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "transitions-dissolve",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "transitions-distortion",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "transitions-grid",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "transitions-light",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "transitions-mechanical",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "transitions-other",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "transitions-push",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "transitions-radial",
|
||||
"type": "hyperframes:block"
|
||||
},
|
||||
{
|
||||
"name": "transitions-scale",
|
||||
"type": "hyperframes:block"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user