-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhappy-new-year-2022.html
186 lines (184 loc) · 3.57 KB
/
happy-new-year-2022.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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Happy New Year 2022</title>
</head>
<body>
<style>
* {
box-sizing: border-box;
}
body {
overflow: hidden;
margin: 0;
padding: 0;
}
body .section {
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(135deg, #111, #222, #111);
position: relative;
}
body .section::before {
content: '';
position: absolute;
width: 30vw;
height: 30vh;
border: 5vw solid #ff1062;
border-radius: 50%;
box-shadow: 0 0 0 1vw #222, 0 0 0 1.3vw #fff;
}
body .section .sectionTitle {
position: absolute;
color: #fff;
font-size: 9vw;
text-align: center;
line-height: 2em;
text-shadow: 1px 1px 0 #ccc, 2px 2px 0 #ccc, 3px 3px 0 #ccc, 4px 4px 0 #ccc, 5px 5px 0 #ccc, 10px 10px 0 rgba(0,0,0,0.2);
animation: floating 5s ease-in-out infinite;
}
body .section .sectionTitle span {
text-shadow: 1px 1px 0 #ccc, 2px 2px 0 #ccc, 3px 3px 0 #ccc, 4px 4px 0 #ccc, 5px 5px 0 #ccc, 6px 6px 0 #ccc, 7px 7px 0 #ccc, 8px 8px 0 #ccc, 9px 9px 0 #ccc, 20px 20px 0 rgba(0,0,0,0.2);
font-weight: 700;
font-size: 3em;
}
@-moz-keyframes floating {
0%, 100% {
transform: skewY(-7deg) translate(0, -20px);
}
50% {
transform: skewY(0deg) translate(0, 20px);
}
}
@-webkit-keyframes floating {
0%, 100% {
transform: skewY(-7deg) translate(0, -20px);
}
50% {
transform: skewY(0deg) translate(0, 20px);
}
}
@-o-keyframes floating {
0%, 100% {
transform: skewY(-7deg) translate(0, -20px);
}
50% {
transform: skewY(0deg) translate(0, 20px);
}
}
@keyframes floating {
0%, 100% {
transform: skewY(-7deg) translate(0, -20px);
}
50% {
transform: skewY(0deg) translate(0, 20px);
}
}
body .section i {
position: absolute;
background-color: #fff;
top: 30px;
left: 30px;
width: 4px;
height: 4px;
z-index: 10;
border-radius: 50%;
box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 40px #fff, 0 0 80px #fff;
animation: animate 1s linear infinite;
}
@-moz-keyframes animate {
0% {
opacity: 0;
}
10% {
opacity: 1;
}
90% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@-webkit-keyframes animate {
0% {
opacity: 0;
}
10% {
opacity: 1;
}
90% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@-o-keyframes animate {
0% {
opacity: 0;
}
10% {
opacity: 1;
}
90% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes animate {
0% {
opacity: 0;
}
10% {
opacity: 1;
}
90% {
opacity: 1;
}
100% {
opacity: 0;
}
}
</style>
<section class="section">
<h2 class="sectionTitle">
Happy New Year<br>
<span>
2022
</span>
</h2>
<i></i>
</section>
<script>
const stars = () => {
const count = 200
const section = document.querySelector('.section')
let i = 0
while (i < count) {
const star = document.createElement('i')
const x = Math.floor(Math.random() * window.innerWidth)
const y = Math.floor(Math.random() * window.innerHeight)
const size = Math.random() * 5
star.style.left = `${x}px`
star.style.top = `${y}px`
star.style.width = `${size}px`
star.style.height = `${size}px`
console.log(star.style.width)
const duration = Math.random() * 4
star.style.animationDuration = `${duration}s`
star.style.animationDelay = `${duration}s`
section.appendChild(star)
++i
}
}
stars()
</script>
</body>
</html>