Skip to content

Instantly share code, notes, and snippets.

@vdel26
Created April 21, 2015 23:02
Show Gist options
  • Save vdel26/2c35afe98cb545f4414d to your computer and use it in GitHub Desktop.
Save vdel26/2c35afe98cb545f4414d to your computer and use it in GitHub Desktop.
Intertial rotating animation
<div class="box">
<div class="star"></div>
</div>
.box {
margin: 0 auto;
position: relative;
top: 200px;
width: 100px;
height: 100px;
transform: rotateZ(0);
transition: all 900ms ease-out;
cursor: pointer;
}
.box:hover {
transform: rotateZ(-60deg);
}
.star {
position: relative;
width: 100px;
height: 100px;
background: url(https://cldup.com/HeqDhxgwV2.png) center no-repeat;
background-size: 100px 100px;
animation-name: spin;
animation-duration: 2000ms;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-play-state: paused;
}
.box:hover .star {
animation-play-state: running;
}
@keyframes spin {
0% { transform: rotateZ(0) }
100% { transform: rotateZ(360deg) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment