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="slider"></div> -->
<div class="container">
	
	<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 778 590">
		<title>media-type-svg-3</title>
		<circle class="mt-base" cx="389" cy="294" r="209" fill="none" stroke="#fff" stroke-miterlimit="10" stroke-width="1.01" opacity="0.3" />
		<path class="mt-base-2" d="M559,294A170,170,0,1,1,389,124,170,170,0,0,1,559,294Z" fill="none" stroke="#fff" stroke-miterlimit="10" stroke-width="40" />
		<g class="mt-rings" fill="none" stroke-miterlimit="10" stroke-width="10" >
			<path class="mt-base-2-track" d="M389,124A170,170,0,1,1,219,294,170,170,0,0,1,389,124Z" stroke="#eeeeee" />
			<path class="mt-ring mt-ring-0" d="M389,124A170,170,0,1,1,219,294,170,170,0,0,1,389,124Z" stroke="#00a2d1" />
			<path class="mt-ring mt-ring-1" d="M389,124A170,170,0,1,1,219,294,170,170,0,0,1,389,124Z" stroke="#0ad100" />
			<path class="mt-ring mt-ring-2" d="M389,124A170,170,0,1,1,219,294,170,170,0,0,1,389,124Z" stroke="#f67521" />
			<path class="mt-ring mt-ring-3" d="M389,124A170,170,0,1,1,219,294,170,170,0,0,1,389,124Z" stroke="#f60d1a" />
			<text class="mt-text sans-light" x="308" y="303" font-size="30" fill="#fff" >MEDIA TYPE</text>
		</g>
		<g class="mt-perc-lines">
			<rect class="mt-perc-line" x="388" y="94" width="2" height="49" fill="#fff" />
			<rect class="mt-perc-line" x="388" y="94" width="2" height="49" fill="#fff" />
			<rect class="mt-perc-line" x="388" y="94" width="2" height="49" fill="#fff" />
			<rect class="mt-perc-line" x="388" y="94" width="2" height="49" fill="#fff" />
		</g>
		<line class="mt-line" x1="389" y1="294" x2="389" y2="94" fill="#fff" stroke="#fff" stroke-miterlimit="10" stroke-width="2" />
		<g class="mt-markers" fill="none" stroke="#fff" stroke-miterlimit="10">
			<line class="mt-marker mt-marker-0" x1="389.5" y1="107" x2="389.5" y2="17" />
			<line class="mt-marker mt-marker-1" x1="389.5" y1="107" x2="389.5" y2="17" />
			<line class="mt-marker mt-marker-2" x1="389.5" y1="107" x2="389.5" y2="17" />
			<line class="mt-marker mt-marker-3" x1="389.5" y1="107" x2="389.5" y2="17" />
		</g>
		<g class="mt-figures">
			<text class="sans-light" x="260" y="20" font-size="14" fill="#fff" >ONLINE - <tspan class="sans-semi">4%</tspan></text>
			<text class="sans-light" x="578" y="78" font-size="14" fill="#fff" >RADIO - <tspan class="sans-semi">22%</tspan></text>
			<text class="sans-light" x="664" y="398" font-size="14" fill="#fff" >TV - <tspan class="sans-semi">17%</tspan></text>
			<text class="sans-light" x="56" y="432" font-size="14" fill="#fff" >PRINT - <tspan class="sans-semi">57%</tspan></text>
		</g>
	</svg>

</div>

<div class="me">
	<a class="me__link portfolio" href="http://www.petebarr.com" target='_blank'>Petebarr.com<span></span></a>

</div>
<a class="twitter" href="https://twitter.com/petebarr" target='_blank'>
	<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52">
		<path fill="#fff" d="M39.19 15.39a10.63 10.63 0 0 1-3.38 1.29 5.31 5.31 0 0 0-9.19 3.63 5.43 5.43 0 0 0 .14 1.22A15.11 15.11 0 0 1 15.8 16a5.39 5.39 0 0 0-.72 2.68 5.32 5.32 0 0 0 2.37 4.42 5.33 5.33 0 0 1-2.45-.7v.07a5.31 5.31 0 0 0 4.27 5.21 5.45 5.45 0 0 1-1.41.19 4.78 4.78 0 0 1-1-.1 5.32 5.32 0 0 0 5 3.69 10.64 10.64 0 0 1-6.6 2.28c-.43 0-.85 0-1.27-.07a15.13 15.13 0 0 0 23.28-12.74v-.69a10.87 10.87 0 0 0 2.66-2.75 10.84 10.84 0 0 1-3.06.84 5.35 5.35 0 0 0 2.34-2.94"></path>
<!-- 		<path fill="#fff" d="M26 5A21 21 0 1 1 5 26 21 21 0 0 1 26 5m0-4a25 25 0 1 0 25 25A25 25 0 0 0 26 1z"></path> -->
	</svg>
</a>
              
            
!

CSS

              
                body {
  //background-color:#00a2d1;
	background-color:#4285F4;
  background: linear-gradient(to right, #ed30a0 0%,#0b86a6 100%);
}

body,
html {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
}

#slider{
  width:300px;
  position:relative;
  margin: 30px auto;
}

.container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 750px;
  height: 500px;
}

svg {
  width: 100%;
  height: 100%;
  visibility: hidden;
}

.sans-light{
    font-family: 'open-sans', sans-serif;
    font-weight: 300;
    font-style: normal;
}

.sans-semi {
    font-family: 'open-sans', sans-serif;
    font-weight: 600;
    font-style: normal;
}

.serif {
    font-family: 'ff-meta-serif-web-pro', serif;
    font-weight: 500;
    font-style: normal;
}

.me {
	position: fixed;
	z-index: 1000;
	top: 24px;
	left: 24px;
	display: flex;
	flex-direction: column;
}

.me__link {
	position: relative;
	margin-bottom: 16px;
	color: white;
	font-family: Helvetica, sans-serif;
	text-decoration: none;
	font-size: 16px;

	span {
		display: block;
		position: absolute;
		bottom: -3px;
		left: 0;
		height: 1px;
		width: 5%;
		background-color: white;
		content: "";
		transition: width 0.3s;
	}

	&:hover span{
		width: 100%;
	}
}

.twitter {
	position: fixed;
	top: 16px;
	right: 24px;
	display: block;
	width: 40px;
	height: 40px;
}
              
            
!

JS

              
                /*  ==========================================================================
    GLOBAL VARIABLES
    ========================================================================== */  

	var percs = [22, 17, 57, 4];
	var percsRange = []; // array of percentage ranges for the arcs to animate from to
	var percsEnd = []; // array of percentages for the divider lines to animate to
	var markersAngles = []; // array of percentages for markers to be positioned mid arcs
	var $sLine = $('.mt-line'); // starting line
	var $mtText = $('.mt-text'); // media type text
	var $ring = $('.mt-ring'); // each percentage arc
	var $percLine = $('.mt-perc-line'); // percentage divider lines
	var $mtBase2 = $('.mt-base-2'); // thick white ring
	var $mtTrack = $('.mt-base-2-track'); // thick ring track
	var $mtMarker =$('.mt-marker'); // marker lines

/*  ==========================================================================
    INIT ITEMS
    ========================================================================== */  

	TweenMax.set('svg', {
		visibility: 'visible'
	});

	TweenMax.set($sLine, {
		drawSVG: '0px 2px'
	});

	TweenMax.set($percLine, {
		transformOrigin: '1px 200px',
		opacity: 0
	});

	TweenMax.set($mtBase2, {
		transformOrigin: '50% 50%',
		rotation: -90,
		drawSVG: '0% 0%'
	});

	TweenMax.set($mtTrack, {
		transformOrigin: '50% 50%',
		drawSVG: '0% 0%'
	});

	TweenMax.set($mtMarker, {
		transformOrigin: '1px 277px',
		drawSVG: '0% 0%'
	});


/*  Set each ring to its starting position and populate arrays
    ========================================================================== */  

	var addPercs = 0;
	$ring.each( function(i, val) {
		percsEnd.push(addPercs);

		var tempStart = addPercs;
		// set the starting positions
		TweenMax.set('.mt-ring-'+i, {
			drawSVG: addPercs + '% ' + addPercs + '%'
		});
		// get the ending positions and set the drawSVG ranges in an array
		addPercs = addPercs + percs[i];
		var rangeString = tempStart + '% ' + addPercs + '%';
		percsRange.push(rangeString);
		markersAngles.push((tempStart + (addPercs-tempStart)/2)/100*360);

	}); 

	percsEnd.reverse(); // reverse the array so the line travelling furthest goes first, and so on
	markersAngles.reverse(); // reverse the array so the line travelling furthest goes first, and so on


/*  ==========================================================================
    TIMELINE ANIMATION
    ========================================================================== */  

	var mtl = new TimelineMax({yoyo: true, repeat: -1, repeatDelay: 2});
		// animate the base line
		mtl.to($sLine, 0.4, {
			drawSVG: '0px 200px',
			ease: Power3.easeIn,
			delay: 0.3
		})
		.to($sLine, 0.3, {
			drawSVG: '200px 150px',
			ease: Power3.easeOut
		})
		.set($sLine, {
			opacity: 0
		})
		.set($percLine, {
			opacity: 1
		})
		// animate the title text
		.from($mtText, 0.7, { 
			y: 50, 
			autoAlpha: 0, 
			ease: Elastic.easeOut.config(1.1, 0.3) 
		}, "-=0.25")
		// animate the base circle
		.to($mtBase2, 1.4, {
			drawSVG: '0% 100%',
			ease: Power4.easeInOut
		}, "-=0.8")
		// animate the base circle track
		.to($mtTrack, 1, {
			drawSVG: '0% 100%',
			ease: Power4.easeInOut
		}, "-=1.05")
		// animate the perctage lines
		.staggerTo($percLine, 1.4, {
			cycle: {
				rotation: function(i) {
					return percsEnd[i]/100 * 360;
				}
			},
			ease:Power4.easeInOut
		}, 0.1, "-=1.2")
		// animate in marker lines
		.staggerTo($mtMarker, 0.8, {
			cycle: {
				rotation: function(i) {
					return markersAngles[i];
				}
			},
			drawSVG: '0% 100%',
			ease: Power3.easeOut
		}, 0.1, "-=0.9")
		// animate the rings
		.staggerTo($ring, 1.4, {
			cycle: {
				drawSVG: function(i) { return percsRange[i] }
			},
			ease: Power4.easeInOut
		}, 0, "-=1.3")
		.from('.mt-figures', 1, {
			opacity: 0
		}, "-=0.5");

	

/*  ==========================================================================
    SLIDER
    ========================================================================== */  

	var $slider = $('#slider'),
		sliderValue = { value: 0 };

	$slider.slider({
	  range: false,
	  min: 0,
	  max: 100,
	  step: .1,
	  start: function() {
		mtl.pause();
	  },
	  slide: function(event, ui) {
		mtl.progress(ui.value / 100);
	  },
	  stop: function() {
		mtl.play();
	  }
	});

	mtl.eventCallback("onUpdate", function() {
	  sliderValue.value = mtl.progress() * 100;
	  $slider.slider(sliderValue);
	});
              
            
!
999px

Console