JSFiddle - React, Tailwind, and code Playground
by kougiland
HTML
<div id="stage">
<div id="traveler">
<div id="bouncer"><!-- --></div>
</div>
</div>
CSS
#traveler {
position: absolute;
width: 20px;
height: 240px;
-webkit-animation-name: travel;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
-webkit-animation-direction: alternate;
-webkit-animation-duration: 4.8s;
}
#bouncer {
position: absolute;
width: 20px;
height: 20px;
background: red;
border-radius: 10px;
-webkit-animation-name: bounce;
-webkit-animation-iteration-count: infinite;
-webkit-animation-duration: 4.2s;
}
#stage {
position: relative;
margin: 1em auto;
width: 660px;
height: 240px;
border: 2px solid #666;
background: #cff;
}
@-webkit-keyframes bounce {
from, to {
-webkit-animation-timing-function: ease-out;
}
50% {
bottom: 220px;
-webkit-animation-timing-function: ease-in;
}
}
@-webkit-keyframes travel {
from { }
to { left: 640px; }
}