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

              
                <svg>
  <polygon id="polygon" points="240,220 240,182 240,145 240,70 155,70 112,70 70,70 70,145 70,220 155,220"/>
</svg>
              
            
!

CSS

              
                #polygon {
  fill: none ;
  stroke: yellowgreen;
  stroke-width: 8;
  stroke-linejoin: round;
  fill: black;
}
svg {
  display: block;
  height: 280px;
  width: 320px;
  margin: auto;
  overflow: visible;
}
body {
  background: #333;
}
              
            
!

JS

              
                /* 
IMPORTANT: the starting and ending values must have the SAME number (and type) of points. AttrPlugin simply animates the numbers in the string(s) in the order they're found. That's why our square has more points than is necessary - so that they'll match up with the number in the star. Feel free to change the order of the points to get different morphing effects.
*/

var tl = new TimelineMax({repeat:-1, delay:2, repeatDelay:2});
    //animate to a star 
    tl.to("#polygon", 1.5, {attr: {points:"264,115 183,103 150,30 116,103 36,115 93,172 80,249 150,215 219,249 208,171"}, ease:Elastic.easeOut})
    //make purple (could include it in previous tween, but didn't want the elastic ease)
    .to("#polygon", 0.3, {fill:"purple"}, "-=1.5")
    //and back to a square
      .to("#polygon", 0.8, {attr: {points:"240,220 240,182 240,145 240,70 155,70 112,70 70,70 70,145 70,220 155,220"}, fill:"black", ease:Power2.easeInOut}, "+=2");
              
            
!
999px

Console