实例教程 纯CSS3打造非常炫的加载动画效果
程序员文章站
2022-06-26 10:02:40
这篇文章主要为大家介绍了一款非常炫的加载图,代码非常简单。没有用任何javascript代码。纯css3实现。用在需要一定时间加载的地方非常合适,感兴趣的可以来复制代码学习哦
... 14-11-05...
纯css3打造的一款非常炫的加载图。用在需要一定时间加载的地方非常合适。代码非常简单。没有用任何javascript代码。纯css3实现。先上效果图:
实现代码如下:
html代码:
xml/html code复制内容到剪贴板
- <div class="content">
- <div style="width: 970px; margin: auto">
- </div>
- <div class="rotate">
- <span class="triangle base"></span><span class="triangle no1"></span><span class="triangle no2">
- </span><span class="triangle no3"></span>
- </div>
- </div>
css代码:
css code复制内容到剪贴板
- body {
- padding:0;
- margin:0;
- background-color: #2a4e66;
- overflow: hidden;
- }
- .content {
- width:100%;
- height:100%;
- top:0;
- rightright:0;
- bottombottom:0;
- left:0;
- position:absolute;
- }
- .rotate {
- position: absolute;
- top: 50%;
- left: 50%;
- margin: -93px 0 0 -93px;
- background: transparent;
- width: 186px;
- height: 186px;
- border-radius: 50%;
- z-index: 20;
- }
- .rotate:after {
- content: '';
- position: absolute;
- box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffff, inset 0 0 2px #ffffff, inset 0 0 4px #ffffff;
- width: 186px;
- height: 186px;
- border-radius: 50%;
- z-index: 10;
- }
- span.triangle.base {
- position: absolute;
- width: 0;
- height: 0;
- margin: 46px 0 0 13px;
- border-left: 80px solid transparent;
- border-right: 80px solid transparent;
- border-top: 140px solid #eeeeee;
- transform-origin: 50% 50%;
- z-index: 20;
- }
- span.triangle.no1 {
- position: absolute;
- margin: 46px 0 0 13px;
- width: 0;
- height: 0;
- border-left: 80px solid transparent;
- border-right: 80px solid transparent;
- border-bottom: 140px solid #eeeeee;
- transform-origin: 0 100%;
- z-index: 20;
- }
- span.triangle.no2 {
- position: absolute;
- margin: 46px 0 0 13px;
- width: 0;
- height: 0;
- border-left: 80px solid transparent;
- border-right: 80px solid transparent;
- border-bottom: 140px solid #eeeeee;
- transform-origin: 100% 100%;
- z-index: 20;
- }
- span.triangle.no3 {
- position: absolute;
- margin: 46px 0 0 13px;
- width: 0;
- height: 0;
- border-left: 80px solid transparent;
- border-right: 80px solid transparent;
- border-bottom: 140px solid #eeeeee;
- transform-origin: 50% 100%;
- z-index: 20;
- }
- /* animation */
- .rotate {
- -webkit-animation: rotatetriangle 3s linear infinite;
- animation: rotatetriangle 3s linear infinite;
- }
- @-webkit-keyframes rotatetriangle {
- from { -webkit-transform: rotate(0deg); }
- to { -webkit-transform: rotate(60deg); }
- }
- @keyframes rotatetriangle {
- from { transform: rotate(0deg); }
- to { transform: rotate(60deg); }
- }
- .rotate:after {
- -webkit-animation: glowanimation 3s ease infinite;
- animation: glowanimation 3s ease infinite;
- }
- @-webkit-keyframes glowanimation {
- 0% { box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffff, inset 0 0 2px #ffffff, inset 0 0 4px #ffffff; }
- 10% { box-shadow: 0 0 80px #ffffff, 0 0 20px #ffffff, 0 0 2px #ffffff, inset 0 0 4px #ffffff, inset 0 0 8px #ffffff; }
- 100% { box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffff, inset 0 0 2px #ffffff, inset 0 0 4px #ffffff; }
- }
- @keyframes glowanimation {
- 0% { box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffff, inset 0 0 2px #ffffff, inset 0 0 4px #ffffff; }
- 10% { box-shadow: 0 0 80px #ffffff, 0 0 20px #ffffff, 0 0 2px #ffffff, inset 0 0 4px #ffffff, inset 0 0 8px #ffffff; }
- 100% { box-shadow: 0 0 30px #ffffff, 0 0 10px #ffffff, 0 0 2px #ffffff, inset 0 0 2px #ffffff, inset 0 0 4px #ffffff; }
- }
- span.triangle.base {
- -webkit-animation: scaletrianglebase 3s linear infinite;
- animation: scaletrianglebase 3s linear infinite;
- }
- @-webkit-keyframes scaletrianglebase {
- from { -webkit-transform: translate(0px,-11px) scale(0.5); }
- to { -webkit-transform: translate(0px,0px) scale(1); }
- }
- @keyframes scaletrianglebase {
- from { transform: translate(0px,-11px) scale(0.5); }
- to { transform: translate(0px,0px) scale(1); }
- }
- span.triangle.no1 {
- -webkit-animation: scaletriangleone 3s linear infinite;
- animation: scaletriangleone 3s linear infinite;
- }
- @-webkit-keyframes scaletriangleone {
- from { -webkit-transform: translate(0px,-46px) scale(0.5); }
- to { -webkit-transform: translate(-80px,0px) scale(0); }
- }
- @keyframes scaletriangleone {
- from { transform: translate(0px,-46px) scale(0.5); }
- to { transform: translate(-80px,0px) scale(0); }
- }
- span.triangle.no2 {
- -webkit-animation: scaletriangletwo 3s linear infinite;
- animation: scaletriangletwo 3s linear infinite;
- }
- @-webkit-keyframes scaletriangletwo {
- from { -webkit-transform: translate(0px,-46px) scale(0.5); }
- to { -webkit-transform: translate(80px,0px) scale(0); }
- }
- @keyframes scaletriangletwo {
- from { transform: translate(0px,-46px) scale(0.5); }
- to { transform: translate(80px,0px) scale(0); }
- }
- span.triangle.no3 {
- -webkit-animation: scaletrianglethree 3s linear infinite;
- animation: scaletrianglethree 3s linear infinite;
- }
- @-webkit-keyframes scaletrianglethree {
- from { -webkit-transform: translate(0px,-116px) scale(0.5); }
- to { -webkit-transform: translate(0px,-280px) scale(0); }
- }
- @keyframes scaletrianglethree {
- from { transform: translate(0px,-116px) scale(0.5); }
- to { transform: translate(0px,-280px) scale(0); }
- }
上一篇: 一款纯css3制作的2015年元旦雪人动画特效教程
下一篇: 大数加减乘除---C++运算符重载
推荐阅读
-
使用css3实现超炫的loading加载动画效果
-
8款使用 CSS3 实现超炫的 Loading(加载)的动画效果
-
css实例教程 一款纯css3实现的超炫动画背画特效
-
实例教程 纯CSS3打造非常炫的加载动画效果
-
使用CSS3实现超炫的Loading(加载)动画效果_html/css_WEB-ITnose
-
使用CSS3实现超炫的Loading(加载)动画效果_html/css_WEB-ITnose
-
使用css3实现超炫的loading加载动画效果
-
8款使用 CSS3 实现超炫的 Loading(加载)的动画效果
-
实例教程 纯CSS3打造非常炫的加载动画效果
-
css实例教程 一款纯css3实现的超炫动画背画特效