本篇文章由:http://xinpure.com/css3-implementations-of-loading-an-animation-effect/

Loading 的菊花图形组合的不太好,基本上实现这个功能了

动画解析

这个动画用到的 CSS3 特性:

  1. transform 主要使用 transform 属性的 rotate,将线条组合成 Loading 图形 (也就是常见的菊花图形)

  2. 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实现加载中的动画效果的更多相关文章

  1. 用C3中的animation和transform写的一个模仿加载的时动画效果

    用用C3中的animation和transform写的一个模仿加载的时动画效果! 不多说直接上代码; html标签部分 <div class="wrap"> <h ...

  2. 页面加载中jquery逐渐消失效果实现

    为了获得更好的用户体验,现在大多数网页都会在页面中加一个加载中效果,这里实现一个加载中逐渐消失的效果,以至于看上去不那么生硬. html: <div id="loading" ...

  3. 纯CSS3技术 加载中

    你能相信吗?这些都是由一个DIV元素实现的动画,纯CSS3技术 html  <div class="loader">加载中...</div> css: 图( ...

  4. [TimLinux] CSS 实现加载中的动画

    内容来自对<CSS世界>学习代码的理解简化: <!DOCTYPE html> <html> <head> <style> div { pad ...

  5. css3 同时加载两个动画

    最近在做H5,遇到这样的需求(如题) 先上一部分代码: .cur .p1d1d4{   width: 3rem;   margin: 2rem 5.3rem 0 0;   -webkit-animat ...

  6. css3实现的3中loading动画效果

    一.css3中animation动画各种属性详解: animation Value:     [<animation-name> || <animation-duration> ...

  7. 一个加载时带动画效果的ListBoxItem

    今天我们来谈一下ListBoxItem这个控件,ListBoxItem是直接从ContentControl继承而来的,所以可以添加到任何具有Content属性的控件中去,常见的ListBoxItem可 ...

  8. CSS3实现加载中效果

    代码: <!doctype html> <html> <head> <meta charset="utf-8" /> <tit ...

  9. android image加载中等待动画

    在布局中添加一个ImageViw和一个EditText. <ImageView android:id="@+id/loading_imageView_info" androi ...

随机推荐

  1. 【计算几何】【分类讨论】Gym - 101243I - Land Division

    题意:给你一个n个点的凸包,让你切一刀,使得它变成一个m边形和一个K边形,问你切的这一刀最短是多少. 如果m+K==n+4,那么一定切在两条边上,但是由于两个线段间的最短距离,至少会经过一条线段的一个 ...

  2. 【FFT】HDU4609-3 idiots

    ..退化为一天两题了,药丸.. [题目大意] 给出n根木棍的长度,求从其中取出3根能组成三角形的概率. [思路] 然后枚举求前缀和,枚举最长边.假设最长边为l,先求出所有两边之和大于它的情况数.然后减 ...

  3. django框架下celery+rabbitmq+flower完成异步任务

    [转载请注明出处:] http://www.cnblogs.com/yukityan/p/8035787.html 环境: ubuntu16.04 64位 安装: sudo apt-get insta ...

  4. iOS中深拷贝、浅拷贝和retain的区别

    浅拷贝:浅拷贝是对object对象的指针拷贝,让指针指向同一块内存地址,“对象永远只有一个",浅拷贝使对象的引用计数器+1.代码如下: 可以看出不可变字符串的指针指向了同一地址,并没有重新开 ...

  5. Web API使用记录系列(四)OAuth授权与身份校验

    呼,开干第四篇,基于OWIN搭建OAuth认证授权服务器与接口身份校验. OAuth包含授权码模式.密码模式.客户端模式和简化模式,这里我们文章记录的是密码模式和客户端模式. 目录 引用安装 授权处理 ...

  6. css/js(工作中遇到的问题)-6

    页面resize方法 if(document.createEvent) { const event = document.createEvent ("HTMLEvents"); e ...

  7. linux图机界面机制

    1.X WindowX Window 是由麻省理工学院(MIT)推出的窗口系统,简称X,它旨在建立不依赖于特定硬件系统的图形和文字显示窗口系统的标准.1987 年9 月,MIT 推出了X 系统的11 ...

  8. JavaScript 创建类/对象的几种方式

    在JS中,创建对象(Create Object)并不完全是我们时常说的创建类对象,JS中的对象强调的是一种复合类型,JS中创建对象及对对象的访问是极其灵活的. JS对象是一种复合类型,它允许你通过变量 ...

  9. XssEncode

    0x00 闲扯 好吧继上一篇文章之后,就没发文章了!(其实是一直在写但是写的很少还凑不起一篇文章而已) 但是这几天对插件进行了一定的改良了 因为在自己在实际的XSS过程中也发现了自己的插件 还不够强大 ...

  10. python matplotlib.pyplot学习记录

    matplotlib是python中很强大的绘图工具,在机器学习中经常用到 首先是导入 import matplotlib.pyplot as plt plt中有很多方法,记录下常用的方法 plt.p ...