forked from usernayeem/web-animation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
style.css
211 lines (178 loc) · 3.06 KB
/
style.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
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
}
html,
body {
width: 100vw;
height: 100vh !important;
overflow: hidden;
}
body {
background-color: var(--bg-color);
height: 100vh;
width: 100vw;
overflow: hidden;
}
:root {
--bg-color: linear-gradient(#a6d8ff, #fff, #fff);
}
.dark {
--bg-color: rgb(53, 53, 53);
}
.sun {
position: absolute;
top: 10%;
left: 50%;
width: 5rem;
height: 5rem;
background: #fff;
border-radius: 50%;
box-shadow: 0 0 50px rgb(255, 189, 189);
cursor: pointer;
transition: 0.2s;
z-index: 50;
}
.dark .sun {
left: 45%;
box-shadow: 0 0;
transition: 0.2s;
}
.dark .sun::before {
content: '';
position: absolute;
top: -1rem;
left: 1rem;
width: 5rem;
height: 5rem;
background: rgb(53, 53, 53);
border-radius: 50%;
}
.bg {
position: absolute;
bottom: 0rem;
width: 100%;
height: 28rem;
background: url(bg.png);
background-size: 50rem;
background-repeat: repeat-x;
animation: animatedBg 50s linear infinite;
}
@keyframes animatedBg {
0% {
background-position-x: 0rem;
}
100% {
background-position-x: 100rem;
}
}
.privateCar {
height: 7rem;
width: 15rem;
position: absolute;
bottom: 0rem;
z-index: 4;
animation: privateCar 15s linear infinite;
}
@keyframes privateCar {
0% {
margin-left: -110%;
}
100% {
margin-left: 110%;
}
}
.truck {
height: 15rem;
width: 15rem;
position: absolute;
bottom: -1rem;
transform: rotateY(180deg);
z-index: 3;
animation: truck 22s linear infinite;
}
@keyframes truck {
0% {
margin-left: 100%;
}
100% {
margin-left: -100%;
}
}
.zip {
height: 6rem;
width: 15rem;
position: absolute;
bottom: 6rem;
transform: rotateY(180deg);
z-index: 2;
animation: zip 25s linear infinite;
}
@keyframes zip {
0% {
margin-left: 150%;
}
100% {
margin-left: -150%;
}
}
.bus {
height: 15rem;
width: 42rem;
position: absolute;
bottom: 7rem;
z-index: 1;
animation: bus 28s linear infinite;
}
@keyframes bus {
0% {
margin-left: -140%;
}
100% {
margin-left: 140%;
}
}
.road {
position: absolute;
bottom: 0rem;
height: 12rem;
width: 100%;
background: url(road.jpg);
background-size: 82rem;
background-repeat: repeat-x;
animation: road 50s linear infinite;
}
@keyframes road {
0% {
background-position-x: 0rem;
}
100% {
background-position-x: 82rem;
}
}
@media(max-width: 992px) {
html {
font-size: 55%;
}
}
@media(max-width: 768px) {
html {
font-size: 45%;
}
.privateCar {
animation: privateCar 10s linear infinite;
}
.truck {
animation: truck 15s linear infinite;
}
.zip {
animation: zip 15s linear infinite;
}
.bus {
animation: bus 23s linear infinite;
}
}