-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
61 lines (55 loc) · 2.29 KB
/
example.html
File metadata and controls
61 lines (55 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text Effect</title>
<!-- Text Effects CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/mindthemath/text-effects-js@main/styles.css">
<!-- Web Fonts (optional - for flip mode fonts) -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@900&family=Roboto+Mono:wght@900&family=Source+Code+Pro:wght@900&family=Space+Mono:wght@700&display=swap" rel="stylesheet">
</head>
<body>
<div class="hero-container">
<h1 class="hero-text">
<span class="static-text" style="color: #1a1a1a; font-family: 'Source Code Pro', monospace;">MIND THE</span>
<span id="wordRotator" class="word-rotator" data-mode="flip" data-board-bg="black"></span>
</h1>
</div>
<!-- Text Effects JS -->
<script src="https://cdn.jsdelivr.net/gh/mindthemath/text-effects-js@main/text-effects.js"></script>
<script>
const animatedText = new WordRotator({
elementId: 'wordRotator',
words: ['math', 'science', 'technology', 'engineering', 'art'],
mode: 'flip',
timingMode: 'pause',
firstWordInterval: 3000,
otherWordInterval: 500,
lastWordInterval: 1000,
onLetterLand: (letterIndex, letter, wordIndex, isAccent) => {
// Apply accent color to first word letters
const color = isAccent ? 'oklch(0.9133 0.2195 102.76)' : '#666666';
const flaps = document.querySelectorAll('.letter-flap');
if (letterIndex < flaps.length) {
flaps[letterIndex].querySelectorAll('.flap-content').forEach(el => {
el.style.color = color;
});
}
}
});
// Ensure initial render is colored correctly on first load.
// (Some builds don't call onLetterLand for the initial letters.)
const initialColor = (animatedText.currentIndex === 0) ? 'oklch(0.9133 0.2195 102.76)' : '#666666';
document.querySelectorAll('.flap-content').forEach(el => {
el.style.color = initialColor;
});
// Apply board font (flip mode)
document.querySelectorAll('.letter-flap, .flap-content').forEach(el => {
el.style.fontFamily = "'Source Code Pro', monospace";
});
</script>
</body>
</html>