Skip to content

Instantly share code, notes, and snippets.

@f8lrebel
Created March 28, 2015 20:21
Show Gist options
  • Save f8lrebel/167974901b64cbf68403 to your computer and use it in GitHub Desktop.
Save f8lrebel/167974901b64cbf68403 to your computer and use it in GitHub Desktop.
Rounded loader - black&white
<div class="container">
<div class="item-1">
</div>
<div class="item-2">
</div>
<p class="text">LOADING</p>
</div>
@import "compass/css3";
@import "compass/css3";
$vendor: '', '-webkit-', '-moz-', '-ms-', '-o-';
@mixin animation-timing-function($name) {
@each $prefix in $vendor {
#{$prefix}animation-timing-function: $name;
}
}
@mixin animation-name($name) {
@each $prefix in $vendor {
#{$prefix}animation-name: $name;
}
}
@mixin animation-fill-mode($mode) {
@each $prefix in $vendor {
#{$prefix}animation-fill-mode: $mode;
}
}
@mixin animation-duration($duration) {
@each $prefix in $vendor {
#{$prefix}animation-duration: $duration;
}
}
@mixin animation-iteration-count($value) {
@each $prefix in $vendor {
#{$prefix}animation-iteration-count: $value;
}
}
@mixin animation-delay($value) {
@each $prefix in $vendor {
#{$prefix}animation-delay: $value;
}
}
@mixin keyframes($name) {
@-webkit-keyframes #{$name} {
@content;
}
@-moz-keyframes #{$name} {
@content;
}
@-ms-keyframes #{$name} {
@content;
}
@keyframes #{$name} {
@content;
}
}
$paint-color:
#000000,
#ffffff,
#414141;
body {
background: nth($paint-color, 3);
}
.container {
width: 400px;
height: 200px;
margin: 50px auto 0 auto;
@for $i from 1 through 2 {
.item-#{$i} {
background: nth($paint-color, $i);
}
}
}
.item-1, .item-2 {
width: 200px;
height: 200px;
float: left;
@include border-radius(360px);
}
.text {
position: absolute;
width: 200px;
height: 200px;
margin: 0;
z-index: 2;
font-size: 28px;
font-family: Impact, Arial, sans-serif;
text-align: center;
line-height: 200px;
color: nth($paint-color, 1);
}
.item-1, .text {
@include animation-name(slide-1);
@include animation-duration(3s);
@include animation-iteration-count(infinite);
@include animation-timing-function(linear);
}
.item-2 {
@include animation-name(slide-2);
@include animation-duration(3s);
@include animation-iteration-count(infinite);
@include animation-timing-function(linear);
}
@include keyframes (slide-1) {
0%, 100% {
@include transform(translateX(0px));
}
50% {
@include transform(translateX(200px));
}
}
@include keyframes (slide-2) {
0%, 100% {
@include transform(translateX(0px));
}
50% {
@include transform(translateX(-200px));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment