Skip to content

Instantly share code, notes, and snippets.

@dunn
Created July 17, 2014 22:27
Show Gist options
  • Save dunn/fc1f8ac2b59c5b510bb8 to your computer and use it in GitHub Desktop.
Save dunn/fc1f8ac2b59c5b510bb8 to your computer and use it in GitHub Desktop.
how to do spinning animations with css
.ghost::before {
content: "👻";
padding-right: 5em;
font-style: normal;
/* position: fixed or absolute is absolutely essential and nobody told me */
position: absolute;
-webkit-animation: ghost 4s linear infinite;
-moz-animation: ghost 4s linear infinite;
-o-animation: ghost 4s linear infinite;
animation: ghost 4s linear infinite;
}
.one::before {
-webkit-animation-delay: -1s;
-moz-animation-delay: -1s;
-o-animation-delay: -1s;
animation-delay: -1s;
}
.two::before {
-webkit-animation-delay: -2s;
-moz-animation-delay: -2s;
-o-animation-delay: -2s;
animation-delay: -2s;
}
.three::before {
-webkit-animation-delay: -3s;
-moz-animation-delay: -3s;
-o-animation-delay: -3s;
animation-delay: -3s;
}
@-moz-keyframes ghost {
from {
-moz-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-moz-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-webkit-keyframes ghost {
from {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes ghost {
from {
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
to {
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-o-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment