cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

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.

            
              
<div class="container">
	<div class="row">
	<div class="col-xs-12 text-center loader-container">

		<?xml version="1.0" encoding="UTF-8"?>
		<svg width="400px" height="300px" viewBox="0 0 400 400" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <!-- Generator: Sketch 43.2 (39069) - http://www.bohemiancoding.com/sketch -->
    <title>Artboard</title>
    <desc>Created with Sketch.</desc>
    <defs></defs>
    <g id="mkbhd" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
      
            <path id="whiteLoading" d="M119.855564 175.19126 254.976142 175.839624 283.144436 228.81648 148.023858 228.168116z"></path>
        
        <g id="Artboard">
            <polygon id="progress1" class="progressBlock pb1" fill="#FFFFFF" points="119 176 153 176 181.165039 229 147.165039 229"></polygon>
            <polygon id="progress2" class="progressBlock pb2" fill="#FFFFFF" points="152 176 186 176 214.165039 229 180.165039 229"></polygon>
            <polygon id="progress3" class="progressBlock pb3" fill="#FFFFFF" points="185 176 219 176 247.165039 229 213.165039 229"></polygon>
            <polygon id="progress4" class="progressBlock pb4" fill="#FFFFFF" points="218 176 252 176 280.165039 229 246.165039 229"></polygon>
            <polygon id="red2" class="redOutline" stroke="#D20217" stroke-width="5" points="142 140 261 204.00774 261 264.00774 142 200"></polygon>
            <path id="white" class="whiteBlock" stroke="#FFFFFF" stroke-width="3" fill="#FFFFFF" d="M141 202.601175 262 138.479492 262 200.842366 141 264.964049z"></path>
            <path d="M142.5,200.5 L204.5,233.5" id="redoverlap" class="redoverlap" stroke="#D20217" stroke-width="5" stroke-linecap="square"></path>
        </g>
    </g>
</svg>
	</div>
</div>

<div class="row text-center">
	<div class="col-xs-12">
		<button class="btn start" onclick="startLoading()">Simulate Loading</button>
	</div>
</div>

</div>

            
          
!
            
              
/* Some housekeeping CSS */
body {
  background: #3D4346 !important;
}

.loader-container {
  margin: auto;
  overflow: hidden;
}

.btn {
	margin:20px;
	background-color:#3D4346;
	color:white;
	padding: 10px 15px;
	border-radius:0;
	border: 2px solid red;
	text-transform:uppercase;
	font-weight:lighter;
	letter-spacing: 2px;
	-webkit-transition: all 0.25s ease;
	-o-transition: all 0.25s ease;
	transition: all 0.25s ease;
}

.btn:hover {
	color:white;
	border-color: white;
}
/* End housekeeping CSS */

.redoverlap.loading {
  -webkit-animation: overlapLoading 0.25s ease forwards;
          animation: overlapLoading 0.25s ease forwards;
}

@-webkit-keyframes overlapLoading {
  0% { opacity: 1;}
  100% { opacity: 0;}
}

@keyframes fillerBarLoading {
  0% { opacity: 1;}
  100% { opacity: 0;}
}

.redOutline {
  -webkit-transform-origin: 50% 50%;
      -ms-transform-origin: 50% 50%;
          transform-origin: 50% 50%;
  z-index:100;
	-webkit-transition: 0.25s ease;
	-o-transition: 0.25s ease;
	transition: 0.25s ease;
}

.redOutline.loading{
	-webkit-transform: rotate(-27.5deg) translate(-2px,0);
	    -ms-transform: rotate(-27.5deg) translate(-2px,0);
	        transform: rotate(-27.5deg) translate(-2px,0)
}

.whiteBlock {
	-webkit-transform-origin: 50% 50%;
	    -ms-transform-origin: 50% 50%;
	        transform-origin: 50% 50%;
	-webkit-transition: all 0.5s ease;
	-o-transition: all 0.5s ease;
	transition: all 0.5s ease;
}

.whiteBlock.loading {
  -webkit-animation: whiteLoading 0.5s ease forwards;
          animation: whiteLoading 0.5s ease forwards;
	-webkit-transform: scaleX(-1) rotate(27.5deg);
	    -ms-transform: scaleX(-1) rotate(27.5deg);
	        transform: scaleX(-1) rotate(27.5deg);
	-webkit-filter: FlipH;
	        filter: FlipH;
	-ms-filter: "FlipH";
	opacity: 0
}

.progressBlock {
  opacity: 0;
	-webkit-transform-origin: 50% 50%;
	    -ms-transform-origin: 50% 50%;
	        transform-origin: 50% 50%;
}

.progressBlock.loading {
  -webkit-animation: progressShow 0.25s ease forwards;
          animation: progressShow 0.25s ease forwards;
}

@-webkit-keyframes progressShow {
  0% {opacity: 0}
  100% {opacity: 1}
}

@keyframes progressShow {
  0% {opacity: 0}
  100% {opacity: 1}
}
            
          
!
            
              let timerId, 
		progress, 
		white, 
		whitePoints,
		progress1,
		progress1Points;

let bar = $('.progress-bar');
let width =  parseInt($('.progress-bar').attr('aria-valuenow'));

progress = 0;

white = Snap.select('#white');
whitePoints = white.node.getAttribute('d');

progress1 = Snap.select('#progress1');
progress1Points = progress1.node.getAttribute('d');

$( ()=>{
  
		// start loading automatically after 1s
		setTimeout(()=>{
			startLoading();
		})

} )

function toLoading(){
	white.animate({d: progress1Points}, 500)
}

function startLoading(){
	// toLoading();
  timerId = setInterval(frame, 100);
  // set loading class on elements
  $('.redOutline').addClass('loading');
  $('.whiteBlock').addClass('loading'); 
  $('.redoverlap').addClass('loading');
	
	// hide simulate loading button
	$('.btn.start').hide()
}

function loadingComplete(){
  $('.redOutline').removeClass('loading');
  $('.whiteBlock').removeClass('loading'); 
  $('.redoverlap').removeClass('loading');
	Snap.select("#progress1").removeClass('loading');
	Snap.select("#progress2").removeClass('loading');
	Snap.select("#progress3").removeClass('loading');
	Snap.select("#progress4").removeClass('loading');
	progress = 0;
	bar.css('width', progress+"%");
	
	// Show start button
	$('.btn.start').show()
}

function frame() {
    if(progress <= 100){
      progress += 3;
      
      switch (true) {
          case ( progress >=25 && progress < 49 ):
							Snap.select("#progress1").addClass('loading')
              break;
          case ( progress >=50 && progress < 74 ):
							Snap.select("#progress2").addClass('loading')
              break;
          case ( progress >=75 && progress < 98 ):
							Snap.select("#progress3").addClass('loading')
              break;
          case ( progress >=99 && progress < 100 ):
							Snap.select("#progress4").addClass('loading')
              break;
      }
      bar.css('width', progress+"%");
    } else {
      clearInterval(timerId);
      loadingComplete()   
    }
  }
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console