Skip to content

Instantly share code, notes, and snippets.

@gonghao
Created December 21, 2012 08:19
Show Gist options
  • Save gonghao/4351411 to your computer and use it in GitHub Desktop.
Save gonghao/4351411 to your computer and use it in GitHub Desktop.
shaker animation like iOS icon sorting shaker animation
@-webkit-keyframes shaker {
0% { -webkit-transform: translate(1px, 0px) rotate(0deg); }
10% { -webkit-transform: translate(0px, -1px) rotate(-1deg); }
20% { -webkit-transform: translate(-2px, 0px) rotate(1deg); }
30% { -webkit-transform: translate(0px, 1px) rotate(0deg); }
40% { -webkit-transform: translate(0px, -0px) rotate(1deg); }
50% { -webkit-transform: translate(0px, 1px) rotate(-1deg); }
60% { -webkit-transform: translate(-2px, 0px) rotate(0deg); }
70% { -webkit-transform: translate(1px, 0px) rotate(-1deg); }
80% { -webkit-transform: translate(0px, 0px) rotate(1deg); }
90% { -webkit-transform: translate(1px, 1px) rotate(0deg); }
100% { -webkit-transform: translate(0px, -1px) rotate(-1deg); }
}
@-moz-keyframes shaker {
0% { -moz-transform: translate(1px, 0px) rotate(0deg); }
10% { -moz-transform: translate(0px, -1px) rotate(-1deg); }
20% { -moz-transform: translate(-2px, 0px) rotate(1deg); }
30% { -moz-transform: translate(0px, 1px) rotate(0deg); }
40% { -moz-transform: translate(0px, -0px) rotate(1deg); }
50% { -moz-transform: translate(0px, 1px) rotate(-1deg); }
60% { -moz-transform: translate(-2px, 0px) rotate(0deg); }
70% { -moz-transform: translate(1px, 0px) rotate(-1deg); }
80% { -moz-transform: translate(0px, 0px) rotate(1deg); }
90% { -moz-transform: translate(1px, 1px) rotate(0deg); }
100% { -moz-transform: translate(0px, -1px) rotate(-1deg); }
}
@keyframes shaker {
0% { transform: translate(1px, 0px) rotate(0deg); }
10% { transform: translate(0px, -1px) rotate(-1deg); }
20% { transform: translate(-2px, 0px) rotate(1deg); }
30% { transform: translate(0px, 1px) rotate(0deg); }
40% { transform: translate(0px, -0px) rotate(1deg); }
50% { transform: translate(0px, 1px) rotate(-1deg); }
60% { transform: translate(-2px, 0px) rotate(0deg); }
70% { transform: translate(1px, 0px) rotate(-1deg); }
80% { transform: translate(0px, 0px) rotate(1deg); }
90% { transform: translate(1px, 1px) rotate(0deg); }
100% { transform: translate(0px, -1px) rotate(-1deg); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment