虾米loop 摇头代码

.head{
position: absolute;
-webkit-animation: shake 1s infinite;
-webkit-transform-origin: center bottom;
}
@-webkit-keyframes shake{
0% {
-webkit-transform:rotate(-5deg);
}
50% {
-webkit-transform:rotate(5deg);
}
100% {
-webkit-transform:rotate(-5deg);
}
}

CSS3 @keyframes 用法:
http://www.w3school.com.cn/cssref/pr_keyframes.asp

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
<style>
.head{
  position: absolute;
  -webkit-animation: shake 1s infinite;
  -webkit-transform-origin: center bottom;
}
@-webkit-keyframes shake{
  0% {
    -webkit-transform:rotate(-5deg);
  }
  50% {
    -webkit-transform:rotate(5deg);
  }
  100% {
    -webkit-transform:rotate(-5deg);
  }
}}
}
</style>  
</head>
<body>
<div class="head"><img src="http://img.xiami.net/res/loop/img/avatar/head_back_girl.png" class="head_img"></div>
</body>
</html>

在线DEMO: http://jsbin.com/vaqicejapa

posted @ 2016-04-13 17:48  roseforyou  阅读(290)  评论(0编辑  收藏  举报