Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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>
  <path id="blob" d="M70.3,103.2c0,0-7.5-58.4,42.9-48.4s43.5,74.5,72,37.9s49.7-72,67.1-36s83.9,92.5,14.3,96.3c-69.6,3.7-82,18-88.8,44.1c-6.8,26.1-93.8,29.8-91.3-18S75.3,134.9,70.3,103.2z" />
</svg>
<svg>  
  <polygon id="star" points="263.6,115.5 182.9,103.3 149.9,30.2 116.5,102.9 35.8,115.1 92.6,172.3 80.2,248.6 149.9,215.3 219.1,248.6 207.7,171.4"/>
</svg>

              
            
!

CSS

              
                body {
  background: #333;
}

svg {
  display: block;
  height: 280px;
  width: 650px;
}

#star {
  fill: yellowgreen;
  stroke: #1a1a1a;
  stroke-width: 1;
}

#blob {
  fill: #1a1a1a;
  stroke: orange;
  stroke-width: 4;
}
              
            
!

JS

              
                
TweenLite.defaultEase = Power0.easeNone;

var blob = document.getElementById("blob");
var star = document.getElementById("star");

var path1 = blob.getAttribute("d");
var path2 = "M39.9,110.7c0,0,18.6-42.2,68.9-32.3s38.5,11.9,67.1-24.7s44.7,9.8,62.1,45.9s39.1,77-30.4,80.7c-69.6,3.7,19.9,26.1,13,52.2c-6.8,26.1-110.6-11.8-108.1-69.6S-15,225,39.9,110.7z";

var path3 = star.getAttribute("points");
var path4 = "263.6,30.2 203.07,30.2 149.9,30.2 96.33,30.2 35.8,30.2 35.8,140.75 35.8,248.6 149.9,248.6 263.6,248.6 263.6,140.75";
var path5 = "400,30.2 203.07,30.2 149.9,30.2 96.33,30.2 35.8,30.2 35.8,140.75 35.8,248.6 149.9,248.6 400,248.6 400,140.75";
var path6 = "450,30.2 203.07,30.2 149.9,30.2 96.33,30.2 35.8,30.2 35.8,140.75 35.8,248.6 149.9,248.6 450,248.6 535,140.75";

path1 = parsePath(path1);
path2 = parsePath(path2);
path3 = parsePath(path3);
path4 = parsePath(path4);
path5 = parsePath(path5);
path6 = parsePath(path6);

new TimelineMax({ repeat: -1, yoyo: true })
  .to(path1, 1, { endArray: path2, onUpdate: update.bind(blob, "d", path1) });

new TimelineMax({ repeat: -1, yoyo: true })
  .to(path3, 1, { endArray: path4, onUpdate: update.bind(star, "points", path3) })
  .to(path4, 1, { endArray: path5, onUpdate: update.bind(star, "points", path4) })
  .to(path5, 1, { endArray: path6, onUpdate: update.bind(star, "points", path5) });

function update(attr, path) {
  this.setAttribute(attr, path.string());
}

function parsePath(string) {  
  
  // Split the string into path commands and points
  var pathExp = /[achlmrqstvz]|(-?\d*\.?\d*(?:e[\-+]?\d+)?)[0-9]/ig;  
  var path = string.match(pathExp).map(function(n) { return isNaN(+n) ? n : +n; });
  
  // The first element needs to be a number, so remove if it's not
  // Calling the string method will return the path with the removed element
  path.prefix = isNaN(path[0]) ? path.shift() : "";
  path.string = function() { return path.prefix + path.join(" "); };
  
  return path;
}




              
            
!
999px

Console