纯css3 轮播图 利用keyframes
效果:

关键点:利用keyframes 原理:infinite
注意点:在处理关键帧动画的时候,注意处理好 总共花费的 animation-duration:time 与每帧延延迟的时间的交错;要让动画显得层次感,处理好 每帧的延迟时间;
多注意时间的穿插 ;效果更很好;下面只是我的小插图;画的不一定对;

以下是我的代码;有兴趣拷贝来看看,仅作为我的练习记录;关键帧要兼容其他浏览器,自行补充前缀即可;
下面附上源码;
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>纯css轮播图</title>
</head> <body> <style>
*{ margin:0 ; padding:0}
ul,li{ list-style:none; margin:0; padding:0;} .box,
.box:after {
position: fixed;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
z-index: 0;
}
.box:after {
content: '';
background: transparent url(../images/pattern.png) repeat top left;
}
.box li span {
width: 100%;
height: 100%;
position: absolute;
top: 0px;
left: 0px;
background-size: cover;
background-position: 50% 50%;
background-repeat: none; background-color:#333;
opacity: 0;
z-index: 0;
-webkit-backface-visibility: hidden;
-webkit-animation: imageAnimation 18s linear infinite 0s;
-moz-animation: imageAnimation 18s linear infinite 0s;
-o-animation: imageAnimation 18s linear infinite 0s;
-ms-animation: imageAnimation 18s linear infinite 0s;
animation: imageAnimation 18s linear infinite 0s;
}
.box li div {
z-index: 1000;
position: absolute;
bottom: 30px;
left: 0px;
width: 100%;
text-align: center;
opacity: 0;
-webkit-animation: titleAnimation 18s linear infinite 0s;
-moz-animation: titleAnimation 18s linear infinite 0s;
-o-animation: titleAnimation 18s linear infinite 0s;
-ms-animation: titleAnimation 18s linear infinite 0s;
animation: titleAnimation 18s linear infinite 0s;
}
.box li div h3 {
font-family: 'BebasNeueRegular', 'Arial Narrow', Arial, sans-serif;
font-size: 160px;
padding: 0 30px;
line-height: 120px;
color: rgba(255,255,255,0.8);
}
.box li:nth-child(1) span { background-image: url(../images/love5.jpg) }
.box li:nth-child(2) span {
background-image: url(../images/love3.jpg);
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
-o-animation-delay: 6s;
-ms-animation-delay: 6s;
animation-delay: 6s;
}
.box li:nth-child(3) span {
background-image: url(../images/love1.jpg);
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-o-animation-delay: 12s;
-ms-animation-delay: 12s;
animation-delay: 12s;
}
.box li:nth-child(2) div {
-webkit-animation-delay: 6s;
-moz-animation-delay: 6s;
-o-animation-delay: 6s;
-ms-animation-delay: 6s;
animation-delay: 6s;
}
.box li:nth-child(3) div {
-webkit-animation-delay: 12s;
-moz-animation-delay: 12s;
-o-animation-delay: 12s;
-ms-animation-delay: 12s;
animation-delay: 12s;
} @-webkit-keyframes imageAnimation {
0% {
opacity: 0;
-webkit-animation-timing-function: ease-in;
}
11% {
opacity: 1;
-webkit-transform: scale(1.05);
-webkit-animation-timing-function: ease-out;
}
30% {
opacity: 1;
-webkit-transform: scale(1.1);
}
35% {
opacity: 0;
-webkit-transform: scale(1.1) translateY(-20%);
}
49% {
opacity: 0;
-webkit-transform: scale(1.1) translateY(-60%);
}
100% { opacity: 0 ; -webkit-transform: scale(1.1) translateY(-100%);}
} @-moz-keyframes imageAnimation {
0% {
opacity: 0;
-moz-animation-timing-function: ease-in;
}
11% {
opacity: 1;
-moz-transform: scale(1.05);
-moz-animation-timing-function: ease-out;
}
30% {
opacity: 1;
-moz-transform: scale(1.1);
}
35% {
opacity: 0;
-moz-transform: scale(1.1) translateY(-20%);
}
49% {
opacity: 0;
-moz-transform: scale(1.1) translateY(-60%);
}
100% { opacity: 0 ; -moz-transform: scale(1.1) translateY(-100%);}
} @keyframes imageAnimation {
0% {
opacity: 0;
animation-timing-function: ease-in;
}
11% {
opacity: 1;
transform: scale(1.05);
animation-timing-function: ease-out;
}
30% {
opacity: 1;
transform: scale(1.1);
}
35% {
opacity: 0;
transform: scale(1.1) translateY(-20%);
}
49% {
opacity: 0;
transform: scale(1.1) translateY(-60%);
}
100% { opacity: 0 ; transform: scale(1.1) translateY(-100%);}
} @-webkit-keyframes titleAnimation {
0% {
opacity: 0;
-webkit-transform: translateY(-300%);
}
8% {
opacity: 1;
-webkit-transform: translateY(0%);
}
22% {
opacity: 1;
-webkit-transform: translateY(0%);
}
28% {
opacity: 0;
-webkit-transform: translateY(100%);
}
35% { opacity: 0 }
100% { opacity: 0 }
} @-moz-keyframes titleAnimation {
0% {
opacity: 0;
-moz-transform: translateY(-300%);
}
8% {
opacity: 1;
-moz-transform: translateY(0%);
}
22% {
opacity: 1;
-moz-transform: translateY(0%);
}
28% {
opacity: 0;
-moz-transform: translateY(100%);
}
35% { opacity: 0 }
100% { opacity: 0 }
} @keyframes titleAnimation {
0% {
opacity: 0;
transform: translateY(-300%);
}
8% {
opacity: 1;
transform: translateY(0%);
}
22% {
opacity: 1;
transform: translateY(0%);
}
28% {
opacity: 0;
transform: translateY(100%);
}
35% { opacity: 0 }
100% { opacity: 0 }
} /* Show at least something when animations not supported */
.no-cssanimations .box li span{
opacity: 1;
} </style>
<ul class="box">
<li><span>Image 01</span><div class="title"><h3>第1张</h3></div></li>
<li><span>Image 02</span><div class="title"><h3>第2张</h3></div></li>
<li><span>Image 03</span><div class="title"><h3>第3张</h3></div></li>
</ul> </body>
</html> 其他:
1,相同参数的可以写在一起;
2,可以只有to, 也可以只有类似50% 省略0%和100%;因为后面的会重置前面的样式;

纯css3 轮播图 利用keyframes的更多相关文章
- 纯CSS3轮播图
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- 纯js轮播图练习-1
偶尔练习,看视频自己学着做个简单的纯JS轮播. 简单的纯js轮播图练习-1. 样子就是上面图片那样,先不管好不好看,主要是学会运用和理解轮播的原理 掌握核心的理论知识和技术的操作,其他的都可以在这个基 ...
- css 纯css轮播图 示例
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...
- 纯js轮播图练习-2,js+css旋转木马层叠轮播
基于css3的新属性,加上js的操作,让现在js轮播图花样越来越多. 而现在出现的旋转木马层叠轮播的轮播图样式,却是得到了很多人都喜爱和投入使用. 尤其是在各大软件中,频繁的出现在大家的眼里,在web ...
- 纯js轮播图练习-3,类似于淘宝海报带小圆点轮播图
基于js和css,跟着网上的视频教程,结合自己想要的效果,做出了一个类似于淘宝海报的效果. 如图:淘宝首页 自己做的: 代码: <!DOCTYPE html> <html> & ...
- 纯js轮播图
<div id="wrapper"> <div id="container"> <img src="http://ima ...
- 纯CSS3实现轮播图
前言 纯css3实现的轮播图效果,和JavaScript控制的相比,简单高效了很多,但是功能也更加单一,只有轮播不能手动切换. 用什么实现的呢?页面布局 + animation动画 HTML部分 &l ...
- 纯CSS实现轮播图效果,你不知道的CSS3黑科技
前言 轮播图已经是一个很常见的东西,尤其是在各大App的首页顶部栏,经常会轮番显示不同的图片. 一提到轮播图如何实现时,很多人的第一反应就是使用Javascript的定时器,当然这种方法是可以实现的. ...
- css3 - 纯css实现一个轮播图
这是我上一次的面试题.一晃两个月过去了. 从前都是拿原理骗人,把怎么实现的思路说出来. 我今天又被人问到了,才想起来真正码出来.码出来效果说明一切: 以上gif,只用到了5张图片,一个html+css ...
随机推荐
- 在iOS7中改动状态栏字体的颜色
状态栏的字体为黑色:UIStatusBarStyleDefault 状态栏的字体为白色:UIStatusBarStyleLightContent 一.在info.plist中,将View contro ...
- 编C语言单元测试框架CUnit方法库
/********************************************************************* * Author : Samson * Date ...
- Mac maven环境变量配置
近期一直在学习使用Macbook,在这里记录一下全部遇到的问题 问题起源: 1.Macbook 安装了Eclipse,Eclipse装入插件maven & git , 可是在git中clone ...
- bnu1066
hnu1066 给我们一张图,问我们摧毁边使得s和t不连通有多少种方案, 方案与方案之间不能存在相同的摧毁目标. 这是一个神奇的题目. 这题可以转为求s与t的最短路,为什么呢? 因为方案与方案之间不能 ...
- Windows Phone开发(17):URI映射
原文:Windows Phone开发(17):URI映射 前面在讲述导航的知识,也讲了控件,也讲了资源,样式,模板,相信大家对UI部分的内容应该有了很直观的认识了.那么今天讲什么呢?不知道大家在练习导 ...
- Git打补丁常见问题
Git打补丁常见问题 往往觉得得到某个功能的补丁就觉得这个功能我就已经成功拥有了,可是在最后一步的打补丁的工作也是须要相当慎重的,甚至有可能还要比你获取这个补丁花费的时间还要多.看到好多同行遇到这个问 ...
- 基于struct2完整的用户登录
第一lib在导入struct2相应jar包 在web.xml组态struct2过滤器 <filter> <filter-name>struts2</filter-name ...
- JMS and ActiveMQ first lesson(转)
JMS and ActiveMQ first lesson -- jms基础概念和应用场景 2011-6-18 PM 9:30 主讲:kimmking <kimmking@163.com> ...
- 【程序员小助手】Synergy,感受穿越屏幕之美
内容简介 1.Synergy简介 2.Synergy安装与配置 3.附录 [程序员小助手]系列 在这个系列文章中(不定期更新),小编会把这些年(也没几年)的编程学习和工作中使用到的个人感觉非常好的软件 ...
- UVa 514 Rails(经典栈)
Rails There is a famous railway station in PopPush City. Country there is incredibly hilly. The st ...