diff --git a/docs/catalog/components/caption-highlight.mdx b/docs/catalog/components/caption-highlight.mdx
new file mode 100644
index 000000000..5937f0962
--- /dev/null
+++ b/docs/catalog/components/caption-highlight.mdx
@@ -0,0 +1,38 @@
+---
+title: "Highlight"
+description: "Red background sweep behind each active word, TikTok-style"
+---
+
+# Highlight
+
+Red background sweep behind each active word, TikTok-style
+
+`captions` `caption-style` `highlight` `social` `tiktok`
+
+
+
+## Install
+
+
+
+```bash Terminal
+npx hyperframes add caption-highlight
+```
+
+
+
+## Details
+
+| Property | Value |
+| --- | --- |
+| Type | Component |
+
+## Files
+
+| File | Target | Type |
+| --- | --- | --- |
+| `caption-highlight.html` | `compositions/components/caption-highlight.html` | hyperframes:snippet |
+
+## Usage
+
+Open `compositions/components/caption-highlight.html` and paste its contents into your composition. See the comment header in the file for detailed instructions.
diff --git a/docs/docs.json b/docs/docs.json
index 45263e34f..acc33ee14 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -103,6 +103,7 @@
"catalog/components/caption-emoji-pop",
"catalog/components/caption-glitch-rgb",
"catalog/components/caption-gradient-fill",
+ "catalog/components/caption-highlight",
"catalog/components/caption-kinetic-slam",
"catalog/components/caption-matrix-decode",
"catalog/components/caption-neon-accent",
diff --git a/docs/public/catalog-index.json b/docs/public/catalog-index.json
index b533fb2cb..1d940f7ff 100644
--- a/docs/public/catalog-index.json
+++ b/docs/public/catalog-index.json
@@ -114,6 +114,21 @@
"href": "/catalog/components/caption-gradient-fill",
"preview": "https://static.heygen.ai/hyperframes-oss/docs/images/catalog/components/caption-gradient-fill.png"
},
+ {
+ "name": "caption-highlight",
+ "type": "component",
+ "title": "Highlight",
+ "description": "Red background sweep behind each active word, TikTok-style",
+ "tags": [
+ "captions",
+ "caption-style",
+ "highlight",
+ "social",
+ "tiktok"
+ ],
+ "href": "/catalog/components/caption-highlight",
+ "preview": "https://static.heygen.ai/hyperframes-oss/docs/images/catalog/components/caption-highlight.png"
+ },
{
"name": "caption-kinetic-slam",
"type": "component",
diff --git a/registry/components/caption-clip-wipe/caption-clip-wipe.html b/registry/components/caption-clip-wipe/caption-clip-wipe.html
index 986368d7f..a519dbfe8 100644
--- a/registry/components/caption-clip-wipe/caption-clip-wipe.html
+++ b/registry/components/caption-clip-wipe/caption-clip-wipe.html
@@ -169,7 +169,7 @@
var ws = pair[0],
we = pair[1];
var nextStart = gi + 1 < RAW_GROUPS.length ? WORDS[RAW_GROUPS[gi + 1][0]].start : 8.0;
- var gEnd = Math.min(WORDS[we].end + 0.35, nextStart - 0.05);
+ var gEnd = Math.min(WORDS[we].end + 0.5, nextStart - 0.05);
return { wordStart: ws, wordEnd: we, start: WORDS[ws].start, end: gEnd };
});
@@ -210,13 +210,13 @@
tl.to(
wordEl,
- { clipPath: "inset(0 0% 0 0)", duration: 0.15, ease: "power3.out" },
+ { clipPath: "inset(0 0% 0 0)", duration: 0.3, ease: "power2.out" },
w.start,
);
if (isKW) {
tl.to(wordEl, { color: "#FFD700", duration: 0.05 }, w.start + 0.1);
}
- tl.to(wordEl, { color: "rgba(255,255,255,0.4)", duration: 0.12 }, w.end);
+ tl.to(wordEl, { color: "rgba(255,255,255,0.4)", duration: 0.2 }, w.end);
});
var wordEls = grp.querySelectorAll(".wp-word");
@@ -224,7 +224,7 @@
wordEls,
{
clipPath: "inset(0 0% 0 100%)",
- duration: 0.14,
+ duration: 0.25,
stagger: 0.04,
ease: "power2.in",
},
diff --git a/registry/components/caption-clip-wipe/demo.html b/registry/components/caption-clip-wipe/demo.html
index 986368d7f..a519dbfe8 100644
--- a/registry/components/caption-clip-wipe/demo.html
+++ b/registry/components/caption-clip-wipe/demo.html
@@ -169,7 +169,7 @@
var ws = pair[0],
we = pair[1];
var nextStart = gi + 1 < RAW_GROUPS.length ? WORDS[RAW_GROUPS[gi + 1][0]].start : 8.0;
- var gEnd = Math.min(WORDS[we].end + 0.35, nextStart - 0.05);
+ var gEnd = Math.min(WORDS[we].end + 0.5, nextStart - 0.05);
return { wordStart: ws, wordEnd: we, start: WORDS[ws].start, end: gEnd };
});
@@ -210,13 +210,13 @@
tl.to(
wordEl,
- { clipPath: "inset(0 0% 0 0)", duration: 0.15, ease: "power3.out" },
+ { clipPath: "inset(0 0% 0 0)", duration: 0.3, ease: "power2.out" },
w.start,
);
if (isKW) {
tl.to(wordEl, { color: "#FFD700", duration: 0.05 }, w.start + 0.1);
}
- tl.to(wordEl, { color: "rgba(255,255,255,0.4)", duration: 0.12 }, w.end);
+ tl.to(wordEl, { color: "rgba(255,255,255,0.4)", duration: 0.2 }, w.end);
});
var wordEls = grp.querySelectorAll(".wp-word");
@@ -224,7 +224,7 @@
wordEls,
{
clipPath: "inset(0 0% 0 100%)",
- duration: 0.14,
+ duration: 0.25,
stagger: 0.04,
ease: "power2.in",
},
diff --git a/registry/components/caption-clip-wipe/registry-item.json b/registry/components/caption-clip-wipe/registry-item.json
index 95005f509..f4ef6f9c9 100644
--- a/registry/components/caption-clip-wipe/registry-item.json
+++ b/registry/components/caption-clip-wipe/registry-item.json
@@ -12,5 +12,5 @@
"type": "hyperframes:snippet"
}
],
- "preview": "https://static.heygen.ai/hyperframes-oss/registry/components/caption-clip-wipe/preview.mp4?v=1779051416"
+ "preview": "https://static.heygen.ai/hyperframes-oss/registry/components/caption-clip-wipe/preview.mp4?v=1779057707"
}
diff --git a/registry/components/caption-glitch-rgb/caption-glitch-rgb.html b/registry/components/caption-glitch-rgb/caption-glitch-rgb.html
index 4b3c120d3..0d8d427cc 100644
--- a/registry/components/caption-glitch-rgb/caption-glitch-rgb.html
+++ b/registry/components/caption-glitch-rgb/caption-glitch-rgb.html
@@ -56,8 +56,8 @@
to bottom,
transparent 0px,
transparent 3px,
- rgba(0, 0, 0, 0.08) 3px,
- rgba(0, 0, 0, 0.08) 4px
+ rgba(0, 0, 0, 0.18) 3px,
+ rgba(0, 0, 0, 0.18) 4px
);
}
#gl-container {
@@ -240,10 +240,10 @@
var wordEl = document.getElementById("gl-w-" + wi);
var isKW = KEYWORDS.has(wi);
var rng = mulberry32(wi * 777 + 13);
- var j1 = (rng() - 0.5) * 10;
- var j2 = (rng() - 0.5) * 8;
- var j3 = (rng() - 0.5) * 6;
- var shadowMag = 3 + rng() * 4;
+ var j1 = (rng() - 0.5) * 24;
+ var j2 = (rng() - 0.5) * 18;
+ var j3 = (rng() - 0.5) * 14;
+ var shadowMag = 6 + rng() * 8;
var sm = shadowMag.toFixed(1);
tl.to(
diff --git a/registry/components/caption-glitch-rgb/demo.html b/registry/components/caption-glitch-rgb/demo.html
index 4b3c120d3..0d8d427cc 100644
--- a/registry/components/caption-glitch-rgb/demo.html
+++ b/registry/components/caption-glitch-rgb/demo.html
@@ -56,8 +56,8 @@
to bottom,
transparent 0px,
transparent 3px,
- rgba(0, 0, 0, 0.08) 3px,
- rgba(0, 0, 0, 0.08) 4px
+ rgba(0, 0, 0, 0.18) 3px,
+ rgba(0, 0, 0, 0.18) 4px
);
}
#gl-container {
@@ -240,10 +240,10 @@
var wordEl = document.getElementById("gl-w-" + wi);
var isKW = KEYWORDS.has(wi);
var rng = mulberry32(wi * 777 + 13);
- var j1 = (rng() - 0.5) * 10;
- var j2 = (rng() - 0.5) * 8;
- var j3 = (rng() - 0.5) * 6;
- var shadowMag = 3 + rng() * 4;
+ var j1 = (rng() - 0.5) * 24;
+ var j2 = (rng() - 0.5) * 18;
+ var j3 = (rng() - 0.5) * 14;
+ var shadowMag = 6 + rng() * 8;
var sm = shadowMag.toFixed(1);
tl.to(
diff --git a/registry/components/caption-glitch-rgb/registry-item.json b/registry/components/caption-glitch-rgb/registry-item.json
index e8f356737..0fe36b9d3 100644
--- a/registry/components/caption-glitch-rgb/registry-item.json
+++ b/registry/components/caption-glitch-rgb/registry-item.json
@@ -12,5 +12,5 @@
"type": "hyperframes:snippet"
}
],
- "preview": "https://static.heygen.ai/hyperframes-oss/registry/components/caption-glitch-rgb/preview.mp4?v=1779051416"
+ "preview": "https://static.heygen.ai/hyperframes-oss/registry/components/caption-glitch-rgb/preview.mp4?v=1779057707"
}
diff --git a/registry/components/caption-gradient-fill/caption-gradient-fill.html b/registry/components/caption-gradient-fill/caption-gradient-fill.html
index eb0fa9e05..75c5d0fcf 100644
--- a/registry/components/caption-gradient-fill/caption-gradient-fill.html
+++ b/registry/components/caption-gradient-fill/caption-gradient-fill.html
@@ -233,11 +233,11 @@
groupWords.forEach(function (w, i) {
var wi = g.wordStart + i;
var el = document.getElementById("gr-w-" + wi);
- tl.to(el, { opacity: 1, scale: 1.1, duration: 0.08 }, w.start);
- tl.to(el, { opacity: 0.3, scale: 1, duration: 0.08 }, w.end);
+ tl.to(el, { opacity: 1, scale: 1.1, duration: 0.15 }, w.start);
+ tl.to(el, { opacity: 0.3, scale: 1, duration: 0.15 }, w.end);
});
- tl.to(grp, { y: -26, opacity: 0, duration: 0.18 }, g.end - 0.18);
+ tl.to(grp, { y: -26, opacity: 0, duration: 0.25 }, g.end - 0.25);
tl.set(grp, { opacity: 0, visibility: "hidden" }, g.end);
});
diff --git a/registry/components/caption-gradient-fill/demo.html b/registry/components/caption-gradient-fill/demo.html
index eb0fa9e05..75c5d0fcf 100644
--- a/registry/components/caption-gradient-fill/demo.html
+++ b/registry/components/caption-gradient-fill/demo.html
@@ -233,11 +233,11 @@
groupWords.forEach(function (w, i) {
var wi = g.wordStart + i;
var el = document.getElementById("gr-w-" + wi);
- tl.to(el, { opacity: 1, scale: 1.1, duration: 0.08 }, w.start);
- tl.to(el, { opacity: 0.3, scale: 1, duration: 0.08 }, w.end);
+ tl.to(el, { opacity: 1, scale: 1.1, duration: 0.15 }, w.start);
+ tl.to(el, { opacity: 0.3, scale: 1, duration: 0.15 }, w.end);
});
- tl.to(grp, { y: -26, opacity: 0, duration: 0.18 }, g.end - 0.18);
+ tl.to(grp, { y: -26, opacity: 0, duration: 0.25 }, g.end - 0.25);
tl.set(grp, { opacity: 0, visibility: "hidden" }, g.end);
});
diff --git a/registry/components/caption-gradient-fill/registry-item.json b/registry/components/caption-gradient-fill/registry-item.json
index f76651f1b..6e090599c 100644
--- a/registry/components/caption-gradient-fill/registry-item.json
+++ b/registry/components/caption-gradient-fill/registry-item.json
@@ -12,5 +12,5 @@
"type": "hyperframes:snippet"
}
],
- "preview": "https://static.heygen.ai/hyperframes-oss/registry/components/caption-gradient-fill/preview.mp4?v=1779051416"
+ "preview": "https://static.heygen.ai/hyperframes-oss/registry/components/caption-gradient-fill/preview.mp4?v=1779057707"
}
diff --git a/registry/components/caption-highlight/caption-highlight.html b/registry/components/caption-highlight/caption-highlight.html
new file mode 100644
index 000000000..57a1c992b
--- /dev/null
+++ b/registry/components/caption-highlight/caption-highlight.html
@@ -0,0 +1,260 @@
+
+
+
+
+
+ Highlight
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/registry/components/caption-highlight/demo.html b/registry/components/caption-highlight/demo.html
new file mode 100644
index 000000000..57a1c992b
--- /dev/null
+++ b/registry/components/caption-highlight/demo.html
@@ -0,0 +1,260 @@
+
+
+
+
+
+ Highlight
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/registry/components/caption-highlight/registry-item.json b/registry/components/caption-highlight/registry-item.json
new file mode 100644
index 000000000..6f112c29a
--- /dev/null
+++ b/registry/components/caption-highlight/registry-item.json
@@ -0,0 +1,16 @@
+{
+ "$schema": "https://hyperframes.heygen.com/schema/registry-item.json",
+ "name": "caption-highlight",
+ "type": "hyperframes:component",
+ "title": "Highlight",
+ "description": "Red background sweep behind each active word, TikTok-style",
+ "tags": ["captions", "caption-style", "highlight", "social", "tiktok"],
+ "files": [
+ {
+ "path": "caption-highlight.html",
+ "target": "compositions/components/caption-highlight.html",
+ "type": "hyperframes:snippet"
+ }
+ ],
+ "preview": "https://static.heygen.ai/hyperframes-oss/registry/components/caption-highlight/preview.mp4"
+}
diff --git a/registry/components/caption-typewriter/caption-typewriter.html b/registry/components/caption-typewriter/caption-typewriter.html
index ee1e194b4..b4f1d4523 100644
--- a/registry/components/caption-typewriter/caption-typewriter.html
+++ b/registry/components/caption-typewriter/caption-typewriter.html
@@ -163,16 +163,16 @@
];
var GROUPS = [
- { wordStart: 0, wordEnd: 3, start: 0.0, end: 1.1 },
- { wordStart: 4, wordEnd: 7, start: 1.1, end: 2.05 },
- { wordStart: 8, wordEnd: 8, start: 2.1, end: 2.6 },
- { wordStart: 9, wordEnd: 12, start: 2.65, end: 3.5 },
- { wordStart: 13, wordEnd: 15, start: 3.55, end: 4.4 },
- { wordStart: 16, wordEnd: 16, start: 3.95, end: 4.75 },
- { wordStart: 17, wordEnd: 19, start: 4.9, end: 5.4 },
- { wordStart: 20, wordEnd: 22, start: 5.65, end: 6.2 },
- { wordStart: 23, wordEnd: 24, start: 6.35, end: 6.75 },
- { wordStart: 25, wordEnd: 27, start: 6.8, end: 7.8 },
+ { wordStart: 0, wordEnd: 3, start: 0.0, end: 1.4 },
+ { wordStart: 4, wordEnd: 7, start: 1.1, end: 2.35 },
+ { wordStart: 8, wordEnd: 8, start: 2.1, end: 2.9 },
+ { wordStart: 9, wordEnd: 12, start: 2.65, end: 3.8 },
+ { wordStart: 13, wordEnd: 15, start: 3.55, end: 4.7 },
+ { wordStart: 16, wordEnd: 16, start: 3.95, end: 5.05 },
+ { wordStart: 17, wordEnd: 19, start: 4.9, end: 5.7 },
+ { wordStart: 20, wordEnd: 22, start: 5.65, end: 6.5 },
+ { wordStart: 23, wordEnd: 24, start: 6.35, end: 7.05 },
+ { wordStart: 25, wordEnd: 27, start: 6.8, end: 7.9 },
];
var container = document.getElementById("tw-container");
diff --git a/registry/components/caption-typewriter/demo.html b/registry/components/caption-typewriter/demo.html
index ee1e194b4..b4f1d4523 100644
--- a/registry/components/caption-typewriter/demo.html
+++ b/registry/components/caption-typewriter/demo.html
@@ -163,16 +163,16 @@
];
var GROUPS = [
- { wordStart: 0, wordEnd: 3, start: 0.0, end: 1.1 },
- { wordStart: 4, wordEnd: 7, start: 1.1, end: 2.05 },
- { wordStart: 8, wordEnd: 8, start: 2.1, end: 2.6 },
- { wordStart: 9, wordEnd: 12, start: 2.65, end: 3.5 },
- { wordStart: 13, wordEnd: 15, start: 3.55, end: 4.4 },
- { wordStart: 16, wordEnd: 16, start: 3.95, end: 4.75 },
- { wordStart: 17, wordEnd: 19, start: 4.9, end: 5.4 },
- { wordStart: 20, wordEnd: 22, start: 5.65, end: 6.2 },
- { wordStart: 23, wordEnd: 24, start: 6.35, end: 6.75 },
- { wordStart: 25, wordEnd: 27, start: 6.8, end: 7.8 },
+ { wordStart: 0, wordEnd: 3, start: 0.0, end: 1.4 },
+ { wordStart: 4, wordEnd: 7, start: 1.1, end: 2.35 },
+ { wordStart: 8, wordEnd: 8, start: 2.1, end: 2.9 },
+ { wordStart: 9, wordEnd: 12, start: 2.65, end: 3.8 },
+ { wordStart: 13, wordEnd: 15, start: 3.55, end: 4.7 },
+ { wordStart: 16, wordEnd: 16, start: 3.95, end: 5.05 },
+ { wordStart: 17, wordEnd: 19, start: 4.9, end: 5.7 },
+ { wordStart: 20, wordEnd: 22, start: 5.65, end: 6.5 },
+ { wordStart: 23, wordEnd: 24, start: 6.35, end: 7.05 },
+ { wordStart: 25, wordEnd: 27, start: 6.8, end: 7.9 },
];
var container = document.getElementById("tw-container");
diff --git a/registry/components/caption-typewriter/registry-item.json b/registry/components/caption-typewriter/registry-item.json
index f5eac06b2..9bd9d0e2a 100644
--- a/registry/components/caption-typewriter/registry-item.json
+++ b/registry/components/caption-typewriter/registry-item.json
@@ -12,5 +12,5 @@
"type": "hyperframes:snippet"
}
],
- "preview": "https://static.heygen.ai/hyperframes-oss/registry/components/caption-typewriter/preview.mp4?v=1779051416"
+ "preview": "https://static.heygen.ai/hyperframes-oss/registry/components/caption-typewriter/preview.mp4?v=1779057707"
}
diff --git a/registry/components/caption-weight-shift/caption-weight-shift.html b/registry/components/caption-weight-shift/caption-weight-shift.html
index b02ca8e52..ec7f624e6 100644
--- a/registry/components/caption-weight-shift/caption-weight-shift.html
+++ b/registry/components/caption-weight-shift/caption-weight-shift.html
@@ -100,7 +100,7 @@
white-space: nowrap;
color: #ffffff;
font-family: "Montserrat", Arial, sans-serif;
- font-weight: 300;
+ font-weight: 200;
font-size: 72px;
letter-spacing: -0.03em;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
@@ -142,10 +142,10 @@
var WORD_SPACING = 12;
var PAUSE_THRESHOLD = 0.1;
var ENTRY_DURATION = 100 / 1000;
- var WEIGHT_TRANSITION = 100 / 1000;
+ var WEIGHT_TRANSITION = 250 / 1000;
var FONT_WIDTH_SAFETY = 1.14;
- var FONT_WEIGHT_LIGHT = 300;
- var FONT_WEIGHT_BOLD = 700;
+ var FONT_WEIGHT_LIGHT = 200;
+ var FONT_WEIGHT_BOLD = 900;
var TRANSCRIPT = [
{ text: "Every", start: 0.0, end: 0.3 },
@@ -309,11 +309,17 @@
var lineEl = document.createElement("div");
lineEl.className = "caption-line";
lineEl.id = "caption-group-" + groupIndex + "-line-" + lineIndex;
- lineEl.style.fontWeight = lineIndex === 0 ? FONT_WEIGHT_BOLD : FONT_WEIGHT_LIGHT;
+ lineEl.style.fontWeight = FONT_WEIGHT_LIGHT;
lineEl.style.fontSize = computedSize + "px";
- line.words.forEach(function (word) {
+ line.words.forEach(function (word, wordIndex) {
var wordEl = document.createElement("span");
+ wordEl.id = "cw-" + groupIndex + "-" + lineIndex + "-" + wordIndex;
wordEl.textContent = word.text.toLowerCase();
+ wordEl.style.fontWeight = FONT_WEIGHT_LIGHT;
+ wordEl.style.display = "inline-block";
+ wordEl.style.transition = "none";
+ wordEl.dataset.start = word.start;
+ wordEl.dataset.end = word.end;
lineEl.appendChild(wordEl);
});
copyEl.appendChild(lineEl);
@@ -357,22 +363,24 @@
visibleStart,
);
- if (group.lines.length === 2) {
- var line1El = document.getElementById("caption-group-" + groupIndex + "-line-0");
- var line2El = document.getElementById("caption-group-" + groupIndex + "-line-1");
- var line2FirstWord = group.lines[1].words[0];
- var switchTime = line2FirstWord.start;
- tl.to(
- line1El,
- { fontWeight: FONT_WEIGHT_LIGHT, duration: WEIGHT_TRANSITION, ease: "power2.out" },
- switchTime,
- );
- tl.to(
- line2El,
- { fontWeight: FONT_WEIGHT_BOLD, duration: WEIGHT_TRANSITION, ease: "power2.out" },
- switchTime,
- );
- }
+ group.lines.forEach(function (line, lineIndex) {
+ line.words.forEach(function (word, wordIndex) {
+ var wEl = document.getElementById(
+ "cw-" + groupIndex + "-" + lineIndex + "-" + wordIndex,
+ );
+ if (!wEl) return;
+ tl.to(
+ wEl,
+ { fontWeight: FONT_WEIGHT_BOLD, duration: WEIGHT_TRANSITION, ease: "power2.out" },
+ word.start,
+ );
+ tl.to(
+ wEl,
+ { fontWeight: FONT_WEIGHT_LIGHT, duration: WEIGHT_TRANSITION, ease: "power2.in" },
+ word.end,
+ );
+ });
+ });
tl.set(groupEl, { opacity: 0 }, visibleEnd);
});
diff --git a/registry/components/caption-weight-shift/demo.html b/registry/components/caption-weight-shift/demo.html
index b02ca8e52..ec7f624e6 100644
--- a/registry/components/caption-weight-shift/demo.html
+++ b/registry/components/caption-weight-shift/demo.html
@@ -100,7 +100,7 @@
white-space: nowrap;
color: #ffffff;
font-family: "Montserrat", Arial, sans-serif;
- font-weight: 300;
+ font-weight: 200;
font-size: 72px;
letter-spacing: -0.03em;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
@@ -142,10 +142,10 @@
var WORD_SPACING = 12;
var PAUSE_THRESHOLD = 0.1;
var ENTRY_DURATION = 100 / 1000;
- var WEIGHT_TRANSITION = 100 / 1000;
+ var WEIGHT_TRANSITION = 250 / 1000;
var FONT_WIDTH_SAFETY = 1.14;
- var FONT_WEIGHT_LIGHT = 300;
- var FONT_WEIGHT_BOLD = 700;
+ var FONT_WEIGHT_LIGHT = 200;
+ var FONT_WEIGHT_BOLD = 900;
var TRANSCRIPT = [
{ text: "Every", start: 0.0, end: 0.3 },
@@ -309,11 +309,17 @@
var lineEl = document.createElement("div");
lineEl.className = "caption-line";
lineEl.id = "caption-group-" + groupIndex + "-line-" + lineIndex;
- lineEl.style.fontWeight = lineIndex === 0 ? FONT_WEIGHT_BOLD : FONT_WEIGHT_LIGHT;
+ lineEl.style.fontWeight = FONT_WEIGHT_LIGHT;
lineEl.style.fontSize = computedSize + "px";
- line.words.forEach(function (word) {
+ line.words.forEach(function (word, wordIndex) {
var wordEl = document.createElement("span");
+ wordEl.id = "cw-" + groupIndex + "-" + lineIndex + "-" + wordIndex;
wordEl.textContent = word.text.toLowerCase();
+ wordEl.style.fontWeight = FONT_WEIGHT_LIGHT;
+ wordEl.style.display = "inline-block";
+ wordEl.style.transition = "none";
+ wordEl.dataset.start = word.start;
+ wordEl.dataset.end = word.end;
lineEl.appendChild(wordEl);
});
copyEl.appendChild(lineEl);
@@ -357,22 +363,24 @@
visibleStart,
);
- if (group.lines.length === 2) {
- var line1El = document.getElementById("caption-group-" + groupIndex + "-line-0");
- var line2El = document.getElementById("caption-group-" + groupIndex + "-line-1");
- var line2FirstWord = group.lines[1].words[0];
- var switchTime = line2FirstWord.start;
- tl.to(
- line1El,
- { fontWeight: FONT_WEIGHT_LIGHT, duration: WEIGHT_TRANSITION, ease: "power2.out" },
- switchTime,
- );
- tl.to(
- line2El,
- { fontWeight: FONT_WEIGHT_BOLD, duration: WEIGHT_TRANSITION, ease: "power2.out" },
- switchTime,
- );
- }
+ group.lines.forEach(function (line, lineIndex) {
+ line.words.forEach(function (word, wordIndex) {
+ var wEl = document.getElementById(
+ "cw-" + groupIndex + "-" + lineIndex + "-" + wordIndex,
+ );
+ if (!wEl) return;
+ tl.to(
+ wEl,
+ { fontWeight: FONT_WEIGHT_BOLD, duration: WEIGHT_TRANSITION, ease: "power2.out" },
+ word.start,
+ );
+ tl.to(
+ wEl,
+ { fontWeight: FONT_WEIGHT_LIGHT, duration: WEIGHT_TRANSITION, ease: "power2.in" },
+ word.end,
+ );
+ });
+ });
tl.set(groupEl, { opacity: 0 }, visibleEnd);
});
diff --git a/registry/components/caption-weight-shift/registry-item.json b/registry/components/caption-weight-shift/registry-item.json
index a5cd5924b..0f3fbbdbb 100644
--- a/registry/components/caption-weight-shift/registry-item.json
+++ b/registry/components/caption-weight-shift/registry-item.json
@@ -12,5 +12,5 @@
"type": "hyperframes:snippet"
}
],
- "preview": "https://static.heygen.ai/hyperframes-oss/registry/components/caption-weight-shift/preview.mp4?v=1779051416"
+ "preview": "https://static.heygen.ai/hyperframes-oss/registry/components/caption-weight-shift/preview.mp4?v=1779057707"
}
diff --git a/registry/registry.json b/registry/registry.json
index 73b93dc5a..303584cf4 100644
--- a/registry/registry.json
+++ b/registry/registry.json
@@ -127,6 +127,10 @@
"name": "caption-neon-glow",
"type": "hyperframes:component"
},
+ {
+ "name": "caption-highlight",
+ "type": "hyperframes:component"
+ },
{
"name": "instagram-follow",
"type": "hyperframes:block"