热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

CSS3实现8种Loading效果【二】

今晚吃完饭回宿舍又捣鼓了另外几种Loading效果,老规矩,直接“上菜“……注:gif图片动画有些卡顿,非实际效果!第一种效果:代码如下:<d

今晚吃完饭回宿舍又捣鼓了另外几种Loading效果,老规矩,直接“上菜“……

注:gif图片动画有些卡顿,非实际效果!

第一种效果:

loading1

代码如下:

<div class="loading">
<span>span>
<span>span>
<span>span>
<span>span>
<span>span>
div>
       .loading{
width
: 80px;
height
: 40px;
margin
: 0 auto;
margin-top
:100px;
}
.loading span
{
display
: inline-block;
width
: 8px;
height
: 100%;
border-radius
: 4px;
background
: lightgreen;
-webkit-animation
: load 1.04s ease infinite;
}
@-webkit-keyframes load
{
0%,100%{
height
: 40px;
background
: lightgreen;
}
50%
{
height
: 60px;
margin-top
: -20px;
background
: lightblue;
}
}
.loading span:nth-child(2)
{
-webkit-animation-delay
:0.13s;
}
.loading span:nth-child(3)
{
-webkit-animation-delay
:0.26s;
}
.loading span:nth-child(4)
{
-webkit-animation-delay
:0.39s;
}
.loading span:nth-child(5)
{
-webkit-animation-delay
:0.52s;
}

第二种效果:

loading2

代码如下:

<div class="loading">
<span>span>
div>
.loading{
width
: 80px;
height
: 80px;
border-radius
: 50%;
margin
: 0 auto;
margin-top
:100px;
position
: relative;
border
:5px solid lightgreen;
-webkit-animation
: turn 2s linear infinite;
}
.loading span
{
display
: inline-block;
width
: 30px;
height
: 30px;
border-radius
: 50%;
background
: lightgreen;
position
: absolute;
left
: 50%;
margin-top
: -15px;
margin-left
: -15px;
-webkit-animation
: changeBgColor 2s linear infinite;
}
@-webkit-keyframes changeBgColor
{
0%{
background
: lightgreen;
}
100%
{
background
: lightblue;
}
}
@-webkit-keyframes turn
{
0%{
-webkit-transform
: rotate(0deg);
border-color
: lightgreen;
}
100%
{
-webkit-transform
: rotate(360deg);
border-color
: lightblue;
}
}

第三种效果:

loading3

代码如下:

<div class="loading">
<span>span>
<span>span>
<span>span>
<span>span>
<span>span>
div>
.loading{
width
: 150px;
height
: 15px;
margin
: 0 auto;
margin-top
:100px;
text-align
: center;
}
.loading span
{
display
: inline-block;
width
: 15px;
height
: 100%;
margin-right
: 5px;
background
: lightgreen;
-webkit-animation
: load 1.04s ease infinite;
}
.loading span:last-child
{
margin-right
: 0px;
}
@-webkit-keyframes load
{
0%{
opacity
: 1;
-webkit-transform
: scale(1.2);
}
100%
{
opacity
: .2;
-webkit-transform
: scale(.2);
}
}
.loading span:nth-child(1)
{
-webkit-animation-delay
:0.13s;
}
.loading span:nth-child(2)
{
-webkit-animation-delay
:0.26s;
}
.loading span:nth-child(3)
{
-webkit-animation-delay
:0.39s;
}
.loading span:nth-child(4)
{
-webkit-animation-delay
:0.52s;
}
.loading span:nth-child(5)
{
-webkit-animation-delay
:0.65s;
}

第四种效果:

loading4

代码如下:

<div class="loading">
<span>span>
div>
.loading{
width
: 150px;
height
: 8px;
border-radius
: 4px;
margin
: 0 auto;
margin-top
:100px;
position
: relative;
background
: lightblue;
overflow
: hidden;
}
.loading span
{
display
:block;
width
: 100%;
height
: 100%;
border-radius
: 3px;
background
: lightgreen;
-webkit-animation
: changePosition 4s linear infinite;
}
@-webkit-keyframes changePosition
{
0%{
-webkit-transform
: translate(-150px);
}
50%
{
-webkit-transform
: translate(0);
}
100%
{
-webkit-transform
: translate(150px);
}
}

第五种效果:

loading5

代码如下:

<div class="loading">
<span>span>
div>
.loading{
width
: 200px;
height
: 60px;
margin
: 0 auto;
margin-top
: 100px;
position
: relative;
}
.loading span
{
width
: 50px;
height
: 30px;
border-radius
: 50%;
background
: lightgreen;
position
: absolute;
top
: 50%;
margin-top
: -15px;
overflow
: hidden;
-webkit-animation
: changePosition 2.08s linear infinite;
}
@-webkit-keyframes changePosition
{
0%,100%{
-webkit-transform
: translate(70px);
}
20%
{
width
: 50px;
height
: 30px;
margin-top
:-15px;
-webkit-transform
: translate(0px);
}
30%
{
width
: 20px;
height
: 60px;
margin-top
:-30px;
-webkit-transform
: translate(0px);
}
35%
{
width
: 50px;
height
: 30px;
margin-top
:-15px;
-webkit-transform
: translate(5px);
background
: lightblue;
}
70%
{
width
: 50px;
height
: 30px;
margin-top
:-15px;
-webkit-transform
: translate(160px);
}
80%
{
width
: 20px;
height
: 60px;
margin-top
:-30px;
-webkit-transform
: translate(160px);
}
85%
{
width
: 50px;
height
: 30px;
margin-top
:-15px;
-webkit-transform
: translate(155px);
background
: lightgreen;
}

}

第六种效果:

loading6

代码如下:

<div class="loadEffect">
<span>span>
<span>span>
<span>span>
<span>span>
<span>span>
<span>span>
<span>span>
<span>span>
div>
.loadEffect{
width
: 100px;
height
: 100px;
position
: relative;
margin
: 0 auto;
margin-top
:100px;
}
.loadEffect span
{
display
: inline-block;
width
: 30px;
height
: 10px;
border-top-left-radius
: 5px;
border-bottom-left-radius
: 5px;
background
: lightgreen;
position
: absolute;
-webkit-animation
: load 1.04s ease infinite;
}
@-webkit-keyframes load
{
0%{
opacity
: 1;
}
100%
{
opacity
: 0.2;
}
}
.loadEffect span:nth-child(1)
{
left
: 0;
top
: 50%;
margin-top
:-5px;
-webkit-animation-delay
:0.13s;
}
.loadEffect span:nth-child(2)
{
left
: 10px;
top
: 20px;
-webkit-transform
: rotate(45deg);
-webkit-animation-delay
:0.26s;
}
.loadEffect span:nth-child(3)
{
left
: 50%;
top
: 10px;
margin-left
: -15px;
-webkit-transform
: rotate(90deg);
-webkit-animation-delay
:0.39s;
}
.loadEffect span:nth-child(4)
{
top
: 20px;
right
:10px;
-webkit-transform
: rotate(135deg);
-webkit-animation-delay
:0.52s;
}
.loadEffect span:nth-child(5)
{
right
: 0;
top
: 50%;
margin-top
:-5px;
-webkit-transform
: rotate(180deg);
-webkit-animation-delay
:0.65s;
}
.loadEffect span:nth-child(6)
{
right
: 10px;
bottom
:20px;
-webkit-transform
: rotate(225deg);
-webkit-animation-delay
:0.78s;
}
.loadEffect span:nth-child(7)
{
bottom
: 10px;
left
: 50%;
margin-left
: -15px;
-webkit-transform
: rotate(270deg);
-webkit-animation-delay
:0.91s;
}
.loadEffect span:nth-child(8)
{
bottom
: 20px;
left
: 10px;
-webkit-transform
: rotate(315deg);
-webkit-animation-delay
:1.04s;
}

第七种效果:

loading7

代码如下:

<div class="loadEffect">
<div><span>span>div>
<div><span>span>div>
<div><span>span>div>
<div><span>span>div>
div>
.loadEffect {
width
: 100px;
height
: 100px;
margin
: 0 auto;
margin-top
:100px;
position
: relative;
}
.loadEffect div
{
width
: 100%;
height
: 100%;
position
: absolute;
-webkit-animation
: load 2.08s linear infinite;
}
.loadEffect div span
{
display
: inline-block;
width
: 20px;
height
: 20px;
border-radius
: 50%;
background
: lightgreen;
position
: absolute;
left
: 50%;
margin-top
: -10px;
margin-left
: -10px;
}
@-webkit-keyframes load
{
0%{
-webkit-transform
: rotate(0deg);
}
10%
{
-webkit-transform
: rotate(45deg);
}
50%
{
opacity
: 1;
-webkit-transform
: rotate(160deg);
}
62%
{
opacity
: 0;
}
65%
{
opacity
: 0;
-webkit-transform
: rotate(200deg);
}
90%
{
-webkit-transform
: rotate(340deg);
}
100%
{
-webkit-transform
: rotate(360deg);
}

}
.loadEffect div:nth-child(1)
{
-webkit-animation-delay
:0.2s;
}
.loadEffect div:nth-child(2)
{
-webkit-animation-delay
:0.4s;
}
.loadEffect div:nth-child(3)
{
-webkit-animation-delay
:0.6s;
}
.loadEffect div:nth-child(4)
{
-webkit-animation-delay
:0.8s;
}

第八种效果:

loading8

代码如下:

<div class="loading">
<div><span>span>div>
<div><span>span>div>
<div><span>span>div>
div>
.loading{
width
: 60px;
height
: 60px;
margin
: 0 auto;
margin-top
:100px;
position
: relative;
-webkit-animation
: load 3s linear infinite;
}
.loading div
{
width
: 100%;
height
: 100%;
position
: absolute;
}
.loading span
{
display
: inline-block;
width
: 20px;
height
: 20px;
border-radius
: 50%;
background
: #99CC66;
position
: absolute;
left
: 50%;
margin-top
: -10px;
margin-left
: -10px;
-webkit-animation
: changeBgColor 3s ease infinite;
}
@-webkit-keyframes load
{
0%{
-webkit-transform
: rotate(0deg);
}
33.3%
{
-webkit-transform
: rotate(120deg);
}
66.6%
{
-webkit-transform
: rotate(240deg);
}
100%
{
-webkit-transform
: rotate(360deg);
}
}
@-webkit-keyframes changeBgColor
{
0%,100%{
background
: #99CC66;
}
33.3%
{
background
: #FFFF66;
}
66.6%
{
background
: #FF6666;
}
}
.loading div:nth-child(2)
{
-webkit-transform
: rotate(120deg);
}
.loading div:nth-child(3)
{
-webkit-transform
: rotate(240deg);
}
.loading div:nth-child(2) span
{
-webkit-animation-delay
: 1s;
}
.loading div:nth-child(3) span
{
-webkit-animation-delay
: 2s;
}

PS:同样的,CSS样式代码没怎么整理,虽然东西简单,但是也是需要一些时间去做出来。

若需转载,请注明出处,谢谢!


推荐阅读
  • 本文整理了常用的CSS属性及用法,包括背景属性、边框属性、尺寸属性、可伸缩框属性、字体属性和文本属性等,方便开发者查阅和使用。 ... [详细]
  • 在Android开发中,使用Picasso库可以实现对网络图片的等比例缩放。本文介绍了使用Picasso库进行图片缩放的方法,并提供了具体的代码实现。通过获取图片的宽高,计算目标宽度和高度,并创建新图实现等比例缩放。 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • 之前我曾经写过一篇关于CSS的border-image属性的文章。现在几乎所有的现代浏览器都支持这个属性——除了IE10及以下IE版本。看起来这是一个非常 ... [详细]
  • 一篇文章搞定css3 3d效果
    css33d学习心得卡片反转魔方banner图首先我们要学习好css33d一定要有一定的立体感通过这个图片应该清楚的了解到了x轴y轴z轴是什么概念了。首先先给大家看一个小 ... [详细]
  • 本文由编程笔记#小编为大家整理,主要介绍了css回到顶部按钮相关的知识,希望对你有一定的参考价值。 ... [详细]
  • 这篇文章将为大家详细讲解有关如何使用JavaScript动态设置CSS3属性值,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读 ... [详细]
  • background:-webkit-gradient(linear,10%10%,100%100%, ... [详细]
  • 前端实用的CSS3技巧有哪些
    本文小编为大家详细介绍“前端实用的CSS3技巧有哪些”,内容详细,步骤清晰,细节处理妥当,希望这篇“前端实用的CSS3技巧有哪些”文章能帮助大家 ... [详细]
  • 怎么用css3实现图片的高斯模糊效果
    小编给大家分享一下怎么用css3实现图片的高斯模糊效果,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后 ... [详细]
  • 可能我们在看一些网页的源码时会发现自己从来没见过的属性或用法今天我就来总结一下CSS3的冷知识样式计算在CSS中也可以进行简单的计算通过calc函数可以实现这样还可以使我们的 ... [详细]
  • vue组件支持预处理语言的关键点:<stylerelstylesheetscss>.mint-swipe{hei ... [详细]
  • sklearn数据集库中的常用数据集类型介绍
    本文介绍了sklearn数据集库中常用的数据集类型,包括玩具数据集和样本生成器。其中详细介绍了波士顿房价数据集,包含了波士顿506处房屋的13种不同特征以及房屋价格,适用于回归任务。 ... [详细]
  • Python瓦片图下载、合并、绘图、标记的代码示例
    本文提供了Python瓦片图下载、合并、绘图、标记的代码示例,包括下载代码、多线程下载、图像处理等功能。通过参考geoserver,使用PIL、cv2、numpy、gdal、osr等库实现了瓦片图的下载、合并、绘图和标记功能。代码示例详细介绍了各个功能的实现方法,供读者参考使用。 ... [详细]
  • CSS3 animation动画属性详解及用法
    本文详细介绍了CSS3 animation动画的各种属性及用法,包括关键帧动画、动画名称、动画时间、动画曲线、动画延迟、动画播放次数、动画状态和动画前后的状态等。通过本文的学习,读者可以深入了解CSS3 animation动画的使用方法。 ... [详细]
author-avatar
辣妈最___潮
这个家伙很懒,什么也没留下!
Tags | 热门标签
RankList | 热门文章
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有