Skip to content

Instantly share code, notes, and snippets.

@C-Rodg
Created May 26, 2016 19:38
Show Gist options
  • Save C-Rodg/c2a0d5971922abdf3f1ecdb58e0e757e to your computer and use it in GitHub Desktop.
Save C-Rodg/c2a0d5971922abdf3f1ecdb58e0e757e to your computer and use it in GitHub Desktop.
Page load animation
.wrapper
.up.slideUp
.spin
.load.grow
.down.slideDown

Page load animation

A spinning page load animation. Great for the entry to welcome pages. Done completely with HTML & CSS. No javascript needed!

A Pen by C-Rodg on CodePen.

License.

/* Containers */
html, body {
width: 100%;
height: 100%;
}
body {
background: url('https://download.unsplash.com/photo-1429277096327-11ee3b761c93');
background-size: cover;
}
.wrapper {
height: 100%;
width: 100%;
position: relative;
overflow: hidden;
}
/* Animation Elements */
.load {
border-top: 10px solid #16a085;
width: 125px;
margin: auto;
}
.spin {
animation-name: spin;
animation-duration: 10s;
animation-timing-function: linear;
animation-delay: 1s;
animation-iteration-count: 1;
animation-direction: normal;
position: absolute;
top: 50%;
left: 0;
right: 0;
margin: auto;
z-index: 99;
overflow: hidden;
}
.grow {
animation-name: grow;
animation-duration: 6s;
animation-timing-function: linear;
animation-delay: 11s;
animation-iteration-count: 1;
animation-direction: normal;
animation-fill-mode: forwards;
}
.up {
height: 50%;
width: 100%;
background-color: #333;
position: absolute;
top: 0;
}
.down {
height: 50%;
width: 100%;
background-color: #333;
position: absolute;
bottom: 0;
}
.slideUp {
animation-name: slideUp;
animation-duration: 3s;
animation-timing-function: linear;
animation-delay: 14s;
animation-iteration-count: 1;
animation-direction: normal;
animation-fill-mode: forwards;
}
.slideDown {
animation-name: slideDown;
animation-duration: 3s;
animation-timing-function: linear;
animation-delay: 14s;
animation-iteration-count: 1;
animation-direction: normal;
animation-fill-mode: forwards;
}
/* Keyframe Animations */
@keyframes grow {
0% {
width: 125px;
}
50% {
width: 100%;
}
75% {
opacity: 1;
}
100% {
width: 0;
opacity: 0;
}
}
@keyframes slideUp {
from {
transform: translateY(0%);
}
to {
transform: translateY(-100%);
}
}
@keyframes slideDown {
from {
transform: translateY(0%);
}
to {
transform: translateY(100%);
}
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
20% {
transform: rotate(360deg);
}
40% {
transform: rotate(720deg);
}
60% {
transform: rotate(1080deg);
}
80% {
transform: rotate(1440deg);
}
100% {
transform: rotate(1800deg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment