CSS发抖
纯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发抖的更多相关文章
- 哇塞!HTML5 实现的雨滴效果 CSS发抖
http://dreamsky.github.io/main/blog/rainy-day/ Rainy Day – 哇塞! HTML5 实现的雨滴效果 http://www.webhek.com/m ...
- Matplotlib数据可视化(3):文本与轴
在一幅图表中,文本.坐标轴和图像的是信息传递的核心,对着三者的设置是作图这最为关心的内容,在上一篇博客中虽然列举了一些设置方法,但没有进行深入介绍,本文以围绕如何对文本和坐标轴进行设置展开(对图像 ...
- CSS的未来
仅供参考 前言 完成<CSS核心技术与实战>这本书,已有一个多月了,而这篇文章原本是打算写在那本书里面的,但本章讲解的内容,毕竟属于CSS未来的范畴,而这一切都还不能够确定下来,所以这一章 ...
- 前端极易被误导的css选择器权重计算及css内联样式的妙用技巧
记得大学时候,专业课的网页设计书籍里面讲过css选择器权重的计算:id是100,class是10,html标签是5等等,然后全部加起来的和进行比较... 我只想说:真是误人子弟,害人不浅! 最近,在前 ...
- 前端css兼容性与易混淆的点
一.常用的骨灰级清除浮动 .clearfix:after { content: "."; display: block; height:; clear: both; visibil ...
- 理解CSS外边距margin
前面的话 margin是盒模型几个属性中一个非常特殊的属性.简单举几个例子:只有margin不显示当前元素背景,只有margin可以设置为负值,margin和宽高支持auto,以及margin具有 ...
- 理解CSS视觉格式化
前面的话 CSS视觉格式化这个词可能比较陌生,但说起盒模型可能就恍然大悟了.实际上,盒模型只是CSS视觉格式化的一部分.视觉格式化分为块级和行内两种处理方式.理解视觉格式化,可以确定得到的效果是应 ...
- 谈谈一些有趣的CSS题目(十二)-- 你该知道的字体 font-family
开本系列,谈谈一些有趣的 CSS 题目,题目类型天马行空,想到什么说什么,不仅为了拓宽一下解决问题的思路,更涉及一些容易忽视的 CSS 细节. 解题不考虑兼容性,题目天马行空,想到什么说什么,如果解题 ...
- ASP.NET MVC with Entity Framework and CSS一书翻译系列文章之第二章:利用模型类创建视图、控制器和数据库
在这一章中,我们将直接进入项目,并且为产品和分类添加一些基本的模型类.我们将在Entity Framework的代码优先模式下,利用这些模型类创建一个数据库.我们还将学习如何在代码中创建数据库上下文类 ...
随机推荐
- activiti笔记三 Activiti问题重现
测试的时候出现一个异常: ContextLoader.initWebApplicationContext(308) | Context initialization failed org.spring ...
- PROCEDURE_监测系统_原始数据报表数据生成存储过程—求每天平均值插入多表视图
create or replace procedure proc_generate_report(in_date in varchar2) is v_retCode varchar2(20); v ...
- 连接postgresql数据库
初装postgresql数据库会产生默认的数据库用户postgres和同名的数据库.但是我的linux用户是jm,两者不一致,连不上数据库.于是先把linux用户切换为postgres.(数据库会为l ...
- maven Spring MVC项目
IntelliJ IDEA上创建maven Spring MVC项目 各软件版本 利用maven骨架建立一个webapp 建立相应的目录 配置Maven和SpringMVC 配置Maven的pom.x ...
- LeetCode_Interleaving String
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 ...
- Tea加密算法和XxTea加密算法
TEA(Tiny Encryption Algorithm)是一种小型的对称加密解密算法,支持128位密码,与BlowFish一样TEA每次只能加密/解密8字节数据.TEA特点是速度快.效率高,实现也 ...
- javascript之Error
一.Error()构造函数 构造函数:new Error(); new Error(message); 二.Error.message //人类可读的错误消息 语法:error.message; 三. ...
- 转:SVN Eclipse插件Subclipse安装和配置
一.安装Subclipse subclipse项目地址:http://subclipse.tigris.org/. 安装Subclipse的最好方法是使用Eclipse Update Manager. ...
- java代码模拟先入先出,fifo
最近在做一个先入先出的出库.琢磨了一下,写了一个简单的java代码测试: public static void main(String[] args) { LinkedList q = new Lin ...
- sqlserver 创建索引
语法:CREATE [索引类型] INDEX 索引名称ON 表名(列名)WITH FILLFACTOR = 填充因子值0~100GO /*实例*/ CREATE NONCLUSTERED INDEX ...