cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <!-- 

Color Swatches - Animating SVG Icon 

This experiment uses CSS Transforms and Animations on an SVG icon. These kinds of techniques will be presented in my upcoming icon design & SVG class on CreativeLive. To stay in the know, visit pnowell.com

Animated and designed by: Peter Nowell
	(note that the icon is currently enlarged 300% for demonstration)

-->

<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"/>
<!-- 			<path id="back-rotation-offset" d="M42.99 42.5L53.01 42.5C54.38 42.5 55.5 43.62 55.5 45.01L55.5 90C55.5 94.14 52.13 97.5 48 97.5 43.86 97.5 40.5 94.14 40.5 90L40.5 45.01C40.5 43.62 41.63 42.5 42.99 42.5Z" opacity="0"/> -->
<!-- 	Rotation Hack not necessary when using specific pixel	coordinates for transform-origin -->
			<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"/>
<!-- 			<path id="mid-rotation-offset" d="M42.99 42.5L53.01 42.5C54.38 42.5 55.5 43.62 55.5 45.01L55.5 90C55.5 94.14 52.13 97.5 48 97.5 43.86 97.5 40.5 94.14 40.5 90L40.5 45.01C40.5 43.62 41.63 42.5 42.99 42.5Z" opacity="0"/> -->
<!-- 	Rotation Hack not necessary when using specific pixel	coordinates for transform-origin -->
			<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"/>
<!-- 			<path id="top-rotation-offset" d="M42.99 42.5L53.01 42.5C54.38 42.5 55.5 43.62 55.5 45.01L55.5 90C55.5 94.14 52.13 97.5 48 97.5 43.86 97.5 40.5 94.14 40.5 90L40.5 45.01C40.5 43.62 41.63 42.5 42.99 42.5Z" opacity="0"/> -->
<!-- 	Rotation Hack not necessary when using specific pixel	coordinates for transform-origin -->
			<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>
            
          
!
            
              
.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"
}


            
          
!
            
              // 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
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console