Bouncing Ball

HTML
<div class="bounce"></div>
CSS
body { background: #323436; } .bounce { position: absolute; top: 50%; left: 50%; width: 80px; height: 80px; margin-top: 80px; background: transparent; border-radius: 50%; transform: translate(-50%,-50%); } .bounce:before { content: ''; position: absolute; z-index: 10; width: 100%; height: 100%; background: #3498db; border-radius: 50%; box-shadow: inset 0 -10px rgba(0,0,0,0.1); animation: bounce .75s infinite linear; } .bounce:after { content: ''; position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.1); border-radius: 50%; transform: scale(1,0.25); animation: shadow .75s infinite linear; } @keyframes bounce { 0% { transform: translate(0,-50%) scale(1,0.8); } 30% { transform: translate(0,-250%) scale(0.8,1); } 60% { transform: translate(0,-300%) scale(0.8,1); } 85% { transform: translate(0,-50%) scale(0.8,1); } 88% { transform: translate(0,-50%) scale(0.8,1); } 95%, 100% { transform: translate(0,-50%) scale(1,0.8); } } @keyframes shadow { 0% { transform: scale(1,0.25); } 30% { transform: scale(1.5,0.25); } 60% { transform: scale(2,0.25); } 85% { transform: scale(1,0.25); } 90% { transform: scale(1,0.25); } 100% { transform: scale(1,0.25); } }
JAVASCRIPT
Expand for more options Login