纯CSS发抖 

当您在 @keyframes 中创建动画时,请把它捆绑到某个选择器,否则不会产生动画效果。

通过规定至少以下两项 CSS3 动画属性,即可将动画绑定到选择器:

  • 规定动画的名称
  • 规定动画的时长

html

<section class="section carrot" style="position: absolute;">
<h1>抖动方式</h1>
<ul class="previews">
<li>
<i class="preview-item shake">
Bs
<span class="flip">
</span>
</i>
<p class="preview-desc">基本抖动</p>
</li> <li>
<i class="preview-item shake shake-constant">
ℇ
<span class="flip"></span>
</i>
<p class="preview-desc">抖动不停</p>
</li>
</ul>
</section>

css

/*绕着图片那个点旋转*/
.shake { display: inline-block;
-webkit-transform-origin: center center;
-ms-transform-origin: center center;
transform-origin: center center;
}
/*基本抖动*/
.shake:hover { -webkit-animation-name: shake-base;
-ms-animation-name: shake-base;
animation-name: shake-base;
-webkit-animation-duration: 100ms;
-ms-animation-duration: 100ms;
animation-duration: 100ms;
-webkit-animation-iteration-count: infinite;
-ms-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-timing-function: ease-in-out;
-ms-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
-webkit-animation-delay: 0s;
-ms-animation-delay: 0s;
animation-delay: 0s;
-webkit-animation-play-state: running;
-ms-animation-play-state: running;
animation-play-state: running;
}
/*抖动不停*/
.shake.shake-constant {
-webkit-animation-name: shake-base;
-ms-animation-name: shake-base;
animation-name: shake-base;
-webkit-animation-duration: 100ms;
-ms-animation-duration: 100ms;
animation-duration: 100ms;
-webkit-animation-iteration-count: infinite;
-ms-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-timing-function: ease-in-out;
-ms-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out;
-webkit-animation-delay: 0s;
-ms-animation-delay: 0s;
animation-delay: 0s;
-webkit-animation-play-state: running;
-ms-animation-play-state: running;
animation-play-state: running;
}
/*keyframes 动画*/
@-webkit-keyframes shake-base {
0% { -webkit-transform: translate(0px, 0px) rotate(0deg); }
2% { -webkit-transform: translate(-0.5px, 1.5px) rotate(0.5deg); }
4% { -webkit-transform: translate(-0.5px, 1.5px) rotate(-0.5deg); }
6% { -webkit-transform: translate(-2.5px, -1.5px) rotate(0.5deg); }
8% { -webkit-transform: translate(-2.5px, -2.5px) rotate(-1.5deg); }
10% { -webkit-transform: translate(1.5px, 1.5px) rotate(-1.5deg); }
12% { -webkit-transform: translate(-2.5px, -0.5px) rotate(-0.5deg); }
14% { -webkit-transform: translate(1.5px, -2.5px) rotate(-0.5deg); }
16% { -webkit-transform: translate(0.5px, 1.5px) rotate(0.5deg); }
18% { -webkit-transform: translate(-2.5px, -0.5px) rotate(0.5deg); }
20% { -webkit-transform: translate(-0.5px, -0.5px) rotate(-1.5deg); }
22% { -webkit-transform: translate(-2.5px, -1.5px) rotate(-1.5deg); }
24% { -webkit-transform: translate(-1.5px, -2.5px) rotate(-1.5deg); }
26% { -webkit-transform: translate(0.5px, -0.5px) rotate(-1.5deg); }
28% { -webkit-transform: translate(-0.5px, -1.5px) rotate(-0.5deg); }
30% { -webkit-transform: translate(-2.5px, 1.5px) rotate(0.5deg); }
32% { -webkit-transform: translate(-2.5px, -2.5px) rotate(-0.5deg); }
34% { -webkit-transform: translate(-1.5px, 0.5px) rotate(-1.5deg); }
36% { -webkit-transform: translate(1.5px, -1.5px) rotate(-1.5deg); }
38% { -webkit-transform: translate(0.5px, -0.5px) rotate(-0.5deg); }
40% { -webkit-transform: translate(-0.5px, 0.5px) rotate(0.5deg); }
42% { -webkit-transform: translate(0.5px, -2.5px) rotate(-0.5deg); }
44% { -webkit-transform: translate(0.5px, -2.5px) rotate(-0.5deg); }
46% { -webkit-transform: translate(-1.5px, 1.5px) rotate(-1.5deg); }
48% { -webkit-transform: translate(0.5px, -2.5px) rotate(-0.5deg); }
50% { -webkit-transform: translate(-1.5px, -0.5px) rotate(-1.5deg); }
52% { -webkit-transform: translate(-2.5px, -0.5px) rotate(-1.5deg); }
54% { -webkit-transform: translate(1.5px, 0.5px) rotate(-1.5deg); }
56% { -webkit-transform: translate(0.5px, 0.5px) rotate(-1.5deg); }
58% { -webkit-transform: translate(0.5px, 1.5px) rotate(-0.5deg); }
60% { -webkit-transform: translate(-0.5px, -2.5px) rotate(-0.5deg); }
62% { -webkit-transform: translate(-2.5px, -1.5px) rotate(-0.5deg); }
64% { -webkit-transform: translate(-1.5px, 0.5px) rotate(0.5deg); }
66% { -webkit-transform: translate(0.5px, -0.5px) rotate(-1.5deg); }
68% { -webkit-transform: translate(-1.5px, -0.5px) rotate(-1.5deg); }
70% { -webkit-transform: translate(-0.5px, -2.5px) rotate(-1.5deg); }
72% { -webkit-transform: translate(-2.5px, -0.5px) rotate(-1.5deg); }
74% { -webkit-transform: translate(-2.5px, 0.5px) rotate(0.5deg); }
76% { -webkit-transform: translate(1.5px, -1.5px) rotate(-1.5deg); }
78% { -webkit-transform: translate(1.5px, -2.5px) rotate(0.5deg); }
80% { -webkit-transform: translate(-2.5px, -2.5px) rotate(-0.5deg); }
82% { -webkit-transform: translate(-2.5px, -1.5px) rotate(0.5deg); }
84% { -webkit-transform: translate(0.5px, -2.5px) rotate(-0.5deg); }
86% { -webkit-transform: translate(-2.5px, 0.5px) rotate(-0.5deg); }
88% { -webkit-transform: translate(-2.5px, -0.5px) rotate(-0.5deg); }
90% { -webkit-transform: translate(-1.5px, -1.5px) rotate(-1.5deg); }
92% { -webkit-transform: translate(-0.5px, -1.5px) rotate(-0.5deg); }
94% { -webkit-transform: translate(0.5px, -0.5px) rotate(-0.5deg); }
96% { -webkit-transform: translate(-2.5px, -2.5px) rotate(0.5deg); }
98% { -webkit-transform: translate(-0.5px, 1.5px) rotate(-0.5deg); } }


抖动方式

鼠标放上去 开始抖动

  • Bs

    基本抖动

  • ℇ

    抖动不停

CSS发抖的更多相关文章

  1. 哇塞!HTML5 实现的雨滴效果 CSS发抖

    http://dreamsky.github.io/main/blog/rainy-day/ Rainy Day – 哇塞! HTML5 实现的雨滴效果 http://www.webhek.com/m ...

  2. Matplotlib数据可视化(3):文本与轴

      在一幅图表中,文本.坐标轴和图像的是信息传递的核心,对着三者的设置是作图这最为关心的内容,在上一篇博客中虽然列举了一些设置方法,但没有进行深入介绍,本文以围绕如何对文本和坐标轴进行设置展开(对图像 ...

  3. CSS的未来

    仅供参考 前言 完成<CSS核心技术与实战>这本书,已有一个多月了,而这篇文章原本是打算写在那本书里面的,但本章讲解的内容,毕竟属于CSS未来的范畴,而这一切都还不能够确定下来,所以这一章 ...

  4. 前端极易被误导的css选择器权重计算及css内联样式的妙用技巧

    记得大学时候,专业课的网页设计书籍里面讲过css选择器权重的计算:id是100,class是10,html标签是5等等,然后全部加起来的和进行比较... 我只想说:真是误人子弟,害人不浅! 最近,在前 ...

  5. 前端css兼容性与易混淆的点

    一.常用的骨灰级清除浮动 .clearfix:after { content: "."; display: block; height:; clear: both; visibil ...

  6. 理解CSS外边距margin

    前面的话   margin是盒模型几个属性中一个非常特殊的属性.简单举几个例子:只有margin不显示当前元素背景,只有margin可以设置为负值,margin和宽高支持auto,以及margin具有 ...

  7. 理解CSS视觉格式化

    前面的话   CSS视觉格式化这个词可能比较陌生,但说起盒模型可能就恍然大悟了.实际上,盒模型只是CSS视觉格式化的一部分.视觉格式化分为块级和行内两种处理方式.理解视觉格式化,可以确定得到的效果是应 ...

  8. 谈谈一些有趣的CSS题目(十二)-- 你该知道的字体 font-family

    开本系列,谈谈一些有趣的 CSS 题目,题目类型天马行空,想到什么说什么,不仅为了拓宽一下解决问题的思路,更涉及一些容易忽视的 CSS 细节. 解题不考虑兼容性,题目天马行空,想到什么说什么,如果解题 ...

  9. ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第二章:利用模型类创建视图、控制器和数据库

    在这一章中,我们将直接进入项目,并且为产品和分类添加一些基本的模型类.我们将在Entity Framework的代码优先模式下,利用这些模型类创建一个数据库.我们还将学习如何在代码中创建数据库上下文类 ...

随机推荐

  1. Oracle中index by binary_integer的作用

    如语句:type  numbers  is table of number index by binary_integer;其作用是,加了”index by binary_integer ”后,num ...

  2. mysql 关键字bug

    今天运行语句 select * from order; 出现bug: ERROR 1064 (42000): You have an error in your SQL syntax; check t ...

  3. 谈谈自己对于Auth2.0的见解

    Auth的原理网上有很多,我这里就不在赘述了. 这里有张时序图我个人觉得是比较合理而且直观的,(感谢这篇博文:http://justcoding.iteye.com/blog/1950270) 参照这 ...

  4. 编译安装hph

    一.安装相关的依赖: yum -y install gcc gcc-c++ bzip2-devel libjpeg-devel libpng-devel freetype-devel libxml2- ...

  5. 在一个exe文件中查找指定内容,找到则返回起始位置, 否则返回0

    //在一个exe文件中查找指定内容,找到则返回起始位置, 否则返回0//如果某字符串, 直接传入字符串进来//如果要查找16进制,则用如下格式传参进来: #$1A#$2A#$3A function F ...

  6. POJ 2533 Longest Ordered Subsequence - from lanshui_Yang

    题目大意:求一个数列的最长上升子序列(严格上升). 解题思路: 方法一:O(n^2) dp[i]:表示处理到第i个位置,序列的最长上升子序列末尾为i的长度: a[]数组存储原序列 dp[i] = ma ...

  7. 使用univocity-parsers创建和读取csv文件

    import com.univocity.parsers.csv.CsvFormat;import com.univocity.parsers.csv.CsvParser;import com.uni ...

  8. Median of Two Sorted Arrays 解答

    Question There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median o ...

  9. UVA 712-S-Trees(满二叉树的简单查询)

    题意:给一棵满二叉树,叶子节点赋予权值,0或者1,对于每个查询输出叶子节点的权值,每个查询0代表往左走,1代表往右走,这题坑的地方是层的访问顺序,如第二组测试,由上到下依次是x3,x1,x2,假如给一 ...

  10. sh_脚本语法

    介绍: 1 开头 程序必须以下面的行开始(必须方在文件的第一行): #!/bin/sh 符号#!用来告诉系统它后面的参数是用来执行该文件的程序.在这个例子中我们使用/bin/sh来执行程序. 当编写脚 ...