虾米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

上一篇:OpenJudge/Poj 1207 The 3n + 1 problem


下一篇:【编程技巧】一些 NSArray 的基本操作代码例子