CSS Animation
body {
height: 350px;
background-color: #DDDDDD;
font: 30px sans-serif;
}
.ball-wrapper {
position: fixed;
top: 20%;
left: 50%;
margin-left: -60px;
width: 120px;
height: 300px;
}
.ball {
position: absolute;
width: 120px;
height: 120px;
border-radius: 70px;
background: linear-gradient(top, rgba(187, 187, 187, 1) 0%, rgba(119, 119, 119, 1) 99%);
box-shadow: inset 0 -5px 15px rgba(255, 255, 255, 0.4), inset -2px -1px 40px rgba(0, 0, 0, 0.4), 0 0 1px #000;
animation: jump 1s infinite;
}
.ball::after {
position: absolute;
top: 10px;
left: 30px;
width: 60px;
height: 30px;
border-radius: 40px / 20px;
background: -webkit-linear-gradient(top, rgba(232, 232, 232, 1) 0%, rgba(232, 232, 232, 1) 1%, rgba(255, 255, 255, 0) 100%);
background: -moz-linear-gradient(top, rgba(232, 232, 232, 1) 0%, rgba(232, 232, 232, 1) 1%, rgba(255, 255, 255, 0) 100%);
background: linear-gradient(top, rgba(232, 232, 232, 1) 0%, rgba(232, 232, 232, 1) 1%, rgba(255, 255, 255, 0) 100%);
content: "";
}
.ball-shadow {
position: absolute;
bottom: 0;
left: 50%;
margin-left: -25px;
width: 50px;
height: 65px;
border-radius: 30px / 40px;
background: rgba(20, 20, 20, 0.1);
box-shadow: 0px 0 20px 35px rgba(20, 20, 20, .1);
transform: scaleY(0.3);
animation: shrink 1s infinite;
}
/**
* animation
*/
@-webkit-keyframes jump {
0% {
top: 0;
-webkit-animation-timing-function: ease-in;
}
50% {
top: 100px;
}
100% {
top: 0;
-webkit-animation-timing-function: ease-in;
}
}
@-webkit-keyframes shrink {
0% {
bottom: 0;
margin-left: -30px;
width: 60px;
height: 75px;
background: rgba(20, 20, 20, .1);
box-shadow: 0px 0 20px 35px rgba(20, 20, 20, .1);
border-radius: 30px / 40px;
-webkit-animation-timing-function: ease-in;
}
50% {
bottom: 30px;
margin-left: -10px;
width: 20px;
height: 5px;
background: rgba(20, 20, 20, .3);
box-shadow: 0px 0 20px 35px rgba(20, 20, 20, .3);
border-radius: 20px / 20px;
-webkit-animation-timing-function: ease-out;
}
100% {
bottom: 0;
margin-left: -30px;
width: 60px;
height: 75px;
background: rgba(20, 20, 20, .1);
box-shadow: 0px 0 20px 35px rgba(20, 20, 20, .1);
border-radius: 30px / 40px;
-webkit-animation-timing-function: ease-in;
}
}
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Default Page</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!----------------------------------------------------------------------------------------------------------------->
<!-- EXTERNAL DEPENDENCIES -->
<!----------------------------------------------------------------------------------------------------------------->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.2.3/foundation.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.2.3/foundation.js"></script>
<!----------------------------------------------------------------------------------------------------------------->
<!-- INTERNAL DEPENDENCIES -->
<!----------------------------------------------------------------------------------------------------------------->
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<div class="ball-wrapper">
<div class="ball"></div>
<div class="ball-shadow"></div>
</div>