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

              
                <div class="bob"></div>
<div class="bob"></div>
<div class="bob"></div>
<div class="bob"></div>
<div class="bob"></div>
              
            
!

CSS

              
                body {
  background: black;
  margin: 0;
  margin-top: 20vh;
}

.bob {
  width: 200px;
  height: 20px;
  background: #333;
  position: relative;
  display: block;
  margin: auto;
  margin-bottom: 10px;
  margin-top: 10px;
}
              
            
!

JS

              
                var items=document.querySelectorAll(".bob");
for(var i=0;i<items.length;i++){
  TweenMax.to(items[i],.5,{x:i%2==0?"+=200":"-=200",opacity:0, delay:.1*i});
}

/* It would be a great thing to add to TweenMax that already handles an array of objects.
If you add this to where you set up your for-loop for multiple tweens, you first check to see if an alternate properties exist.
If it does, flip flop between both properties as you set up your tweens.

I could see a possible new custom property being added like this:
TweenMax.staggerFrom(".bob",.5,{opacity:0,x:"+=200",delay:1,alternate:{x:"-=200"}},.2);

UPDATE: I created a new version of TweenMax to do just this!
https://dl.dropboxusercontent.com/u/1256960/%20Research/JS/TweenMaxAlternate/index.html

Also added a topic on the Greensock Forums
https://greensock.com/forums/topic/12208-alternating-property-direction-with-any-array/
*/

              
            
!
999px

Console