css3,环绕圆环 loading,小组件

一个loading的小组件, 给其他模块调用。先上图

type:cat

type:ball

 

第一幅loading,老鼠是一个圆形的背景图片,已经转成base64。 小猫也是图片 也已经转成base64. 

老鼠的父div,一直在rotate。

小猫的眼珠,是不动的。动的是 小猫的眼球div,眼球div一直在rotate,眼珠是绝对定位在眼球的底部,这样眼球转起来的时候,给人的感觉就是眼珠再转。

第二幅loading的小球也是上面这个原理。

 

文字的动画,是用宽度,和透明度的变化来实现的。

 

源代码 css 代码是用less 编写的。并且这个type,涉及到模块化的一点东西。所以下面就贴出,2个loading的 dom和css。

 

第一幅的css

  1 .loadingcat-wrap {
  2   position: absolute;
  3   left: 0px;
  4   right: 0px;
  5   top: 0px;
  6   bottom: 0px;
  7   z-index: 999;
  8   background-color: rgba(0, 0, 0, 0.6);
  9   box-shadow: 1px 1px 50px rgba(0, 0, 0, 0.3);
 10   display: flex;
 11   justify-content: center;
 12   align-items: center;
 13   flex-direction: column;
 14   overflow: hidden;
 15 }
 16 .loadingcat-wrap .loadingcat {
 17   width: 150px;
 18   height: 150px;
 19   border-radius: 150px;
 20   background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAYAAAA8AXHiAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDY3IDc5LjE1Nzc0NywgMjAxNS8wMy8zMC0yMzo0MDo0MiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlw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9pGqo00jrDSpb+fr7DJD1FlooD00WbhgnWm9tfU2VOtNrwVj+SC4ivTn0WayIVbKNFgJ1CDJlhJvtrbcDqtSt5mJnrHq9nHJaF4fjVV5hlophqDrQOtplo67H8D/f9WqMixDjkDtRiuN1lVziURjkYrA3b8IjUVoLEJjEUJjERqL0FiE0FiExiI0FiE0FqGxCI1FCI1FaCxCYxEShv8JMABJX3wc/SiOXQAAAABJRU5ErkJggg==);
 21   position: relative;
 22   display: flex;
 23   justify-content: center;
 24   align-items: center;
 25   animation: catspin 3s linear infinite;
 26   animation-play-state: running;
 27 }
 28 @keyframes catspin {
 29   0% {
 30     transform: rotate(1turn);
 31   }
 32   100% {
 33     transform: rotate(0turn);
 34   }
 35 }
 36 .loadingcat-wrap .cat {
 37   background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA2CAYAAACSjFpuAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMDY3IDc5LjE1Nzc0NywgMjAxNS8wMy8zMC0yMzo0MDo0MiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZ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oDw52E3AvIxabg5fJvru3DXsGe9TD0eXlFaU5j0dXSd+B361aex2risQ20aA97iK9uJPcqPoiukeB9CZWFNH2iPLV1ZWkiqxijTvsch8nndg0+G1zs9wo/YtnSDc56VGaiMRQSEYqimxBWpNmE9jjMat7h0Ne1vs86eJWF9UiOpngXtKjlytGZ91mAQN5+plh2EjFMXOPWnu6uG36qnFCQea/gPk+5zct0+2s2zelzlRQDE58bc6yqN/DfHettvxc5yIvWPQ5kiTQT8F8MVWeptT45KZmzsSW5bmeNDpfIf2O9FzdAMShiTxnkWjxa5Z/yrvfjXr+Jm8DP0t6w4rkc04n+q8AAwCkvGteDg25CAAAAABJRU5ErkJggg==);
 38   width: 56px;
 39   height: 54px;
 40   position: relative;
 41   top: -100px;
 42 }
 43 .loadingcat-wrap .cat .eye {
 44   width: 20px;
 45   height: 20px;
 46   border-radius: 20px;
 47   position: absolute;
 48   animation: scatpin 2s linear infinite;
 49   animation-play-state: running;
 50 }
 51 @keyframes scatpin {
 52   0% {
 53     transform: rotate(1turn);
 54   }
 55   100% {
 56     transform: rotate(0turn);
 57   }
 58 }
 59 .loadingcat-wrap .cat .lefteye {
 60   left: 5px;
 61   top: 15px;
 62 }
 63 .loadingcat-wrap .cat .righteye {
 64   left: 30px;
 65   top: 15px;
 66 }
 67 .loadingcat-wrap .cat .ball {
 68   width: 10px;
 69   height: 10px;
 70   position: absolute;
 71   top: 9px;
 72   left: 5px;
 73   border-radius: 5px;
 74   background-color: #818492;
 75 }
 76 .loadingcat-wrap .text {
 77   color: #fff;
 78   width: 120px;
 79 }
 80 .loadingcat-wrap .text p {
 81   white-space: nowrap;
 82   overflow: hidden;
 83   width: 0px;
 84   animation: textspin 3s ease-in-out infinite;
 85   opacity: 0.7;
 86   filter: alpha(opacity=70);
 87 }
 88 @keyframes textspin {
 89   0% {
 90     width: 0px;
 91     opacity: 0.7;
 92     filter: alpha(opacity=70);
 93   }
 94   50% {
 95     width: 120px;
 96     opacity: 0.7;
 97     filter: alpha(opacity=70);
 98   }
 99   90% {
100     opacity: 0;
101     filter: alpha(opacity=0);
102     width: 120px;
103   }
104   100% {
105     opacity: 0;
106     filter: alpha(opacity=0);
107     width: 120px;
108   }
109 }
View Code

 

第一幅的dom

 1 <div class="loadingcat-wrap"><!--   
 2 @require "app/component/loading/loadingcat.less" 
 3   -->
 4     <div class="loadingcat">
 5     </div>
 6     <div class="cat">
 7         <div class="eye lefteye">
 8             <div class="ball"></div>
 9         </div>
10         <div class="eye righteye">
11             <div class="ball"></div>            
12         </div>
13     </div>
14     <div class="text">
15         <p>L O A D I N G . . .</p>
16     </div>
17 </div>
View Code

第二幅的css

 1 .loading-wrap {
 2   position: absolute;
 3   left: 0px;
 4   right: 0px;
 5   top: 0px;
 6   bottom: 0px;
 7   z-index: 999;
 8   background-color: rgba(0, 0, 0, 0.3);
 9   box-shadow: 1px 1px 50px rgba(0, 0, 0, 0.3);
10   display: flex;
11   justify-content: center;
12   align-items: center;
13   flex-direction: column;
14   overflow: hidden;
15 }
16 .loading-wrap .loading {
17   width: 100px;
18   height: 100px;
19   border-radius: 100px;
20   background-color: transparent;
21   border: 1px solid #fff;
22   position: relative;
23   animation: spin 1s ease infinite;
24   animation-play-state: running;
25 }
26 .loading-wrap .loading .ball {
27   width: 20px;
28   height: 20px;
29   position: absolute;
30   border-radius: 10px;
31 }
32 .loading-wrap .loading .ball1 {
33   bottom: 0px;
34   left: 50%;
35   margin-left: -10px;
36   background-color: #FF6552;
37 }
38 @keyframes spin {
39   0% {
40     transform: rotate(0turn);
41   }
42   50% {
43     transform: rotate(0.5turn);
44     animation-timing-function: ease-in;
45   }
46   100% {
47     transform: rotate(1turn);
48   }
49 }
50 .loading-wrap .text {
51   margin-top: 60px;
52   color: #fff;
53   width: 120px;
54 }
55 .loading-wrap .text p {
56   white-space: nowrap;
57   overflow: hidden;
58   font-size: 13px;
59   width: 0px;
60   animation: textspin 3s ease-in-out infinite;
61   opacity: 0.7;
62   filter: alpha(opacity=70);
63 }
64 @keyframes textspin {
65   0% {
66     width: 0px;
67     opacity: 0.7;
68     filter: alpha(opacity=70);
69   }
70   50% {
71     width: 120px;
72     opacity: 0.7;
73     filter: alpha(opacity=70);
74   }
75   90% {
76     opacity: 0;
77     filter: alpha(opacity=0);
78     width: 120px;
79   }
80   100% {
81     opacity: 0;
82     filter: alpha(opacity=0);
83     width: 120px;
84   }
85 }
View Code

 

第二幅的dom

 1 <div class="loading-wrap"><!--   
 2 @require "app/component/loading/loading.less" 
 3   -->
 4     <div class="loading">
 5         <div class="ball ball1"></div>
 6     </div>
 7     <div class="text">
 8         <p>L O A D I N G . . .</p>
 9     </div>
10 </div>
View Code

 

 

以上。

posted @ 2016-09-08 19:17  btg.yoyo  阅读(1840)  评论(1编辑  收藏  举报