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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <!-- Trying to replicate the effect here - https://tympanus.net/Development/MorphingBackgroundShapes/ -->

<svg width="400px" height="353px" viewBox="182 171 552 353" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <path d="M733,179 L182.560176,179 C182.560176,179 169.999998,503 379,406 C379,406 492,323 561,489 C630,655 734,172 734,180" id="shape-1" stroke="none" fill="#FF6B6B" fill-rule="evenodd"></path>
</svg>



<svg width="583px" height="185px" viewBox="182 172 583 185" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <path d="M732.439824,179 L182,179 C182,179 231.855405,403 440.855408,306 C440.855408,306 664.439819,140 733.439819,306 C802.439819,472 733.439824,172 733.439824,180" id="shape-2" stroke="none" fill="#716BFF" fill-rule="evenodd"></path>
</svg>

<div style="height:2000px"></div>
              
            
!

CSS

              
                body {
  background-color: #f9f9f9;
}

svg {
  position: fixed;
  top: 135px;
  width: 400px;
  height: 400px;
  left: 100px;
  margin: 0 auto;
  display: block;
  visibility: hidden;
}

#shape-2 {
  visibility: hidden;
}
              
            
!

JS

              
                // Trying to replicate the effect here - https://tympanus.net/Development/MorphingBackgroundShapes/ 

var Shape1 = MorphSVGPlugin.convertToPath("#shape-1")[0];
var Shape1Path = Shape1.getAttribute("d");

TweenLite.set("svg", {
  visibility: "visible"
});

var tl = new TimelineMax({
  repeat: 0,
  yoyo: true,
  repeatDelay: 0,
  delay: 0
});
var changeVar = false;

function change() {
  $(window).scroll(function(event) {
    var scroll = $(window).scrollTop();

    if (!changeVar) {
      if (scroll > 40) {
        tl.to(Shape1, 0.7, {
          morphSVG: { shape: "#shape-2" },
          stroke: "none",
          fill: "#716BFF",
          ease: Back.easeInOut
        });
        changeVar = true;
        console.log("scroll > 60 " + changeVar);
      }
    }

    if (changeVar) {
      if (scroll < 40) {
        tl.to(Shape1, 0.7, {
          morphSVG: { shape: Shape1Path },
          stroke: "none",
          fill: "#FF6B6B",
          ease: Back.easeInOut
        });
        changeVar = false;
        console.log(changeVar);
      }
    }
  });
}

setInterval(change, 500);

              
            
!
999px

Console