Skip to content

Instantly share code, notes, and snippets.

@kinopyo
Last active December 16, 2015 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinopyo/5432049 to your computer and use it in GitHub Desktop.
Save kinopyo/5432049 to your computer and use it in GitHub Desktop.
%span.css3_loader<
  %figure>
  %figure>
  %figure>
  %figure>
  %figure>
@-webkit-keyframes fade {
  0% { opacity: 1 }
  100% { opacity: 0.1 }
}

@-moz-keyframes fade {
  0% { opacity: 1 }
  100% { opacity: 0.1 }
}

@mixin animation_delay($sec) {
  -webkit-animation-delay: $sec;
  -moz-animation-delay: $sec;
}

.css3_loader {

  figure {
    background: olive;
    margin: 0 1px 0 0;
    display: inline-block;
    height: 1em;
    width: 4px;
    opacity: 0.1;
    -webkit-animation: fade 1s linear infinite;
    -moz-animation: fade 1s linear infinite;

    &:nth-child(1) {
      @include animation_delay(0s);
      @include border-radius(2px 0 0 2px);
    }
    &:nth-child(2) {
      @include animation_delay(0.2s);
    }
    &:nth-child(3) {
      @include animation_delay(0.4s);
    }
    &:nth-child(4) {
      @include animation_delay(0.6s);
    }
    &:nth-child(5) {
      @include animation_delay(0.8s);
      @include border-radius(0 2px 2px 0);
    }
  }

}
<span class="css3_loader"><figure></figure><figure></figure><figure></figure><figure></figure><figure></figure></span>
@-webkit-keyframes fade {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0.1;
  }
}

@-moz-keyframes fade {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0.1;
  }
}

.css3_loader figure {
  background: olive;
  margin: 0 1px 0 0;
  display: inline-block;
  height: 1em;
  width: 4px;
  opacity: 0.1;
  -webkit-animation: fade 1s linear infinite;
  -moz-animation: fade 1s linear infinite;
}
.css3_loader figure:nth-child(1) {
  -webkit-animation-delay: 0s;
  -moz-animation-delay: 0s;
  -webkit-border-radius: 2px 0 0 2px;
  -moz-border-radius: 2px 0 0 2px;
  -ms-border-radius: 2px 0 0 2px;
  -o-border-radius: 2px 0 0 2px;
  border-radius: 2px 0 0 2px;
}
.css3_loader figure:nth-child(2) {
  -webkit-animation-delay: 0.2s;
  -moz-animation-delay: 0.2s;
}
.css3_loader figure:nth-child(3) {
  -webkit-animation-delay: 0.4s;
  -moz-animation-delay: 0.4s;
}
.css3_loader figure:nth-child(4) {
  -webkit-animation-delay: 0.6s;
  -moz-animation-delay: 0.6s;
}
.css3_loader figure:nth-child(5) {
  -webkit-animation-delay: 0.8s;
  -moz-animation-delay: 0.8s;
  -webkit-border-radius: 0 2px 2px 0;
  -moz-border-radius: 0 2px 2px 0;
  -ms-border-radius: 0 2px 2px 0;
  -o-border-radius: 0 2px 2px 0;
  border-radius: 0 2px 2px 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment