JSFiddle - React, Tailwind, and code Playground
by Alexandru Gatea
HTML
<div class="animation">
<div class="car">
<div class="car-wheels"></div>
</div>
<div class="building first"></div>
<div class="building second"></div>
<div class="building third"></div>
<div class="text">yeParking</div>
<div class="cloud"></div>
</div>
SCSS
.animation {
display: block;
position: absolute;
width: 100%;
height: 50vW;
top: 0;
left: 0;
background: #e5e5e5;
overflow: hidden;
}
.building {
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid #333;
position: absolute;
bottom: 0;
&.first {
right: 0;
}
&.second {
right: 2vw;
border-left: 150px solid transparent;
border-right: 150px solid transparent;
border-bottom: 200px solid #333;
}
&.third {
right: 30vw;
}
}
.car {
position: absolute;
bottom: 15px;
left: 0;
border-bottom: 50px solid red;
border-left: 25px solid transparent;
border-right: 25px solid transparent;
height: 0;
width: 100px;
animation: car-move 5s linear infinite;
z-index: 1000;
&:before {
content: '';
width: 200px;
height: 25px;
background: red;
position: absolute;
top: 25px;
left: -25px;
}
.car-wheels {
position: absolute;
width: 160px;
top: 45px;
left:0;
height: 20px;
&:before, &:after {
content: '';
width: 30px;
height: 30px;
border-radius: 50%;
display: block;
position: absolute;
background: red;
bottom: 0;
}
&:before {
left:-10px;
}
&:after {
right: 0;
}
}
}
.text {
font-size: 50px;
position: absolute;
top: 20%;
left: 20%;
font-weight: bold;
font-family: Helvetica;
animation: pulse 1s ease-in-out infinite alternate;
}
.cloud {
width: 50px;
height: 50px;
border-radius: 50%;
display: block;
background: rgba(255,255,255,0.5);
position: absolute;
left: 70%;
top: 55%;
z-index: 100;
animation: cloud-move 15s ease-in-out infinite alternate;
&:before, &:after {
content: '';
...