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

              
                <div id="discoveryChart">

<div id="pieContainer">
	
	<svg id="chart" x="0px" y="0px" width="239.3px" height="239px" viewBox="0 0 239.3 239">
		<path id="orange" d="M119.5,58c29.5,0,54.2,20.7,60.2,48.4l56.9-12.1C225,40.4,176.9,0,119.5,0c-0.1,0,0.5,0-0.5,0v58.1
			C120,58.1,119.4,58,119.5,58z"/>
		<path id="green" d="M58,119.5c0-33.9,28-61.3,61-61.5V0C54,0.1,0,53.6,0,119.5c0,29.1,10.6,55.9,27.9,76.6l44.4-37.3
			C63.4,148.1,58,134.4,58,119.5z"/>
		<path id="red" d="M179.8,106.5c0.9,4.2,1.4,8.6,1.4,13c0,24.3-14.1,45.3-34.6,55.3l25.5,52.2c39.8-19.4,67.2-60.2,67.2-107.5
			c0-8.6-0.9-17-2.7-25.1L179.8,106.5z"/>
		<path id="blue" d="M119.8,181c-19,0-36-8.6-47.3-22.2L28,196.1c21.9,26.2,54.9,42.9,91.7,42.9c18.8,0,36.5-4.3,52.3-12
			l-25.5-52.2C138.5,178.8,129.4,181,119.8,181z"/>
		<style>#red, #blue, #green, #orange { cursor: pointer; transition: opacity .2s ease-in-out;}
			#red:hover, #blue:hover, #green:hover, #orange:hover{ opacity: 0.8;}</style>
	</svg>

	
	<svg id="lines" width="69.1px" height="69.1px" viewBox="0 0 69.1 69.1">
		<line id="line1" x1="34.5" y1="34.5" x2="0.7" y2="0.7"/>
		<line id="line2" x1="34.5" y1="34.5" x2="68.4" y2="0.7"/>
		<line id="line3" x1="34.5" y1="34.5" x2="0.7" y2="68.4"/>
		<line id="line4" x1="34.5" y1="34.5" x2="68.4" y2="68.4"/>
	</svg>
	<!-- 		Vitamin Icon -->
	<svg version="1.1" id="vit-svg-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 800 800" style="enable-background:new 0 0 800 800;" xml:space="preserve">
<style type="text/css">
	.st0{fill:#a4be43;}
</style>
<path class="st0" d="M591.6,64c-10.8,12.9-20.8,27.9-30.2,44.9c-19.3,34.1-37,76.7-57.2,124.3l-6.6-14.8
	c13.2-38.8,20.8-75.5,20.8-106.5c0-47.4-17.4-82.7-57.6-94c-20-3.2-40.5-4.9-61.4-4.9c-32,0-63,3.9-92.7,11.2
	c-35.7,21.4-34.1,72.7-13.1,118.6L421,429.5l-85.4,201.7h-7l-225-480.5C46.9,218,12.7,304.9,12.7,399.8
	c0,213.6,173.2,386.8,386.8,386.8s386.8-173.2,386.8-386.8C786.3,256.1,707.9,130.7,591.6,64z"/>
</svg>
</div><!--end pie container-->

<div id="discoveryTextContainer">
	<div id="description" class="title">
		<h2>Infographics Design</h2>
		<p>Click or tap on the segements of the pie chart.</p>
	</div>
	<div id="titleOne" class="title">
		<h2>Our Expertise</h2>
		<p>We've designed infographics for all sectors from pharma to IT. We'll deliver razor sharp graphics in whatever format the job needs. Better still, we future-proof all our work by using the latest design tools. If you want that brochure graphic animated for your website, we can easily re-purpose existing assets</p>
	</div>
	<div id="titleTwo" class="title">
		<h2>What's an infographic?</h2>
		<p style="top:80px;">An infographic can be a simple pie chart ,line graph, visual reprentation of a process or even an entire business model. A little sprinkle of designer magic can really bring them to life!</p>
	</div>
	<div id="titleThree" class="title">
		<h2>Icons</h2>
		<p>Icons are everywhere, on your phone, TV and even in your car. They communicate much more than function, they can be used to reinforce your brand identity. We're icon design experts and can even create custom icon fonts if needed</p>
	</div>
	<div id="titleFour" class="title">
		<h2>Facts & Figures</h2>
		<p>If you have a story to tell and it needs a few figures, an infographic might be just the job! Why struggle with hundreds of words when some sharp graphics will look better, be easier to understand and a whole pile more engaging! </p>
	</div>
</div>
	<div id="preloader"></div>
</div><!--end discovery chart-->
              
            
!

CSS

              
                html,
body {
	margin: 0;
	font-family: 'IBM Plex Sans', sans-serif;
}

#preloader {
	position: absolute;
	width: 100%;
	height: 100%;
	background: white;
}

#discoveryChart {
	position: absolute;
	width: 620px;
	height: 240px;
	margin: auto;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
}

#pieContainer {
	position: absolute;
	width: 240px;
	height: 240px;
	left: 0;
	overflow: visible;
}

#discoveryTextContainer {
	position: absolute;
	width: 380px;
	height: 240px;
	left: 260px;
}

#lines {
	position: absolute;
	margin: auto;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
}

#line1,
#line2,
#line3,
#line4 {
	fill:none;
	stroke-width:1;
	stroke-miterlimit:10;
	stroke-dasharray: 50;
  stroke-dashoffset: -50;
}

#line1{
	stroke:#a4be43;
}
#line2{
		stroke:#3f3d3e;
}
#line3{
		stroke:#3f3d3e;
}
#line4{
		stroke:#a4be43;
}

#chart {
	position: absolute;
	overflow: visible;
}

svg:hover{
	pointer: cursor;
}

#green {
	fill:#a4be43;
}

#orange {
	fill:#adadad;
}

#blue {
	fill:#3f3d3e;
}

#red {
	fill:#c1d088;
}

#leftBar {
	display: inline-block;
	background-color: #c1d088;
	width: 1px;
	height: 100%;
}

.title {
	width: 100%;
}

#discoveryTextContainer {
	border-left: 0px solid #EEE;
}

.title h2 {
	position: absolute;
	text-transform: uppercase;
	font-size: 28px;	
	margin-top: 14px;
	left: 20px;
	visibility: hidden;
	color: #a4be43;
}

.title p {
	position: absolute;
	margin-left: 20px;
	top: 48px;
	visibility: hidden;
	color: #3f3d3e;
	line-height: 1.4;
}

              
            
!

JS

              
                var firstMove = true;
var active;
var tl;

var g = document.getElementById('green');
var o = document.getElementById('orange');
var b = document.getElementById('blue');
var r = document.getElementById('red');

var dc = document.getElementById('discoveryChart');

function setup() {
	TweenMax.set('#chart', {scale: 0});
	TweenMax.set('#vit-svg-icon', {scale: 0});
	TweenMax.set('#lines', {scale: 1.5 });
	TweenMax.set(['#description h2', '#titleOne h2','#titleTwo h2','#titleThree h2','#titleFour h2'], { x: '-=8' });
	TweenMax.to('#preloader', 0.25, { autoAlpha: 0 });
	animate();
	listeners();
};

function animate() {
	TweenMax.to(['#line1','#line2','#line3','#line4'], 1.25, { strokeDashoffset: 50, ease: Power3.easeInOut });
	TweenMax.to('#chart', 1.5, { scale: 1, ease: Power3.easeOut, delay: .84 });
	TweenMax.to('#vit-svg-icon', 1.2, { scale: 0.3, ease: Power3.easeOut, delay: 1.2 });
	TweenMax.to(['#description h2', '#description p'], 1.5, { x: 0, autoAlpha: 1, ease: Power3.easeOut });
	
	tl = new TimelineMax();
}; 

function listeners() {
	
	g.addEventListener('click', highlightGreen);
	
	o.addEventListener('click', highlightOrange);
	
	b.addEventListener('click', highlightBlue);
	
	r.addEventListener('click', highlightRed);

};

function removeDescription() {
	TweenMax.to(['#description h2', '#description p'], 1, { autoAlpha: 0, ease: Linear.easeNone });
};

function highlightGreen() {

	removeDescription();
	
	if (active === 'orange') {
		placeOrange();
	} else if (active === 'blue') { 
		placeBlue();
 	} else if (active === 'red') {
		placeRed();
	}
	
	active = 'green';
	
	tl.to('#green', .3, { x: -10, y: -10, ease: Power3.easeOut });
	tl.to('#discoveryTextContainer', .3, { borderLeft: '2px solid #a4be43', ease: Linear.easeNone });
	tl.to('#titleOne h2', .3, { x: 0, autoAlpha: 1, ease: Linear.easeNone }, '-=0.3');
	tl.to('#titleOne p', .3, { autoAlpha: 1, ease: Linear.easeNone }, '-=.2');	
	
};
function placeGreen() {
	tl.to('#green', .3, { x: 0, y: 0, ease: Power3.easeOut });
	tl.to('#discoveryTextContainer', .3, { borderLeft: '0px solid #a4be43', ease: Linear.easeNone });
	tl.to('#titleOne h2', .3, { x: '-=8', autoAlpha: 0, ease: Linear.easeNone }, '-=0.3');
	tl.to('#titleOne p', .3, { autoAlpha: 0, ease: Linear.easeNone }, '-=.3');
};

function highlightOrange() {
	
	removeDescription();
	
	if (active === 'blue') {
		placeBlue();
	} else if (active === 'green') { 
		placeGreen();
 	} else if (active === 'red') {
		placeRed();
	}
	
	active = 'orange';
	
	tl.to('#orange', .3, { x: 8, y: -10, ease: Power3.easeOut });
	tl.to('#discoveryTextContainer', .3, { borderLeft: '2px solid #a4be43', ease: Linear.easeNone });
	tl.to('#titleTwo h2', .3, { x: '0', autoAlpha: 1, ease: Linear.easeNone }, '-=0.3');
	tl.to('#titleTwo p', .3, { autoAlpha: 1, ease: Linear.easeNone }, '-=.2');
};
function placeOrange() {
	tl.to('#orange', .3, { x: 0, y: 0, ease: Power3.easeOut });
	tl.to('#discoveryTextContainer', .3, { borderLeft: '0px solid #EEE', ease: Linear.easeNone });
	tl.to('#titleTwo h2', .3, { x: '-=8', autoAlpha: 0, ease: Linear.easeNone }, '-=0.3');
	tl.to('#titleTwo p', .3, { autoAlpha: 0, ease: Linear.easeNone }, '-=.3');
};

function highlightBlue() {
	
	removeDescription();
	
	if (active === 'green') {
		placeGreen();
	} else if (active === 'orange') { 
		placeOrange();
 	} else if (active === 'red') {
		placeRed();
	}
	
	active = 'blue';
	
	tl.to('#blue', .3, { x: -2, y: 12, ease: Power3.easeOut });
	tl.to('#discoveryTextContainer', .3, { borderLeft: '2px solid #a4be43', ease: Linear.easeNone });
	tl.to('#titleThree h2', .3, { x: '0', autoAlpha: 1, ease: Linear.easeNone }, '-=0.3');
	tl.to('#titleThree p', .3, { autoAlpha: 1, ease: Linear.easeNone }, '-=.2');
};
function placeBlue() {
	tl.to('#blue', .3, { x: 0, y: 0, ease: Power3.easeOut });
	tl.to('#discoveryTextContainer', .3, { borderLeft: '0px solid #EEE', ease: Linear.easeNone });
	tl.to('#titleThree h2', .3, { x: '-=8', autoAlpha: 0, ease: Linear.easeNone }, '-=0.3');
	tl.to('#titleThree p', .3, { autoAlpha: 0, ease: Linear.easeNone }, '-=.3');
};

function highlightRed() {
	
	removeDescription();
	
	if (active === 'orange') {
		placeOrange();
	} else if (active === 'blue') { 
		placeBlue();
 	} else if (active === 'green') {
		placeGreen();
	}
	
	active = 'red';
	
	tl.to('#red', .3, { x: 10, y: 4, ease: Power3.easeOut });
	tl.to('#discoveryTextContainer', .3, { borderLeft: '2px solid #a4be43', ease: Linear.easeNone });
	tl.to('#titleFour h2', .3, { x: '0', autoAlpha: 1, ease: Linear.easeNone }, '-=0.3');
	tl.to('#titleFour p', .3, { autoAlpha: 1, ease: Linear.easeNone }, '-=.3');
};
function placeRed() {
	
	tl.to('#red', .5, { x: 0, y: 0, ease: Power3.easeOut });
	tl.to('#discoveryTextContainer', .3, { borderLeft: '0px solid #EEE', ease: Linear.easeNone });
	tl.to('#titleFour h2', .3, { x: '-=8', autoAlpha: 0, ease: Linear.easeNone }, '-=0.3');
	tl.to('#titleFour p', .3, { autoAlpha: 0, ease: Linear.easeNone }, '-=.3');

};

document.addEventListener("DOMContentLoaded", setup);
              
            
!
999px

Console