其他代码

CSS3炫酷loading加载动画特效

阿里云


这是一款共 2 种炫酷效果的纯 CSS3 loading 加载动画特效。该 CSS3 加载动画分别为弹跳的小方块和月亮绕地球旋转的动画效果。它们使用的技术都是 CSS animation 来实现,效果非常的震撼。

HTML 结构

该 CSS3 加载动画特效的 HTML 结构使用的是

也想出现在这里?联系我们
创客主机
的嵌套结构。

  1. <div class='demo-container'>
  2.   <!--小方块弹跳效果-->
  3.   <div class='demo-panel bg1'>
  4.     <div class='spinner'>
  5.       <div class='bouncer'></div>
  6.     </div>
  7.   </div>
  8.   <!--月亮绕地球旋转效果-->
  9.   <div class='demo-panel bg2'>
  10.     <div class='spinner'>
  11.       <div class='orbiter'>
  12.         <div class='planet'></div>
  13.         <div class='orbit-outer'>
  14.           <div class='orbit-inner'>
  15.             <div class='dot'></div>
  16.           </div>
  17.         </div>
  18.       </div>
  19.     </div>
  20.   </div>
  21. </div>

CSS 样式

在 DEMO 中的布局使用的是 CSS flex 布局。

  1. .demo-container {
  2.   display: -webkit-box;
  3.   display: -webkit-flex;
  4.   display: -ms-flexbox;
  5.   display: flex;
  6.   -webkit-flex-direction: row;
  7.   -webkit-box-orient: horizontal;
  8.   -webkit-box-direction: normal;
  9.       -ms-flex-direction: row;
  10.           flex-direction: row;
  11.   height: 60vh;
  12.   -webkit-align-items: center;
  13.   -webkit-box-align: center;
  14.       -ms-flex-align: center;
  15.           align-items: center;
  16. }
  17. .demo-container .demo-panel {
  18.   -webkit-flex-grow: 1;
  19.   -webkit-box-flex: 1;
  20.       -ms-flex-positive: 1;
  21.           flex-grow: 1;
  22.   height: 100%;
  23.   display: -webkit-box;
  24.   display: -webkit-flex;
  25.   display: -ms-flexbox;
  26.   display: flex;
  27.   -webkit-align-items: center;
  28.   -webkit-box-align: center;
  29.       -ms-flex-align: center;
  30.           align-items: center;
  31.   -webkit-flex-direction: row;
  32.   -webkit-box-orient: horizontal;
  33.   -webkit-box-direction: normal;
  34.       -ms-flex-direction: row;
  35.           flex-direction: row;
  36. }

小方块的弹跳动画使用了两组 bounce 帧动画,分别对应小方块上升和下降时的动画效果。animation 被设置为无限循环模式,并且指定了 easing 效果。

  1. .bouncer {
  2.   width: 30px;
  3.   height: 10px;
  4.   position: absolute;
  5.   background: white;
  6.   left: 35%;
  7.   -webkit-animation-name: bounce;
  8.   animation-name: bounce;
  9.   -webkit-animation-duration: 2s;
  10.   animation-duration: 2s;
  11.   -webkit-animation-iteration-count: infinite;
  12.   animation-iteration-count: infinite;
  13.   -webkit-animation-timing-function: ease;
  14.   animation-timing-function: ease;
  15. }
  16. @-webkit-keyframes bounce {
  17.   0% {
  18.     -webkit-transform: rotate(0turn);
  19.             transform: rotate(0turn);
  20.     bottom: 0%;
  21.     height: 20px;
  22.   }
  23.   4% {
  24.     height: 5px;
  25.   }
  26.   5% {
  27.     height: 30px;
  28.     bottom: 0%;
  29.     -webkit-animation-timing-function: cubic-bezier(0, 0.62, 0.42, 1);
  30.     animation-timing-function: cubic-bezier(0, 0.62, 0.42, 1);
  31.   }
  32.   20% {
  33.     height: 20px;
  34.     bottom: 50%;
  35.     -webkit-animation-timing-function: cubic-bezier(0.57, 0.01, 0.98, 0.47);
  36.     animation-timing-function: cubic-bezier(0.57, 0.01, 0.98, 0.47);
  37.   }
  38.   45% {
  39.     height: 20px;
  40.     bottom: 0%;
  41.   }
  42.   49% {
  43.     height: 5px;
  44.   }
  45.   50% {
  46.     -webkit-transform: rotate(0turn);
  47.             transform: rotate(0turn);
  48.     /* height: $h + 60; */
  49.     bottom: 0%;
  50.     -webkit-animation-timing-function: cubic-bezier(0, 0.62, 0.42, 1);
  51.     animation-timing-function: cubic-bezier(0, 0.62, 0.42, 1);
  52.   }
  53.   75% {
  54.     height: 20px;
  55.     bottom: 100%;
  56.     -webkit-animation-timing-function: cubic-bezier(0.57, 0.01, 0.98, 0.47);
  57.     animation-timing-function: cubic-bezier(0.57, 0.01, 0.98, 0.47);
  58.   }
  59.   100% {
  60.     -webkit-transform: rotate(1turn);
  61.             transform: rotate(1turn);
  62.     height: 20px;
  63.     bottom: 0%;
  64.   }
  65. }
  66. @keyframes bounce {
  67.   0% {
  68.     -webkit-transform: rotate(0turn);
  69.             transform: rotate(0turn);
  70.     bottom: 0%;
  71.     height: 20px;
  72.   }
  73.   4% {
  74.     height: 5px;
  75.   }
  76.   5% {
  77.     height: 30px;
  78.     bottom: 0%;
  79.     -webkit-animation-timing-function: cubic-bezier(0, 0.62, 0.42, 1);
  80.     animation-timing-function: cubic-bezier(0, 0.62, 0.42, 1);
  81.   }
  82.   20% {
  83.     height: 20px;
  84.     bottom: 50%;
  85.     -webkit-animation-timing-function: cubic-bezier(0.57, 0.01, 0.98, 0.47);
  86.     animation-timing-function: cubic-bezier(0.57, 0.01, 0.98, 0.47);
  87.   }
  88.   45% {
  89.     height: 20px;
  90.     bottom: 0%;
  91.   }
  92.   49% {
  93.     height: 5px;
  94.   }
  95.   50% {
  96.     -webkit-transform: rotate(0turn);
  97.             transform: rotate(0turn);
  98.     /* height: $h + 60; */
  99.     bottom: 0%;
  100.     -webkit-animation-timing-function: cubic-bezier(0, 0.62, 0.42, 1);
  101.     animation-timing-function: cubic-bezier(0, 0.62, 0.42, 1);
  102.   }
  103.   75% {
  104.     height: 20px;
  105.     bottom: 100%;
  106.     -webkit-animation-timing-function: cubic-bezier(0.57, 0.01, 0.98, 0.47);
  107.     animation-timing-function: cubic-bezier(0.57, 0.01, 0.98, 0.47);
  108.   }
  109.   100% {
  110.     -webkit-transform: rotate(1turn);
  111.             transform: rotate(1turn);
  112.     height: 20px;
  113.     bottom: 0%;
  114.   }
  115. }

CSS3 炫酷 loading 加载动画特效

已有 412 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!