JSFiddle - React, Tailwind, and code Playground

by geekambassador

HTML

<link rel="stylesheet" href="http://www.greensock.com/_css/tour/greensock-theme/jquery-ui-1.9.1.custom.css">
<script src="http://www.greensock.com//js/src/tour/jquery/jquery-ui-1.9.1.custom.js"></script>
<script src="http://www.snorkl.tv/dev/libs/greensock/TweenMax.min.js"></script>
<div id="demoWrapper">
    <div id="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" class="firstRow">
            <div class="box"></div>
            <div class="box"></div>
            <div class="box"></div> 
            <div class="box"></div>
            <div class="box"></div>
            <div class="box"></div>
            <div class="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" class="secondRow">
            <div class="box"></div>
            <div class="box"></div>
            <div class="box"></div> 
            <div class="box"></div>
            <div class="box"></div>
            <div class="box"></div>
            <div class="box"></div> 
        </div>             
    </div>        
    <div id="demoNav"> 
        <div id="slider1"></div>
    </div>       
</div>

CSS

body{
margin:0px;
}
strong{
    font-weight:bold;
    color:#fff;
}

h1{
    font-size:22px;
    font-weight:bold;
    margin-bottom:10px;
    color:#fff;
}


#demoWrapper{
    width:550px;
    height:400px;
    padding:1px;
    margin:-1px;
    background-color:#000;
}

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




#demoNav{
    padding:20px;
    height:20px;
    background-color:#555;
}

#slider1{
    width:500px;
    margin:auto;    
}

.box{
    position:relative;
    width:50px;
    height:50px;
    background-color:#0066ff;
    margin:10px 20px 0px 0px;
    display:inline-block;
}

JavaScript

//3D transformPerspective vs perspective


var $perspective = $("#perspective"),
    $transformPerspectiveBoxes = $("#transformPerspective").find(".box"),
    $boxes = $(".box"),
    tween, slider;

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

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

tween = TweenMax.to($boxes, 2, {css:{rotationY:360}, ease:Linear.easeNone, onUpdate:updateSlider});

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

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

$("body").append("TweenMax.min.js / Version: " + TweenMax.version);