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 class="o-layout o-layout--flush o-layout--center c-logo-svg" xmlns="http://www.w3.org/2000/svg" width="392px" height="337px" viewBox="0 0 392 337" zoomAndPan="disable">
    <defs>
        <style>.fill-turquoise{fill:#078781;}</style>
    </defs>
    <path class="fill-turquoise" d="M212.5 98.6a10.6 10.6 0 0 0-6.9-2.2h-1.9a10.5 10.5 0 0 0-6.9 2.1 15.2 15.2 0 0 0-4.3 5.8L171.3 158.4h18.5l15-39.5 68.3 164.8a157.1 157.1 0 0 0 12.6-13.5L216.9 104.3A14.9 14.9 0 0 0 212.5 98.6ZM278.9 297.8l15.1 36.6h18.3L291.9 285.2A169.7 169.7 0 0 1 278.9 297.8ZM181.3 163.4v48.9a13.4 13.4 0 0 1-2 7.3 12.6 12.6 0 0 1-5.3 4.8 97.1 97.1 0 0 1-44.2 10.9q-19.9 0-35.3-8.9a61.3 61.3 0 0 1-24-24.8q-8.5-15.9-8.5-36.2 0-20.7 8.9-36.7a63.3 63.3 0 0 1 24.2-24.8 67.5 67.5 0 0 1 34.1-8.8q15.1 0 26.4 3.7a96.6 96.6 0 0 1 21.7 10.3 6.8 6.8 0 0 1 2.7 2.7 8.2 8.2 0 0 1 1.2 4.3A7.9 7.9 0 0 1 178.9 122a7.7 7.7 0 0 1-5.9 2.3 8.9 8.9 0 0 1-4.1-1 80.2 80.2 0 0 0-18.2-8.2 68.2 68.2 0 0 0-19.7-2.7 55.7 55.7 0 0 0-26.5 6.2 44.7 44.7 0 0 0-18.4 18.2q-6.7 12-6.7 28.6a57.8 57.8 0 0 0 6.3 27.2A46.4 46.4 0 0 0 104 211.6q11.9 6.9 28.1 6.9a69.2 69.2 0 0 0 33.8-8.6V178.4H132.8c-3.1 0-8.2-1.3-8.2-7.7 0-6 5.7-7.3 8.2-7.3h48.5ZM223.3 178.4h-90.5v-15h84M247.3 163.4h138.5c-1 1.4-7 15-7 15h-125M167.8 329.4c-88.3 0-160-71.7-160-160.1S79.5 9.7 167.8 9.7c84.5 0 153.6 65.7 159.5 148.7h5.1c-5.9-86-77.3-153.8-164.6-153.8-91.1 0-165 73.7-165 164.8S76.7 334.5 167.8 334.5a165.1 165.1 0 0 0 164.3-150.1h-5.1C319.6 265.4 251.2 329.4 167.8 329.4Z"/>
</svg>


<button id="restart">restart</button>
              
            
!

CSS

              
                .c-logo-svg {
  display: block;
  position: absolute;
  top: 10vh;
  max-height: 80vh;
  width: 392px;
  left: calc((50% - 169px));

  opacity: 0.5;
  transform: scale(0.5);
}

button {
  display: block;
  position: relative;
  margin: 20px;
}
              
            
!

JS

              
                var SETTINGS = {
  ui: {
    logo: {
      elemName: document.querySelector('.c-logo-svg'),
      duration: 1.2,
      tweenAttrsTo: {
        0: {
          opacity: 1,
          scale: 1
        }
      }
    }
  }
};

// Variable that hold the parameters for the filter animation
var logoFilterAmount = {
  a: 0,
  b: 0
}; // a=radius, b=opacity

// Tween the logo. Second animation should set the drop-shadow filter.
function tweenLogo() {
  "use strict";

  var tl = new TimelineLite({
    paused: true
  });

  tl.to(
    SETTINGS.ui.logo.elemName,
    SETTINGS.ui.logo.duration,
    SETTINGS.ui.logo.tweenAttrsTo[0]
  );

  // Apply filter
  tl.to(
    logoFilterAmount,
    1.5, {
      a: parseInt(80),
      b: parseInt(80),
      onComplete: readSVG,
      onUpdate: setLogoShadow
    }
  );

  tl.restart();

  return tl;

}

// The "Set" function that handles the update of the drop-shadow filter
function setLogoShadow() {
  console.log("setLogoShadow called,\n  logoFilterAmount =", logoFilterAmount);

  TweenMax.set(
    SETTINGS.ui.logo.elemName, {
      filter: "drop-shadow(0 0 " + logoFilterAmount.a + "px rgba(0,203,170," + (parseInt(logoFilterAmount.b * 1000)) + "))",
      webkitFilter: "drop-shadow(0 0 " + logoFilterAmount.a + "px rgba(0,203,170," + (parseInt(logoFilterAmount.b * 1000)) + "))"
    }
  );
}

function readSVG() {
  var cssClasses1 = window.getComputedStyle(SETTINGS.ui.logo.elemName).filter;
  console.log("Filter =", cssClasses1);

  var cssClasses2 = window.getComputedStyle(SETTINGS.ui.logo.elemName).webkitFilter;
  console.log("WebkitFilter =", cssClasses2);
}

// Start animation
function mainIntroAnim() {
  console.log("Start Animation...")
  var tl = new TimelineMax();
  tl.add(tweenLogo());
  return tl;
}

var anim = mainIntroAnim();

var btn = document.getElementById('restart');
btn.addEventListener("click", function() {
  console.log("-> clicked btn");
  anim.restart();
})



// DEBUG HELPERS
function readParams() {
  console.log("a =", logoFilterAmount.a, ", b =", logoFilterAmount.b)
}
              
            
!
999px

Console