Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

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.

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 class="demoWrapper">
  <div class="stage">
    <h1>transformPerspective Vs perspective</h1>
    <p><strong>transformPerspective</strong> is applied to each box causing each box to have its own vanishing point</p>
    <div id="transformPerspective">
      <div class="tpvp_box"></div>
      <div class="tpvp_box"></div>
      <div class="tpvp_box"></div>
      <div class="tpvp_box"></div>
      <div class="tpvp_box"></div>
      <div class="tpvp_box"></div>
      <div class="tpvp_box"></div>
    </div>
    <div style="height:30px;"></div>
    <p>A single <strong>perspective</strong> is applied to the parent div of all the boxes causing each box to share the same vanishing point</p>
    <div id="perspective">
      <div class="tpvp_box"></div>
      <div class="tpvp_box"></div>
      <div class="tpvp_box"></div>
      <div class="tpvp_box"></div>
      <div class="tpvp_box"></div>
      <div class="tpvp_box"></div>
      <div class="tpvp_box"></div>
    </div>
  </div>
  <div class="demoNav">
    <div id="tpvp_slider" class="demoSlider"></div>
    <button id="tpvp_play_btn" class="play">play</button>
  </div>
</div>
              
            
!

CSS

              
                .demoWrapper
{
	width:550px;
	height:400px;
	background-color:#000;
	-webkit-font-smoothing:antialiased;
	margin:-1px -1px 30px 10px;
	padding:1px;
}

.demoWrapper strong
{
	font-weight:700;
	color:#fff;
}

.demoWrapper h1
{
	font-size:22px;
	font-weight:700;
	line-height:28px;
	color:#fff;
	float:none;
	margin:0 0 10px;
	padding:0;
}

.demoWrapper p
{
	line-height:18px;
	clear:none;
	margin:0;
	padding:0;
}

.stage
{
	height:325px;
	margin-top:15px;
	margin-left:15px;
	color:#ddd;
	margin-right:10px;
	font-family:Arial, Helvetica, Verdana;
}

.tpvp_box
{
	position:relative;
	width:50px;
	height:50px;
	background-color:#06f;
	display:inline-block;
	margin:10px 20px 0 0;
}




.demoNav
{
	margin-top:5px;
	background-color:#555;
	width:550px;
	height:50px;
	padding-top:5px;
}

#slider,.demoSlider
{
	width:420px;
	float:left;
	margin:15px 0 8px 22px;
}

.play
{
	float:right;
	margin-right:15px;
	margin-top:5px;
}

              
            
!

JS

              
                //3D transformPerspective vs perspective

var $perspective = $("#perspective"),
    $transformPerspectiveBoxes = $("#transformPerspective").find(".tpvp_box"),
    $boxes = $(".tpvp_box"),
    tpvp_tween, tpvp_slider,
	  tpvp_play_btn = $("#tpvp_play_btn").button();

//set transformPerspective on each box
TweenLite.to($transformPerspectiveBoxes, .2, {css:{transformPerspective:300}});

//set perspective on parent div of all the boxes in the second row
TweenLite.set($perspective, {perspective:300});

tpvp_tween = TweenMax.to($boxes, 2, {rotationY:360, ease:Linear.easeNone, onUpdate:update_tpvp_slider, paused:true});

tpvp_slider = $("#tpvp_slider").slider({
    range: false,
    min: 0,
    max: 100,
    step: .1,
    slide: function(event, ui) {
        tpvp_tween.pause();
        tpvp_tween.progress(ui.value / 100);
    }
});

function update_tpvp_slider() {
    tpvp_slider.slider( "value", tpvp_tween.progress() *100 );
}

$("#tpvp_play_btn").click(function(){
	if(tpvp_tween.progress()==1){
		tpvp_tween.restart();
		}else{
			tpvp_tween.play(); 
		}
}) 
   

function update_tp_slider() {
    tp_slider.slider( "value", tween.progress() *100 );
}


$("#tp_play_btn").click(function(){
	if(tween.progress()==1){
		tween.restart();
		}else{
			tween.play(); 
		}
}) 
              
            
!
999px

Console