Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                .picker
  %h1 Loading Animation Mixins
  .select-wrapper
    %select.selector
      %option{:value=>""}Select
      %option{:value=>"spinner"}Spinner
      %option{:value=>"propeller"}Propeller
      %option{:value=>"line"}Line
      %option{:value=>"wheel"}Wheel
      %option{:value=>"bounce"}Bounce
      %option{:value=>"text"}Text
      %option{:value=>"hourglass"}Hourglass
      %option{:value=>"pinwheel"}Pinwheel
      %option{:value=>"beer"}Beer
      %option{:value=>"clock"}Clock
.container
  #stage
              
            
!

CSS

              
                @import "compass/css3";

$bkg: #ff704d;
@import url(https://fonts.googleapis.com/css?family=Cinzel|Julius+Sans+One);

html,body{
  margin: 0;
  padding: 0;
  background: $bkg;
  font-family: "Julius Sans One", sans-serif;
}

//SPINNER
@mixin spinner($color,$dur,$width,$height:$width){
 width: $width;
  height: $height;
  border-radius: 50%;
  box-shadow:0px 0px 0px 1px rgba(0,0,0,0.1), 2px 1px 0px $color;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: ($height/2)*-1;
  margin-left: ($width/2)*-1;
  @include animation(spin $dur linear infinite);
  @include keyframes(spin){
  100%{
    @include transform(rotate(360deg));
  }
  };
}

//PROPELLER
@mixin propeller($size,$dur, $center-color,$wing-color:$center-color){
  width: $size;
  height: $size;
  border-radius: 50%;
  background: $center-color;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: ($size/2)*-1;
  margin-left: ($size/2)*-1;
  @include animation(rotate $dur linear infinite);
  &:before, &:after{
    width: $size+10;
    height: 2px;
    background: $wing-color;
    position: absolute;
    content:'';
    margin-top: $size/2;
  }
  &:before{
    margin-left: ($size+20)*-1;
  }
  &:after{
    margin-left: $size+10;
  }
@include keyframes(rotate){
  100%{
    @include transform(rotate(360deg));
  }
};
}

//LINE
@mixin line($final-width,$color, $dur){
  position: absolute;
  width: 0px;
  height: 1px;
  top: 50%;
  left: 50%;
  margin-left: ($final-width/2)*-1;
  border-right: 5px solid white;
  background-color: $color;
  box-shadow: 0 0 10px $color;
  @include animation(line $dur ease-out infinite);
  @include keyframes(line){
    0%{
      width: 0;
    }
    100%{
      width: $final-width;
      opacity: 0;
    }
  }
}

//WHEEL
@mixin wheel ($size, $color-a, $color-b, $dur){
  width: $size;
  height: $size;
  border-radius: 50%;
  background: $color-a;
  overflow: hidden;
  position: relative;
  top: 50%;
  left: 50%;
  margin-top: ($size/2)*-1;
  margin-left: ($size/2)*-1;
  &:before,&:after{
    content:'';
    position: absolute;
    border-left: ($size/2) solid transparent;
    border-right: ($size/2) solid transparent;
  }
  &:before{
    border-top: ($size/2) solid $color-b;
  }
  &:after{
    border-bottom: ($size/2) solid $color-b;
    margin-top: ($size/2);
  }
  @include animation(wheel $dur linear infinite);
  @include keyframes(wheel){
    100%{
      @include transform(rotate(360deg));
    }
  }
}

//BOUNCE
@mixin bounce($size, $color, $dur){
  width: 5px;
  height: $size*4;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  position: absolute;
  left: 50%;
  top: 50%;
  margin-left: -2px;
  margin-top: ($size*2)*-1;
  @include animation(shadow $dur ease-in-out infinite);
  @include keyframes(shadow){
    50%{
      width: $size;
      border-bottom: 2px solid rgba(0,0,0,0.1);
      @include translateX(($size/2)*-1);
    }
  }
  &:before{
  content:'';
  width: $size;
  height: $size;
  background: $color;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: ($size*2)*-1;
  margin-left: ($size/2)*-1;
  @include animation(bounce $dur ease-in-out infinite);
  @include keyframes(bounce){
    25%{
      height: $size;
      border-radius: 0px;
    }
    50%{
      @include transform(rotate(180deg));
      margin-top: $size - 2;
      border-radius: 50%;
    }
    100%{
      @include transform(rotate(540deg));
    }
  }
  }
}

//TEXT
@mixin text($text,$color,$font-size,$dur){
  height:60px;
  width: 100%;
  top: 50%;
  margin-top: -30px;
  text-align: center;
  position: absolute;
  &:before{
    content:$text;
    font-family: "Julius Sans One",sans-serif;
    color: transparent;
    vertical-align: -50%;
    font-size: $font-size;
    letter-spacing: -6px;
    @include animation(fade $dur ease-in-out infinite);
    @include keyframes(fade){
      0%,100%{
        text-shadow: 0px 0px $font-size;
      }
      25%, 75%{
        color: transparent;
      }
      50%{
        text-shadow: 0px 0px 0px $color;
        letter-spacing: 4px;
        color:$color;
      }
    }
  }
}

//HOURGLASS
@mixin hourglass($width,$height,$glass,$sand,$dur){	
	position: absolute;
	border-radius: 50%;
	overflow: hidden;
	width: $width;
	height: $height;
	top: 50%;
	background: $glass;
	left: 50%;
	margin-left: ($width/2)*-1;
	margin-top: ($height/2)*-1;
	@include animation(turn $dur ease-in-out infinite);
		@include keyframes(turn){
			60%{
				@include transform(rotate(0deg));
			}
			100%{
				@include transform(rotate(180deg));
			}
		}
	&:before,&:after{
		border-left: ($width/2) solid transparent;
		border-right: ($width/2) solid transparent;
		content:'';
		position: absolute;
	}
	&:before{
		border-top: ($height/2) solid $sand;
		@include animation(drain $dur ease-in-out infinite);
	}
	&:after{
		border-bottom: 0px solid $sand;
		margin-top: ($height/2);
		@include animation(fill $dur ease-in-out infinite);
		@include transform(rotateY(90deg));
	}
	@include keyframes(drain){
		60%,100%{
			border-top:0px solid $sand;
			@include transform(rotateY(90deg) translateY(($height/2)));
		}
	}
	@include keyframes(fill){
    0%, 5%{
      border-bottom: 0px solid $sand;
    }
		70%,100%{
			border-bottom: ($height/2) solid $sand;
			@include transform(rotateY(0deg));
		}
	}
}

//PINWHEEL
@mixin pinwheel($width, $height, $pin-size, $speed){
  width: $width;
  height: $height;
  left: 50%;
  top: 50%;
  margin-left: ($width/2)*-1;
  position: absolute;
  margin-top: (($height/2)*-1)+$pin-size;
  background: #ddd;
  &:before{
  content:'';
    position: absolute;
    width: $pin-size;
    height: $pin-size;
    margin-top: $pin-size*-1;
    margin-left: (($pin-size/2)-$width)*-1;
    background: #ddd;
    border-radius: 50%;
    box-shadow: 0px 0px 5px 2px #666,
      0px ($pin-size+5) 0px 7px rgba(#D11919,0.5),
      -3px ($pin-size+3) 0px 7px mix(black,rgba(#D11919,0.4),20),
      ($pin-size+5) 0px 0px 7px rgba(#339966,0.5),
      ($pin-size+3) -3px 0px 7px mix(white,rgba(#339966,0.4),40),
      (($pin-size+5)*-1) 0px 0px 7px rgba(#FFDA45,0.5),
      (($pin-size+5)*-1) -3px 0px 7px mix(black,rgba(#FFDA45,0.4),30),
      0px (($pin-size+5)*-1) 0px  7px rgba(#993399,0.5),
      3px (($pin-size+5)*-1) 0px 7px mix(white,rgba(#993399,0.4),30);
    @include animation(wind $speed linear infinite);
    @include keyframes(wind){
      100%{
        @include transform(rotate(360deg));
      }
    }
      
  }
}

//BEER
@mixin beer($width, $height, $color,$dur){
	width:$width;
	height: $height;
	border-left: 3px solid #ddd;
	border-right: 3px solid #ddd;
	border-bottom: 2px solid #ddd;
	position: absolute;
	top: 50%;
	left: 50%;
  border-radius: 0 0 10% 10%;
	margin-top: ($height/2)*-1;
	margin-left: ($width/2)*-1;
	background: rgba(255,255,255,0.5);
	@include animation(tilt $dur linear infinite);
	@include keyframes(tilt){
		0%,60%{
			@include transform(rotate(0deg));
		}
		70%,90%{
			@include transform(rotate(90deg));
		}
	}
	&:before{
	  width: 3px;
		height: 0px;
		background: $color;
		content:'';
		position: absolute;
		margin-left: 23px;
    margin-top: -60px;
		@include animation(pour $dur linear infinite);
		@include keyframes(pour){
			30%{
				opacity: 0.7;
				height: $height - 10;
        margin-top: 10px;
			}
			50%,100%{
        margin-top:10px;
        opacity: 0;
			}
		}		
	}
	&:after{
		width: $width;
		height: 0px;
		bottom: 0;
		background: $color;
		content:'';
    border-radius: 0 0 10% 10%;
		position: absolute;
    @include animation(height $dur linear infinite);
    @include keyframes(height){
      0%,30%{
        height:0px;
        box-shadow: 0px -3px 0px #eee;
      }
      50%,70%{
        height: $height - 30;
        right: 0;
        width: $width;
        box-shadow: 0px -20px 0px #eee;
      }
      72%{
        box-shadow: 0px 0px 0px #eee;
      }
      75%,100%{
        right:0;
        width: 0px;
        height: $height+30
      }
    }
	}
}


//CLOCK
@mixin clock($size, $dur){
	border: 2px solid #222;
	box-shadow: 3px 3px 0px rgba(0,0,0,0.1), inset 0px 0px ($size/20) black,inset
		-5px -7px 0px 0px rgba(255,255,255,0.6);
	width: $size;
	height: $size;
	left: 50%;
	top: 50%;
	margin-left: ($size/2)*-1;
	margin-top: ($size/2)*-1;
	border-radius: 50%;
	background:#CCEAEA;
	position: absolute;
	&:before,&:after{
		position: absolute;
		content:'';
		top: 50%;
		width: $size/25;
		background: black;
		border-radius: 0 0 100% 100%;
		transform-origin: top;
		margin-left: ($size/2);
		@include keyframes(tick){
			100%{
				@include transform(rotate(360deg));
			}
		}
	}
	&:before{
		height: 35%;
		background: black;
		@include animation(tick $dur*2.5 linear infinite);
	}
	&:after{
		height: 40%;
		@include animation(tick $dur linear infinite);
	}
}

.spinner{
  @include spinner(white,0.7s,50px);
}
.propeller{
  @include propeller(20px,350ms, #009999, white);
}

.line{
  @include line(200px, #D14719, 2s);
}

.wheel{
  @include wheel(50px,#ddd,#990000,0.75s);
}

.bounce{
  @include bounce(25px, white, 2s);
}

.text{
  @include text("loading",white,15px,5s);
}

.hourglass{
  @include hourglass(50px,100px,transparent,#eee,3.5s);
}

.pinwheel{
  @include pinwheel(3px,75px,10px,0.3s);
}

.beer{
	@include beer(50px,90px,#E8BF19,6s);
}

.clock{
	@include clock(50px, 3s);
}


//OTHER STYLES
.container{
  width: 300px;
  height: 300px;
  border: 1px solid rgba(255,255,255,0.2);
  position: absolute;
  border-radius: 10px;
  top: 50%;
  left: 50%;
  margin-top: -150px;
  margin-left: -150px;
  box-shadow: -7px 7px 0px mix(black,$bkg,2);
}
.picker{
  position: absolute;
  z-index:11;
  width: 100%;
  margin: 0;
  padding: 15px 0;
  background: #222;
  text-align: center;
  border-bottom: 5px solid mix(black,$bkg,10);
}
.select-wrapper{
  width: 200px;
  height: 30px;
  background: black;
  border-bottom: 1px solid #bbb;
  margin: 0 auto;
  overflow: hidden;
}
.selector{
  background: transparent;
  border-radius: 0;
  border: 0;
  font-size: 20px;
  text-transform: uppercase;
  font-family: "Julius Sans One",sans-serif;
  letter-spacing: 4px;
  width: 200px;
  height: 30px;
  color: #bbb;
  cursor: pointer;
  outline: none;
}
h1{
  color: #eee;
  letter-spacing: 3px;
  font-size: 25px;
  margin: 0 0 10px 0;
}

              
            
!

JS

              
                $(document).ready(function(){
  $(".selector").on("change",function(){
    var loader=$(".selector").val();
    $("#stage").removeClass();
    $("#stage").addClass(loader);
  });
})
              
            
!
999px

Console