Orange car
Animated Single element, Pseudo-elements :before :after. / Experiment / only works in Chrome and Firefox
<!--
<!--
autor: Marco Barría
https://twitter.com/marco_bf
-->
<div class="car"></div>
html,
html,
body{
height:100%;
overflow:hidden;
}
body{
background:rgba(52, 152, 219, 0.5);
background: linear-gradient(top, rgba(52, 152, 219, 0.5) 60%,rgba(250, 252, 219, 0.5) 100%);
background: linear-gradient(top, rgba(52, 152, 219, 0.5) 60%,rgba(250, 252, 219, 0.5) 100%);
}
.car,
.car:before,
.car:after{
position:absolute;
}
.car{
background:rgb(230, 126, 34);
border-radius:100%;
box-shadow:
/* ruedas */
5px 12px 0 5px rgb(189, 195, 199), /* izquierda */
30px 11px 0 5px rgb(189, 195, 199),
5px 12px 0 8px rgb(52, 73, 94), /* izquierda */
30px 11px 0 8px rgb(52, 73, 94),
/* ventana */
14px -11px 0 5px rgb(236, 240, 241),
27px -11px 0 5px rgb(236, 240, 241),
/* chasis */
0 -1px 0 10px rgb(230, 126, 34),
5px -1px 0 10px rgb(230, 126, 34),
10px -1px 0 10px rgb(230, 126, 34),
15px -1px 0 10px rgb(230, 126, 34),
20px -1px 0 10px rgb(230, 126, 34),
25px -1px 0 10px rgb(230, 126, 34),
30px -1px 0 10px rgb(230, 126, 34),
/* techo */
15px -11px 0 10px rgb(230, 126, 34),
20px -11px 0 10px rgb(230, 126, 34),
26px -11px 0 10px rgb(230, 126, 34);
/* El width y el height del div deben ser inferiores al tamaño total del box-shadow, de esa manera controlaremos distintas variantes de tamaños.*/
width:2px; height:2px;
left:50%; top:50%;
margin-left:-15px; margin-top:-40px;
animation:simulacion 1s linear infinite;
}
@keyframes simulacion{
25%, 75%{
box-shadow:
/* ruedas */
5px 7px 0 5px rgb(189, 195, 199), /* izquierda */
30px 8px 0 5px rgb(189, 195, 199),
5px 7px 0 8px rgb(52, 73, 94), /* izquierda */
30px 8px 0 8px rgb(52, 73, 94),
/* ventana */
14px -9px 0 5px rgb(236, 240, 241),
27px -9px 0 5px rgb(236, 240, 241),
/* chasis */
0 1px 0 10px rgb(230, 126, 34),
5px 1px 0 10px rgb(230, 126, 34),
10px 1px 0 10px rgb(230, 126, 34),
15px 1px 0 10px rgb(230, 126, 34),
20px 1px 0 10px rgb(230, 126, 34),
25px 1px 0 10px rgb(230, 126, 34),
30px 1px 0 10px rgb(230, 126, 34),
/* techo */
15px -9px 0 10px rgb(230, 126, 34),
20px -9px 0 10px rgb(230, 126, 34),
26px -9px 0 10px rgb(230, 126, 34);
}
50%, 100%{
box-shadow:
/* ruedas */
5px 12px 0 5px rgb(189, 195, 199), /* izquierda */
30px 11px 0 5px rgb(189, 195, 199),
5px 12px 0 8px rgb(52, 73, 94), /* izquierda */
30px 11px 0 8px rgb(52, 73, 94),
/* ventana */
14px -11px 0 5px rgb(236, 240, 241),
27px -11px 0 5px rgb(236, 240, 241),
/* chasis */
0 -1px 0 10px rgb(230, 126, 34),
5px -1px 0 10px rgb(230, 126, 34),
10px -1px 0 10px rgb(230, 126, 34),
15px -1px 0 10px rgb(230, 126, 34),
20px -1px 0 10px rgb(230, 126, 34),
25px -1px 0 10px rgb(230, 126, 34),
30px -1px 0 10px rgb(230, 126, 34),
/* techo */
15px -11px 0 10px rgb(230, 126, 34),
20px -11px 0 10px rgb(230, 126, 34),
26px -11px 0 10px rgb(230, 126, 34);
}
}
.car:before,
.car:after{
content:"";
}
.car:before{
background:rgba(236, 240, 241, 0);
border-radius:100%;
box-shadow:
/* nubes */
-80px 60px 10px 5px rgba(236, 240, 241, 0.5),
-60px 50px 10px 10px rgba(236, 240, 241, 0.5),
-30px 60px 10px 15px rgba(236, 240, 241, 0.9),
-10px 60px 10px 20px rgba(255, 255, 255, 0.8),
110px 50px 10px 5px rgba(236, 240, 241, 0.5),
90px 60px 10px 10px rgba(236, 245, 245, 0.8),
70px 50px 10px 15px rgba(236, 240, 241, 0.5),
50px 60px 10px 20px rgba(236, 240, 241, 0.8);
width:1px; height:1px;
left:50%; top:50%;
animation:nubes 2s linear infinite;
}
@keyframes nubes{
50%{
box-shadow:
/* nubes */
-82px 59px 8px 5px rgba(255, 255, 255, 0.5),
-63px 52px 12px 10px rgba(236, 240, 241, 0.5),
-35px 63px 10px 15px rgba(236, 240, 241, 0.9),
-8px 58px 10px 20px rgba(255, 255, 255, 0.8),
112px 46px 10px 5px rgba(236, 240, 241, 0.5),
93px 58px 10px 10px rgba(255, 255, 255, 0.8),
68px 52px 10px 15px rgba(236, 240, 241, 0.5),
52px 61px 10px 20px rgba(255, 255, 255, 0.8);
}
}
.car:after{
background:rgb(46, 204, 113);
border-radius:100%;
box-shadow:1px 0px 20px 1px rgba(255, 255, 255, 0.3);
width:82px; height:78px;
left:50%; top:50%;
margin-top:17px; margin-left:-25px;
animation:rotar 1s linear infinite;
}
@keyframes rotar{
100%{
transform:rotateZ(360deg);
}
}
// Es un experimento de single element utilizando box-shadow y animaciones Pseudo
// Es un experimento de single element utilizando box-shadow y animaciones Pseudo
// La idea es investigar sobre el comportamiento de los Pseudo-elements usando animaciones.