《CSS动画实用技巧》课程笔记
概述
这是我学习CSS动画实用技巧的课程笔记
常用动画属性——transition

.change img{
display:block;
width:300px;
height:284px;
opacity:0;
-webkit-transform:translate(-100px,-100px);
-webkit-transition:opacity 1s ease-in-out 0.5s,-webkit-transform 1s ease-in-out;
transition: opacity 1s ease-in-out 0.5s,transform 1s ease-in-out;
}
.change:hover img{
-webkit-transform:translate(0px,0px);
opacity:1;
-webkit-transition: opacity 1s ease-in-out,-webkit-transform 1s ease-in-out .1s;
transition: opacity 1s ease-in-out,transform 1s ease-in-out .1s;
}
主要是移动和透明渐变同时进行(有延迟)。
常用动画属性——animation

@keyframes shake-hard {
2% {
transform: translate(1px, -2px) rotate(3.5deg); }
4% {
transform: translate(-7px, -6px) rotate(3.5deg); }
6% {
transform: translate(2px, -6px) rotate(-0.5deg); }
8% {
transform: translate(1px, 2px) rotate(2.5deg); }
10% {
transform: translate(1px, 7px) rotate(1.5deg); }
12% {
transform: translate(0px, 2px) rotate(-0.5deg); }
14% {
transform: translate(9px, 2px) rotate(1.5deg); }
16% {
transform: translate(-4px, 2px) rotate(3.5deg); }
18% {
transform: translate(-9px, 5px) rotate(1.5deg); }
20% {
transform: translate(-9px, -8px) rotate(1.5deg); }
22% {
transform: translate(-2px, 3px) rotate(-0.5deg); }
24% {
transform: translate(3px, 2px) rotate(-2.5deg); }
26% {
transform: translate(8px, -7px) rotate(2.5deg); }
28% {
transform: translate(-7px, 9px) rotate(-2.5deg); }
30% {
transform: translate(-9px, 3px) rotate(-0.5deg); }
32% {
transform: translate(-7px, 2px) rotate(3.5deg); }
34% {
transform: translate(-1px, -6px) rotate(0.5deg); }
36% {
transform: translate(5px, -1px) rotate(3.5deg); }
38% {
transform: translate(2px, 6px) rotate(3.5deg); }
40% {
transform: translate(-4px, -2px) rotate(-1.5deg); }
42% {
transform: translate(1px, -7px) rotate(-2.5deg); }
44% {
transform: translate(6px, 7px) rotate(-1.5deg); }
46% {
transform: translate(-3px, 6px) rotate(2.5deg); }
48% {
transform: translate(-6px, 6px) rotate(2.5deg); }
50% {
transform: translate(4px, -6px) rotate(1.5deg); }
52% {
transform: translate(-8px, 9px) rotate(-2.5deg); }
54% {
transform: translate(-7px, 5px) rotate(-0.5deg); }
56% {
transform: translate(-4px, 9px) rotate(2.5deg); }
58% {
transform: translate(-6px, -8px) rotate(-0.5deg); }
60% {
transform: translate(6px, -9px) rotate(2.5deg); }
62% {
transform: translate(2px, 9px) rotate(1.5deg); }
64% {
transform: translate(7px, -7px) rotate(1.5deg); }
66% {
transform: translate(1px, -3px) rotate(0.5deg); }
68% {
transform: translate(9px, -2px) rotate(-0.5deg); }
70% {
transform: translate(9px, -3px) rotate(-1.5deg); }
72% {
transform: translate(2px, -3px) rotate(-0.5deg); }
74% {
transform: translate(6px, -9px) rotate(1.5deg); }
76% {
transform: translate(-3px, 6px) rotate(3.5deg); }
78% {
transform: translate(1px, 8px) rotate(-0.5deg); }
80% {
transform: translate(10px, -2px) rotate(1.5deg); }
82% {
transform: translate(-5px, 5px) rotate(3.5deg); }
84% {
transform: translate(7px, -5px) rotate(-0.5deg); }
86% {
transform: translate(-3px, -7px) rotate(-0.5deg); }
88% {
transform: translate(-2px, -1px) rotate(-1.5deg); }
90% {
transform: translate(5px, 0px) rotate(-2.5deg); }
92% {
transform: translate(10px, -5px) rotate(-0.5deg); }
94% {
transform: translate(2px, 9px) rotate(0.5deg); }
96% {
transform: translate(4px, -8px) rotate(0.5deg); }
98% {
transform: translate(2px, 8px) rotate(-0.5deg); }
0%, 100% {
transform: translate(0, 0) rotate(0); } }
其实就是把抖动分隔成一帧帧,然后用keyframes连接起来。
常用动画属性——transform###

.cardfan > img{
position:absolute;
border:10px solid #fff;
box-sizing:border-box;
box-shadow: 4px 4px 3px rgba(0, 0, 0, 0.2);
-webkit-transform-origin: center 400px;
transform-origin: center 400px;
-webkit-transition: -webkit-transform .7s ease;
transition: transform .7s ease;
}
.cardfan img:first-child{
-webkit-transform:rotate(5deg);
transform:rotate(5deg);
}
.cardfan img:last-child{
-webkit-transform:rotate(-5deg);
transform:rotate(-5deg);
}
.cardfan:hover img:first-child{
-webkit-transform:rotate(25deg);
transform:rotate(25deg);
}
.cardfan:hover img:last-child{
-webkit-transform:rotate(-25deg);
transform:rotate(-25deg);
}
其实就是在鼠标接触之后第1,3张图旋转一下。
常用动画属性——animation-delay为负值

.spinner > div{
display:inline-block;
width:6px;
height:100%;
background:green;
-webkit-animation: strechdelay 1.2s infinite ease-in-out ;
}
.spinner .line2{
-webkit-animation-delay:-1.1s;
}
.spinner .line3{
-webkit-animation-delay:-1.0s;
}
.spinner .line4{
-webkit-animation-delay:-0.9s;
}
.spinner .line5{
-webkit-animation-delay:-0.8s;
}/**/
@-webkit-keyframes strechdelay{
0%,40%,100%{
-webkit-transform:scaleY(.4);
}
20%{
-webkit-transform:scaleY(1);
}
}
比如:animation-delay为-2s,效果是使动画马上开始,但跳过 2 秒进入动画。
常用动画属性——妙用border颜色

.spinner{
width:10em;
height:10em;
border-radius:100%;
margin:100px auto;
border:1.1em solid rgba(255,255,255,.2);
border-left-color:#fff;
}
主要是先让一个边框颜色不同,然后让它旋转。
常用动画属性——巧用border宽度

.image-layer:before {
content: '';
position: absolute;
top: 0;
right: 0;
border-style: solid;
border-width: 0;
border-color: rgba(0,0,0,0.2) #fff;
border-radius: 0 0 0 4px;
box-shadow: 0 1px 1px rgba(0,0,0,0.3), -1px 1px 1px rgba(0,0,0,0.2);
-webkit-transition: all 0.4s ease-out;
transition:all 0.4s ease-out;
}
.image-layer:hover:before{
border-right-width:80px;
border-bottom-width:80px;
}
.paper-flip.folded .image-layer:before{
border-right-width:1000px;
border-bottom-width:600px;
}
利用宽度做成折角效果。翻页效果有点看不懂。
常用动画属性——实现运动动画

.stage{
width:120px;
height:auto;
margin:0 auto;
position:relative;
-webkit-transform-origin:center top;
-webkit-transform:rotate(-30deg);
-webkit-animation:sway 2.2s infinite alternate ease-in-out;
}
.watch{
width:100%;
height:auto;
}
.seconds{
position:absolute;
width:8%;
height:auto;
bottom:11.5%;
left:45.5%;
-webkit-transform-origin:center 72.4%;
-webkit-animation:second 60s infinite linear;
}
@-webkit-keyframes second{
to{
-webkit-transform:rotate(355deg);
}
}
@-webkit-keyframes sway{
to{
-webkit-transform:rotate(30deg);
}
}
其实就是利用rotate来进行弧形运动,注意animation-direction:alternate和center:top。
《CSS动画实用技巧》课程笔记的更多相关文章
- 《css定位 position》课程笔记
这是我学习课程css定位 position时做的笔记! 本节内容 html的三种布局方式 position可选参数 z-index 盒子模型和定位的区别 侧边栏导航跟随实例 html的三种布局方式 三 ...
- div+css定位position详解
div+css定位position详解 1.div+css中的定位position 最主要的两个属性:属性 absolute(绝对定位) relative(相对定位),有他们才造就了div+css布局 ...
- web前端css定位position和浮动float
最近做了几个项目:配资公司,ecmal商城等,客户对前台要求都很高.所以,今天来谈谈css的基础,以及核心,定位问题. div.h1或p元素常常被称为块级元素.这意味着这些元素显示为一块内容,即“块框 ...
- css定位position认识
1.绝对定位(position: absolute) 2.相对定位(position: relative) 3.固定定位(position: fixed) 绝对定位 设置position:absolu ...
- CSS定位position
position选项来定义元素的定位属性,选项有5个可选值:static.relative.absolute.fixed.inherit 属性值为relative.absolute.fixed时top ...
- css 定位position总结
在CSS中,Position 属性经常会用到,主要是绝对定位和相对定位,简单的使用都没有问题,尤其嵌套起来,就会有些混乱,今记录总结一下,防止久而忘之. CSS position 属性值: absol ...
- css定位position属性深究
1.static:对象遵循常规流.此时4个定位偏移属性不会被应用. 2.relative:对象遵循常规流,并且参照自身在常规流中的位置通过top,right,bottom,left这4个定位偏移属性进 ...
- 【前段开发】10步掌握CSS定位: position static relative absolute float
希望能帮到须要的人,转自:http://www.see-design.com.tw/i/css_position.html 1. position:static 元素的 position 屬性默認值為 ...
- css定位-position
前言 定位的目的就是把元素摆放到指定的位置. 定位上下文:定位元素的大小,位置都是相对于定位上下文的. position属性值有5个值 static:所有有元素定位默认的初始值都是static.就是不 ...
- CSS - 定位(position),难点
元素的定位属性主要包括定位模式和边偏移两部分. 1. 边偏移 边偏移属性 描述 top 顶端偏移量,定义元素相对于其父元素上边线的距离 bottom 底部偏移量,定义元素相对于其父元素下边线的距离 l ...
随机推荐
- 到底啥事w3c标准
W3C标准 ...
- Virtual Box配置CentOS7网络
1.先管理中配置两个网络 最好的办法就是使用两块网卡,nat(虚拟机访问互联网,使用10.0.2.x段)和host-only(虚拟机和主机互相通信,使用192.168.56.x段) 2.接下来对Cen ...
- 通过yum安装mysql数据
1. 卸载掉原有mysql 因为mysql数据库在Linux上实在是太流行了,所以目前下载的主流Linux系统版本基本上都集成了mysql数据库在里面,我们可以通过如下命令来查看我们的操作系统上是否已 ...
- Django--权限组件
创建组件 需求分析: 创建独立app, rbac ##注意: app创建后需要注册到setting.py中 INSTALLED_APPS = [ 'django.contrib.admin', 'dj ...
- Mysql ibd文件恢复指南
背景 mysql在使用的过程中,难免遇到数据库表误操作,基于此,作者亲力亲为,对mysql数据表ibd文件的恢复做以下详细的说明,对开发或者初级dba提供一定的指导作用,博客中如若存在相关问题,请指明 ...
- codechef [snackdown2017 Onsite Final] AND Graph
传送门 题解给出了一个很强势的dp: i<K $$dp[i][len]*Fib[len+2-(t[i]==1)] -> dp[i+1][len]$$ $$dp[i][len]*Fib[le ...
- [51nod1213]二维曼哈顿距离最小生成树
二维平面上有N个坐标为整数的点,点x1 y1同点x2 y2之间的距离为:横纵坐标的差的绝对值之和,即:Abs(x1 - x2) + Abs(y1 - y2)(也称曼哈顿距离).求这N个点所组成的完全图 ...
- 浅尝辄止WPF自定义用户控件(实现颜色调制器)
主要利用用户控件实现一个自定义的颜色调制控件,实现一个小小的功能,具体实现界面如下. 首先自己新建一个wpf的用户控件类,我就放在我的wpf项目的一个文件夹下面,因为是一个很小的东西,所以就没有用mv ...
- mysql常用的提权方法
一,利用MOF提权 Windows 管理规范 (WMI) 提供了以下三种方法编译到 WMI 存储库的托管对象格式 (MOF) 文件: 方法 1: 运行 MOF 文件指定为命令行参数将 Mofcomp. ...
- 爬 NationalData ,虽然可以直接下,但还是爬一下吧
爬取的是分省月度数据,2017年的,包括:居民消费价格指数,食品烟酒类居民消费价格指数,衣着类居民消费价格指数,居住类居民消费价格指数,生活用品及服务类居民消费价格指数,交通和通信类居民消费价格指数, ...