cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmloctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="dl-box">
  <svg class="dl-svg" viewBox="0 0 160 160">
    <path class="dl-svg__circle" d="M80,3 a77,77 0 1,0 0,154 a77,77 0 1,0 0,-154 a77,77 0 1,0 0,154 a77,77 0 1,0 0,-154"/>
    <path class="dl-svg__arrow dl-svg__arrow-main" d="M80,47 v66"/>
    <path class="dl-svg__arrow dl-svg__arrow-side" d="M56,85 80,115"/>
    <path class="dl-svg__arrow dl-svg__arrow-side" d="M104,85 80,115"/>
    <path class="dl-svg__rotater" d="M80,3 a77,77 0 0,1 0,154 a77,77 0 0,1 0,-154"/>
    <path class="dl-svg__progress-plc" d="M-77,207 h314"/>
    <path class="dl-svg__triangle" d="M80,3 Q180,10 225,207 h-302"/>
    <path class="dl-svg__triangle-piece" d="M225,207 h15"/>
    <path class="dl-svg__progress" d="M-77,207 h314"/>
    <path class="dl-svg__progress-vert" d="M80,207 80,3"/>
    <path class="dl-svg__checkmark" d="M7,56 l74,52 l44,-56"/>
  </svg>
  <div class="dl-status">
    <p class="dl-status__numbers">0</p>
    <span class="dl-status__perc">%</span>
  </div>
  <div class="particles m--stage-2">
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
  </div>
  <div class="particles m--stage-3">
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
    <div class="particles__p"></div>
  </div>
  <button type="button" class="dl-reset">Reset</button>
</div>

<a href="https://dribbble.com/shots/2939772--Daily-UI-Download" target="_blank" class="icon-link">
  <img src="http://icons.iconarchive.com/icons/uiconstock/socialmedia/256/Dribbble-icon.png">
</a>
<a href="https://twitter.com/NikolayTalanov" target="_blank" class="icon-link icon-link--twitter">
  <img src="https://cdn1.iconfinder.com/data/icons/logotypes/32/twitter-128.png">
</a>
            
          
!
            
              *, *:before, *:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #006cc7;
  font-family: 'Roboto', Helvetica, Arial, sans-serif;
}

$circleSize: 160px;
$dlPad: 20px;
$dlWidth: 320px + $dlPad * 2;
$dlHeight: $circleSize + 50px + $dlPad*2;
$strokeW: 6px;

.dl-box {
  position: absolute;
  left: 50%;
  top: 50%;
  width: $dlWidth;
  height: $dlHeight;
  padding: $dlPad;
  margin-left: $dlWidth/-2;
  margin-top: $dlHeight/-2;
}

.dl-svg {
  overflow: visible;
  display: block;
  width: $circleSize;
  height: $circleSize;
  margin: 0 auto;
  
  &:not(.s--animating) {
    cursor: pointer;
  }
  
  path {
    fill: none;
    stroke-width: $strokeW;
    stroke-linecap: round;
  }
  
  &__circle {
    stroke: #4c99d9;
  }
  
  &__arrow {
    stroke: #fff;
  }
  
  &__rotater {
    stroke: #fff;
    opacity: 0;
  }
  
  &__triangle {
    stroke: #fff;
    opacity: 0;
    
    &-piece {
      stroke: #fff;
      opacity: 0;
    }
  }
  
  &__progress-plc {
    stroke: rgba(#fff, 0.4);
    opacity: 0;
  }
  
  &__progress,
  &__progress-vert,
  &__checkmark {
    stroke: #fff;
    opacity: 0;
  }
}

.dl-status {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  position: absolute;
  left: 0;
  top: 90px;
  width: 100%;
  color: #4c99d9;
  opacity: 0;
  transition: 0.6s;
  transform: scale(0.8);
  pointer-events: none;
  
  &.s--active {
    opacity: 1;
    transform: scale(1);
  }
  
  &__numbers {
    width: 95px;
    line-height: 1;
    font-size: 55px;
    font-weight: bold;
    text-align: center;
    transition: 0.3s;
    
    .dl-status.s--active & {
      color: #fff;
    }
  }
  
  &__perc {
    font-size: 25px;
  }
}

.dl-reset {
  position: absolute;
  left: 50%;
  top: 110%;
  width: 140px;
  height: 50px;
  margin-left: -70px;
  font-size: 24px;
  text-transform: uppercase;
  color: #fff;
  border: 3px solid #fff;
  border-radius: 4px;
  background: transparent;
  outline: none;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s;
  
  &.s--visible {
    pointer-events: auto;
    opacity: 1;
  }
}

$numOfBaseParticles: 10;
$particleSize: 4px;
$particlesAT: 0.6s;
$particlesDelay: 0;
$partInitRnd: 3;
$initChildX: 5px;
$moveChange: 15px;
$childMove: 10px;

.particles {
  position: absolute;
  height: 1px;
  
  &__p {
    position: absolute;
    top: 0;
    width: $particleSize;
    height: $particleSize;
    border-radius: 50%;
    background: rgba(#fff, 0.8);
    opacity: 0;
    transition: all $particlesAT;
    
    &:before,
    &:after {
      content: "";
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background: inherit;
      transition: all $particlesAT;
    }
    
    @for $i from 1 through $numOfBaseParticles {
      &:nth-child(#{$i}) {
        $leftStep: 100% / $numOfBaseParticles;
        @debug $leftStep;
        $rndX: ($partInitRnd/-2 + random($partInitRnd)) * 1px;
        $rndY: ($partInitRnd/-2 + random($partInitRnd)) * 1px;
        left: $i * $leftStep - $leftStep/2;
        transform: translate($rndX, $rndY);
        
        &:before {
          $rndDeg: random(360) * 1deg;
          transform: rotate($rndDeg) translateX($initChildX);
          
          .particles.s--active & {
            transform: rotate($rndDeg) translateX($initChildX + $childMove);
          }
        }
        &:after {
          $rndDeg: random(360) * 1deg;
          transform: rotate($rndDeg) translateX($initChildX);
          
          .particles.s--active & {
            transform: rotate($rndDeg) translateX($initChildX + $childMove);
          }
        }
        
        .particles.s--active & {
          animation: fadeParticle $particlesAT 0.05s * $i + $particlesDelay ease-in-out;
          transform: translate($rndX + $moveChange, $rndY - $moveChange);
        }
      }
    }
  }
  
  &.m--stage-2 {
    left: 241px;
    top: 50px;
    width: 200px;
    transform-origin: 0 0;
    transform: rotate(63deg);
  }
  
  &.m--stage-3 {
    left: 340px;
    top: 210px;
    width: 300px;
    transform-origin: 0 0;
    transform: rotate(180deg);
  }
}

@keyframes fadeParticle {
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.icon-link {
  position: absolute;
  left: 5px;
  bottom: 5px;
  width: 32px;

  img {
    width: 100%;
    vertical-align: top;
  }

  &--twitter {
    left: auto;
    right: 5px;
  }
}
            
          
!
            
              (function() {
  function $$(selector, context) {
    var context = context || document;
    var elements = context.querySelectorAll(selector);
    var nodesArr = [].slice.call(elements);
    return nodesArr.length === 1 ? nodesArr[0] : nodesArr;
  };

  var $status = $$('.dl-status');
  var $statusNumbers = $$('.dl-status__numbers');

  var $dlSVG = $$('.dl-svg');

  var $circle = $$('.dl-svg__circle');
  var $arrMain = $$('.dl-svg__arrow-main');
  var $arrSides = $$('.dl-svg__arrow-side');
  var $rotater = $$('.dl-svg__rotater');
  var $tri = $$('.dl-svg__triangle');
  var $triPiece = $$('.dl-svg__triangle-piece');
  var $plc = $$('.dl-svg__progress-plc');
  var $progress = $$('.dl-svg__progress');
  var $prVert = $$('.dl-svg__progress-vert');
  var $check = $$('.dl-svg__checkmark');

  var $resetBtn = $$('.dl-reset');
  var $particles = $$('.particles');
  var $particlesStage2 = $$('.particles.m--stage-2');
  var $particlesStage3 = $$('.particles.m--stage-3');

  var arrInitAT = 0.5;
  var dotFadeAT = 0.1;
  var rtRotationAT = 1.4;
  var triAT = 1.1;
  var rtDelay = arrInitAT + dotFadeAT;
  var triPhase2Delay = triAT * 0.6;

  var progressDelay = 0.2;
  var progressAT = 1;
  var prCollapseAT = 0.5;
  var prMoveAT = 0.4;

  var circleAT = 0.6;

  var checkAT = 0.5;

  function resetDl() {
    $dlSVG.classList.remove('s--animating');
    $resetBtn.classList.remove('s--visible');
    $particles.forEach(function($part) {
      $part.classList.remove('s--active');
    });

    TweenMax.set($arrMain, {drawSVG: '100%', y: 0, opacity: 1});
    TweenMax.set($arrSides, {drawSVG: '100%'});
    TweenMax.set($circle, {transformOrigin: '50% 50%'});
    TweenMax.set($rotater, {opacity: 0, transformOrigin: '50% 50%', drawSVG: '0.5px', rotation: 0});
    TweenMax.set($tri, {opacity: 0, drawSVG: '1px'});
    TweenMax.set($triPiece, {opacity: 0, drawSVG: 0});
    TweenMax.set($plc, {opacity: 0, drawSVG: '305px 305px'});
    TweenMax.set($progress, {opacity: 0, drawSVG: 0});
    TweenMax.set($prVert, {opacity: 0, drawSVG: 0, transformOrigin: '50% 77px', rotation: 0});
    TweenMax.set($check, {opacity: 0, drawSVG: 0});
  };

  resetDl();

  function checkmarkAnim() {
    TweenMax.set($check, {opacity: 1});
    TweenMax.set($prVert, {opacity: 0});
    TweenMax.to($check, checkAT * 0.7, {drawSVG: '100% 40%'});
    TweenMax.to($check, checkAT * 0.3, {drawSVG: '95% 35%', delay: checkAT * 0.7,
                                        onComplete: function() {
                                          $resetBtn.classList.add('s--visible');
                                        }});
  };

  function successAnim() {
    $statusNumbers.innerHTML = 0;

    TweenMax.set($circle, {opacity: 1, drawSVG: 0, scale: 1});
    TweenMax.to($circle, circleAT, {drawSVG: '60%'});
    TweenMax.to($prVert, circleAT, {rotation: -432, onComplete: checkmarkAnim});
  };

  function afterProgressAnim() {
    $status.classList.remove('s--active');

    TweenMax.set($plc, {opacity: 0});
    TweenMax.to($progress, prCollapseAT, {drawSVG: '157px 156px'});
    TweenMax.set($progress, {opacity: 0, delay: prCollapseAT});
    TweenMax.set($prVert, {opacity: 1, delay: prCollapseAT});
    TweenMax.to($prVert, prMoveAT * 0.8, {drawSVG: '100% 70%', delay: prCollapseAT});
    TweenMax.to($prVert, prMoveAT * 0.2, {drawSVG: '100% 99%', delay: prCollapseAT + prMoveAT * 0.5, 
                                          onComplete: successAnim});
  };

  function progressAnim() {
    var status = {p: 0};
    TweenMax.set($progress, {opacity: 1, delay: progressDelay});
    TweenMax.to(status, progressAT, {p: 100, delay: progressDelay, ease: Power1.easeInOut, 
                                     onComplete: afterProgressAnim,
                                     onUpdate: function() {
                                       var _p = Math.ceil(status.p);
                                       $statusNumbers.innerHTML = _p;
                                       TweenMax.to($progress, 0.05, {drawSVG: _p + '%', ease: Power1.easeInOut});
                                     }});
  };

  function trinagleAnim() {
    $status.classList.add('s--active');

    TweenMax.to($rotater, 0.1, {opacity: 0});
    TweenMax.to($tri, 0.2, {opacity: 1});
    TweenMax.to($tri, triAT * 0.15, {drawSVG: '20%', ease: Power1.easeInOut,
                                    onComplete: function() {
                                      $particlesStage2.classList.add('s--active');
                                      setTimeout(function() {
                                        $particlesStage3.classList.add('s--active');
                                      }, triAT * 0.3 * 1000);
                                    }});
    TweenMax.to($tri, triAT * 0.65, {drawSVG: '90% 50%', delay: triAT * 0.15, ease: Power1.easeOut});
    TweenMax.to($tri, triAT * 0.4, {drawSVG: '105% 100%', opacity: 0, delay: triPhase2Delay, ease: Power1.easeOut, 
                                    onComplete: progressAnim});
    TweenMax.to($circle, 0.3, {scale: 0.8, opacity: 0, delay: triPhase2Delay});
    TweenMax.set($triPiece, {opacity: 1, delay: triPhase2Delay - triAT * 0.2});
    TweenMax.to($triPiece, triAT * 0.3, {drawSVG: '100% 25%', delay: triPhase2Delay - triAT * 0.2});
    TweenMax.to($triPiece, triAT * 0.2, {drawSVG: '100% 100%', delay: triPhase2Delay});
    TweenMax.set($plc, {opacity: 1, delay: triPhase2Delay});
    TweenMax.to($plc, triAT * 0.2, {drawSVG: '100% 0', delay: triPhase2Delay});
  };

  function initDlAnim() {
    $dlSVG.classList.add('s--animating');

    TweenMax.to($arrMain, arrInitAT, {drawSVG: '0.5px', y: -45});
    TweenMax.to($arrSides, arrInitAT, {drawSVG: '100% 100%'});
    TweenMax.to($arrMain, dotFadeAT, {opacity: 0, delay: arrInitAT * 1.1});

    TweenMax.to($rotater, dotFadeAT, {opacity: 1, delay: arrInitAT});
    TweenMax.to($rotater, rtRotationAT, {rotation: 720, delay: rtDelay, ease: Power1.easeInOut});
    TweenMax.to($rotater, rtRotationAT * 0.2, {drawSVG: '20px', opacity: 0.4, delay: rtDelay});
    TweenMax.to($rotater, rtRotationAT * 0.15, {drawSVG: '0.5px', opacity: 1, delay: rtDelay + rtRotationAT * 0.85,
                                                onComplete: trinagleAnim});
  };

  $dlSVG.addEventListener('click', function() {
    if ($dlSVG.classList.contains('s--animating')) return;
    initDlAnim();
  });

  $resetBtn.addEventListener('click', resetDl);

}());
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console