css 动画效果
要搞就搞明白,一知半解时停止研究 损失最大
css3意义:
CSS3 动画
通过 CSS3,我们能够创建动画,这可以在许多网页中取代动画图片、Flash 动画以及 JavaScript。
重点知识
CSS3 @keyframes 规则
如需在 CSS3 中创建动画,您需要学习 @keyframes 规则。
@keyframes 规则用于创建动画。在 @keyframes 中规定某项 CSS 样式,就能创建由当前样式逐渐改为新样式的动画效果。
CSS3 动画属性
下面的表格列出了 @keyframes 规则和所有动画属性:
属性
描述
CSS
@keyframes
规定动画。
3
animation
所有动画属性的简写属性,除了 animation-play-state 属性。
3
animation-name
规定 @keyframes 动画的名称。
3
animation-duration
规定动画完成一个周期所花费的秒或毫秒。默认是 0。
3
animation-timing-function
规定动画的速度曲线。默认是 "ease"。
3
animation-delay
规定动画何时开始。默认是 0。
3
animation-iteration-count
规定动画被播放的次数。默认是 1。
3
animation-direction
规定动画是否在下一周期逆向地播放。默认是 "normal"。
3
animation-play-state
规定动画是否正在运行或暂停。默认是 "running"。
3
animation-fill-mode
规定对象动画时间之外的状态。
3
参考资料:http://www.w3school.com.cn/css3/css3_animation.asp
作业:
1.实现颜色的变化
@keyframes myfirst
{
from {background: red;}
to {background: yellow;}
}
,多种颜色变化
@keyframes myfirst
{
0% {background: red;}
25% {background: yellow;}
50% {background: blue;}
100% {background: green;}
}
2.实现颜色和位置的变化
@keyframes myfirst
{
0% {background: red; left:0px; top:0px;}
25% {background: yellow; left:200px; top:0px;}
50% {background: blue; left:200px; top:200px;}
75% {background: green; left:0px; top:200px;}
100% {background: red; left:0px; top:0px;}
}
3.重复
animation-iteration-count 规定动画被播放的次数
animation-iteration-count:1;
-webkit-animation-iteration-count:1; /* Safari 和 Chrome */
设置一个够大的数。
简写一个参数
animation-name: myfirst;
animation-duration: 5s;
animation-timing-function: linear;
animation-delay: 2s;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: running;
animation: myfirst 5s linear 2s infinite alternate;
/* Firefox: */
-moz-animation: myfirst 5s linear 2s infinite alternate;
/* Safari 和 Chrome: */
-webkit-animation: myfirst 5s linear 2s infinite alternate;
/* Opera: */
-o-animation: myfirst 5s linear 2s infinite alternate;
实际应用:
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no"/>
<style type="text/css">
@keyframes passdown {
0% {
bottom: 5px;
}
50% {
bottom: 12px;
}
100% {
bottom: 5px;
}
}
@-webkit-keyframes passdown {
0% {
bottom: 5px;
}
50% {
bottom: 12px;
}
100% {
bottom: 5px;
}
}
.one-slide-8 {
opacity: 1;
transition: all 0.1s ease-in 5.1s;
-webkit-transition: all 0.1s ease-in 5.1s;
}
.pub-passdown {
position: absolute;
width: 18px;
height: 16px;
left: 50%;
margin-left: -9px;
bottom: 10px;
/*transition: all 1s ease-in 20s;*/
animation-name: passdown;
animation-timing-function: ease;
animation-duration: 0.8s;
animation-iteration-count: infinite;
/*-webkit-transition: all 1s ease-in 20s;*/
-webkit-animation-name: passdown;
-webkit-animation-timing-function: ease;
-webkit-animation-duration: 0.8s;
-webkit-animation-iteration-count: infinite;
}
</style>
</head>
<body style="background-color:#000000">
<div class="one-slide-8 pub-passdown">
<img src="http://m.yintai.com/event/actives/luyaninvitation/img/arrow-doubleup.png"/>
</div>
</body>
</html>
css 动画效果的更多相关文章
- 15个来自 CodePen 的酷炫 CSS 动画效果【下篇】
CodePen 是一个在线的前端代码编辑和展示网站,能够编写代码并即时预览效果.你在上面可以在线分享自己的 Web 作品,也可以欣赏到世界各地的优秀开发者在网页中实现的各种令人惊奇的效果. 今天这篇文 ...
- 赞!15个来自 CodePen 的酷炫 CSS 动画效果
CodePen 是一个在线的前端代码编辑和展示网站,能够编写代码并即时预览效果.你在上面可以在线分享自己的 Web 作品,也可以欣赏到世界各地的优秀开发者在网页中实现的各种令人惊奇的效果. 今天这篇文 ...
- CSS动画效果的回调
用纯JS实现动画效果代码量大,计算复杂.因此现在前端页面的动画效果一般都采用CSS来实现. CSS动画实现简单高效,但是在处理动画,控制动画过程上却缺少一些有效手段. 例如我们想在动画效果完成时调用回 ...
- CSS动画效果
CSS变形效果 Transform translate:平移 translate(x,y) translateX(x) translateY(y)相对于元素原始位置平移. scale:缩放 大于1放大 ...
- 运动曲线提升CSS动画效果
原文链接 译文\译者鞠大宝 先有UI动画,然后才会有好的UI动画.好的动画会让人惊叹“哇哦!”——因为页面看上去很流畅.很漂亮,最重要的是,自然,一点都不会让人觉得不和谐或者僵硬死板.如果你经常逛Dr ...
- CSS动画效果之animation
Y(^o^)Y css动画大乱弹之animation. 概述 什么是animation呢?在回答这个问题之前,先要说明什么叫做@keyframe(关键帧).@keyframe算是一个动画模板.在其中, ...
- react中使用css动画效果
index.js import React, { Component, Fragment } from 'react'; class App extends Component { construct ...
- web前端学习(三)css学习笔记部分(8)-- SVN的介绍和应用、CSS动画效果、CSS3布局属性全接触
15.SVN的介绍和应用 15.1.SVN的介绍和应用课程概要 将代码进行集中管理,有版本号的进行迭代,方便集体工作的build流程 15.2.SVN的介绍 SVN是Subversion的简称,是一个 ...
- css动画效果之transition(动画过渡效果属性)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
随机推荐
- hdu 3234 并查集
虚拟一个根节点n,设其值为0.并且始终保持其为根. #include<map> #include<set> #include<cmath> #include< ...
- 有一种风格,叫做 Low Poly 3D
原作:Simon阿文 杂交编辑者:RhinoC 个人更推崇使用第二款神器 ImageTriangulator :http://www.conceptfarm.ca/2013/port ...
- 转: 数字证书原理 https 完整过程解析
点评: 讲的非常的详细与全面,值得一看. 转: http://www.cnblogs.com/JeffreySun/archive/2010/06/24/1627247.html 文中首先解释了加密解 ...
- selenium判断元素类型
在做级联的下拉框时发现第一次选择了下拉框(如省份),第二个下拉框可能是输入框,也可能是下拉框,这个时候就需要判断他的元素类型,来做判断 图1 图2 原理很简单:获取控件的html文件内容,拿到内容后在 ...
- Eclipse中调试技巧
1.打印输出 System.outprintln(“执行了此程序"); 2.运用Log方法: 示例 Log.d("myDubug", "myFirstDebu ...
- iOS 通过tag查找控件
//比如创建一个UIImageView到view上 UIImageView *imageView = [[UIImageView allc] init]; imageView.tag = 10001; ...
- javascript 操作复选框无效
<script type="text/javascript"> // 操作checkbox复选框按钮 var inputs = $('#article_list').f ...
- ASP.Net 获取当前时间,包含各种时间格式
在c# / ASP.net中我们可以通过使用DataTime这个类来获取当前的时间.通过调用类中的各种方法我们可以获取不同的时间:如:日期(2008-09-04).时间(12:12:12).日期+时间 ...
- sql获取时间时分秒
select datename(hour,getdate())+':'+datename(minute,getdate())+':'+datename(second,getdate())
- .net 后台中对html标签按钮跳转后台以及后台简单验证
---------------------------------学霸,学神,大牛,hacker请绕道de分割线-------------------------------------------- ...