-
Notifications
You must be signed in to change notification settings - Fork 0
/
movingTruck.html
220 lines (197 loc) · 6.39 KB
/
movingTruck.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
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
212
213
214
215
216
217
218
219
220
<!DOCTYPE html>
<html>
<head>
<style>
body {
background: #1A1A1A; /* Dark background for evening */
overflow: hidden;
font-family: 'Open Sans', sans-serif;
}
.loop-wrapper {
margin: 0 auto;
position: relative;
display: block;
width: 600px;
height: 250px;
overflow: hidden;
border-bottom: 3px solid #fff;
color: #fff;
}
.mountain {
position: absolute;
right: -900px;
bottom: -20px;
width: 2px;
height: 2px;
box-shadow:
0 0 0 50px #333; /* Dark greenish color for evening mountains */
transform: rotate(130deg);
animation: mtn 20s linear infinite;
}
.hill {
position: absolute;
right: -900px;
bottom: -50px;
width: 400px;
border-radius: 50%;
height: 20px;
box-shadow:
0 0 0 50px #333; /* Dark greenish color for evening hills */
animation: hill 4s 2s linear infinite;
}
.tree, .tree:nth-child(2), .tree:nth-child(3) {
position: absolute;
height: 100px;
width: 35px;
bottom: 0;
background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/130015/tree.svg) no-repeat;
}
.rock {
margin-top: -17%;
height: 2%;
width: 2%;
bottom: -2px;
border-radius: 20px;
position: absolute;
background: #222; /* Dark gray for rocks in the evening */
animation: rock 4s -0.530s linear infinite;
}
.truck, .wheels {
transition: all ease;
width: 85px;
margin-right: -60px;
bottom: 0px;
right: 50%;
position: absolute;
background: #444; /* Dark gray for trucks in the evening */
}
.truck {
background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/130015/truck.svg) no-repeat;
background-size: contain;
height: 60px;
animation: truck 4s 0.080s ease infinite;
}
.truck:before {
content: " ";
position: absolute;
width: 25px;
box-shadow:
-30px 28px 0 1.5px #333, /* Dark greenish color for the truck shadows */
-35px 18px 0 1.5px #333;
}
.wheels {
background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/130015/wheels.svg) no-repeat;
height: 15px;
margin-bottom: 0;
animation: truck 4s 0.001s ease infinite;
}
.moon {
position: absolute;
left: 20px;
top: 20px;
width: 60px;
height: 60px;
background: #fff; /* White for the moon */
border-radius: 50%;
animation: moon 30s linear infinite; /* Adding a moon with animation */
}
.star {
position: absolute;
width: 2px;
height: 2px;
background: #fff; /* White for stars */
border-radius: 50%;
animation: stars 10s linear infinite alternate; /* Adding stars with animation */
}
.tree { animation: tree 3s 0.000s linear infinite; }
.tree:nth-child(2) { animation: tree2 2s 0.150s linear infinite; }
.tree:nth-child(3) { animation: tree3 8s 0.050s linear infinite; }
.rock { animation: rock 4s -0.530s linear infinite; }
.truck { animation: truck 4s 0.080s ease infinite; }
.wheels { animation: truck 4s 0.001s ease infinite; }
.truck:before { animation: wind 1.5s 0.000s ease infinite; }
@keyframes tree {
0% { transform: translate(1350px); }
50% {}
100% { transform: translate(-50px); }
}
@keyframes tree2 {
0% { transform: translate(650px); }
50% {}
100% { transform: translate(-50px); }
}
@keyframes tree3 {
0% { transform: translate(2750px); }
50% {}
100% { transform: translate(-50px); }
}
@keyframes rock {
0% { right: -200px; }
100% { right: 2000px; }
}
@keyframes truck {
0% { }
6% { transform: translateY(0px); }
7% { transform: translateY(-6px); }
9% { transform: translateY(0px); }
10% { transform: translateY(-1px); }
11% { transform: translateY(0px); }
100% { }
}
@keyframes wind {
0% { }
50% { transform: translateY(3px) }
100% { }
}
@keyframes moon {
0% {
transform: scale(0.9);
}
50% {
transform: scale(1.1);
}
100% {
transform: scale(0.9);
}
}
@keyframes stars {
0% {
opacity: 0;
transform: translateY(0);
}
100% {
opacity: 1;
transform: translateY(2px);
}
}
@keyframes mtn {
100% {
transform: translateX(-2000px) rotate(130deg);
}
}
@keyframes hill {
100% {
transform: translateX(-2000px);
}
}
</style>
</head>
<body>
<div class="loop-wrapper">
<div class="mountain"></div>
<div class="hill"></div>
<div class="tree"></div>
<div class="tree"></div>
<div class="tree"></div>
<div class="rock"></div>
<div class="truck"></div>
<div class="wheels"></div>
<div class="moon"></div>
<div class="star" style="left: 50px; top: 80px;"></div>
<div class="star" style="left: 150px; top: 30px;"></div>
<div class="star" style="left: 300px; top: 120px;"></div>
<div class="star" style="left: 400px; top: 70px;"></div>
<div class="star" style="left: 500px; top: 10px;"></div>
</div>
</body>
</html>