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

              
                <link href="https://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet" />

<section>
  <div id="progress" class="progress-indicator" aria-labelledby="progress-valuenow" role="progressbar" aria-valuemin="0%" aria-valuenow="0%" aria-valuemax="100%">
    <div class="progress-label">
      <p id="progress-valuenow" class="progress-label__value">
        <span class="hidden">Progress </span>0%<span class="hidden"> completed.</span>
      </p>
    </div>
    <svg class="progress-indicator__bar" xmlns="http://www.w3.org/2000/svg" width="400" height="150" aria-role="presentation">
      <defs>
        <filter id="blur-filter-1" color-interpolation-filters="sRGB">
          <feGaussianBlur stdDeviation="8" />
        </filter>
        <filter id="blur-filter-2" color-interpolation-filters="sRGB">
          <feGaussianBlur stdDeviation="3" />
        </filter>
        <filter id="blur-filter-3" color-interpolation-filters="sRGB">
          <feGaussianBlur stdDeviation="1" />
        </filter>
        <filter id="dm-filter" x="0" y="0" width="440" height="150" color-interpolation-filters="sRGB" preserveAspectRatio="none" filterUnits="userSpaceOnUse">
          <feFlood flood-color="transparent" result="FLOOD_TRANS" />
          <feImage id="feimage" href="" width="100%" height="750" x="0" y="-600" result="FEIMG_MAP" preserveAspectRatio="none">

          </feImage>
          <feGaussianBlur id="gaussianblur" in="SourceGraphic" stdDeviation="4" result="BLUR_SOURCE" />

          <feFlood id="floodNeutral" flood-color="rgba(128, 0, 128)" result="FLOOD_NEUTRAL" width="1%" x="0%">
          </feFlood>
          <feMerge result="MERGE_FLOOD">
            <feMergeNode in="FLOOD_TRANS" />
            <feMergeNode in="FLOOD_NEUTRAL" />
          </feMerge>
          <feGaussianBlur in="MERGE_FLOOD" stdDeviation="10" result="BLUR_FLOOD" />
          <feMerge result="MERGE_ALL">
            <feMergeNode in="FEIMG_MAP" />
            <feMergeNode in="BLUR_FLOOD" />
          </feMerge>
          <feDisplacementMap id="displSource" in="BLUR_SOURCE" RESULT="DISPL_SOURCE" in2="MERGE_ALL" scale="0" xChannelSelector="R" yChannelSelector="B">
          </feDisplacementMap>

          <feFlood id="floodMask10" flood-color="black" result="FLOOD_MASK_10" width="440">
          </feFlood>
          <feMerge result="MERGE_MASK">
            <feMergeNode in="FLOOD_TRANS" />
            <feMergeNode in="FLOOD_MASK_10" />
          </feMerge>
          <feGaussianBlur in="MERGE_MASK" stdDeviation="20" result="BLUR_MASK" />
          <feComposite in="SourceGraphic" in2="BLUR_MASK" in="BLUR_10" operator="in" result="COMP_SOURCE" />

          <feFlood id="floodMask20" flood-color="black" result="FLOOD_MASK_20" x="0">

          </feFlood>
          <feMerge result="MERGE_DM">
            <feMergeNode in="FLOOD_TRANS" />
            <feMergeNode in="FLOOD_MASK_20" />
          </feMerge>
          <feGaussianBlur in="MERGE_DM" stdDeviation="20" result="BLUR_MASK_20" />
          <feComposite in="DISPL_SOURCE" in2="BLUR_MASK_20" in="BLUR_MASK_20" operator="in" result="COMP_MAP" />

          <feMerge result="MERGE_DM">
            <feMergeNode in="COMP_SOURCE" />
            <feMergeNode in="COMP_MAP" />
          </feMerge>
          <!-- 
            <feMerge>
                <feMergeNode in="BLUR_MASK"/>
                <feMergeNode in="BLUR_MASK_20" />
            </feMerge>  -->
        </filter>
        <g id="animations">
          <animate class="js_syncStart" href="#floodNeutral" attributeName="width" values="7%;120%;" dur="15s" repeatCount="1" begin="indefinite" end="indefinite" />
          <animate class="js_syncStart" href="#feimage" id="feImgAnim" attributeName="y" trom="-550" to="0" dur="12s" repeatCount="100" begin="indefinite" end="indefinite" restart="always" fill="remove" />
          <animate class="js_syncStart" href="#displSource" id="displAnim" attributeName="scale" values="0; 210; 60; 60" keySplines="
                0.61, 1, 0.88, 1;
                0.61, 1, 0.88, 1;
                0.61, 1, 0.88, 1" keyTimes="
                0;0.025;0.05; 1" calcMode="spline" dur="12s" repeatCount="1" begin="indefinite" end="indefinite" fill="remove" />
          <animate class="js_syncStart" href="#floodMask10" attributeName="width" values="40;440" dur="13s" repeatCount="1" begin="indefinite" end="indefinite" />
          <animate class="js_syncStart" href="#floodMask20" attributeName="x" values="10;440" dur="13s" repeatCount="1" begin="indefinite" end="indefinite" />
          <animate class="js_syncStart" href="#stripePtrn" begin="indefinite" end="indefinite" attributeName="x" from="-400" to="0" dur="13s" repeatCount="1" />
          <animate class="js_syncStart" href="#stripePtrn" begin="indefinite" attributeName="opacity" values="1; 1; 0" keyTimes="0; 0.9; 1" dur="12s" fill="freeze" repeatCount="1" />
          <animate class="js_syncStart" href="#barLine" id="barAnimMove" begin="indefinite" end="indefinite" attributeName="x1" values="40;340" dur="10s" repeatCount="1" />
          <animate class="js_syncStart" href="#barLine" id="barAnimOut" begin="indefinite" attributeName="stroke" values="hsla(70, 100%, 46%, 0); hsl(70, 100%, 46%); hsl(70, 100%, 46%); hsla(70, 100%, 46%, 0)" keyTimes="0; 0.1; 0.98; 1" dur="10s" repeatCount="1" />
        </g>
        <linearGradient id="bargradient" x1="0" x2="0" y1="0" y2="1" color-interpolation="sRGB" gradientUnits="objectBoundingBox">
          <stop offset="0.1" stop-color="hsl(120, 100%, 50%)" />
          <stop offset="0.3" stop-color="hsl(84, 100%, 76%)" />
          <stop offset="0.5" stop-color="hsl(84, 100%, 50%)" />
          <stop offset="0.75" stop-color="hsl(120, 100%, 40%)" />
          <stop offset="1" stop-color="hsl(120, 100%, 50%)" />
        </linearGradient>
        <linearGradient id="stripegradient" x1="0" x2="0" y1="0" y2="1" color-interpolation="sRGB" gradientUnits="objectBoundingBox">
          <stop offset="0.1" stop-color="hsl(50, 100%, 50%)" />
          <stop offset="0.3" stop-color="hsl(50, 100%, 82%)" />
          <stop offset="0.5" stop-color="hsl(50, 100%, 50%)" />
          <stop offset="0.75" stop-color="hsl(50, 100%, 40%)" />
          <stop offset="1" stop-color="hsl(50, 100%, 45%)" />
        </linearGradient>
        <clipPath id="myClip">
          <rect x="40" y="61" width="360" height="28" rx="14" />
        </clipPath>
        <pattern id="stripes" viewBox="0,0,54,28" width="9%" height="100%" preserveAspectRatio="none">
          <rect x="0" y="0" width="25" height="28" fill="url(#stripegradient)" transform="skewX(45)" />
        </pattern>
      </defs>
      <g id="target" class="progress-indicator__filtertarget">
        <g class="progress-indicator__dropshadow" filter="url(#blur-filter-1)">
          <rect width="440" height="150" fill="transparent" />
          <line class="progress-indicator__shadow" x1="30" y1="66%" x2="410" y2="66%" stroke-linecap="round" />
        </g>

        <g class="progress-indicator__pill">
          <rect x="40" y="61" width="360" height="28" fill="url(#bargradient)" rx="14" />
          <g clip-path="url(#myClip)">
            <rect id="stripePtrn" x="-400" y="61" width="440" height="28" fill="url(#stripes)">
            </rect>
            <rect filter="url(#blur-filter-2)" x="40" y="61" width="360" height="28" fill="transparent" rx="14" stroke="hsl(120, 100%, 25%)" stroke-width="4" />
          </g>
          <g filter="url(#blur-filter-3)" opacity="0.7">
            <rect width="100%" height="100%" fill="transparent" />
            <line x1="55" y1="70" x2="58" y2="70" stroke="white" stroke-width="4" stroke-linecap="round" />
            <line x1="65" y1="70" x2="385" y2="70" stroke="white" stroke-width="4" stroke-linecap="round" />
          </g>
          <line id="barLine" x1="400" y1="66" x2="340" y2="66" stroke="transparent" stroke-width="3" stroke-linecap="round" />

        </g>
      </g>
    </svg>
  </div>
  <button id="btn-download" class="download-btn" style="overflow: visible;" aria-label="start download">
    <svg width="100%" height="100" viewBox="0 0 70 70" preserveAspectRatio="xMidYMin" style="overflow: visible;">
      <defs>
        <linearGradient id="bg" x1="0" x2="0" y1="-1" y2="1" color-interpolation="sRGB" gradientUnits="objectBoundingBox">
          <animate id="gradientHoverAnimIn" begin="indefinite" attributeName="y2" values="1; 2" dur="0.4s" fill="freeze" repeatCount="1" />
          <animate id="gradientHoverAnimOut" fill="freeze" begin="indefinite" attributeName="y2" values="2; 1" dur="0.8s" repeatCount="1" fill="freeze" />
          <stop offset="0" stop-color="hsl(120, 100%, 36%)" />
          <stop offset="0.33" stop-color="hsl(120, 100%, 50%)" />
          <stop offset="0.66" stop-color="hsl(120, 100%, 36%)" />
          <stop offset="1" stop-color="hsl(120, 100%, 50%)" />
        </linearGradient>
        <symbol id="arrow" class="download-arrow-icon">
          <circle cx="50%" cy="50%" r="33" fill="none" stroke="white" />
          <line x1="35.5" y1="17" x2="35.5" y2="52" stroke="white">
            <animate id="arrowHoverAnimIn" begin="indefinite" attributeName="y2" values="52; 42" dur="0.3s" repeatCount="1" fill="freeze" />
            <animate begin="arrowHoverAnimIn.begin" attributeName="y1" values="17; 42" dur="0.3s" repeatCount="1" fill="freeze" />
            <animate id="arrowHoverAnimOut" begin="indefinite" attributeName="y2" values="42; 54" dur="0.3s" repeatCount="1" fill="freeze" />
            <animate begin="arrowHoverAnimOut.begin" attributeName="y1" values="42; 17" dur="0.3s" repeatCount="1" fill="freeze" />
          </line>

          <polyline points="14,39 35.5,54 55,39" stroke="white" fill="none">
            <animateTransform begin="arrowHoverAnimIn.begin" attributeName="transform" attributeType="XML" type="translate" from="0 0" to="0 -10" dur="0.3s" repeatCount="1" fill="freeze" />
            <animateTransform begin="arrowHoverAnimOut.begin" attributeName="transform" attributeType="XML" type="translate" from="0 -10" to="0 0" dur="0.3s" repeatCount="1" fill="freeze" />
          </polyline>
        </symbol>
        <mask id="mask">
          <use href="#arrow" />
        </mask>
      </defs>

      <use href="#arrow" />
      <rect width="100%" height="100%" fill="url(#bg)" mask="url(#mask)" />
    </svg><span class="download-btn__label">Start</span></button>
</section>
              
            
!

CSS

              
                @use postcss-preset-env;
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
}

.filter {
    position: absolute;
    top: 0;
    left: -1;
    width: 1px;
    height: 1px;
    visibility: hidden;
}

:root {
    --gradient-start: white;
    --gradient-stop-1: hsl(140, 20%, 90%);
    --label-text: hsl(120, 100%, 36%);
    --focus-border: hsla(120, 100%, 60%, 0.75);
    --shadow: hsla(140, 20%, 50%, 0.5);
    --shadow--hover: hsla(140, 20%, 50%, 0.15);
    --easing-func-btn: cubic-bezier(0.6, 0.18, 0, 1.36);
    --easing-func-pill: cubic-bezier(0.44, 0.25, 0.79, 2.02);
}

body {
    margin: 0;
    padding: 1.25em;
    height: 100%;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #001326
        radial-gradient(
            50vw 50vh ellipse at center,
            var(--gradient-start) 0%,
            var(--gradient-start) 30%,
            var(--gradient-stop-1) 100%
        );

    min-width: 440px;
    padding: 0;
}

.hidden {
    width: 1px;
    height: 1ox;
    position: absolute;
    color: transparent;
    overflow: hidden;
    font-size: 0.001em;
}

.progress-indicator {
    position: relative;
    width: 440px;
    height: 150px;
    margin: auto;
}

.progress-label {
    position: relative;
    transition: transform 0.2s 0.1s var(--easing-func-pill);
}

.progress-label--hover {
    transform: translateY(-30px);
}

.progress-label__value {
    position: absolute;
    left: 0;
    top: 0;
    width: 40px;
    text-align: right;
    font-family: 'Varela Round', sans-serif;
    font-size: 16px;
    color: var(--label-text);
    opacity: 0;
    z-index: 1000;
}

.progress-indicator__filtertarget {
    will-change: filter;
}

.progress-indicator__bar {
    width: 100%;
    height: 100%;
    overflow: visible;
    z-index: 0;
}

.progress-indicator__pill {
    transition: transform 0.2s var(--easing-func-pill);
}

.progress-indicator__pill--hover {
    transform: translateY(-30px);
}

.progress-indicator__shadow {
    stroke: var(--shadow);
    stroke-width: 8;
    transition-property: stroke, stroke-width, transform;
    transition-duration: 0.25s;
    transition-timing-function: var(--easing-func-pill);
}

.progress-indicator__shadow--hover {
    stroke: var(--shadow--hover);
    stroke-width: 18px;
    transform: translateX(12.5%) scale(0.75, 1);
}

.container {
    position: relative;
    width: 400px;
    height: 400px;
    margin: 0 auto;
}

.filtered {
    filter: url('#dm-filter');
}

.download-btn {
    appearance: none;
    display: block;
    position: relative;
    cursor: pointer;
    width: 90px;
    height: 90px;
    margin: 0 auto;
    border: none;
    border-radius: 50%;
    filter: drop-shadow(0 14px 7px var(--shadow));
    color: white;
    padding: 10px;
    background: linear-gradient(var(--button-start) 40%, var(--button-start) 90%);
    background: transparent;

    transition-property: transform, filter;
    transition-duration: 0.4s;
    transition-timing-function: var(--easing-func-btn);

    &:hover {
        transform: translateY(14px);
        filter: drop-shadow(0 2px 4px var(--shadow));
    }

    &::after {
        display: block;
        border-radius: 50%;
        width: 70px;
        height: 70px;
        border: solid var(--focus-border) 1px;
        position: absolute;
        left: 10px;
        top: 10px;
        content: '';
    }

    &:active::after {
        animation: btn-active-anim 0.2s ease-out;
    }
}

.download-btn__label {
    position: absolute;
    font-size: 0.0001em;
    line-height: 0;
    color: transparent;
}

.download-arrow-icon {
    stroke-width: 3;
    stroke-linecap: round;
}

@keyframes btn-active-anim {
    from {
        opacity: 0;
        width: 70px;
        height: 70px;
    }

    75% {
        opacity: 1;
        border-width: 2px;
    }

    to {
        opacity: 0;
        width: 130px;
        height: 130px;
        left: -20px;
        top: -20px;
        border-width: 1px;
    }
}
              
            
!

JS

              
                const suffix = webpSupported() ? 'webp' : 'jpg';
const filterTarget = document.querySelector('#target');
const progress = document.querySelector('#progress');
const btn = document.querySelector('#btn-download');
const labelWrapper = document.querySelector('.progress-label');
const label = document.querySelector('#progress-valuenow');
const syncedAnims = document.querySelectorAll('.js_syncStart');
const displaceAnim = document.querySelector('#displAnim');
const arrowHoverAnimIn = document.querySelector('#arrowHoverAnimIn');
const arrowHoverAnimOut = document.querySelector('#arrowHoverAnimOut');
const gradientHoverAnimIn = document.querySelector('#gradientHoverAnimIn');
const gradientHoverAnimOut = document.querySelector('#gradientHoverAnimOut');
const progressbar = document.querySelector('.progress-indicator__pill');
const dropShadow = document.querySelector('.progress-indicator__shadow');
const duration = 12000;
const totalLength = 360;
const labelAnimTiming = {
    duration: 500,
    fill: 'forwards',
    easing: 'ease-in'
}

let cancelled = false;
let labelAnim, startTime, valueAnimReq;

fetch(`https://assets.codepen.io/100347/fedm_progressbar.${suffix}`, {
    method: 'GET',
    headers: new Headers(),
    mode: 'cors',
    cache: 'default',
})
    .then((response) => {
        return response.blob();
    })
    .then((blob) => {
        const url =  URL.createObjectURL(blob);
        const feImage = document.querySelector('#feimage');
        feImage.setAttribute('href', url);
        setUp();
    });

const progressAnim = () => {
    let percent, position, status;
    let currentTime = Date.now() - startTime;

    if (currentTime >= duration) {
        return;
    }

    percent = currentTime / duration;
    position = percent * totalLength;
    status = `${Math.round(percent * 100)}%`

    label.setAttribute('style', `transform: translate3d(${position.toFixed(2)}px, 0px, 0);`);
    label.innerHTML = status;
    progress.setAttribute('aria-valuenow', status);
    valueAnimReq = requestAnimationFrame(progressAnim);
}

const labelAnimConf = (animateIn = true) => {
    const opacityIn = animateIn ? 0 : 1;
    const opacityout = !animateIn ? 0 : 1;

    return [
        { opacity: opacityIn },
        { opacity: opacityout }];
}

const startProgressAnim = () => {
    startTime = Date.now();
    labelAnim = label.animate(labelAnimConf(), labelAnimTiming);

    label.setAttribute('style', `transform: translate3d(0, 0, 0);`);
    valueAnimReq = requestAnimationFrame(progressAnim);
}

const start = () => {
    cancelled = false;
    filterTarget.classList.add('filtered');

    /* As SMIL syncing is screwed in Webkit and Blink we must roll something on our own:  */

    for (let anim of syncedAnims) {
        anim.beginElement();
    }

    btn.removeEventListener('click', start);
    btn.addEventListener('click', stop);
    startProgressAnim();
}

const stop = () => {
    cancelled = true;

    for (let anim of syncedAnims) {
        anim.endElement();
    }
}

const end = () => {
    const delay = cancelled ? 0 : 900;

    cancelAnimationFrame(valueAnimReq);
    progress.setAttribute('aria-valuenow', '0%');
    labelAnim = label.animate(labelAnimConf(false), labelAnimTiming);

    btn.removeEventListener('click', stop);

    setTimeout(() => {
        filterTarget.classList.remove('filtered');
        btn.addEventListener('click', start);
    }, delay);
}

const hoverInFunc = () => {
    labelWrapper.classList.add('progress-label--hover');
    progressbar.classList.add('progress-indicator__pill--hover');
    dropShadow.classList.add('progress-indicator__shadow--hover');
    arrowHoverAnimIn.beginElement();
    gradientHoverAnimIn.beginElement();
}

const hoverOutFunc = () => {
    labelWrapper.classList.remove('progress-label--hover');
    progressbar.classList.remove('progress-indicator__pill--hover');
    dropShadow.classList.remove('progress-indicator__shadow--hover');
    arrowHoverAnimOut.beginElement();
    gradientHoverAnimOut.beginElement();
}

function setUp() {
    displaceAnim.addEventListener('endEvent', end)
    btn.addEventListener('click', start);
    btn.addEventListener('mouseenter', hoverInFunc);
    btn.addEventListener('mouseleave', hoverOutFunc);
}
              
            
!
999px

Console