效果大致如下:

主要实现方式:

该效果主要用到animation-timing-function中的steps()函数,该函数主要用于分步隐藏不同模块。

实现思路:

第一步动画:

第二步动画:

第三步动画:

第四步动画:

旋转半圆:

将gif动画分解为四步实现,每一步都是由旋转半圆旋转实现动画效果,再通过steps函数分步隐藏不同模块实现整个连贯动画。

全部代码:

 <!DOCTYPE HTML>
<html>
<head>
<title></title>
<meta charset=UTF-8 />
<style>
.wrap {
width: 64px;
height: 64px;
position: relative;
}
.inner, .inner2 {
position: absolute;
width: 38px;
height: 38px;
border-radius: 40px;
overflow: hidden;
left: 13px;
top: 13px;
}
.inner { opacity: 1; background-color: #89abdd;
animation: second-half-hide 1.6s steps(1, end) infinite;
}
.inner2 { opacity: 0; background-color: #4b86db;
animation: second-half-show 1.6s steps(1, end) infinite;
}
.spiner, .filler, .masker {
position: absolute;
width: 50%;
height: 100%;
}
.spiner {
border-radius: 40px 0 0 40px;
background-color: #4b86db;
transform-origin: right center;
animation: spin 800ms infinite linear;
left: 0;
top: 0;
}
.filler {
border-radius: 0 40px 40px 0;
background-color: #4b86db;
animation: second-half-hide 800ms steps(1, end) infinite;
left: 50%;
top: 0;
opacity: 1;
}
.masker {
border-radius: 40px 0 0 40px;
background-color: #89abdd;
animation: second-half-show 800ms steps(1, end) infinite;
left: 0; top: 0;
opacity: 0;
} .inner2 .spiner, .inner2 .filler {
background-color: #89abdd;
}
.inner2 .masker {
background-color: #4b86db;
} /*旋转动画*/
@keyframes spin {
0% { transform: rotate(360deg); }
100% { transform: rotate(0deg); }
}
/*分步显示动画*/
@keyframes second-half-hide {
0% { opacity: 1; }
50%, 100% { opacity: 0; }
}
/*分步显示动画*/
@keyframes second-half-show {
0% { opacity: 0; }
50%, 100% { opacity: 1; }
}
</style>
</head>
<body>
<body>
<div class="wrap">
<div class="inner">
<!-- 顶层旋转效果 -->
<div class="spiner"></div>
<!-- 右侧分步显示半圆 -->
<div class="filler"></div>
<!-- 左侧分步显示半圆 -->
<div class="masker"></div>
</div>
<div class="inner2">
<div class="spiner"></div>
<div class="filler"></div>
<div class="masker"></div>
</div>
</div>
</body>
</html>

参考文章:http://www.zhangxinxu.com/wordpress/2014/04/css3-pie-loading-waiting-animation/

http://www.tuicool.com/articles/neqMVr

animation-timing-function

CSS3 之loading动画实现思路的更多相关文章

  1. 纯CSS3文字Loading动画特效

    纯CSS3文字Loading动画特效是一款个性的loading文字加载动画. 在线演示本地下载

  2. css3波浪形loading动画

    css3做个第一个动画,主要点在box-shadow和background的变化,虽然不难,但是还是有一定的技巧性的!备注下 html <div class="loading" ...

  3. CSS3实现Loading动画特效

    查看效果:http://hovertree.com/texiao/css3/43/ 代码如下: <!DOCTYPE html> <html> <head> < ...

  4. 【CSS3】loading动画

    HTML: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF ...

  5. 分享web前端七款HTML5 Loading动画特效集锦

    以前我们大部分的Loading动画都是利用gif图片实现的,这种图片实现Loading动画的方法虽然也很不错,但是作为HTML5开发者来说,如果能利用HTML5和CSS3实现这些超酷的Loading动 ...

  6. 7 款华丽的 HTML5 Loading 动画特效

    我们在进行大数据的传输或者复杂操作的等待时,最好能有一个Loading等待的小动画提示用户.本文将为大家分享一些超华丽的基于HTML5的Loading加载动画特效,希望你会喜欢. 1.HTML5 Ca ...

  7. 简单的CSS3 Loading动画

    最终效果如图一,gif图片稍微有点卡顿,事实上代码在浏览器里执行得很流畅.这里面用到的css3技术非常简单,分别是border-radius.伪元素.css3关键帧以及animation动画. 首先整 ...

  8. 纯css3 加载loading动画特效

    最近项目中要实现当页面还没有加载完给用户提示正在加载的loading,本来是想做个图片提示的,但是图片如果放大电脑的分辨率就会感觉到很虚,体验效果很不好.于是就采用css3+js实现这个loading ...

  9. CSS3效果:animate实现点点点loading动画效果(二)

    box-shadow实现的打点效果 简介 box-shadow理论上可以生成任意的图形效果,当然也就可以实现点点点的loading效果了. 实现原理 html代码,首先需要写如下html代码以及cla ...

随机推荐

  1. Bootstrap中的datetimepicker用法总结

    bootstrap时间控件参考文档(少走弯路) https://blog.csdn.net/hizzyzzh/article/details/51212867#31-format-%E6%A0%BC% ...

  2. Spring-Cloud之Feign声明式调用-4

    一.Feign受Retrofit.JAXRS-2.0和WebSocket影响,采用了声明式API 接口的风格,将Java Http 客户端绑定到它的内部. Feign 首要目的是将 Java Http ...

  3. Go defer 会有性能损耗,尽量不要用?

    上个月在 @polaris @轩脉刃 的全栈技术群里看到一个小伙伴问 “说 defer 在栈退出时执行,会有性能损耗,尽量不要用,这个怎么解?”. 恰好前段时间写了一篇 <深入理解 Go def ...

  4. 1 matplotlib绘制折线图

    from matplotlib import pyplot as plt #设置图形大小 plt.figure(figsize=(20,8),dpi=80) plt.plot(x,y,color=&q ...

  5. Python进阶(八)----模块,import , from import 和 `__name__`的使用

    Python进阶(八)----模块,import , from import 和 __name__的使用 一丶模块的初识 #### 什么是模块: # 模块就是一个py文件(这个模块存放很多相似的功能, ...

  6. MySQL Replication--复制基本工作原理

    复制工作原理(1) master将改变记录到二进制日志(binary log)中(这些记录叫做二进制日志事件,binary log events):(2) slave将master的binary lo ...

  7. DELL R720针对磁盘故障面板信息误报解决

    现象: 面板报警信息显示 PDR1101 fault detected on drive 0. Check drive... 经查资料是磁盘故障的原因,而r720的idrac似乎我们没有安装,我不能通 ...

  8. django的缓存实例应用

    那么多的可配置方法,我们用那个呢. 首先在setting中配置你想要的缓存,我这里就用文件的方式是配置.如图: 第二步: 第三步: 第四步:  实现结果: 总结: 都是指明当前资源的有效期,控制浏览器 ...

  9. Activity知识点详解

    Activity知识点详解 一.什么是Activity 官方解释: The Activity class is a crucial component of an Android app, and t ...

  10. MySQL/MariaDB数据库的性能测试

      MySQL/MariaDB数据库的性能测试 作者:尹正杰  版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.数据库服务衡量指标 qps: query per second(每秒支持多少查询 ...