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

              
                <svg viewBox="0 0 219.7 38.4">
<path d="M5.1,37.8c0.7,0.4,1.8,0.3,3.9-0.1
	C49.7,33.3,42.4,13.3,5,19.3C41.2,11.4,32.5-2.5,0.3,1"/>
<path d="M2.5,2.3C2.6,12.1,2.7,23.3,4,33c0.3,2.7,0.1,4.3,1.1,4.8"/>
<path d="M59.1,1c-24.9,1.8-22.4,40.1,3.5,35.5c6.9,0,13.6-7.3,13.4-14.1C77.1,12.5,70.2,0.2,59.1,1"/>
<path d="M106.2,1.9c0,8.8,0,26.4,0,35.2"/>
<path d="M83.3,2.3c-1,10.4-7,23.9,0.2,33c0.6,1.5,3,1.8,4.5,1.7c5.4,1,12.8-4.3,14.1-7
	c3.9-8.7,4-19.4,4-28.1"/>
<path d="M113.9,36.9c0.4-8.8,0.7-18.7,0.7-27.6c0.2-3.8-1.1-10.7,3.8-4c8.3,9.5,16.3,20.5,23.9,30.6
	c0.4-11.2,0.1-23.6,0-34.8"/>
<path d="M175.5,2.8c-9.4-8.1-25.1,5.4-25.9,15.9c-3,10.2,5.2,19,15.4,18.9c8-0.2,14.5-5.1,20.2-10.3"/>
<path d="M215,18.8c-13.5,2.6-20.9,1.5-23.3,2.6
	c-1.3,1.8,0.2,6.4,0.9,15.9c6.7-0.4,20.1-1.3,26.8-1.7"/>
<path d="M214.5,1.5c-5.7,0.2-17,0.5-22.7,0.7c0,0-0.1,9.6-0.1,9.6l-0.1,9.6c5.8-0.7,17.5-1.9,23.3-2.6"/>
</svg>

              
            
!

CSS

              
                body {
  overflow: hidden;
  height: 100vh;
  display: grid;
  place-items: center;
  background: black;
}
svg {
  width: 70vw;
  height: auto;
  overflow: visible;
}
line,
path {
  stroke-width: 5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
              
            
!

JS

              
                console.clear();

const tl = gsap.timeline({
  id: 'Timeline',
  repeat: -1,
  repeatDelay: 1.5
});

const colors = ['#E8D2A6', '#F48484', '#F55050'];

function tween (node) {
  let path = node;
  // Start each path animation with a random delay
  const delay = Math.random();
  // Calculate the length of the path
  const length = path.getTotalLength();
  
  // Loop on each color
  colors.forEach((color, index) => {
    let end = 0; // Used to store the end value of the tween
    let ease = 'power2.in'; // Default ease is ease-in
    
    // Create a clone for 2nd & 3rd colors
    if (index !== 0) {
      path = path.cloneNode();
      node.parentNode.appendChild(path);
    }
    
    // Define the initial values to 'hide' the paths
    tl.set(path, {
      strokeDasharray: length + 0.5,
      strokeDashoffset: length + 0.6,
      autoRound: false
    }, 0);
    
    // Assign the color to the stroke
    path.setAttribute('stroke', color);
    
    // Second path is going backward with an ease-out transition
    // So we need to set a different value for the end and ease variables
    if (index === 1) {
      end = (length + 0.5) * 2;
      ease = 'linear'
    } else if (index === 2) {
      ease = 'power2.out'
    }
    
    // Animate each path to the defined `end` value
    tl.to(path, {
      strokeDashoffset: end,
      autoRound: false,
      duration: 1,
      ease
    }, index * 0.8 + delay);
  });
}

// Query all paths and create a tween for each
document.querySelectorAll('svg path').forEach(p => tween(p));

// Init GSAP devtools
GSDevTools.create({
  animation: tl
});
              
            
!
999px

Console