css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

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

<!-- 		Paset the SVG code here -->
		<?xml version="1.0" encoding="UTF-8"?>
<svg width="400px" height="400px" 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 49.3 (51167) - http://www.bohemiancoding.com/sketch -->
    <title>Artboard</title>
    <desc>Created with Sketch.</desc>
    <defs>
        <polygon id="path-1" points="119 176 153 176 181.165039 229 147.165039 229"></polygon>
    </defs>
    <g id="Artboard" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <g id="progress1" class="progressBlock">
            <use fill="#FFFFFF" fill-rule="evenodd" xlink:href="#path-1"></use>
        </g>
        <polygon id="progress2" class="progressBlock" fill="#FFFFFF" points="152 176 186 176 214.165039 229 180.165039 229"></polygon>
        <polygon id="progress3" class="progressBlock" fill="#FFFFFF" points="185 176 219 176 247.165039 229 213.165039 229"></polygon>
        <polygon id="progress4"  class="progressBlock" fill="#FFFFFF" points="218 176 252 176 280.165039 229 246.165039 229"></polygon>
        <path d="M142.5,200.5 L204.5,233.5" id="redOverlap" class="redOverlap" stroke="#D20217" stroke-width="5" stroke-linecap="square"></path>
			<polygon id="red" class="redOutline" stroke="#D20217" stroke-width="5" points="142 140 261 204.00774 261 264.00774 142 200"></polygon>
			<polygon id="white" class="white" stroke="#FFFFFF" stroke-width="3" fill="#FFFFFF" points="141 202.599373 262 138.48 262 200.840627 141 264.96"></polygon>
    </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>

            
          
!
            
              
/* Start animation CSS */
.progressBlock {
  opacity: 0;
	transition: 0.25s ease;
}

.progressBlock.loaded {
	opacity: 1;
}

#red {
	transform-origin: 50% 50%;
	transition: 0.25s ease;
}

#red.loading{
	transform: rotate(-27.5deg) translate(-2px,0);
}

#redOverlap {
	transition: 0.25s ease;
}

#redOverlap.loading {
	opacity: 0;
}

#white {
	transform-origin: 50% 50%;
	transition: all 0.5s ease;
}

#white.loading {
	transform: scaleX(-1) rotate(27.5deg);
	opacity: 0
}








/* 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;
}

.btn.focus, .btn:focus, .btn:hover {
    color: white;
}
/* End housekeeping CSS */
            
          
!
            
              let timerId;
let progress;

function startLoading() {
	// hide button 
	$('.btn.start').hide();
	
	// set loading class on elements
	Snap.select("#red").addClass("loading");
	Snap.select("#redOverlap").addClass("loading");
	Snap.select("#white").addClass("loading");
	
	progress = 0;
	timerId = setInterval(frame, 500);
	
}

function frame() {
			
	if(progress === 25 ){
		Snap.select("#progress1").addClass('loaded')
	} else if (progress === 50){
		Snap.select("#progress2").addClass('loaded')
	} else if (progress === 75) {
		Snap.select("#progress3").addClass('loaded')
	} else if (progress === 100) {
		Snap.select("#progress4").addClass('loaded')
		clearInterval(timerId);
		finishLoading();
	}

	progress += 25;
			
}

function finishLoading() {
	// remove loading/loaded classes from all elements
	Snap.select("#red").removeClass("loading");
	Snap.select("#redOverlap").removeClass("loading");
	Snap.select("#white").removeClass("loading");
	Snap.select('#progress1').removeClass('loaded')
	Snap.select('#progress2').removeClass('loaded')
	Snap.select('#progress3').removeClass('loaded')
	Snap.select('#progress4').removeClass('loaded')
	
	// show button again
	$('.btn.start').show();
	
}
            
          
!
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