Return to Snippet

Revision: 56543
at April 2, 2012 22:30 by ryanfiorini


Initial Code
<style>
@-webkit-keyframes clock {
    0% {-webkit-transform: rotate(0deg);}
    100% {-webkit-transform: rotate(360deg);}
}

@-moz-keyframes clock {
    0% {-moz-transform: rotate(0deg);}
    100% {-webkit-transform: rotate(360deg);}
}

@-webkit-keyframes counter-clock{
    0% {-webkit-transform: rotate(360deg);width: 85px;height: 85px;}
    50% {-webkit-transform: rotate(180deg);width: 185px; height: 185px;}
    100% {-webkit-transform: rotate(0deg);width: 85px;height: 85px;}
}
@-moz-keyframes counter-clock{
    0% {-moz-transform: rotate(360deg); width: 85px;height: 85px;}
    100% {-moz-transform: rotate(0deg);width: 185px;height: 185px;}
}


/* spinners */
.spinner {
    float: none;
    position: absolute;
    text-align: center;
    width: 85px;
    height: 85px;
 
    -moz-animation-timing-function: linear;
    -moz-animation-iteration-count: infinite;
    -moz-animation-direction: normal;
    -moz-animation-delay: 0;
    -moz-animation-play-state: running;
    -moz-animation-fill-mode: forwards;
 
    -webkit-animation-timing-function: linear;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-direction: normal;
    -webkit-animation-delay: 0;
    -webkit-animation-play-state: running;
    -webkit-animation-fill-mode: forwards;
}


#spinner1 {
    background-color: #454545;
    left: 31px;
    top: 45px;
 
    -moz-animation-name: clock;
    -moz-animation-duration: 10s;
 
    -webkit-animation-name: clock;
    -webkit-animation-duration: 10s;
}

#spinner2 {
    background-color: #123123;
    left: 81px;
    top: 85px;
 
    -moz-animation-name: counter-clock;
    -moz-animation-duration: 10s;
 
    -webkit-animation-name: counter-clock;
    -webkit-animation-duration: 10s;
}
</style>

<div class="container">
    <div class="spinner" id="spinner1"></div>
    <div class="spinner" id="spinner2"></div>
</div>

Initial URL
http://jsfiddle.net/ryanwfiorini/kStWt/25/

Initial Description
This uses css3 keyframes, so IE support is limited.

Initial Title
Spinning Div with KeyFrames

Initial Tags


Initial Language
CSS