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

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

              
                <div id="ps4">
  
<svg version="1.1" viewBox="0 0 1280 668" class="line-animated">
  <path 
      d="
M 155 313 L 161.667 236.333
M 161.667 236.333 L 538.333 236.333
M 538.333 236.333 L 538.333 313
M 538.333 313 L 155 313
M 538.333 241 L 550.333 241.666
M 550.333 236.333 L 550.333 313
M 550.333 236.333 L 1140 236.333
M 1140 236.333 L 1147 313
M 1147 313 L 550.333 313
M 1109 313 L 1109 345
M 550.333 345 L 1147 345
M 1147 345 L 1156 423
M 1156 423 L 550.333 423
M 550.333 423 L 550.333 345
M 550.333 423 L 538.333 423
M 538.333 423 L 146 423
M 146 423 L 155 345
M 155 345 L 538.333 345
M 538.333 345 L 538.333 423
M 194 313 L 194 345
M 983.667 264.667 L 1014.333 264.667
M 1014.333 264.667 L 1014.333 274.667
M 1014.333 274 L 983.667 274
M 983.667 274 L 983.667 282.333
M 1019 282.333 L 1037 282.333
M 1037 282.333 L 1037 264.667
M 1037 264.667 L 1054 264.667
M 1085.333 264.667 L 1056.333 279.667
M 1056.333 279.667 L 1090.667 279.667
M 1085.333 264.667 L 1085.333 282.333
" 
      stroke="#fff" 
      stroke-width="2" 
      fill="none" 
      stroke-dasharray="988.01 988.01"
      stroke-dashoffset="0" /*set to 0 so that if JS is off the image will still appear (Progressive Enhancement Son!)*/
      >
  </path>
</svg>
  
</div>


              
            
!

CSS

              
                body{
  width: 100%;
  background: #337BC5;
  height: 100%;
}
h1{
  font-family: Gotham, Helvetica, san-serif;
  color: #fff;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 2em 0;
}
div{
  width: 90%;
  margin: 0 auto;
}
svg{
  width: 100%;
  height: 75%;
}
path{ 
  
-webkit-transition: stroke-dashoffset 2s ease-in-out; 
  transition: stroke-dashoffset 2s ease-in-out;
}       
              
            
!

JS

              
                window.onload = function(){
  lineDraw();
  //repeat for demo purposes
  setInterval(lineDraw, 5000);
  
};
function lineDraw(){
var path = document.querySelector('.line-animated path');
var length = path.getTotalLength();
// Clear any previous transition
path.style.transition = path.style.WebkitTransition =
  'none';

// Set up the starting positions
path.style.strokeDasharray = length + ' ' + length; 
path.style.strokeDashoffset = length;
// Trigger a layout so styles are calculated & the browser 
// picks up the starting position before animating
path.getBoundingClientRect();
// Define our transition
path.style.transition = path.style.WebkitTransition =
  'stroke-dashoffset 7s ease-in-out';
// Go!
path.style.strokeDashoffset = '0';
  //0 is the image fully animated, 988.01 is the starting point.
};




              
            
!
999px

Console