-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathletters-16.html
52 lines (50 loc) · 1.17 KB
/
letters-16.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="common.css" />
<title>Letters Animation</title>
<style>
:root {
--color: #262626;
}
body {
background: var(--color);
}
h1 {
color: white;
font-size: 4rem;
display: flex;
position: relative;
}
h1 span {
animation: smoke 5s ease forwards;
display: inline-block;
filter: none;
opacity: 1;
}
@keyframes smoke {
to {
filter: blur(50px);
opacity: 1;
transform: scale(5) translateX(-150px) translateY(-150px);
}
}
</style>
</head>
<body>
<h1>Smoky Effect</h1>
<!-- animation script -->
<script>
let h1 = document.querySelector("h1");
h1.innerHTML = h1.textContent.replaceAll(" ", " ");
h1.innerHTML = h1.textContent.replace(/\S/g, "<span>$&</span>");
let defaultDelay = 20;
[...h1.children].forEach((span, index, arr) => {
span.style.animationDelay = `${defaultDelay + (arr.length - index) * 120}ms`;
});
</script>
</body>
</html>