Created
April 12, 2018 16:12
-
-
Save Stanback/de0ffa2162f0acee99c4a6e70d9894be to your computer and use it in GitHub Desktop.
CSS animation example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
padding: 5rem; | |
} | |
.animation { | |
height: 1.25rem; | |
margin: .625rem 0 0; | |
} | |
.animation-dot { | |
animation: dot 2s infinite; | |
display: inline-block; | |
border-radius: 50%; | |
position: relative; | |
background: #aaa; | |
height: 1.25rem; | |
margin: 0 .25rem; | |
width: 1.25rem; | |
} | |
.animation-dot:nth-child(2) { | |
animation-delay: .2s; | |
} | |
.animation-dot:nth-child(3) { | |
animation-delay: .4s; | |
} | |
.animation-dot:nth-child(4) { | |
animation-delay: .6s; | |
} | |
.animation-dot:nth-child(5) { | |
animation-delay: .8s; | |
} | |
@keyframes dot { | |
0% { | |
background-color: #aaa; | |
} | |
50% { | |
background-color: #7e5; | |
transform: translateY(-.75rem); | |
} | |
100% { | |
background-color: #aaa; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=1"> | |
<link rel="stylesheet" href="animation.css"> | |
</head> | |
<body> | |
<div class="animation"> | |
<div class="animation-dot"></div> | |
<div class="animation-dot"></div> | |
<div class="animation-dot"></div> | |
<div class="animation-dot"></div> | |
<div class="animation-dot"></div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment