Pen Settings



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


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


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.


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.


                <div class='control forward'>play()</div>
<div class='control back'>reverse()</div>

<div class="elements">
    <div class="square a">a</div>
    <div class="square b">b</div>
    <div class="square c">c</div>
    <div class="square d">d</div>
    <div class="circle e">e</div>
    <div class="circle f">f</div>
    <div class="circle g">g</div>
    <div class="circle h">h</div>



                .elements {
  clear: both;
    .square, .circle {width: 50px;
         height: 50px;
         background-color: red;
         display: flex;
        justify-content: center;
        position: relative;
        float: left;
        margin-right: 10px; 
      font-size: 30px;
      text-transform: uppercase;
      color: white;
    .circle {
        border-radius: 50%;
         background-color: blue;
.control {
  cursor: pointer;
  float: left;
  margin: 20px;
  padding: 10px; 
  border: 2px solid grey;
  border-radius: 5px;



                //To learn more about using GreenSock's bonus plugins for free on CodePen visit:

var tl = new TimelineMax({paused: true});

// these, i want to play the same every time
tl.staggerTo(".square", 0.5, {y: "+=180px"},0.25)
.staggerTo(".circle", 0.5, {autoAlpha: 1},0.25);

var reverse = new TimelineMax({paused: true})
.to(".circle", 0.5, {autoAlpha: 0})
.staggerTo(".square", 0.5, {y:0},-0.25)  // negative stagger number means reversed order

// these, I want to vary
// so I build them, paused, and store refs in an array 
//var cachedTweens = [];
//var cachedIds = [".e", ".f", ".g", ".h"];
//for (var whichId = 0; whichId < cachedIds.length; whichId++) {
 // var tweener =[whichId], 0.5, {opacity: 1, paused: true});
 // cachedTweens.push(tweener);  

$(".forward").click(function(e) {
  tl.restart();  // .play(0)  or restart();

$(".back").click(function(e) {