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

              
                <div style="position: fixed; top: 1rem; margin-bottom: 4rem;">
  <button id="animate">Progress Animation</button>
  <button id="clear">Reset</button>
</div>

<svg id="data-viz" class="step-0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1000 1000" xml:space="preserve">
  <defs>
    <mask id="test">

      <path d="M919.277 727.42V271.593c0-8.88-4.933-16.773-11.838-20.719L512.825 22.96c-7.892-3.947-16.771-3.947-24.663 0L93.548 250.874c-7.892 3.947-12.825 11.84-12.825 20.719v456.814c0 8.88 4.933 16.773 11.838 20.719L487.175 977.04c7.892 3.947 16.771 3.947 24.663 0l394.614-227.914c7.892-4.933 12.825-12.826 12.825-21.706z" fill="white" />
    </mask>
  </defs>
  <!-- <clipPath id="b">
    <use xlink:href="#a" />a
  </clipPath> -->
  <g class="hex" mask="url(#test)">
    <path opacity="0.1" fill="#0D2326" d="M0 0h1000v1000H0z" />
    <path class="wave-back" d="M1000-208.63V980h-3007.315V-208.63c55.022 0 111.378 43.609 167.075 63.721 55.681 20.128 111.378 20.128 167.075 10.056 55.681-10.056 111.378-30.168 167.075-50.297 55.681-20.112 111.378-40.241 167.075-33.536 55.681 6.848 111.378 40.112 167.059 67.089 55.697 26.816 111.393 46.929 167.075 40.241 55.697-6.865 111.393-40.112 167.075-50.297 55.697-9.944 111.393 18.845 167.075 8.917 55.697-10.185 107.481-55.894 167.075-55.894 59.594 0 111.378 45.71 167.075 55.894 55.681 9.928 111.378-18.861 167.075-8.917 55.681 10.184 111.378 43.432 167.075 50.297 55.681 6.688 111.378-13.424 167.075-40.241 55.681-26.977 111.378-60.241 167.059-67.089 55.697-6.704 111.394 13.424 167.075 33.536 55.697 20.128 111.393 40.241 167.075 50.297 55.697 10.072 111.394 10.072 167.075-10.056 55.694-20.112 112.05-63.721 167.072-63.721z" />
    <path class="wave-front" d="M3007.315-188.63V1000H0V-188.63c55.022 0 111.378 43.609 167.075 63.721 55.681 20.128 111.378 20.128 167.075 10.056 55.681-10.056 111.378-30.168 167.075-50.297 55.681-20.112 111.378-40.241 167.075-33.536 55.681 6.848 111.378 40.112 167.059 67.089 55.697 26.816 111.393 46.929 167.075 40.241 55.697-6.865 111.393-40.112 167.075-50.297 55.697-9.944 111.393 18.845 167.075 8.917 55.697-10.185 107.481-55.894 167.075-55.894 59.594 0 111.378 45.71 167.075 55.894 55.681 9.928 111.378-18.861 167.075-8.917 55.681 10.184 111.378 43.432 167.075 50.297 55.682 6.688 111.378-13.424 167.075-40.241 55.681-26.977 111.378-60.241 167.059-67.089 55.697-6.704 111.394 13.424 167.075 33.536 55.697 20.128 111.393 40.241 167.074 50.297 55.697 10.072 111.394 10.072 167.075-10.056 55.695-20.112 112.052-63.721 167.073-63.721z" />
  </g>
  <g class="lines" opacity=".35">
    <g fill="none" stroke="#2e434d" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10">
      <path d="M953 990h0" />
      <path stroke-dasharray="0,11.9211" d="M941.079 990H52.961" />
      <path d="M47 990h0" />
    </g>
    <g fill="none" stroke="#2e434d" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10">
      <path d="M953 867.5h0" />
      <path stroke-dasharray="0,11.9211" d="M941.079 867.5H52.961" />
      <path d="M47 867.5h0" />
    </g>
    <g fill="none" stroke="#2e434d" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10">
      <path d="M953 745h0" />
      <path stroke-dasharray="0,11.9211" d="M941.079 745H52.961" />
      <path d="M47 745h0" />
    </g>
    <g fill="none" stroke="#2e434d" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10">
      <path d="M953 622.5h0" />
      <path stroke-dasharray="0,11.9211" d="M941.079 622.5H52.961" />
      <path d="M47 622.5h0" />
    </g>
    <g fill="none" stroke="#2e434d" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10">
      <path d="M953 500h0" />
      <path stroke-dasharray="0,11.9211" d="M941.079 500H52.961" />
      <path d="M47 500h0" />
    </g>
    <g fill="none" stroke="#2e434d" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10">
      <path d="M953 377.5h0" />
      <path stroke-dasharray="0,11.9211" d="M941.079 377.5H52.961" />
      <path d="M47 377.5h0" />
    </g>
    <g fill="none" stroke="#2e434d" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10">
      <path d="M953 255h0" />
      <path stroke-dasharray="0,11.9211" d="M941.079 255H52.961" />
      <path d="M47 255h0" />
    </g>
    <g fill="none" stroke="#2e434d" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10">
      <path d="M953 132.5h0" />
      <path stroke-dasharray="0,11.9211" d="M941.079 132.5H52.961" />
      <path d="M47 132.5h0" />
    </g>
    <g fill="none" stroke="#2e434d" stroke-width="3" stroke-linecap="round" stroke-miterlimit="10">
      <path d="M953 11h0" />
      <path stroke-dasharray="0,11.9211" d="M941.079 11H52.961" />
      <path d="M47 11h0" />
    </g>
  </g>
  <g class="nums" fill="#2e434d">
    <path d="M7.2 491.544h3v17.274H6.525v-12.05c-.915.739-2.383.71-3.65.75v-2.9c2.106-.003 4.304-.725 4.325-3.074zm5.7 13.875h3.4v3.399h-3.4v-3.399zm12.15 3.774c-6.541.291-8.319-7.443-6.888-12.55 1.58-7.314 12.187-7.342 13.75 0 1.419 5.094-.323 12.847-6.862 12.55zm0-3.049c3.069.043 3.485-3.549 3.475-5.95.001-2.434-.407-5.983-3.475-5.975-3.065-.015-3.497 3.559-3.5 5.975-.008 2.445.429 5.963 3.5 5.95zM7.2 245.544h3v17.275H6.525v-12.05c-.915.739-2.383.709-3.65.75v-2.9c2.106-.004 4.304-.724 4.325-3.075zm5.7 13.875h3.4v3.4h-3.4v-3.4zm12.924-8.3c5.536-.313 7.523 7.112 3.775 10.475-3.757 3.23-11.602 1.579-11.599-4.025h3.6c.08 2.839 4.511 3.633 5.75 1.149.67-1.37.534-3.781-.975-4.562-1.42-.741-3.569-.343-4.6.988H18.25l1.925-9.601H30.7v3.025h-7.925l-.75 3.85v.05c1.062-.928 2.283-1.356 3.799-1.349zM10.325 753.194c-6.54.29-8.319-7.442-6.888-12.55 1.58-7.315 12.187-7.343 13.75 0 1.42 5.094-.323 12.846-6.862 12.55zm0-3.049c3.069.042 3.485-3.549 3.475-5.95.001-2.435-.406-5.982-3.475-5.976-3.065-.014-3.497 3.559-3.5 5.976-.008 2.444.43 5.963 3.5 5.95zm8.75-.726h3.4v3.4h-3.4v-3.4zm12.925-8.3c5.536-.313 7.523 7.112 3.775 10.475-3.757 3.23-11.602 1.579-11.599-4.025h3.6c.08 2.839 4.511 3.633 5.75 1.149.67-1.37.534-3.781-.975-4.562-1.42-.741-3.569-.343-4.6.988h-3.525l1.925-9.601h10.525v3.025H28.95l-.75 3.85v.05c1.062-.928 2.284-1.356 3.8-1.349zM10.325 998.194c-6.54.29-8.319-7.442-6.888-12.55 1.58-7.315 12.187-7.343 13.75 0 1.42 5.094-.323 12.846-6.862 12.55zm0-3.049c3.069.042 3.485-3.549 3.475-5.95.001-2.435-.406-5.982-3.475-5.976-3.065-.014-3.497 3.559-3.5 5.976-.008 2.444.43 5.963 3.5 5.95zm8.75-.726h3.4v3.4h-3.4v-3.4zm12.15 3.775c-6.54.29-8.319-7.442-6.888-12.55 1.58-7.315 12.187-7.343 13.75 0 1.42 5.094-.323 12.846-6.862 12.55zm0-3.049c3.069.042 3.485-3.549 3.475-5.95.001-2.435-.406-5.982-3.475-5.976-3.065-.014-3.497 3.559-3.5 5.976-.008 2.444.43 5.963 3.5 5.95zM6.525 7.769h-3.6c-.233-5.543 5.073-7.885 9.788-5.987 2.651 1.059 3.534 4.387 2.437 6.888-.898 2.093-2.94 3.428-4.725 4.699-1.031.665-2.106 1.353-2.775 2.375v.051h7.875v3.024h-12.9C2.48 15.1 5.356 12.995 8.15 10.993c1.318-.931 2.736-1.723 3.425-3.137.454-1.056.353-2.702-.713-3.363-2.434-1.128-4.525.583-4.337 3.276zm10.975 7.65h3.4v3.399h-3.4v-3.399zm12.15 3.774c-6.541.291-8.319-7.442-6.888-12.55 1.58-7.314 12.187-7.342 13.75 0 1.419 5.094-.323 12.847-6.862 12.55zm0-3.049c3.069.043 3.485-3.549 3.475-5.95.001-2.434-.407-5.983-3.475-5.975-3.065-.015-3.497 3.559-3.5 5.975-.008 2.445.429 5.963 3.5 5.95z" />
  </g>
</svg>
              
            
!

CSS

              
                :root {
  --green-600: #0abb62;
  --green-dk: #09a556;
  --yellow: #ffd00f;
  --yellow-dk: #e5b900;
  --orange: #ff871f;
  --orange-dk: #dc7718;
  --red: #ff4824;
  --red-dk: #e52600;
  --step-sm: 1200ms;
  --step-md: 1500ms;
  --step-lg: 2000ms;
  --ease: cubic-bezier(0.45, 0, 0.55, 1);
}

body {
  background: #f9f6ee;
  padding: 6rem 2rem;
}

svg {
  width: 600px;
}
svg.step-0 .wave-back {
  transform: translate(0px, 1200px);
  fill: var(--green-dk);
  transition: all var(--step-md) var(--ease);
}

svg.step-0 .wave-front {
  transform: translate(0px, 1200px);
  fill: var(--green-600);
  transition: all var(--step-md) var(--ease);
}

svg.step-1 .wave-back {
  transform: translate(400px, 700px);
  fill: var(--yellow-dk);
  transition: all var(--step-md) var(--ease);
  // fill: orange;
}

svg.step-1 .wave-front {
  transform: translate(-400px, 700px);
  fill: var(--yellow);
  transition: all var(--step-md) var(--ease);
  // fill: orange;
}

svg.step-2 .wave-back {
  transform: translate(800px, 475px);
  fill: var(--orange-dk);
  transition: all var(--step-sm) var(--ease);
  // fill: orange;
}

svg.step-2 .wave-front {
  transform: translate(-800px, 475px);
  fill: var(--orange);
  transition: all var(--step-sm) var(--ease);
  // fill: orange;
}

svg.step-3 .wave-back {
  transform: translate(1200px, 0px);
  fill: var(--red-dk);
  transition: all var(--step-md) var(--ease);
  // fill: orange;
}

svg.step-3 .wave-front {
  transform: translate(-1200px, 0px);
  fill: var(--red);
  transition: all var(--step-md) var(--ease);
  // fill: orange;
}

svg.step-4 .wave-back {
  transform: translate(450px, 750px);
  fill: var(--green-dk);
  transition: all var(--step-lg) var(--ease);
  // fill: orange;
}

svg.step-4 .wave-front {
  transform: translate(-450px, 750px);
  fill: var(--green-600);
  transition: all var(--step-lg) var(--ease);
  // fill: orange;
}

              
            
!

JS

              
                const btn = document.querySelector("#animate");
const clr = document.querySelector("#clear");
const hex = document.querySelector("#data-viz");
let step = 0;

function callback() {
  step += 1;
  update();
}

function update() {
  const animClass = `step-${step}`;
  console.log(animClass);
  hex.classList.add(animClass);
  step > 4 && clear();
}

function clear() {
  step = 0;
  hex.classList.remove(...hex.classList);
  hex.classList.add(`step-${step}`);
}

clr.addEventListener("click", clear);
btn.addEventListener("click", callback);

              
            
!
999px

Console