CSS3实现加载中的动画效果
本篇文章由:http://xinpure.com/css3-implementations-of-loading-an-animation-effect/
Loading 的菊花图形组合的不太好,基本上实现这个功能了
动画解析
这个动画用到的 CSS3 特性:
transform 主要使用
transform属性的rotate,将线条组合成 Loading 图形 (也就是常见的菊花图形)animation 实现将线条颜色由浅到深,再由深到浅来回变换的动画,通过
animation-delay属性来使颜色的变换产生过渡的效果,从而达到类似于 Loading 动画的效果
效果实例
HTML Code
<div class="loading">
<span class="line1"></span>
<span class="line2"></span>
<span class="line3"></span>
<span class="line4"></span>
<span class="line5"></span>
<span class="line6"></span>
<span class="line7"></span>
<span class="line8"></span>
</div>
CSS Code
.loading {
width: 80px;
height: 60px;
margin: 0 auto;
position: relative;
}
span {
width: 4px;
height: 20px;
background-color: #ccc;
position: absolute;
left: 38px;
-webkit-animation: loading 1s infinite;
}
.line1 {
background-color: #000;
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
-webkit-animation-delay: .3s;
}
.line2 {
top: 5px;
left: 52px;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-animation-delay: .4s;
}
.line3 {
top: 18px;
left: 57px;
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
-webkit-animation-delay: .5s;
}
.line4 {
top: 31px;
left: 52px;
-webkit-transform: rotate(135deg);
transform: rotate(135deg);
-webkit-animation-delay: .6s;
}
.line5 {
top: 37px;
-webkit-animation-delay: .7s;
}
.line6 {
top: 32px;
left: 24px;
-webkit-transform: rotate(-135deg);
transform: rotate(-135deg);
-webkit-animation-delay: .8s;
}
.line7 {
top: 18px;
left: 19px;
-webkit-transform: rotate(-90deg);
transform: rotate(-90deg);
-webkit-animation-delay: .9s;
}
.line8 {
top: 5px;
left: 24px;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-animation-delay: 1s;
}
@-webkit-keyframes loading {
0% {
background-color: #ccc;
}
50% {
background-color: #000;
}
100% {
background-color: #ccc;
}
}
效果示图

CSS3实现加载中的动画效果的更多相关文章
- 用C3中的animation和transform写的一个模仿加载的时动画效果
用用C3中的animation和transform写的一个模仿加载的时动画效果! 不多说直接上代码; html标签部分 <div class="wrap"> <h ...
- 页面加载中jquery逐渐消失效果实现
为了获得更好的用户体验,现在大多数网页都会在页面中加一个加载中效果,这里实现一个加载中逐渐消失的效果,以至于看上去不那么生硬. html: <div id="loading" ...
- 纯CSS3技术 加载中
你能相信吗?这些都是由一个DIV元素实现的动画,纯CSS3技术 html <div class="loader">加载中...</div> css: 图( ...
- [TimLinux] CSS 实现加载中的动画
内容来自对<CSS世界>学习代码的理解简化: <!DOCTYPE html> <html> <head> <style> div { pad ...
- css3 同时加载两个动画
最近在做H5,遇到这样的需求(如题) 先上一部分代码: .cur .p1d1d4{ width: 3rem; margin: 2rem 5.3rem 0 0; -webkit-animat ...
- css3实现的3中loading动画效果
一.css3中animation动画各种属性详解: animation Value: [<animation-name> || <animation-duration> ...
- 一个加载时带动画效果的ListBoxItem
今天我们来谈一下ListBoxItem这个控件,ListBoxItem是直接从ContentControl继承而来的,所以可以添加到任何具有Content属性的控件中去,常见的ListBoxItem可 ...
- CSS3实现加载中效果
代码: <!doctype html> <html> <head> <meta charset="utf-8" /> <tit ...
- android image加载中等待动画
在布局中添加一个ImageViw和一个EditText. <ImageView android:id="@+id/loading_imageView_info" androi ...
随机推荐
- 【费用流】NOI2008志愿者招募
1061: [Noi2008]志愿者招募 Time Limit: 20 Sec Memory Limit: 162 MBSubmit: 5171 Solved: 3089[Submit][Stat ...
- 【找规律】【递归】XVII Open Cup named after E.V. Pankratiev Stage 4: Grand Prix of SPb, Sunday, Octorber 9, 2016 Problem F. Doubling
题意: 给你一个n,问你R(n)对应的字符串长度最小的是啥. dp打个表出来,f(i)表示i值对应的字符串的最小长度,发现f(1)=1,f(2)=2,其他的情况下,若是偶数,则恰好在其外面加一对中括号 ...
- 【Manacher算法】poj3974 Palindrome
Manacher算法教程:http://blog.csdn.net/ggggiqnypgjg/article/details/6645824 模板题,Code 附带注释: #include<cs ...
- 【枚举+贪心】POJ2718-Smallest Difference
[题目大意] 按升序输出几个不同的数字,任意组成两个数字,输出最小的差值. [思路] 虽然是在穷竭搜索的章节里找到的题目,但是我觉得不需要穷竭搜索,枚举一下就可以了,0MS.分为一下三种情况: (1) ...
- c99柔性数组
变长结构体 struct test { int nSize; char data[]; // 或者 char data[0];但建议使用 char data[]; 注意:c98 时不支持柔性数组,其仅 ...
- window下命令行的方式安装svn服务端
下载Binary Packages类型的 安装文件 https://www.visualsvn.com/server/download/ 自己选择版本 第一步 :开始安装到 c:/software ...
- JavaScript 匹配字符串偶数位置的字符 及匹配 $ 符号
已知一个字符串#####,现需要替换偶数位置的#为&. function replaceDemo(){ var s = "1#2#3#4#5#"; var regex = ...
- Linux中的黑洞(black hole)-/dev/null
http://blog.csdn.net/loongshawn/article/details/50514018
- 【spring】【spring mvc】【spring boot】获取spring cloud项目中所有spring mvc的请求资源
实现的方法: 1.在父级项目中 或者 每个微服务都引用的项目中添加实体类Resource 2.在父级项目中 或者 每个为服务都引用的项目中写一个工具类,作用是用来获取请求资源 3.在每一个微服务的启动 ...
- Bestreviewapp给iOS软件写评论赚钱
BestReviewApp 这是一个评论类的活动,网站上会提供App列表,在iTunes评论这些应用就能获得报酬.目前账号中的余额可通过PayPal或支付宝提取出来.BestReviewApp 开放的 ...