Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

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

              
                <!-- 
Color Swatches - Animating SVG Icon 

This experiment uses CSS Transforms and Animations on an SVG icon.
	(note that the icon is currently enlarged 300% for demonstration)

Designed and animated by Peter Nowell  ( @pnowelldesign  sketchmaster.com )
-->

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="97" height="60" viewBox="0 0 97 60" version="1.1">

	<g class="icon-container">
		<g class="back-panel">
			<path class="back-panel-shape" d="M40.5 5.01C40.5 3.62 41.63 2.5 42.99 2.5L53.01 2.5C54.38 2.5 55.5 3.62 55.5 5.01L55.5 50C55.5 54.14 52.13 57.5 48 57.5 43.86 57.5 40.5 54.14 40.5 50L40.5 5.01 40.5 5.01Z" fill="#FFFFFF" stroke="#565961"/>
			<rect class="back-swatch-1" fill="#40D68B" x="41" y="6"  width="14" height="7"/>
			<rect class="back-swatch-2" fill="#41D967" x="41" y="14" width="14" height="7"/>
			<rect class="back-swatch-3" fill="#59DB4B" x="41" y="22" width="14" height="7"/>
			<rect class="back-swatch-4" fill="#7DDE45" x="41" y="30" width="14" height="7"/>
			<rect class="back-swatch-5" fill="#A6E647" x="41" y="38" width="14" height="7"/>
		</g>

		<g class="mid-panel">
			<path class="mid-panel-shape" d="M40.5 5.01C40.5 3.62 41.63 2.5 42.99 2.5L53.01 2.5C54.38 2.5 55.5 3.62 55.5 5.01L55.5 50C55.5 54.14 52.13 57.5 48 57.5 43.86 57.5 40.5 54.14 40.5 50L40.5 5.01 40.5 5.01Z" fill="#FFFFFF" stroke="#565961"/>
			<rect class="mid-swatch-1" fill="#0BCDD4" x="41" y="6"  width="14" height="7"/>
			<rect class="mid-swatch-2" fill="#20D6CA" x="41" y="14" width="14" height="7"/>
			<rect class="mid-swatch-3" fill="#23DEBF" x="41" y="22" width="14" height="7"/>
			<rect class="mid-swatch-4" fill="#33E8B2" x="41" y="30" width="14" height="7"/>
			<rect class="mid-swatch-5" fill="#55F2B3" x="41" y="38" width="14" height="7"/>
		</g>

		<g class="top-panel">
			<path class="top-panel-shape" d="M40.5 5.01C40.5 3.62 41.63 2.5 42.99 2.5L53.01 2.5C54.38 2.5 55.5 3.62 55.5 5.01L55.5 50C55.5 54.14 52.13 57.5 48 57.5 43.86 57.5 40.5 54.14 40.5 50L40.5 5.01 40.5 5.01Z" fill="#FFFFFF" stroke="#565961"/>
			<rect class="top-swatch-1" fill="#31A0F7" x="41" y="6"  width="14" height="7"/>
			<rect class="top-swatch-2" fill="#31B2F8" x="41" y="14" width="14" height="7"/>
			<rect class="top-swatch-3" fill="#31C3F8" x="41" y="22" width="14" height="7"/>
			<rect class="top-swatch-4" fill="#31D3F8" x="41" y="30" width="14" height="7"/>
			<rect class="top-swatch-5" fill="#31E4F8" x="41" y="38" width="14" height="7"/>
		</g>

		<circle class="pin" fill="#565961" cx="48" cy="50" r="2"/>
	
	</g>

</svg>




<div class="zoom-button">Scale to </div>
              
            
!

CSS

              
                
.icon-container {
	animation: fade 6s infinite;
	opacity: 0;
}

.top-panel,
.mid-panel,
.back-panel {
	transform-origin: 48px 50px;
	transform: rotate(-50deg);
}
.top-panel {
	animation: open-top 6s cubic-bezier(.2,1.8,.45,.95) infinite;
}
.mid-panel {
	animation: open-mid 6s cubic-bezier(.2,1.8,.45,.95) infinite;
}
.back-panel {
	animation: open-back 6s cubic-bezier(.2,1.8,.45,.95) infinite;
}


@keyframes fade {
	10% { opacity: 1; }
	84% { opacity: 1; }
	92% { opacity: 0; }
}
@keyframes open-top {
	16% { transform: rotate(0deg); }
	84% { transform: rotate(0deg); }
}
@keyframes open-mid {
	16% { transform: rotate(27deg); }
	84% { transform: rotate(27deg); }
}
@keyframes open-back {
	16% { transform: rotate(53deg); }
	84% { transform: rotate(53deg); }
}






/* Zoom Button + Zooming */
svg {
	margin-top: 10vh;
	transform: scale(1);
	transform-origin: top left;
	transition: .6s;
}
.zoomed svg {
	transform: scale(3);
}
.zoom-button {
	position: fixed;
	bottom: 20px;
	background: white;
	cursor: pointer;
	padding: 5px 15px;
	border: 1px solid #3279FD;
	border-radius: 4px;
	font-family: Avenir, sans-serif;
	color: #3074F3;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}
.zoom-button:after {
	content: "300%"
}
.zoomed .zoom-button:after {
	content: "actual size"
}


              
            
!

JS

              
                // Event Listener for Zoom Button
$('.zoom-button').click( zoom );

// Function to zoom in or out
function zoom() {
	if( $('html').hasClass('zoomed') ) {
		$('html').removeClass('zoomed');
	}else{
		$('html').addClass('zoomed');
	};
};
              
            
!
999px

Console