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

              
                <!--  This is a vain attempt at putting together something along the lines of Cary Huang's Scale of the Universe (Flash)
http://scaleofuniverse.com/  and Jerome Punzalan's Cosimic Scale (html/javascript/raphael)
https://cosmicscale.appspot.com/index.html 
I've used some parallax scrolling ideas and then used the .scrollTop() amount animate the circles
This started life as a fork of my previous parallax circles pen, but no one likes a fork so here it is in it's own right!
-->

<div id="holder"></div>

<div id="outerWrapper">

<div id="innerWrapper"></div>

</div>


<a href="#" id="zoomOut">Future</a>
<a href="#" id="zoomIn">Past</a>

              
            
!

CSS

              
                body {
  margin: 10px 100px;
  padding: 10px;
}

#outerWrapper {
  margin-top: -600px;
  width: 610px;
  height: 600px;
  position: relative;
  /*border: 2px solid #131313;*/
  overflow-y: scroll;
  overflow-x: hidden;

}

#innerWrapper {
  position: absolute;
  top: 0px;
  width: 595px;
  height: 1300px;


 }

 #holder {
  position: relative;
  overflow: hidden;
  width: 595px;
  height: 600px;
  background: #121830;
  background-image: linear-gradient(bottom, rgb(6,82,163) 0%, rgb(18,24,48) 62%);
  background-image: -o-linear-gradient(bottom, rgb(6,82,163) 0%, rgb(18,24,48) 62%);
  background-image: -moz-linear-gradient(bottom, rgb(6,82,163) 0%, rgb(18,24,48) 62%);
  background-image: -webkit-linear-gradient(bottom, rgb(6,82,163) 0%, rgb(18,24,48) 62%);
  background-image: -ms-linear-gradient(bottom, rgb(6,82,163) 0%, rgb(18,24,48) 62%);
 }

 #zoomIn, #zoomOut {
   position: relative;
   top: 10px;
   border-top: 1px solid #96d1f8;
   background: #51a8d0;
   padding: 6px 11px 2.5px;
   -webkit-border-radius: 4px;
   -moz-border-radius: 4px;
   border-radius: 4px;
   -webkit-box-shadow: rgba(0,0,0,1) 0 1px 0;
   -moz-box-shadow: rgba(0,0,0,1) 0 1px 0;
   box-shadow: rgba(0,0,0,1) 0 1px 0;
   color: white;
   font-size: 14px;
   font-family: Helvetica, Arial, Sans-Serif;
   text-decoration: none;
   vertical-align: middle;
   -webkit-transition: 100ms linear;
   -moz-transition: 100ms linear;
   -o-transition: 100ms linear;
   -ms-transition: 100ms linear;
   transition: 100ms linear;
   }

 #zoomIn:hover, #zoomOut:hover {
   border-top-color: #28597a;
   background: #28597a;
   color: #ccc;
   }

              
            
!

JS

              
                // First nominate the div to hold the Raphael svg
      var r = Raphael("holder", 595, 600),
  		// Then create some vars to centre the circles
			circX = $('#outerWrapper').width() / 2,
			circY = $('#outerWrapper').height() / 2,
			// Make a variable to store the amount that the outerwrapper has scrolled
			scrollAmount = 0,
			// This is the amount to push the text down by
			textOffset = 60;
			// Then make an array to hold all of the circle radii
			radii = [	-600,
						-500,
						-400,
						-300,
						-200,
						-100,
						0,
						100,
						200,
						300
						],
			circles = r.set(),			
			// Then make the cirles inside the set called 'circles'
			circles.push(
			circle10 = r.circle(circX, circY, radii[9]).attr({fill:"#FF0000"}),
			circle9 = r.circle(circX, circY, radii[8]).attr({fill:"#FF0000"}),
			circle8 = r.circle(circX, circY, radii[7]).attr({fill:"#FF0000"}),
			circle7 = r.circle(circX, circY, 0).attr({fill:"#FF7F00"}),
			circle6 = r.circle(circX, circY, 0).attr({fill:"#FF7F00"}),
			circle5 = r.circle(circX, circY, 0).attr({fill:"#FF7F00"}),
			circle4 = r.circle(circX, circY, 0).attr({fill:"#FFFF00"}),
			circle3 = r.circle(circX, circY, 0).attr({fill:"#FFFF00"}),
			circle2 = r.circle(circX, circY, 0).attr({fill:"#FFFF00"}),
			circle1 = r.circle(circX, circY, 0).attr({fill:"#00FF00"})
			).attr({'stroke-width':0, 'opacity':'.2' });
			// Let's start putting some text togther
			text = r.set(),
			text.push(
			txt10 = r.text(circX, (circY - (radii[9] - textOffset)), "2012").attr({ "font-size":"30" }),
			txt9 = r.text(circX, (circY - (radii[8] - textOffset)), "2011").attr({ "font-size":"20" }),
			txt8 = r.text(circX, (circY - (radii[7] - textOffset)), "2010").attr({ "font-size":"10", opacity:"0.505" }),
			txt7 = r.text(circX, (circY - (radii[6] - textOffset)), "2009").attr({ "font-size":"0" }),
			txt6 = r.text(circX, (circY - (radii[5] - textOffset)), "2008").attr({ "font-size":"0" }),
			txt5 = r.text(circX, (circY - (radii[4] - textOffset)), "2007").attr({ "font-size":"0" }),
			txt4 = r.text(circX, (circY - (radii[3] - textOffset)), "2006").attr({ "font-size":"0" }),
			txt3 = r.text(circX, (circY - (radii[2] - textOffset)), "2005").attr({ "font-size":"0" }),
			txt2 = r.text(circX, (circY - (radii[1] - textOffset)), "2004").attr({ "font-size":"0" })
			// txt1 = r.text(circX, (circY - (radii[0] - textOffset)), "October").attr({ "font-size":"0" })
			).attr({"font-family":"arial,helvetica,clean,sans-serif" , "fill":"#fff"});

			function moveCircles (x) {

				for (var i = 0; i < circles.length; i++) {
					// iterate through the circles in revers order
					p = (circles.length - 1) - i;
					// Only animate the visible circles
					if ( (x + radii[i]) <= 0 ) {
						circles[p].attr({r: 0 });
					} else if ( (x + radii[i]) >= 430 ) {
						circles[p].attr({r: 430 });
					} else {
						circles[p].animate({r: (x + radii[i]) });
					}

				};



				for (var i = 0; i < text.length; i++) {
					// iterate through the text in reverse order
					q = (radii.length - 1) - i;
					// Only animate the visible text
					if ( (circY - ((x + radii[q]) - textOffset)) <= -20 ) {
						text[i].attr({y: -20, "font-size": "38"});
					} else if ( (circY - ((x + radii[q]) - textOffset)) >= circY ) {
						text[i].attr({y: circY, "font-size": "0"});
					} else {
						text[i].animate({y: (circY - ((x + radii[q]) - textOffset)), 
							"font-size": (circles[i].attr('r') / 10 )
						});
					}

					if ( (circles[i].attr('r') / 200 ) <= 0.1 ) {
						text[i].attr({ opacity: 0 });
					} else if ( (circles[i].attr('r') / 200 ) >= 1 ) {
						text[i].attr({ opacity: 1 });
					} else {
						text[i].animate({ opacity: (circles[i].attr('r') / 200 )});
					}

				};
			}


			$('#outerWrapper').bind('scroll', function () {
				scrollAmount = $('#outerWrapper').scrollTop();
				moveCircles(scrollAmount);
			});

			$('#zoomIn').bind('click', function(e) {
				if ( scrollAmount < 700 ) {
				$('#outerWrapper').animate({scrollTop: (scrollAmount += 100 )}, 'slow');
				};
				e.preventDefault();
				return false;
			});

			$('#zoomOut').bind('click', function(e) {
				if ( scrollAmount > 0 ) {	
				$('#outerWrapper').animate({scrollTop: (scrollAmount -= 100 )}, 'slow');
				};
				e.preventDefault();
				return false;	
			});	
              
            
!
999px

Console