dsh-hyperframes 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +35 -0
- package/README.md +35 -0
- package/cordis.patch.yml +7 -0
- package/lib/index.d.ts +35 -0
- package/lib/index.js +74 -0
- package/package.json +63 -0
- package/skills/gsap/SKILL.md +213 -0
- package/skills/gsap/references/effects.md +297 -0
- package/skills/gsap/scripts/extract-audio-data.py +188 -0
- package/skills/hyperframes/SKILL.md +366 -0
- package/skills/hyperframes/data-in-motion.md +19 -0
- package/skills/hyperframes/house-style.md +71 -0
- package/skills/hyperframes/palettes/bold-energetic.md +14 -0
- package/skills/hyperframes/palettes/clean-corporate.md +14 -0
- package/skills/hyperframes/palettes/dark-premium.md +14 -0
- package/skills/hyperframes/palettes/jewel-rich.md +14 -0
- package/skills/hyperframes/palettes/monochrome.md +14 -0
- package/skills/hyperframes/palettes/nature-earth.md +14 -0
- package/skills/hyperframes/palettes/neon-electric.md +14 -0
- package/skills/hyperframes/palettes/pastel-soft.md +14 -0
- package/skills/hyperframes/palettes/warm-editorial.md +14 -0
- package/skills/hyperframes/patterns.md +118 -0
- package/skills/hyperframes/references/audio-reactive.md +76 -0
- package/skills/hyperframes/references/captions.md +132 -0
- package/skills/hyperframes/references/css-patterns.md +373 -0
- package/skills/hyperframes/references/dynamic-techniques.md +90 -0
- package/skills/hyperframes/references/motion-principles.md +69 -0
- package/skills/hyperframes/references/transcript-guide.md +151 -0
- package/skills/hyperframes/references/transitions/catalog.md +117 -0
- package/skills/hyperframes/references/transitions/css-3d.md +12 -0
- package/skills/hyperframes/references/transitions/css-blur.md +51 -0
- package/skills/hyperframes/references/transitions/css-cover.md +43 -0
- package/skills/hyperframes/references/transitions/css-destruction.md +95 -0
- package/skills/hyperframes/references/transitions/css-dissolve.md +66 -0
- package/skills/hyperframes/references/transitions/css-distortion.md +45 -0
- package/skills/hyperframes/references/transitions/css-grid.md +10 -0
- package/skills/hyperframes/references/transitions/css-light.md +49 -0
- package/skills/hyperframes/references/transitions/css-mechanical.md +30 -0
- package/skills/hyperframes/references/transitions/css-other.md +25 -0
- package/skills/hyperframes/references/transitions/css-push.md +41 -0
- package/skills/hyperframes/references/transitions/css-radial.md +37 -0
- package/skills/hyperframes/references/transitions/css-scale.md +24 -0
- package/skills/hyperframes/references/transitions.md +112 -0
- package/skills/hyperframes/references/tts.md +75 -0
- package/skills/hyperframes/references/typography.md +175 -0
- package/skills/hyperframes/scripts/animation-map.mjs +596 -0
- package/skills/hyperframes/scripts/contrast-report.mjs +335 -0
- package/skills/hyperframes/visual-styles.md +211 -0
- package/skills/hyperframes-cli/SKILL.md +152 -0
- package/skills/hyperframes-registry/SKILL.md +106 -0
- package/skills/hyperframes-registry/examples/add-block.md +51 -0
- package/skills/hyperframes-registry/examples/add-component.md +73 -0
- package/skills/hyperframes-registry/references/demo-html-pattern.md +54 -0
- package/skills/hyperframes-registry/references/discovery.md +53 -0
- package/skills/hyperframes-registry/references/install-locations.md +45 -0
- package/skills/hyperframes-registry/references/wiring-blocks.md +91 -0
- package/skills/hyperframes-registry/references/wiring-components.md +77 -0
- package/skills/website-to-hyperframes/SKILL.md +125 -0
- package/skills/website-to-hyperframes/references/step-1-capture.md +74 -0
- package/skills/website-to-hyperframes/references/step-2-design.md +178 -0
- package/skills/website-to-hyperframes/references/step-3-script.md +96 -0
- package/skills/website-to-hyperframes/references/step-4-storyboard.md +246 -0
- package/skills/website-to-hyperframes/references/step-5-vo.md +42 -0
- package/skills/website-to-hyperframes/references/step-6-build.md +229 -0
- package/skills/website-to-hyperframes/references/step-7-validate.md +114 -0
- package/skills/website-to-hyperframes/references/techniques.md +387 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Composition Patterns
|
|
2
|
+
|
|
3
|
+
## Picture-in-Picture (Video in a Frame)
|
|
4
|
+
|
|
5
|
+
Animate a wrapper div for position/size. The video fills the wrapper. The wrapper has NO data attributes.
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<div
|
|
9
|
+
id="pip-frame"
|
|
10
|
+
style="position:absolute;top:0;left:0;width:1920px;height:1080px;z-index:50;overflow:hidden;"
|
|
11
|
+
>
|
|
12
|
+
<video
|
|
13
|
+
id="el-video"
|
|
14
|
+
data-start="0"
|
|
15
|
+
data-duration="60"
|
|
16
|
+
data-track-index="0"
|
|
17
|
+
src="talking-head.mp4"
|
|
18
|
+
muted
|
|
19
|
+
playsinline
|
|
20
|
+
></video>
|
|
21
|
+
</div>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
tl.to(
|
|
26
|
+
"#pip-frame",
|
|
27
|
+
{ top: 700, left: 1360, width: 500, height: 280, borderRadius: 16, duration: 1 },
|
|
28
|
+
10,
|
|
29
|
+
);
|
|
30
|
+
tl.to("#pip-frame", { left: 40, duration: 0.6 }, 30);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Title Card with Fade
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<div
|
|
37
|
+
id="title-card"
|
|
38
|
+
data-start="0"
|
|
39
|
+
data-duration="5"
|
|
40
|
+
data-track-index="5"
|
|
41
|
+
style="display:flex;align-items:center;justify-content:center;background:#111;z-index:60;"
|
|
42
|
+
>
|
|
43
|
+
<h1 style="font-size:64px;color:#fff;opacity:0;">My Video Title</h1>
|
|
44
|
+
</div>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
tl.to("#title-card h1", { opacity: 1, duration: 0.6 }, 0.3);
|
|
49
|
+
tl.to("#title-card", { opacity: 0, duration: 0.5 }, 4);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Slide Show with Section Headers
|
|
53
|
+
|
|
54
|
+
Use separate elements on the same track, each with its own time range. Slides auto-mount/unmount based on `data-start`/`data-duration`.
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<div class="slide" data-start="0" data-duration="30" data-track-index="3">...</div>
|
|
58
|
+
<div class="slide" data-start="30" data-duration="25" data-track-index="3">...</div>
|
|
59
|
+
<div class="slide" data-start="55" data-duration="20" data-track-index="3">...</div>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Top-Level Composition Example
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<div
|
|
66
|
+
id="comp-1"
|
|
67
|
+
data-composition-id="my-video"
|
|
68
|
+
data-start="0"
|
|
69
|
+
data-duration="60"
|
|
70
|
+
data-width="1920"
|
|
71
|
+
data-height="1080"
|
|
72
|
+
>
|
|
73
|
+
<!-- Primitive clips -->
|
|
74
|
+
<video
|
|
75
|
+
id="el-1"
|
|
76
|
+
data-start="0"
|
|
77
|
+
data-duration="10"
|
|
78
|
+
data-track-index="0"
|
|
79
|
+
src="..."
|
|
80
|
+
muted
|
|
81
|
+
playsinline
|
|
82
|
+
></video>
|
|
83
|
+
<video
|
|
84
|
+
id="el-2"
|
|
85
|
+
data-start="el-1"
|
|
86
|
+
data-duration="8"
|
|
87
|
+
data-track-index="0"
|
|
88
|
+
src="..."
|
|
89
|
+
muted
|
|
90
|
+
playsinline
|
|
91
|
+
></video>
|
|
92
|
+
<img id="el-3" data-start="5" data-duration="4" data-track-index="1" src="..." />
|
|
93
|
+
<audio id="el-4" data-start="0" data-duration="30" data-track-index="2" src="..." />
|
|
94
|
+
|
|
95
|
+
<!-- Sub-compositions loaded from files -->
|
|
96
|
+
<div
|
|
97
|
+
id="el-5"
|
|
98
|
+
data-composition-id="intro-anim"
|
|
99
|
+
data-composition-src="compositions/intro-anim.html"
|
|
100
|
+
data-start="0"
|
|
101
|
+
data-track-index="3"
|
|
102
|
+
></div>
|
|
103
|
+
|
|
104
|
+
<div
|
|
105
|
+
id="el-6"
|
|
106
|
+
data-composition-id="captions"
|
|
107
|
+
data-composition-src="compositions/caption-overlay.html"
|
|
108
|
+
data-start="0"
|
|
109
|
+
data-track-index="4"
|
|
110
|
+
></div>
|
|
111
|
+
|
|
112
|
+
<script>
|
|
113
|
+
// Just register the timeline — framework auto-nests sub-compositions
|
|
114
|
+
const tl = gsap.timeline({ paused: true });
|
|
115
|
+
window.__timelines["my-video"] = tl;
|
|
116
|
+
</script>
|
|
117
|
+
</div>
|
|
118
|
+
```
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Audio-Reactive Animation
|
|
2
|
+
|
|
3
|
+
Drive visuals from music, voice, or sound. Any GSAP-animatable property can respond to pre-extracted audio data.
|
|
4
|
+
|
|
5
|
+
## Audio Data Format
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
var AUDIO_DATA = {
|
|
9
|
+
fps: 30,
|
|
10
|
+
totalFrames: 900,
|
|
11
|
+
frames: [{ bands: [0.82, 0.45, 0.31, ...] }, ...]
|
|
12
|
+
};
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- `frames[i].bands[]` — frequency band amplitudes, 0-1. Index 0 = bass, higher = treble.
|
|
16
|
+
- Each band normalized independently across the full track.
|
|
17
|
+
|
|
18
|
+
## Mapping Audio to Visuals
|
|
19
|
+
|
|
20
|
+
| Audio signal | Visual property | Effect |
|
|
21
|
+
| ---------------------- | --------------------------------- | -------------------------- |
|
|
22
|
+
| Bass (bands[0]) | `scale` | Pulse on beat |
|
|
23
|
+
| Treble (bands[12-14]) | `textShadow`, `boxShadow` | Glow intensity |
|
|
24
|
+
| Overall amplitude | `opacity`, `y`, `backgroundColor` | Breathe, lift, color shift |
|
|
25
|
+
| Mid-range (bands[4-8]) | `borderRadius`, `width` | Shape morphing |
|
|
26
|
+
|
|
27
|
+
Any GSAP-tweenable property works — `clipPath`, `filter`, SVG attributes, CSS custom properties.
|
|
28
|
+
|
|
29
|
+
## Content, Not Medium
|
|
30
|
+
|
|
31
|
+
Audio provides **timing and intensity**. The visual vocabulary comes from the narrative.
|
|
32
|
+
|
|
33
|
+
**Never add:** equalizer bars, spectrum analyzers, waveform displays, musical notes clip art, generic particle systems, rainbow color cycling, strobing white on beats, abstract pulsing orbs.
|
|
34
|
+
|
|
35
|
+
**Instead:** Let content guide the visual and audio drive its behavior. Bass makes warmth _swell_. Treble sharpens _contrast_. The visual choice comes from "what does this piece feel like?"
|
|
36
|
+
|
|
37
|
+
## Sampling Pattern
|
|
38
|
+
|
|
39
|
+
Audio reactivity requires per-frame sampling via a `for` loop with `tl.call()`, not a single tween:
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
// ✅ Correct — sample every frame
|
|
43
|
+
for (var f = 0; f < AUDIO_DATA.totalFrames; f++) {
|
|
44
|
+
tl.call(
|
|
45
|
+
(function (frame) {
|
|
46
|
+
return function () {
|
|
47
|
+
draw(frame);
|
|
48
|
+
};
|
|
49
|
+
})(AUDIO_DATA.frames[f]),
|
|
50
|
+
[],
|
|
51
|
+
f / AUDIO_DATA.fps,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ❌ Wrong — single tween, doesn't react to audio
|
|
56
|
+
gsap.to(".el", { scale: 1.2, duration: totalDuration });
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Without per-frame sampling, the composition doesn't actually react to audio.
|
|
60
|
+
|
|
61
|
+
## textShadow Gotcha
|
|
62
|
+
|
|
63
|
+
`textShadow` on a parent container with semi-transparent children (e.g., inactive caption words at `rgba(255,255,255,0.3)`) renders a visible glow rectangle behind all children. Fix: apply `scale` to the container for beat pulse, but apply `textShadow` to individual active words only.
|
|
64
|
+
|
|
65
|
+
## Guidelines
|
|
66
|
+
|
|
67
|
+
- **Subtlety for text** — 3-6% scale variation, soft glow. Heavy pulsing makes text unreadable.
|
|
68
|
+
- **Go bigger on non-text** — backgrounds and shapes can handle 10-30% swings.
|
|
69
|
+
- **Match the energy** — corporate = subtle; music video = dramatic.
|
|
70
|
+
- **Deterministic** — pre-extracted data, no Web Audio API, no runtime analysis.
|
|
71
|
+
|
|
72
|
+
## Constraints
|
|
73
|
+
|
|
74
|
+
- All audio data must be pre-extracted (use `extract-audio-data.py` from the gsap skill's scripts/)
|
|
75
|
+
- No `Math.random()` or `Date.now()`
|
|
76
|
+
- Audio reactivity runs on the same GSAP timeline as everything else
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Captions
|
|
2
|
+
|
|
3
|
+
## Language Rule (Non-Negotiable)
|
|
4
|
+
|
|
5
|
+
**Never use `.en` models unless the user explicitly states the audio is English.** `.en` models TRANSLATE non-English audio into English instead of transcribing it.
|
|
6
|
+
|
|
7
|
+
1. User says the language → `--model small --language <code>` (no `.en`)
|
|
8
|
+
2. User says English → `--model small.en`
|
|
9
|
+
3. Language unknown → `--model small` (no `.en`, no `--language`) — auto-detects
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
Analyze spoken content to determine caption style. If user specifies a style, use that. Otherwise, detect tone from the transcript.
|
|
14
|
+
|
|
15
|
+
## Transcript Source
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
[
|
|
19
|
+
{ "text": "Hello", "start": 0.0, "end": 0.5 },
|
|
20
|
+
{ "text": "world.", "start": 0.6, "end": 1.2 }
|
|
21
|
+
]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
For transcription commands, whisper models, external APIs, see [transcript-guide.md](transcript-guide.md).
|
|
25
|
+
|
|
26
|
+
## Style Detection (When No Style Specified)
|
|
27
|
+
|
|
28
|
+
Read the full transcript before choosing. Four dimensions:
|
|
29
|
+
|
|
30
|
+
**1. Visual feel** — corporate→clean; energetic→bold; storytelling→elegant; technical→precise; social→playful.
|
|
31
|
+
|
|
32
|
+
**2. Color palette** — dark+bright for energy; muted for professional; high contrast for clarity; one accent color.
|
|
33
|
+
|
|
34
|
+
**3. Font mood** — heavy/condensed for impact; clean sans for modern; rounded for friendly; serif for elegance.
|
|
35
|
+
|
|
36
|
+
**4. Animation character** — scale-pop for punchy; gentle fade for calm; word-by-word for emphasis; typewriter for technical.
|
|
37
|
+
|
|
38
|
+
## Per-Word Styling
|
|
39
|
+
|
|
40
|
+
Scan for words deserving distinct treatment:
|
|
41
|
+
|
|
42
|
+
- **Brand/product names** — larger size, unique color
|
|
43
|
+
- **ALL CAPS** — scale boost, flash, accent color
|
|
44
|
+
- **Numbers/statistics** — bold weight, accent color
|
|
45
|
+
- **Emotional keywords** — exaggerated animation (overshoot, bounce)
|
|
46
|
+
- **Call-to-action** — highlight, underline, color pop
|
|
47
|
+
- **Marker highlight** — for beyond-color emphasis, see [css-patterns.md](css-patterns.md)
|
|
48
|
+
|
|
49
|
+
## Script-to-Style Mapping
|
|
50
|
+
|
|
51
|
+
| Tone | Font mood | Animation | Color | Size |
|
|
52
|
+
| ------------ | ------------------------ | ---------------------------------- | --------------------------- | ------- |
|
|
53
|
+
| Hype/launch | Heavy condensed, 800-900 | Scale-pop, back.out(1.7), 0.1-0.2s | Bright on dark | 72-96px |
|
|
54
|
+
| Corporate | Clean sans, 600-700 | Fade+slide, power3.out, 0.3s | White/neutral, muted accent | 56-72px |
|
|
55
|
+
| Tutorial | Mono/clean sans, 500-600 | Typewriter/fade, 0.4-0.5s | High contrast, minimal | 48-64px |
|
|
56
|
+
| Storytelling | Serif/elegant, 400-500 | Slow fade, power2.out, 0.5-0.6s | Warm muted tones | 44-56px |
|
|
57
|
+
| Social | Rounded sans, 700-800 | Bounce, elastic.out, word-by-word | Playful, colored pills | 56-80px |
|
|
58
|
+
|
|
59
|
+
## Word Grouping
|
|
60
|
+
|
|
61
|
+
- **High energy:** 2-3 words. Quick turnover.
|
|
62
|
+
- **Conversational:** 3-5 words. Natural phrases.
|
|
63
|
+
- **Measured/calm:** 4-6 words. Longer groups.
|
|
64
|
+
|
|
65
|
+
Break on sentence boundaries, 150ms+ pauses, or max word count.
|
|
66
|
+
|
|
67
|
+
## Positioning
|
|
68
|
+
|
|
69
|
+
- **Landscape (1920x1080):** Bottom 80-120px, centered
|
|
70
|
+
- **Portrait (1080x1920):** Lower middle ~600-700px from bottom, centered
|
|
71
|
+
- Never cover the subject's face
|
|
72
|
+
- `position: absolute` — never relative
|
|
73
|
+
- One caption group visible at a time
|
|
74
|
+
|
|
75
|
+
## Text Overflow Prevention
|
|
76
|
+
|
|
77
|
+
Use `window.__hyperframes.fitTextFontSize()`:
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
var result = window.__hyperframes.fitTextFontSize(group.text.toUpperCase(), {
|
|
81
|
+
fontFamily: "Outfit",
|
|
82
|
+
fontWeight: 900,
|
|
83
|
+
maxWidth: 1600,
|
|
84
|
+
});
|
|
85
|
+
el.style.fontSize = result.fontSize + "px";
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Options: `maxWidth` (1600 landscape, 900 portrait), `baseFontSize` (78), `minFontSize` (42), `fontWeight`, `fontFamily`, `step` (2).
|
|
89
|
+
|
|
90
|
+
CSS safety nets: `max-width` on container, `overflow: visible` (**not** `hidden` — hidden clips scaled emphasis words and glow effects), `position: absolute`, explicit `height`. When per-word styling uses `scale > 1.0`, compute `maxWidth = safeWidth / maxScale` to leave headroom.
|
|
91
|
+
|
|
92
|
+
**Container pattern:** Full-width absolute container, centered. Do **not** use `left: 50%; transform: translateX(-50%)` — causes clipping at composition edges.
|
|
93
|
+
|
|
94
|
+
## Caption Exit Guarantee
|
|
95
|
+
|
|
96
|
+
Every group **must** have a hard kill after exit animation:
|
|
97
|
+
|
|
98
|
+
```js
|
|
99
|
+
tl.to(groupEl, { opacity: 0, scale: 0.95, duration: 0.12, ease: "power2.in" }, group.end - 0.12);
|
|
100
|
+
tl.set(groupEl, { opacity: 0, visibility: "hidden" }, group.end); // deterministic kill
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Self-lint after building timeline — place **before** `window.__timelines[id] = tl` so it runs at composition init:
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
GROUPS.forEach(function (group, gi) {
|
|
107
|
+
var el = document.getElementById("cg-" + gi);
|
|
108
|
+
if (!el) return;
|
|
109
|
+
tl.seek(group.end + 0.01);
|
|
110
|
+
var computed = window.getComputedStyle(el);
|
|
111
|
+
if (computed.opacity !== "0" && computed.visibility !== "hidden") {
|
|
112
|
+
console.warn(
|
|
113
|
+
"[caption-lint] group " + gi + " still visible at t=" + (group.end + 0.01).toFixed(2) + "s",
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
tl.seek(0);
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Further References
|
|
121
|
+
|
|
122
|
+
- [dynamic-techniques.md](dynamic-techniques.md) — karaoke, clip-path reveals, slam words, scatter exits, elastic, 3D rotation
|
|
123
|
+
- [transcript-guide.md](transcript-guide.md) — transcription commands, whisper models, external APIs
|
|
124
|
+
- [css-patterns.md](css-patterns.md) — CSS+GSAP marker highlighting (deterministic, fully seekable)
|
|
125
|
+
|
|
126
|
+
## Constraints
|
|
127
|
+
|
|
128
|
+
- Deterministic. No `Math.random()`, no `Date.now()`.
|
|
129
|
+
- Sync to transcript timestamps.
|
|
130
|
+
- One group visible at a time.
|
|
131
|
+
- Every group must have a hard `tl.set` kill at `group.end`.
|
|
132
|
+
- The compiler embeds supported fonts automatically — just declare `font-family` in CSS.
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
# CSS Patterns for Marker Highlighting
|
|
2
|
+
|
|
3
|
+
Pure CSS + GSAP implementations of all five MarkerHighlight.js drawing modes. Use these for deterministic rendering in HyperFrames compositions — no external library dependency, full GSAP timeline control.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [1. Highlight Mode](#1-highlight-mode) — Yellow marker sweep behind text
|
|
8
|
+
- [2. Circle Mode](#2-circle-mode) — Hand-drawn ellipse around text
|
|
9
|
+
- [3. Burst Mode](#3-burst-mode) — Radiating lines from text
|
|
10
|
+
- [4. Scribble Mode](#4-scribble-mode) — Chaotic scribble over text
|
|
11
|
+
- [5. Sketchout Mode](#5-sketchout-mode) — Rough rectangle outline
|
|
12
|
+
|
|
13
|
+
## 1. Highlight Mode
|
|
14
|
+
|
|
15
|
+
Yellow marker sweep behind text. The most common mode.
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<span class="mh-highlight-wrap">
|
|
19
|
+
<span class="mh-highlight-bar" id="hl-1"></span>
|
|
20
|
+
<span class="mh-highlight-text">highlighted text</span>
|
|
21
|
+
</span>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```css
|
|
25
|
+
.mh-highlight-wrap {
|
|
26
|
+
position: relative;
|
|
27
|
+
display: inline;
|
|
28
|
+
}
|
|
29
|
+
.mh-highlight-bar {
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: 0;
|
|
32
|
+
left: -6px;
|
|
33
|
+
right: -6px;
|
|
34
|
+
bottom: 0;
|
|
35
|
+
background: #fdd835;
|
|
36
|
+
opacity: 0.35;
|
|
37
|
+
transform: scaleX(0);
|
|
38
|
+
transform-origin: left center;
|
|
39
|
+
border-radius: 3px;
|
|
40
|
+
z-index: 0;
|
|
41
|
+
}
|
|
42
|
+
.mh-highlight-text {
|
|
43
|
+
position: relative;
|
|
44
|
+
z-index: 1;
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// Sweep in from left
|
|
50
|
+
tl.to("#hl-1", { scaleX: 1, duration: 0.5, ease: "power2.out" }, 0.6);
|
|
51
|
+
|
|
52
|
+
// Optional: skew for hand-drawn feel
|
|
53
|
+
// gsap.set("#hl-1", { skewX: -2 });
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Multi-line Highlight
|
|
57
|
+
|
|
58
|
+
Stagger bars across multiple lines:
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
tl.to(
|
|
62
|
+
".mh-highlight-bar",
|
|
63
|
+
{
|
|
64
|
+
scaleX: 1,
|
|
65
|
+
duration: 0.5,
|
|
66
|
+
ease: "power2.out",
|
|
67
|
+
stagger: 0.3,
|
|
68
|
+
},
|
|
69
|
+
0.6,
|
|
70
|
+
);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 2. Circle Mode
|
|
74
|
+
|
|
75
|
+
Hand-drawn circle around text. Use `border-radius: 50%` with a slight rotation for organic feel.
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<span class="mh-circle-wrap">
|
|
79
|
+
<span class="mh-circle-text" id="circle-word">IMPORTANT</span>
|
|
80
|
+
<span class="mh-circle-ring" id="circle-1"></span>
|
|
81
|
+
</span>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```css
|
|
85
|
+
.mh-circle-wrap {
|
|
86
|
+
position: relative;
|
|
87
|
+
display: inline;
|
|
88
|
+
}
|
|
89
|
+
.mh-circle-text {
|
|
90
|
+
position: relative;
|
|
91
|
+
z-index: 1;
|
|
92
|
+
}
|
|
93
|
+
.mh-circle-ring {
|
|
94
|
+
position: absolute;
|
|
95
|
+
top: 50%;
|
|
96
|
+
left: 50%;
|
|
97
|
+
width: 130%;
|
|
98
|
+
height: 160%;
|
|
99
|
+
transform: translate(-50%, -50%) rotate(-3deg) scale(0);
|
|
100
|
+
border: 3px solid #e53935;
|
|
101
|
+
border-radius: 50%;
|
|
102
|
+
pointer-events: none;
|
|
103
|
+
z-index: 0;
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
// Circle scales in with a wobble
|
|
109
|
+
tl.to(
|
|
110
|
+
"#circle-1",
|
|
111
|
+
{
|
|
112
|
+
scale: 1,
|
|
113
|
+
rotation: -3,
|
|
114
|
+
duration: 0.6,
|
|
115
|
+
ease: "back.out(1.7)",
|
|
116
|
+
transformOrigin: "center center",
|
|
117
|
+
},
|
|
118
|
+
0.7,
|
|
119
|
+
);
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Variations
|
|
123
|
+
|
|
124
|
+
```css
|
|
125
|
+
/* Tighter circle (for short words) */
|
|
126
|
+
.mh-circle-ring.tight {
|
|
127
|
+
width: 150%;
|
|
128
|
+
height: 180%;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* Squared circle (rounded rectangle) */
|
|
132
|
+
.mh-circle-ring.rounded {
|
|
133
|
+
border-radius: 30%;
|
|
134
|
+
width: 120%;
|
|
135
|
+
height: 140%;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* Ellipse (wider than tall) */
|
|
139
|
+
.mh-circle-ring.ellipse {
|
|
140
|
+
width: 150%;
|
|
141
|
+
height: 130%;
|
|
142
|
+
border-radius: 50%;
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## 3. Burst Mode
|
|
147
|
+
|
|
148
|
+
Radiating lines from text center. Each line is a positioned div rotated to its angle.
|
|
149
|
+
|
|
150
|
+
```html
|
|
151
|
+
<span class="mh-burst-wrap">
|
|
152
|
+
<span class="mh-burst-text">WOW</span>
|
|
153
|
+
<span class="mh-burst-container" id="burst-1">
|
|
154
|
+
<span class="mh-burst-line" style="--angle: 0deg; --len: 70px;"></span>
|
|
155
|
+
<span class="mh-burst-line" style="--angle: 30deg; --len: 55px;"></span>
|
|
156
|
+
<span class="mh-burst-line" style="--angle: 60deg; --len: 80px;"></span>
|
|
157
|
+
<span class="mh-burst-line" style="--angle: 90deg; --len: 45px;"></span>
|
|
158
|
+
<span class="mh-burst-line" style="--angle: 120deg; --len: 65px;"></span>
|
|
159
|
+
<span class="mh-burst-line" style="--angle: 150deg; --len: 75px;"></span>
|
|
160
|
+
<span class="mh-burst-line" style="--angle: 180deg; --len: 50px;"></span>
|
|
161
|
+
<span class="mh-burst-line" style="--angle: 210deg; --len: 60px;"></span>
|
|
162
|
+
<span class="mh-burst-line" style="--angle: 240deg; --len: 80px;"></span>
|
|
163
|
+
<span class="mh-burst-line" style="--angle: 270deg; --len: 40px;"></span>
|
|
164
|
+
<span class="mh-burst-line" style="--angle: 300deg; --len: 70px;"></span>
|
|
165
|
+
<span class="mh-burst-line" style="--angle: 330deg; --len: 55px;"></span>
|
|
166
|
+
</span>
|
|
167
|
+
</span>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```css
|
|
171
|
+
.mh-burst-wrap {
|
|
172
|
+
position: relative;
|
|
173
|
+
display: inline;
|
|
174
|
+
}
|
|
175
|
+
.mh-burst-text {
|
|
176
|
+
position: relative;
|
|
177
|
+
z-index: 2;
|
|
178
|
+
}
|
|
179
|
+
.mh-burst-container {
|
|
180
|
+
position: absolute;
|
|
181
|
+
top: 50%;
|
|
182
|
+
left: 50%;
|
|
183
|
+
width: 0;
|
|
184
|
+
height: 0;
|
|
185
|
+
z-index: 1;
|
|
186
|
+
}
|
|
187
|
+
.mh-burst-line {
|
|
188
|
+
position: absolute;
|
|
189
|
+
display: block;
|
|
190
|
+
width: 3px;
|
|
191
|
+
height: var(--len);
|
|
192
|
+
background: #1e88e5;
|
|
193
|
+
left: -1.5px;
|
|
194
|
+
top: calc(-1 * var(--len));
|
|
195
|
+
transform: rotate(var(--angle));
|
|
196
|
+
transform-origin: bottom center;
|
|
197
|
+
opacity: 0;
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
```js
|
|
202
|
+
// All lines burst outward simultaneously with slight stagger
|
|
203
|
+
tl.fromTo(
|
|
204
|
+
"#burst-1 .mh-burst-line",
|
|
205
|
+
{ scaleY: 0, opacity: 0 },
|
|
206
|
+
{ scaleY: 1, opacity: 1, duration: 0.4, ease: "power2.out", stagger: 0.03 },
|
|
207
|
+
0.7,
|
|
208
|
+
);
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**Vary line lengths** (40-80px range) for an organic, hand-drawn feel. Equal lengths look mechanical.
|
|
212
|
+
|
|
213
|
+
## 4. Scribble Mode
|
|
214
|
+
|
|
215
|
+
Wavy SVG underlines and strikethroughs that draw themselves via `stroke-dashoffset`.
|
|
216
|
+
|
|
217
|
+
```html
|
|
218
|
+
<span class="mh-scribble-wrap">
|
|
219
|
+
<span class="mh-scribble-text">underlined text</span>
|
|
220
|
+
<svg class="mh-scribble-svg" viewBox="0 0 500 24" preserveAspectRatio="none">
|
|
221
|
+
<path
|
|
222
|
+
id="scribble-1"
|
|
223
|
+
d="M0,12 Q31,0 62,12 Q93,24 125,12 Q156,0 187,12 Q218,24 250,12 Q281,0 312,12 Q343,24 375,12 Q406,0 437,12 Q468,24 500,12"
|
|
224
|
+
fill="none"
|
|
225
|
+
stroke="#FDD835"
|
|
226
|
+
stroke-width="3"
|
|
227
|
+
stroke-linecap="round"
|
|
228
|
+
/>
|
|
229
|
+
</svg>
|
|
230
|
+
</div>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
```css
|
|
234
|
+
.mh-scribble-wrap {
|
|
235
|
+
position: relative;
|
|
236
|
+
display: inline;
|
|
237
|
+
}
|
|
238
|
+
.mh-scribble-text {
|
|
239
|
+
position: relative;
|
|
240
|
+
z-index: 1;
|
|
241
|
+
}
|
|
242
|
+
.mh-scribble-svg {
|
|
243
|
+
position: absolute;
|
|
244
|
+
left: 0;
|
|
245
|
+
bottom: -6px;
|
|
246
|
+
width: 100%;
|
|
247
|
+
height: 24px;
|
|
248
|
+
z-index: 0;
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
```js
|
|
253
|
+
// Measure path length and set initial dash state
|
|
254
|
+
var path = document.querySelector("#scribble-1");
|
|
255
|
+
var len = path.getTotalLength();
|
|
256
|
+
gsap.set(path, { strokeDasharray: len, strokeDashoffset: len });
|
|
257
|
+
|
|
258
|
+
// Draw the line
|
|
259
|
+
tl.to(
|
|
260
|
+
"#scribble-1",
|
|
261
|
+
{
|
|
262
|
+
strokeDashoffset: 0,
|
|
263
|
+
duration: 0.8,
|
|
264
|
+
ease: "power1.inOut",
|
|
265
|
+
},
|
|
266
|
+
0.7,
|
|
267
|
+
);
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Strikethrough Variant
|
|
271
|
+
|
|
272
|
+
Position the SVG at `top: 50%; transform: translateY(-50%)` instead of `bottom: -6px`.
|
|
273
|
+
|
|
274
|
+
### Wavy Path Generator
|
|
275
|
+
|
|
276
|
+
Scale the path's viewBox width to match text width. The wave pattern `Q x1,y1 x2,y2` alternates between `y=0` and `y=24` for a natural wobble. Adjust the control points for tighter or looser waves:
|
|
277
|
+
|
|
278
|
+
- **Tight waves**: smaller x-increments (25px per half-wave)
|
|
279
|
+
- **Loose waves**: larger x-increments (50px per half-wave)
|
|
280
|
+
- **Amplitude**: change the y range (0-24 for standard, 0-16 for subtle)
|
|
281
|
+
|
|
282
|
+
## 5. Sketchout Mode
|
|
283
|
+
|
|
284
|
+
Cross-hatch lines over de-emphasized text. Multiple angled lines create a "crossed out" effect.
|
|
285
|
+
|
|
286
|
+
```html
|
|
287
|
+
<span class="mh-sketchout-wrap">
|
|
288
|
+
<span class="mh-sketchout-text">old price</span>
|
|
289
|
+
<span class="mh-sketchout-lines" id="sketchout-1">
|
|
290
|
+
<span class="mh-sketchout-line mh-sketchout-fwd"></span>
|
|
291
|
+
<span class="mh-sketchout-line mh-sketchout-bwd"></span>
|
|
292
|
+
</span>
|
|
293
|
+
</span>
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
```css
|
|
297
|
+
.mh-sketchout-wrap {
|
|
298
|
+
position: relative;
|
|
299
|
+
display: inline;
|
|
300
|
+
}
|
|
301
|
+
.mh-sketchout-text {
|
|
302
|
+
position: relative;
|
|
303
|
+
z-index: 0;
|
|
304
|
+
}
|
|
305
|
+
.mh-sketchout-lines {
|
|
306
|
+
position: absolute;
|
|
307
|
+
top: 0;
|
|
308
|
+
left: -4px;
|
|
309
|
+
right: -4px;
|
|
310
|
+
bottom: 0;
|
|
311
|
+
overflow: hidden;
|
|
312
|
+
z-index: 1;
|
|
313
|
+
}
|
|
314
|
+
.mh-sketchout-line {
|
|
315
|
+
position: absolute;
|
|
316
|
+
display: block;
|
|
317
|
+
top: 50%;
|
|
318
|
+
left: 0;
|
|
319
|
+
width: 100%;
|
|
320
|
+
height: 2px;
|
|
321
|
+
background: #e53935;
|
|
322
|
+
transform-origin: left center;
|
|
323
|
+
transform: scaleX(0);
|
|
324
|
+
}
|
|
325
|
+
.mh-sketchout-fwd {
|
|
326
|
+
transform: scaleX(0) rotate(-12deg);
|
|
327
|
+
}
|
|
328
|
+
.mh-sketchout-bwd {
|
|
329
|
+
transform: scaleX(0) rotate(12deg);
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
```js
|
|
334
|
+
// Forward slash draws first
|
|
335
|
+
tl.to(
|
|
336
|
+
"#sketchout-1 .mh-sketchout-fwd",
|
|
337
|
+
{
|
|
338
|
+
scaleX: 1,
|
|
339
|
+
duration: 0.3,
|
|
340
|
+
ease: "power2.out",
|
|
341
|
+
},
|
|
342
|
+
1.0,
|
|
343
|
+
);
|
|
344
|
+
|
|
345
|
+
// Backward slash follows
|
|
346
|
+
tl.to(
|
|
347
|
+
"#sketchout-1 .mh-sketchout-bwd",
|
|
348
|
+
{
|
|
349
|
+
scaleX: 1,
|
|
350
|
+
duration: 0.3,
|
|
351
|
+
ease: "power2.out",
|
|
352
|
+
},
|
|
353
|
+
1.15,
|
|
354
|
+
);
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
## Combining Modes in Captions
|
|
358
|
+
|
|
359
|
+
Use mode cycling for visual variety across caption groups:
|
|
360
|
+
|
|
361
|
+
```js
|
|
362
|
+
var MODES = ["highlight", "circle", "burst", "scribble"];
|
|
363
|
+
|
|
364
|
+
GROUPS.forEach(function (group, gi) {
|
|
365
|
+
var mode = MODES[gi % MODES.length];
|
|
366
|
+
// Apply the mode's CSS pattern to emphasis words in this group
|
|
367
|
+
group.emphasisWords.forEach(function (word) {
|
|
368
|
+
applyMode(word.el, mode, tl, word.start);
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Cycle every 2-3 groups for high energy, every 3-4 for medium, every 4-5 for low.
|