This repository has been archived by the owner on Sep 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
glitch_text.css
144 lines (128 loc) · 2.58 KB
/
glitch_text.css
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
@import url('https://fonts.googleapis.com/css?family=Kanit:800');
@import url('https://fonts.googleapis.com/css?family=Bungee+Shade');
:root {
--f-size: 15;
--f-unit: 1vmin;
--f: calc(var(--f-size) * var(--f-unit));
--bg: #181717;
}
*, *::after, *::before {
box-sizing: border-box;
}
body {
font-family: 'Bungee Shade', cursive;//'Kanit', sans-serif;
font-size: var(--f);
background-color: var(--bg);
display: flex;
min-height: 100vh;
margin: 0;
overflow: hidden;
}
p {
flex: 1;
line-height: .75;
margin: auto;
color: #1af0dc;
text-align: center;
transform: scaleX(var(--scale, 1));
animation: glitch-p 11s infinite alternate;
&::before,
&::after {
--top: 0; // offset from top [0 - 10]
--left: 0; // offset from left [0.001 - 1]
--v-height: 30%; // visible part
--n-tenth: calc(var(--f-size) * .1 * var(--top));
--t-cut: calc(var(--n-tenth) / var(--f-size) * 100%);
--b-cut: calc(var(--t-cut) + var(--v-height));
content: attr(data-text);
position: absolute;
width: 100%;
left: 0;
text-align: center;
transform: translateX(calc(var(--left) * 100%));
// this helps to get rid of pixelization
filter: drop-shadow(0 0 transparent);
text-shadow: calc(var(--left) * -3em) 0 .02em lime,
calc(var(--left) * -6em) 0 .02em #ff00e1;
background-color: var(--bg);
clip-path: polygon(0% var(--t-cut), 100% var(--t-cut), 100% var(--b-cut), 0% var(--b-cut));
}
&::before {
animation: glitch-b 1.7s infinite alternate-reverse;
}
&::after {
animation: glitch-a 3.1s infinite alternate;
}
}
@keyframes glitch-p {
17% { --scale: .87; }
31% { --scale: 1.1; }
37% { --scale: 1.3; }
47% { --scale: .91; }
87% { --scale: 1; }
}
@keyframes glitch-a {
10%,30%,50%,70%,90% {
--top: 0;
--left: 0;
}
0% {
--v-height: 15%;
}
20% {
--left: .005;
}
40% {
--left: .01;
--v-height: 20%;
--top: 3;
}
60% {
--left: .03;
--v-height: 25%;
--top: 6;
}
80% {
--left: .07;
--v-height: 5%;
--top: 8;
}
100% {
--left: .083;
--v-height: 30%;
--top: 1;
}
}
@keyframes glitch-b {
10%,30%,50%,70%,90% {
--top: 0;
--left: 0;
}
0% {
--v-height: 15%;
--top: 10;
}
20% {
--left: -.005;
}
40% {
--left: -.01;
--v-height: 17%;
--top: 3;
}
60% {
--left: -.03;
--v-height: 35%;
--top: 6;
}
80% {
--left: -.07;
--v-height: 5%;
--top: 8;
}
100% {
--left: -.083;
--v-height: 30%;
--top: 1;
}
}