JSFiddle - React, Tailwind, and code Playground
by kougiland
HTML
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/142927/jquery.transform.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
<div class='kai animate' id='running'>
<div class='eyes'></div>
</div>
<div class='slide'>
<div class='stage'>
<div class='foreground-trees'></div>
<div class='landscape'></div>
<div class='behind-trees'></div>
<div class='behind-mountains'></div>
</div>
</div>
CSS
body {
background: #fff4e0;
}
.slide {
background: #fff4e0;
position: relative;
}
.slide .stage {
position: relative;
height: 400px;
background: #c5e0dc;
}
.slide .stage .landscape {
background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/142927/landscape.png") no-repeat center top;
background-size: cover;
height: 248px;
position: absolute;
top: 185px;
left: 0;
width: 100%;
z-index: 3;
}
.slide .stage .behind-trees {
background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/142927/behind-trees.png") no-repeat center top;
height: 103px;
position: absolute;
top: 120px;
left: 0;
width: 100%;
z-index: 2;
}
.slide .stage .behind-mountains {
background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/142927/behind-mountains.png") no-repeat center top;
height: 103px;
position: absolute;
top: 100px;
left: 0;
width: 100%;
z-index: 2;
}
.slide .stage .foreground-trees {
background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/142927/foreground-trees.png") no-repeat center top;
height: 264px;
position: absolute;
top: 150px;
left: 0;
width: 100%;
z-index: 4;
}
.kai {
height: 257px;
position: absolute;
width: 180px;
left: 50%;
margin-left: -90px;
top: 110px;
z-index: 3;
transform: scale(0);
background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/142927/kai_running.png");
}
.kai .eyes:after, .kai .eyes:before {
height: 8px;
width: 5px;
background: #1a181b;
top: 100px;
content: "";
position: absolute;
display: block;
border-radius: 50%;
}
.kai .eyes:after {
right: 70px;
}
.kai .eyes:before {
left: 70px;
}
.kai.animate {
animation: animate 0.75s steps(19) infinite;
}
.kai.animate .eyes {
position: relative;
animation: eyes_running .75s reverse infinite;
}
.kai.animate .eyes:before, .kai.animate .eyes:after {
animation: eyes_blink 5s .2s alternate infinite linear;
}
@keyframes animate {
to {
background-position: -3420px;
...
JavaScript
$(document).ready( function() {
$('#running').animate({
'top' : '10px',
transform: 'scale(0.6)'
}, 3200, function() {
$(this).animate({
'z-index' : 5
}, 0, function() {
$(this).animate({
'top' : '90px',
transform: 'scale(1)'
}, 2000);
});
});
});