Skip to content

Instantly share code, notes, and snippets.

@akiyamaSM
Last active June 19, 2017 13:06
Show Gist options
  • Save akiyamaSM/f16c9efd0a878fe8c5094b0d8f51d89a to your computer and use it in GitHub Desktop.
Save akiyamaSM/f16c9efd0a878fe8c5094b0d8f51d89a to your computer and use it in GitHub Desktop.
Css3 Shake effect on hover
<html>
<head>
<title></title>
<style type="text/css">
.rect{
cursor: default;
display: block;
width: 400px;
height: 140px;
background-color: lightblue;
}
a.rect:hover{
-webkit-animation-name: shake;
-webkit-animation-duration: 0.8s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
}
@-webkit-keyframes shake{
0% {
-webkit-transform : translateX(2px);
-webkit-transform : rotate(4deg);
}
10% {
-webkit-transform : translateX(-2px);
-webkit-transform : rotate(-4deg);
}
20% {
-webkit-transform : translateX(2px);
-webkit-transform : rotate(4deg);
}
30% {
-webkit-transform : translateX(-2px);
-webkit-transform : rotate(-4deg);
}
40% {
-webkit-transform : translateX(2px);
}
50% {
-webkit-transform : translateX(-2px);
}
60% {
-webkit-transform : translateX(2px);
}
70% {
-webkit-transform : translateX(-2px);
}
80% {
-webkit-transform : translateX(2px);
}
90% {
-webkit-transform : translateX(-2px);
}
0% {
-webkit-transform : translateX(2px);
}
100% {
-webkit-transform : translateX(-2px);
}
}
</style>
</head>
<body>
<a class="rect" href="#"></a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment