实例教程 纯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 相关文章推荐
css3强大的动画效果animate使用说明及浏览器兼容介绍
Jan 09 HTML / CSS
CSS中的字体大小设置属性总结
May 24 HTML / CSS
使用 css3 实现圆形进度条的示例
Jul 05 HTML / CSS
CSS3实现酷炫的3D旋转透视效果
Nov 21 HTML / CSS
移动web模拟客户端实现多方框输入密码效果【附代码】
Mar 25 HTML / CSS
使用Canvas操作像素的方法
Jun 14 HTML / CSS
HTML5 语义化结构化规范化
Oct 17 HTML / CSS
用HTML5实现手机摇一摇的功能的教程
Oct 30 HTML / CSS
HTML5中的autofocus(自动聚焦)属性介绍
Apr 23 HTML / CSS
HTML5 Canvas玩转酷炫大波浪进度图效果实例(附demo)
Dec 14 HTML / CSS
HTML5 WebSocket实现点对点聊天的示例代码
Jan 31 HTML / CSS
Html5 canvas画图白板踩坑
Jun 01 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
php获取$_POST同名参数数组的实现介绍
2013/06/30 PHP
php实现数组筛选奇数和偶数示例
2014/04/11 PHP
php发送html格式文本邮件的方法
2015/06/10 PHP
Laravel5.1 框架控制器基础用法实例分析
2020/01/04 PHP
Javascript操纵Cookie实现购物车程序
2006/11/23 Javascript
用js实现的页面关键字密度查询代码
2007/12/27 Javascript
jQuery浏览器CSS3特写兼容实例
2015/01/19 Javascript
兼容各大浏览器的JavaScript阻止事件冒泡代码
2015/07/09 Javascript
js中的内部属性与delete操作符介绍
2015/08/10 Javascript
jQuery事件绑定on()与弹窗实现代码
2016/04/28 Javascript
jquery弹出遮掩层效果【附实例代码】
2016/04/28 Javascript
WEB前端开发框架Bootstrap3 VS Foundation5
2016/05/16 Javascript
Node.js Express 框架 POST方法详解
2017/01/23 Javascript
angularjs实现猜大小功能
2017/10/23 Javascript
Vue-Router2.X多种路由实现方式总结
2018/02/09 Javascript
VUE实现图片验证码功能
2020/11/18 Javascript
微信小程序转发事件实现解析
2019/10/22 Javascript
vue 解决form表单提交但不跳转页面的问题
2019/10/30 Javascript
vue路由守卫,限制前端页面访问权限的例子
2019/11/11 Javascript
小程序外卖订单界面的示例代码
2019/12/30 Javascript
Js数组扁平化实现方法代码总汇
2020/11/11 Javascript
[00:42]《辉夜杯》—职业组预选赛12月3日15点 正式打响
2015/12/03 DOTA
Mac下Supervisor进程监控管理工具的安装与配置
2014/12/16 Python
Python中使用dom模块生成XML文件示例
2015/04/05 Python
浅谈python配置与使用OpenCV踩的一些坑
2018/04/02 Python
Django 登陆验证码和中间件的实现
2018/08/17 Python
Django视图扩展类知识点详解
2019/10/25 Python
python 深度学习中的4种激活函数
2020/09/18 Python
Chain Reaction Cycles芬兰:世界上最大的在线自行车商店
2017/12/06 全球购物
英国领先的高街书籍专家:Waterstones
2018/02/01 全球购物
美国隐形眼镜零售商:LensPure
2019/03/10 全球购物
机关门卫岗位职责
2013/12/30 职场文书
计算机网络工程专业职业生涯规划书
2014/03/10 职场文书
2014年营业员工作总结
2014/11/18 职场文书
成品仓库管理员岗位职责
2015/04/09 职场文书
windows11怎么查看自己安装的版本号? win11版本号的查看方法
2021/11/21 数码科技