实例教程 纯CSS3打造非常炫的加载动画效果


Posted in HTML / CSS onNovember 05, 2014

纯css3打造的一款非常炫的加载图。用在需要一定时间加载的地方非常合适。代码非常简单。没有用任何javascript代码。纯css3实现。先上效果图:

实例教程 纯CSS3打造非常炫的加载动画效果

实现代码如下:

html代码:

XML/HTML Code复制内容到剪贴板
  1. <div class="content">  
  2.        <div style="width: 970px; margin: auto">  
  3.        </div>  
  4.        <div class="rotate">  
  5.            <span class="triangle base"></span><span class="triangle no1"></span><span class="triangle no2">  
  6.            </span><span class="triangle no3"></span>  
  7.        </div>  
  8.    </div>  

CSS代码:

CSS Code复制内容到剪贴板
  1. body {   
  2.     padding:0;   
  3.     margin:0;      
  4.     background-color#2a4e66;   
  5.   overflowhidden;   
  6. }   
  7.   
  8. .content {   
  9.     width:100%;   
  10.     height:100%;   
  11.     top:0;   
  12.     rightright:0;   
  13.     bottombottom:0;   
  14.     left:0;   
  15.     position:absolute;   
  16. }   
  17.   
  18. .rotate {   
  19.     positionabsolute;   
  20.     top: 50%;   
  21.     left: 50%;   
  22.     margin: -93px 0 0 -93px;   
  23.     backgroundtransparent;   
  24.     width186px;   
  25.     height186px;   
  26.     border-radius: 50%;   
  27.     z-index: 20;   
  28. }   
  29.   
  30. .rotate:after {   
  31.     content'';       
  32.     positionabsolute;   
  33.     box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffffinset 0 0 2px #ffffffinset 0 0 4px #ffffff;   
  34.     width186px;   
  35.     height186px;   
  36.     border-radius: 50%;   
  37.     z-index: 10;   
  38. }   
  39.   
  40. span.triangle.base {   
  41.     positionabsolute;   
  42.     width: 0;    
  43.     height: 0;   
  44.     margin46px 0 0 13px;   
  45.     border-left80px solid transparent;   
  46.     border-right80px solid transparent;                  
  47.     border-top140px solid #eeeeee;   
  48.     transform-origin: 50% 50%;   
  49.     z-index: 20;   
  50. }   
  51.   
  52. span.triangle.no1 {   
  53.     positionabsolute;   
  54.     margin46px 0 0 13px;   
  55.     width: 0;    
  56.     height: 0;    
  57.     border-left80px solid transparent;   
  58.     border-right80px solid transparent;                  
  59.     border-bottom140px solid #eeeeee;   
  60.     transform-origin: 0 100%;   
  61.     z-index: 20;   
  62. }   
  63.   
  64. span.triangle.no2 {   
  65.     positionabsolute;   
  66.     margin46px 0 0 13px;   
  67.     width: 0;    
  68.     height: 0;    
  69.     border-left80px solid transparent;   
  70.     border-right80px solid transparent;                  
  71.     border-bottom140px solid #eeeeee;   
  72.     transform-origin: 100% 100%;   
  73.     z-index: 20;   
  74. }   
  75.   
  76. span.triangle.no3 {   
  77.     positionabsolute;   
  78.     margin46px 0 0 13px;   
  79.     width: 0;    
  80.     height: 0;    
  81.     border-left80px solid transparent;   
  82.     border-right80px solid transparent;                  
  83.     border-bottom140px solid #eeeeee;   
  84.     transform-origin: 50% 100%;   
  85.     z-index: 20;   
  86. }   
  87.   
  88. /* Animation */  
  89.   
  90. .rotate {   
  91.     -webkit-animation: rotateTriangle 3s linear infinite;   
  92.     animation: rotateTriangle 3s linear infinite;   
  93. }   
  94.   
  95. @-webkit-keyframes rotateTriangle {   
  96.     from { -webkit-transform: rotate(0deg); }   
  97.     to { -webkit-transform: rotate(60deg); }   
  98. }   
  99. @keyframes rotateTriangle {   
  100.     from { transform: rotate(0deg); }   
  101.     to { transform: rotate(60deg); }   
  102. }   
  103.   
  104. .rotate:after {   
  105.     -webkit-animation: glowAnimation 3s ease infinite;   
  106.     animation: glowAnimation 3s ease infinite;   
  107. }   
  108.   
  109. @-webkit-keyframes glowAnimation {         
  110.     0% { box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffffinset 0 0 2px #ffffffinset 0 0 4px #ffffff; }   
  111.     10% { box-shadow: 0 0 80px #ffffff, 0 0 20px #ffffff, 0 0 2px #ffffffinset 0 0 4px #ffffffinset 0 0 8px #ffffff; }   
  112.     100% { box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffffinset 0 0 2px #ffffffinset 0 0 4px #ffffff; }   
  113. }   
  114. @keyframes glowAnimation {   
  115.     0% { box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffffinset 0 0 2px #ffffffinset 0 0 4px #ffffff; }   
  116.     10% { box-shadow: 0 0 80px #ffffff, 0 0 20px #ffffff, 0 0 2px #ffffffinset 0 0 4px #ffffffinset 0 0 8px #ffffff; }   
  117.     100% { box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffffinset 0 0 2px #ffffffinset 0 0 4px #ffffff; }   
  118. }   
  119.   
  120. span.triangle.base {   
  121.     -webkit-animation: scaleTriangleBase 3s linear infinite;   
  122.     animation: scaleTriangleBase 3s linear infinite;   
  123. }   
  124.   
  125. @-webkit-keyframes scaleTriangleBase {   
  126.     from { -webkit-transform: translate(0px,-11px) scale(0.5); }   
  127.     to { -webkit-transform: translate(0px,0px) scale(1); }   
  128.     }   
  129. @keyframes scaleTriangleBase {   
  130.     from { transform: translate(0px,-11px) scale(0.5); }   
  131.     to { transform: translate(0px,0px) scale(1); }   
  132. }   
  133.   
  134. span.triangle.no1 {   
  135.     -webkit-animation: scaleTriangleOne 3s linear infinite;   
  136.     animation: scaleTriangleOne 3s linear infinite;   
  137. }   
  138.   
  139. @-webkit-keyframes scaleTriangleOne {   
  140.     from { -webkit-transform: translate(0px,-46px) scale(0.5); }   
  141.     to { -webkit-transform: translate(-80px,0px) scale(0); }   
  142. }   
  143. @keyframes scaleTriangleOne {   
  144.     from { transform: translate(0px,-46px) scale(0.5); }   
  145.     to { transform: translate(-80px,0px) scale(0); }   
  146. }   
  147.   
  148. span.triangle.no2 {   
  149.     -webkit-animation: scaleTriangleTwo 3s linear infinite;   
  150.     animation: scaleTriangleTwo 3s linear infinite;   
  151. }   
  152.   
  153. @-webkit-keyframes scaleTriangleTwo {   
  154.     from { -webkit-transform: translate(0px,-46px) scale(0.5); }   
  155.     to { -webkit-transform: translate(80px,0px) scale(0); }   
  156. }   
  157. @keyframes scaleTriangleTwo {   
  158.     from { transform: translate(0px,-46px) scale(0.5); }   
  159.     to { transform: translate(80px,0px) scale(0); }   
  160. }   
  161.   
  162. span.triangle.no3 {   
  163.     -webkit-animation: scaleTriangleThree 3s linear infinite;   
  164.     animation: scaleTriangleThree 3s linear infinite;   
  165. }   
  166.   
  167. @-webkit-keyframes scaleTriangleThree {   
  168.     from { -webkit-transform: translate(0px,-116px) scale(0.5); }   
  169.     to { -webkit-transform: translate(0px,-280px) scale(0); }   
  170. }   
  171. @keyframes scaleTriangleThree {   
  172.     from { transform: translate(0px,-116px) scale(0.5); }   
  173.     to { transform: translate(0px,-280px) scale(0); }   
  174. }  

以上就是实现一款非常炫的加载图的css代码,谢谢阅读,希望能帮到大家,请继续关注三水点靠木,我们会努力分享更多优秀的文章。

HTML / CSS 相关文章推荐
一款利用html5和css3实现的3D立方体旋转效果教程
Apr 26 HTML / CSS
CSS3 translate导致字体模糊的实例代码
Aug 30 HTML / CSS
纯CSS3实现滚动的齿轮动画效果
Jun 05 HTML / CSS
CSS3属性background-size使用指南
Dec 09 HTML / CSS
CSS3毛玻璃效果(blur)有白边问题的解决方法
Nov 15 HTML / CSS
css3实现动画的三种方式
Aug 24 HTML / CSS
html5开发之viewport使用
Oct 17 HTML / CSS
针对HTML5的Web Worker使用攻略
Jul 12 HTML / CSS
HTML5中的进度条progress元素简介及兼容性处理
Jun 02 HTML / CSS
HTML5本地存储之Web Storage详解
Jul 04 HTML / CSS
HTML5和CSS3实例教程总结(推荐)
Jul 18 HTML / CSS
CSS预处理框架——Stylus
Apr 21 HTML / CSS
纯CSS3实现自定义Tooltip边框涂鸦风格的教程
Nov 05 #HTML / CSS
支持IE8的纯css3开发的响应式设计动画菜单教程
Nov 05 #HTML / CSS
一款利用纯css3实现的360度翻转按钮的实例教程
Nov 05 #HTML / CSS
css实例教程 一款纯css3实现的超炫动画背画特效
Nov 05 #HTML / CSS
一款纯css3实现的非常实用的鼠标悬停特效演示
Nov 05 #HTML / CSS
利用css3实现的简单的鼠标悬停按钮
Nov 04 #HTML / CSS
一款简洁的纯css3代码实现的动画导航
Oct 31 #HTML / CSS
You might like
Windows下部署Apache+PHP+MySQL运行环境实战
2012/08/31 PHP
PHP使用curl模拟post上传及接收文件的方法
2016/03/04 PHP
PHP微信分享开发详解
2017/01/14 PHP
PHP实现腾讯与百度坐标转换
2017/08/05 PHP
jQuery 动画弹出窗体支持多种展现方式
2010/04/29 Javascript
jquery列表拖动排列(由项目提取相当好用)
2014/06/17 Javascript
js使用removeChild方法动态删除div元素
2014/08/01 Javascript
浅谈JS闭包中的循环绑定处理程序
2014/11/09 Javascript
js实现搜索框关键字智能匹配代码
2020/03/26 Javascript
详解Node.js模块间共享数据库连接的方法
2016/05/24 Javascript
jquery+CSS3实现3D拖拽相册效果
2016/07/18 Javascript
微信小程序 WXML、WXSS 和JS介绍及详解
2016/10/08 Javascript
Angular2平滑升级到Angular4的步骤详解
2017/03/29 Javascript
Angular 2.0+ 的数据绑定的实现示例
2017/08/09 Javascript
jQuery Datatable 多个查询条件自定义提交事件(推荐)
2017/08/24 jQuery
JS实现快递单打印功能【推荐】
2018/06/21 Javascript
vue v-model动态生成详解
2018/06/30 Javascript
js实现图片跟随鼠标移动效果
2019/10/16 Javascript
[04:49]期待西雅图之战 2016国际邀请赛中国区预选赛WINGS战队赛后采访
2016/06/29 DOTA
[48:20]OpTic vs Serenity 2018国际邀请赛小组赛BO2 第二场 8.18
2018/08/19 DOTA
[01:31:02]TNC vs VG 2019国际邀请赛淘汰赛 胜者组赛BO3 第一场
2019/08/22 DOTA
Python正则抓取新闻标题和链接的方法示例
2017/04/24 Python
Python实现导出数据生成excel报表的方法示例
2017/07/12 Python
详解pandas.DataFrame中删除包涵特定字符串所在的行
2019/04/04 Python
Python选择网卡发包及接收数据包
2019/04/04 Python
python正则表达式匹配不包含某几个字符的字符串方法
2019/07/23 Python
Django中自定义admin Xadmin的实现代码
2019/08/09 Python
python 通过视频url获取视频的宽高方式
2019/12/10 Python
python输出第n个默尼森数的实现示例
2020/03/08 Python
用60行代码实现Python自动抢微信红包
2021/02/04 Python
生产管理的三大手法
2013/11/11 职场文书
高一英语教学反思
2014/01/22 职场文书
幼儿园家长评语
2014/02/10 职场文书
校长四风对照检查材料
2014/09/27 职场文书
地陪导游欢迎词
2015/01/26 职场文书
关于Spring配置文件加载方式变化引发的异常详解
2022/01/18 Java/Android