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

              
                <link href='https://fonts.googleapis.com/css?family=Alfa+Slab+One' rel='stylesheet' type='text/css'>
<div class="box box-1">YABBA</div>
<div class="box box-2">DABBA</div>
<div class="box box-3">DOO!!!!</div>
              
            
!

CSS

              
                body{
    padding: 10px 0 0 0;
    margin: 0;
    -webkit-transform-style: preserve-3d;
    -webkit-perspective: 1000px;
    -moz-transform-style: preserve-3d;
    -moz-perspective: 1000px;
    -ms-transform-style: preserve-3d;
    -ms-perspective: 1000px;
    transform-style: preserve-3d;
    perspective: 1000px;
    background-color: #a62e54;
    overflow: hidden;
}
.box{
	height: 200px;
	margin: 0 200px;
	-webkit-transform-origin: center top;
	-moz-transform-origin: center top;
  -ms-transform-origin: center top;
	transform-origin: center top;
	opacity: 0.9;
	text-align: center;
	font-size: 200px;
	line-height: 200px;
	font-family: 'Alfa Slab One', arial;
	color: #fff;
}
.box-2{
	display: none;
}
.box-3{
	display: none;
}
              
            
!

JS

              
                $(document).ready(function(){

	var direction = true;	

	var time = 0;

	var counter = 300;

	var speed = 1;

	(function myLoop () {

		setTimeout(function () { 

		   	time++;

	   		var degrees = -counter/3;
	   		var degrees_2 = -counter/2;
	   		var degrees_3 = -counter/1;
 
	   		var radian = degrees * (Math.PI/180);
	   		var radian_2 = degrees_2 * (Math.PI/180);

	   		var y = 200-(Math.cos(radian)*200);
	   		var z = (Math.sin(radian)*200);

	   		var y_2 = y+(200-(Math.cos(radian_2)*200));
	   		var z_2 = z+(Math.sin(radian_2)*200);

	   		$(".box-1").css("transform", "rotateX("+degrees+"deg)");
	   		$(".box-2").css("transform", "translateZ("+z+"px) translateY(-"+y+"px) rotateX("+degrees_2+"deg)");
	   		$(".box-3").css("transform", "translateZ("+z_2+"px) translateY(-"+y_2+"px) rotateX("+degrees_3+"deg)");
	   		
	   		// Fade in
		   	if(time == 40){
		   		$(".box-2").fadeIn(200);
		   	}
		   	if(time == 80){
		   		$(".box-3").fadeIn(200);
		   	}

		   	// Direction
		    if(direction){
		    	counter = counter - 2;
		    }else{
		     	counter = counter + 2;
		    }

		    // Slow the animation
			if(time > 120){
				speed = speed*1.012;
			}
		    
		    // Change direction
		    if(time == 241){
		     	direction = false;
		    }
		    if(time == 378){
		     	direction = true;
		    }
		    if(time == 447){
		     	direction = false;
		    }
		    if(time == 480){
		     	direction = true;
		    }
		    if(time == 490){
		     	return false
		    }		    

		    myLoop(time, speed, counter);
		}, speed)
	})(); 

});
              
            
!
999px

Console