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

              
                <button id="reverse">reverse</button>
<div class="progress white"><div id="progress" class="red progress"></div></div>

<div id="boxes">
<div id="box1">box1</div>
<div id="box2">box2</div>
<div id="box3">box3</div>
</div>

              
            
!

CSS

              
                body{
  background-color:black;
}

.progress{
  width:555px;
  height:10px;
  margin-top:5px;
}

.red{
  background-color:red; 
}

.white{
  background-color:white;
}

#boxes div{
position:relative;
display:inline-block;
margin:20px;
width:100px;
height:100px;
color:black;
font-size:30px;
line-height:100px;
text-align:center;
font-family: sans-serif;
background: #9af600; /* Old browsers */
background: -moz-linear-gradient(top,  #9af600 0%, #a0fd00 50%, #90e700 51%, #a0fe00 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#9af600), color-stop(50%,#a0fd00), color-stop(51%,#90e700), color-stop(100%,#a0fe00)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  #9af600 0%,#a0fd00 50%,#90e700 51%,#a0fe00 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  #9af600 0%,#a0fd00 50%,#90e700 51%,#a0fe00 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  #9af600 0%,#a0fd00 50%,#90e700 51%,#a0fe00 100%); /* IE10+ */
background: linear-gradient(to bottom,  #9af600 0%,#a0fd00 50%,#90e700 51%,#a0fe00 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9af600', endColorstr='#a0fe00',GradientType=0 ); /* IE6-9 */

-webkit-box-shadow:  0px 0px 10px 2px #a1ff00;
        box-shadow:  0px 0px 10px 2px #a1ff00;  
}
              
            
!

JS

              
                

//create 3 timelines
var box1Timeline = new TimelineLite();
box1Timeline.to("#box1", 1, {rotation:360})
.to("#box1", 1, {opacity:0})

var box2Timeline = new TimelineLite();
box2Timeline.to("#box2", 1, {top:100})
.to("#box2", 1, {opacity:0})

var box3Timeline = new TimelineLite();
box3Timeline.to("#box3", 1, {rotation:-360})
.to("#box3", 1, {opacity:0})


var masterTimeline = new TimelineLite({smoothChildTiming:true});

masterTimeline.add(box1Timeline)//starts at time of 0
.add(box2Timeline, 0.5)//starts at 0.5 seconds
.add(box3Timeline, 1)// starts at 1 second
.from("#progress", masterTimeline.duration(), {scaleX:0, transformOrigin:"left center"}, 0)// starts a time of 0 and its duration matches that of the timeline it is in.

$("#reverse").click(function() {
  box1Timeline.reverse()
  box2Timeline.reverse()
  box3Timeline.reverse()
  //restart the parent later
  TweenLite.delayedCall(2, masterTimeline.restart, [], masterTimeline)
})
              
            
!
999px

Console