forked from clubgamma/Awesome-Web-Art
-
Notifications
You must be signed in to change notification settings - Fork 0
/
animation2.html
113 lines (88 loc) · 1.63 KB
/
animation2.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
/* reset */
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
min-height: 100vh;
padding: 20px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
/* other */
p {
color: #2e2e2e;
margin-bottom: 20px;
}
/* block-$ */
.block-effect {
font-size: calc(8px + 6vw);
}
.block-reveal {
--t: calc(var(--td) + var(--d));
color: transparent;
padding: 4px;
position: relative;
overflow: hidden;
animation: revealBlock 0s var(--t) forwards;
}
.block-reveal::after {
content: '';
width: 0%;
height: 100%;
padding-bottom: 4px;
position: absolute;
top: 0;
left: 0;
background: var(--bc);
animation: revealingIn var(--td) var(--d) forwards, revealingOut var(--td) var(--t) forwards;
}
/* animations */
@keyframes revealBlock {
100% {
color: #0f0f0f;
}
}
@keyframes revealingIn {
0% {
width: 0;
}
100% {
width: 100%;
}
}
@keyframes revealingOut {
0% {
transform: translateX(0);
}
100% {
transform: translateX(100%);
}
}
.abs-site-link {
position: fixed;
bottom: 20px;
left: 20px;
color: hsla(0, 0%, 0%, .6);
font-size: 16px;
}
</style>
</head>
<body>
<h1 class="block-effect" style="--td: 1.2s">
<div class="block-reveal" style="--bc: #4040bf; --d: .1s">Block</div>
<div class="block-reveal" style="--bc: #bf4060; --d: .5s">Revealing Effect</div>
</h1>
</body>
</html>