Skip to content

Instantly share code, notes, and snippets.

@pavermakov
Created November 29, 2016 09:43
Show Gist options
  • Save pavermakov/c5013cd1dcd94e16db373d9f9251dad7 to your computer and use it in GitHub Desktop.
Save pavermakov/c5013cd1dcd94e16db373d9f9251dad7 to your computer and use it in GitHub Desktop.
Bouncing ball loading animation
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS ui</title>
<style>
* {
box-sizing: border-box;
}
body {
font-family: Palanquin;
line-height: 1.618em;
background: #3498db;
color: #fff;
}
.wrapper {
max-width: 50rem;
width: 100%;
margin: 5rem auto;
text-align: center;
}
.bouncing_ball {
position: relative;
width: 4rem;
margin: 0 auto;
height: 12rem;
}
.ball{
width: 4rem;
height: 4rem;
border-radius: 50%;
background: #fff;
position: absolute;
top:0;
animation: bounce 1s infinite;
}
@keyframes bounce{
0%{
top: 0;
animation-timing-function: ease-in;
}
34%{
height: 4rem;
width: 4rem;
}
35%{
top: 8rem;
height: 3rem;
width: 4.3rem;
animation-timing-function: ease-out;
}
45%{
height: 4rem;
width: 4rem;
}
90%{
top: 0;
}
100%{
top: 0;
}
}
</style>
</head>
<body>
<div class="wrapper">
<div class="bouncing_ball">
<div class="ball"></div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment