Continuous CSS rotation animation on hover, animated back to 0deg on hover out
The solution is to set the default value in your .elem. But this annimation work fine with -moz but not yet implement in -webkit
Look at the fiddle I updated from yours : http://jsfiddle.net/DoubleYo/4Vz63/1648/
It works fine with Firefox but not with Chrome
.elem{
position: absolute;
top: 40px;
left: 40px;
width: 0;
height: 0;
border-style: solid;
border-width: 75px;
border-color: red blue green orange;
transition-property: transform;
transition-duration: 1s;
}
.elem:hover {
animation-name: rotate;
animation-duration: 2s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes rotate {
from {transform: rotate(0deg);}
to {transform: rotate(360deg);}
}
<div class="elem"></div>
Here's a simple working solution:
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
.elem:hover {
-webkit-animation:spin 1.5s linear infinite;
-moz-animation:spin 1.5s linear infinite;
animation:spin 1.5s linear infinite;
}