继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

用CSS制作Loading加载动画-Loading字样【第二期】

毛毛07
关注TA
已关注
手记 9
粉丝 8
获赞 1131

上一期是《用CSS3制作Loading加载动画》的首期,我们利用了CSS制作了8款风格迥异的Loading加载动画效果,等到了大家不少的支持,小编在这里谢谢大家的支持。这一期,小编吧眼光盯在带有“Loading”字母样式的加载动作效果之上。这一期我们介绍的5个加载动画虽然风格差异也是不小,但他们的共同特点就是带有标志性的“Loading”字母。这次所有的效果代码简洁而且没有任何图片,只有一些用上了GoogleApi上的字体。闲话就不多说啦,小编已经迫不及待的想为大家展示他们的效果咯!

(效果均以作者的名字命名,在此代表慕课网对作者们表示诚挚的感谢。)
PrayushS
图片描述
HTML

<div id = "cupcake" class = "box">
    <span class = "letter">L</span>

    <div class = "cupcakeCircle box">
        <div class = "cupcakeInner box">
            <div class = "cupcakeCore box"></div>

        </div></div>

    <span class = "letter box">A</span>
    <span class = "letter box">D</span>
    <span class = "letter box">I</span>
    <span class = "letter box">N</span>
    <span class = "letter box">G</span>
</div>

CSS

 html,body{
  height:100%;
  width:100%;
  margin:0px;
  padding:0px;
  background-color:#FFD454;
}
#cupcake{
flex-direction:row;
-webkit-flex-direction:row;
-ms-flex-direction:row;
-mos-flex-direction:row;
-o-flex-direction:row;
justify-content:center;
-webkit-justify-content:center;
-ms-justify-content:center;
height:100%;
width:100%;
background-color:#FFD454;    
}

.letter{
    font-size:100px;
    color:#222;
    font-family:tahoma;
}

.box{
    display: box;
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
}

.cupcakeCircle, .cupcakeInner, .cupcakeCore{
     border-radius:50%;
    -webkit-border-radius:50%;
    -moz-border-radius:50%;
    -ms-border-radius:50%;
}

.cupcake, .letter, .cupcakeCircle, .cupcakeInner, .cupcakeCore{
    flex:none;
    -webkit-flex:none;
    -moz-flex:none;
    -ms-flex:none;
    -o-flex:none;
}

.letter, .cupcakeCircle{
    align-self:center;
    -webkit-align-self:center;
    -moz-align-self:center;
    -o-align-self:center;
    -ms-align-self:center;
}
.cupcakeCircle{
    align-items:center;
    -ms-align-items:center;
    justify-content:center;
    -ms-justify-content:center;
    height:100px;
    width:100px;
    background-color:#222;
}

.cupcakeInner{
    align-self:center;
    -ms-align-self:center;
    justify-content:center;
    -ms-justify-content:center;
    height:50%;
    width:50%;
    background-color:#FFD454;
    -webkit-animation-name:cupcakeAnimate;
    -webkit-animation-duration:500ms;
    -webkit-animation-direction:alternate;
    -webkit-animation-timing-function:ease-in-out;
    -webkit-animation-iteration-count:infinite;

}
.cupcakeCore{
    align-self:center;
    -ms-align-self:center;
    height:25%;
    width:25%;
    background-color:#222;
    -webkit-animation-name:coreAnimate;
    -webkit-animation-duration:1s;
    -webkit-animation-direction:alternate;
    -webkit-animation-timing-function:ease-in-out;
    -webkit-animation-iteration-count:infinite;
}

@-webkit-keyframes cupcakeAnimate{
        to{ height:90%; width:90%; }
}
@keyframes cupcakeAnimate{
    to{ height:90%; width:90%; }
}

@-webkit-keyframes coreAnimate{
    to{ height:90%; width:90%; }
}
@keyframes coreAnimate{
    to{ height:90%; width:90%; }
}

Eric Huguenin
图片描述
HTML

<div class="loading">
  <span>Loading</span>
</div>

CSS

body {background:#f3efe8;}
.loading {
  font-family: "Arial Black", "Arial Bold", Gadget, sans-serif;
  text-transform:uppercase;

  width:150px;
  text-align:center;
  line-height:50px;

  position:absolute;
  left:0;right:0;top:50%;
  margin:auto;
  transform:translateY(-50%);
}

.loading span {
  position:relative;
  z-index:999;
  color:#fff;
}
.loading:before {
  content:'';
  background:#61bdb6;
  width:128px;
  height:36px;
  display:block;
  position:absolute;
  top:0;left:0;right:0;bottom:0;
  margin:auto;

  animation:2s loadingBefore infinite ease-in-out;
}

@keyframes loadingBefore {
  0%   {transform:translateX(-14px);}
  50%  {transform:translateX(14px);}
  100% {transform:translateX(-14px);}
}

.loading:after {
  content:'';
  background:#ff3600;
  width:14px;
  height:60px;
  display:block;
  position:absolute;
  top:0;left:0;right:0;bottom:0;
  margin:auto;
  opacity:.5;

  animation:2s loadingAfter infinite ease-in-out;
}

@keyframes loadingAfter {
  0%   {transform:translateX(-50px);}
  50%  {transform:translateX(50px);}
  100% {transform:translateX(-50px);}
}

Austin Zach
图片描述
HTML

<div class="loader">
  <span>L</span>
  <span>O</span>
  <span>A</span>
  <span>D</span>
  <span>I</span>
  <span>N</span>
  <span>G</span>

  <div class="covers">
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
    <span></span>
  </div>
</div>

CSS


@import url(http://fonts.googleapis.com/css?family=Roboto+Condensed);

* {
  box-sizing: border-box;
  overflow: hidden;
}

body {
  padding-top: 10em;
  text-align: center;
}

.loader {
  position: relative;
  margin: auto;
  width: 350px;
  color: white;
  font-family: "Roboto Condensed", sans-serif;
  font-size: 250%;
  background: linear-gradient(180deg, #222 0, #444 100%);
  box-shadow: inset 0 5px 20px black;
  text-shadow: 5px 5px 5px rgba(0,0,0,0.3);
}

.loader:after {
  content: "";
  display: table;
  clear: both;
}

span {
  float: left;
  height: 100px;
  line-height: 120px;
  width: 50px;
}

.loader > span {
  border-left: 1px solid #444;
  border-right: 1px solid #222;
}

.covers {
  position: absolute;
  height: 100%;
  width: 100%;
}

.covers span {
  background: linear-gradient(180deg, white 0, #ddd 100%);
  animation: up 2s infinite;
}

@keyframes up {
  0%   { margin-bottom: 0; }
  16%  { margin-bottom: 100%; height: 20px; }
  50% { margin-bottom: 0; }
  100% { margin-bottom: 0; }
}

.covers span:nth-child(2) { animation-delay: .142857s; }
.covers span:nth-child(3) { animation-delay: .285714s; }
.covers span:nth-child(4) { animation-delay: .428571s; }
.covers span:nth-child(5) { animation-delay: .571428s; }
.covers span:nth-child(6) { animation-delay: .714285s; }
.covers span:nth-child(7) { animation-delay: .857142s; }

ian Gloude
图片描述
HTML

<div class="wrap">
  <div class="l">L</div>
  <div class="o">O</div>
  <div class="a">A</div>
  <div class="d">D</div>
  <div class="i">I</div>
  <div class="n">N</div>
  <div class="g">G</div>
</div>

CSS

@import url(http://fonts.googleapis.com/css?family=Open+Sans:700);
body {
  background: #333;
  color: #eee;
  font-size: 34px;
  font-family: "Open Sans";
}

.wrap {
  width: 250px;
  text-align: center;
  position: absolute;
  top: 40%;
  left: 50%;
  margin-left: -125px;
}
.wrap div {
  display: inline;
  margin: -2px;
}

.l {
  -webkit-animation: shrinkgrow 1.75s ease-in-out infinite;
          animation: shrinkgrow 1.75s ease-in-out infinite;
  -webkit-animation-delay: 0s;
          animation-delay: 0s;
}

.o {
  -webkit-animation: shrinkgrow 1.75s ease-in-out infinite;
          animation: shrinkgrow 1.75s ease-in-out infinite;
  -webkit-animation-delay: 0.21875s;
          animation-delay: 0.21875s;
}

.a {
  -webkit-animation: shrinkgrow 1.75s ease-in-out infinite;
          animation: shrinkgrow 1.75s ease-in-out infinite;
  -webkit-animation-delay: 0.4375s;
          animation-delay: 0.4375s;
}

.d {
  -webkit-animation: shrinkgrow 1.75s ease-in-out infinite;
          animation: shrinkgrow 1.75s ease-in-out infinite;
  -webkit-animation-delay: 0.65625s;
          animation-delay: 0.65625s;
}

.i {
  -webkit-animation: shrinkgrow 1.75s ease-in-out infinite;
          animation: shrinkgrow 1.75s ease-in-out infinite;
  -webkit-animation-delay: 0.875s;
          animation-delay: 0.875s;
}

.n {
  -webkit-animation: shrinkgrow 1.75s ease-in-out infinite;
          animation: shrinkgrow 1.75s ease-in-out infinite;
  -webkit-animation-delay: 1.09375s;
          animation-delay: 1.09375s;
}

.g {
  -webkit-animation: shrinkgrow 1.75s ease-in-out infinite;
          animation: shrinkgrow 1.75s ease-in-out infinite;
  -webkit-animation-delay: 1.3125s;
          animation-delay: 1.3125s;
}

@-webkit-keyframes shrinkgrow {
  0% {
    -webkit-transform: scale(0);
            transform: scale(0);
  }
  12.5% {
    -webkit-transform: scale(1);
            transform: scale(1);
  }
  25% {
    -webkit-transform: scale(1);
            transform: scale(1);
  }
  33% {
    -webkit-transform: scale(0);
            transform: scale(0);
  }
  100% {
    -webkit-transform: scale(0);
            transform: scale(0);
  }
}

@keyframes shrinkgrow {
  0% {
    -webkit-transform: scale(0);
            transform: scale(0);
  }
  12.5% {
    -webkit-transform: scale(1);
            transform: scale(1);
  }
  25% {
    -webkit-transform: scale(1);
            transform: scale(1);
  }
  33% {
    -webkit-transform: scale(0);
            transform: scale(0);
  }
  100% {
    -webkit-transform: scale(0);
            transform: scale(0);
  }
}

Nick Moreton

图片描述
HTML

<div class="container">
  <div class="l">L</div>
  <div class="circle"></div>
  <div class="square"></div>
  <div class="triangle"></div>
  <div class="i">I</div>
  <div class="n">N</div>
  <div class="g">G</div>
</div>

CSS

@import url(http://fonts.googleapis.com/css?family=Open+Sans:700);

body {
  background:#222;
  color:#eee;
  font-size:34px;
  font-weight:700;
  font-family:'Open Sans', sans-serif;
}

.container {
  position:absolute;
  width:120px;
  height:50px;
  top:50%;
  left:50%;
  transform: translate(-50%, -50%);

}

.container > div {
  position:absolute;
  transform-origin:center;
}

.l {
  left:8px;
}

.i {
  left:60px;
}

.n {
  left:72px;
}

.g {
  left:99px;
}
.square, .circle, .triangle {
  left:30px;
}

.square {
  background:#75B3D1;
  width:24px;
  height:24px;
  left:32px;
  top:12px;
  transform:scale(0);
  animation: shrinkgrow 3s ease-in-out infinite;

  animation-delay:2s;
}

.circle {
  background:#81D47D;
  width:27px;
  height:27px;
  top:10px;
  left:30px;
  border-radius:50%;
  animation: shrinkgrow 3s ease-in-out infinite;
  animation-delay:0s;
}

.triangle {
  width: 0;
  height: 0;
  left:30px;
  top:11px;
  border-style: solid;
  border-width:  0 14.5px 25.1px 14.5px;
  border-color: transparent transparent #D2798C transparent;
  transform:scale(0);
  animation: shrinkgrow 3s ease-in-out infinite;
  animation-delay:1s;
}

@keyframes shrinkgrow {
  0% {
    transform:scale(0);
  }

  12.5% {
    transform:scale(1)
  }

  25% {
    transform:scale(1)
  }

  33% {
    transform:scale(0)
  }
  100% {
    transform:scale(0)
  }
}

上一期:《用CSS3制作Loading加载动画》 【第一期】
下一期:《用CSS3制作Loading加载动画-Dot泡泡样式》【第三期】

打开App,阅读手记
37人推荐
发表评论
随时随地看视频慕课网APP

热门评论

已阅

mark

mark

查看全部评论