cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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="cont">
  <div class="demo">
    <div class="demo__head">
      <p class="demo__pull-down">Pull down content part</p>
    </div>
    <div class="demo__body">
      <svg class="demo__svg" viewBox="0 0 400 540" xmlns="http://www.w3.org/2000/svg" version="1.1">
        <path class="demo__path" fill="#fff" d="M0,540 0,0 Q200,0 400,0 L400,540" />
      </svg>
      <div class="demo__ball-cont">
        <div class="demo__ball">
        </div>
      </div>
      <div class="demo__content">
        <div class="demo__el">
          <div class="demo__el-img"></div>
          <div class="demo__el-text"></div>
        </div>
        <div class="demo__el">
          <div class="demo__el-img"></div>
          <div class="demo__el-text"></div>
        </div>
        <div class="demo__el">
          <div class="demo__el-img"></div>
          <div class="demo__el-text"></div>
        </div>
        <div class="demo__el">
          <div class="demo__el-img"></div>
          <div class="demo__el-text"></div>
        </div>
        <div class="demo__el">
          <div class="demo__el-img"></div>
          <div class="demo__el-text"></div>
        </div>
        <div class="demo__el">
          <div class="demo__el-img"></div>
          <div class="demo__el-text"></div>
        </div>
      </div>
    </div>
    <svg class="demo__progress" viewBox="0 0 80 80">
      <path stroke="#fff" stroke-width="6" fill="none" d="M40,80 a40,40 0 0,1 0,-80 a40,40 0 0,1 0,80" />
    </svg>
  </div>
</div>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  <defs>
    <filter id="goo">
      <feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur" />
      <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 19 -9" result="goo" />
      <feComposite in="SourceGraphic" in2="goo" operator="atop"/>
    </filter>
  </defs>
</svg>
<p class="check-out">Check out my other <a href="https://codepen.io/suez/public/" target="_blank">pens</a></p>
            
          
!
            
              @import "compass/css3";

*, *:before, *:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  font-size: 62.5%;
  height: 100%;
  overflow: hidden;
}
svg {
  display: block;
  overflow: visible;
}
.cont {
  position: relative;
  height: 100%;
  background: #F4F4F6;
  overflow: auto;
}
.demo {
  position: absolute;
  top: 50%;
  left: 50%;
  margin-left: -20rem;
  margin-top: -32rem;
  width: 40rem;
  height: 64rem;
  background: #8B90B1;
  overflow: hidden;
  
  &__head {
    position: relative;
    height: 10rem;
    background: #C0C4D7;
    text-align: center;
    user-select: none;
    
    &:before,
    &:after {
      content: "";
      position: absolute;
      bottom: 1rem;
      width: 1.5rem;
      height: 1.5rem;
      border: 2px solid #fff;
      border-left: none;
      border-top: none;
      transform: rotate(45deg);
    }
    &:before {
      left: 7rem;
    }
    &:after {
      right: 7rem;
      
    }
  }
  
  &__pull-down {
    line-height: 10rem;
    font-size: 2rem;
    text-transform: uppercase;
    color: #fff;
    font-weight: bold;
  }
  
  &__body {
    position: relative;
    height: 54rem;
    cursor: grab;
    
    &.withTransition {
      transition: transform 0.45s;
    }
  }
  
  &__svg {
    z-index: 2;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
  &__ball-cont {
    position: absolute;
    top: 0;
    left: 50%;
    width: 12rem;
    height: 1rem;
    margin-left: -6rem;
    background: #fff;
    filter: url("#goo");
  }
  &__ball {
    position: absolute;
    top: 9rem;
    left: 50%;
    margin-left: -3.5rem;
    z-index: 1;
    width: 7rem;
    height: 7rem;
    border-radius: 50%;
    background: #fff;
    filter: url("#goo");
    transition: transform 0.7s;
    
    &.jump {
      transform: translateY(-20rem);
    }
  }
  
  &__progress {
    position: absolute;
    top: 13.5rem;
    left: 50%;
    margin-left: -4rem;
    width: 8rem;
    height: 8rem;
    
    &.animate {
      transition: transform 0.3s 2s, opacity 0.3s 2s;
      transform: scale(2);
      opacity: 0;
      
      path {
        animation: animatePath 2s forwards;
      }
    }
    
    path {
      stroke-dasharray: 251.36276245117188;
      stroke-dashoffset: 251.36276245117188;
    }
  }
  
  &__content {
    z-index: 3;
    position: relative;
    height: 100%;
    transition: opacity 0.2s;
    user-select: none;
    
    &.hidden {
      opacity: 0;
    }
  }
  
  &__el {
    position: relative;
    height: 9rem;
    border-bottom: 1px solid #EAEAEA;
    padding: 1.5rem;
    
    &:last-child {
      border-bottom: 0;
    }
    
    &-img {
      display: inline-block;
      width: 6rem;
      height: 6rem;
      margin-right: 1.5rem;
      border-radius: 1rem;
      background: #C0C4D7;
    }
    
    &-text {
      position: relative;
      display: inline-block;
      vertical-align: top;
      width: 9rem;
      height: 1.2rem;
      border-radius: 0.5rem;
      background: #C0C4D7;
      
      &:before,
      &:after {
        content: "";
        position: absolute;
        left: 0;
        height: 0.9rem;
        background: #C0C4D7;
        border-radius: 0.5rem;
      }
      &:before {
        top: 2.5rem;
        width: 19rem;
      }
      &:after {
        top: 4.9rem;
        width: 24rem;
      }
    }
  }
  
}

.check-out {
  position: absolute;
  bottom: 0.5rem;
  right: 1rem;
  font-size: 1.5rem;
}

@keyframes animatePath {
  to {
    stroke-dashoffset: 0;
  }
}
            
          
!
            
              $(document).ready(function() {
  
  var animating = false,
      frame = 1000 / 60,
      animTime = 900,
      curY = 0,
      transDiff = 0,
      $body = $(".demo__body"),
      $content = $(".demo__content"),
      $svg = $(".demo__svg"),
      $path = $(".demo__path"),
      $ball = $(".demo__ball"),
      $progress = $(".demo__progress");
  
  var easings = {
    smallElastic: function(t,b,c,d) {
      var ts = (t/=d)*t;
      var tc = ts*t;
      return b+c*(33*tc*ts + -106*ts*ts + 126*tc + -67*ts + 15*t);
    },
    bigElastic: function(t, b, c, d) {
      var ts=(t/=d)*t;
      var tc=ts*t;
      return b+c*(56*tc*ts + -175*ts*ts + 200*tc + -100*ts + 20*t);
    },
    inCubic: function(t,b,c,d) {
      var tc = (t/=d)*t*t;
      return b+c*(tc);
    }
  }
  
  function createD(sideY,y) {
    return "M0,550 0,"+sideY+" Q200,"+y+" 400,0 L400,550";
  }
  
  var currentPath = createD(0,0);
  
  function changeQ(path,x,y) {
    var d = path.attr("d"),
        newD = d.replace(/\bQ(\d+),(\d+)\b/gi, "Q" + x + "," + y);
    path.attr("d", newD);
  }
  
  function animatePathD(path, finalD, time, callback, easing) {
    animating = true;
    var steps = Math.floor(time / frame),
        curStep = 0,
        oldArr = currentPath.split(" "),
        nextY,
        easingQ = easings[easing] || easings["bigElastic"];

    function animate() {
      curStep++;
      nextY = easingQ(curStep, curY, 0-curY, steps);
      oldArr[2] = "Q200,"+nextY;
      $path.attr("d", oldArr.join(" "));
      if (curStep > steps) {
        curY = 0;
        $path.attr("d", finalD);
        if (callback) callback();
        return;
      }
      requestAnimationFrame(animate);
    }
    animate();
  }
  
  function handlers() {
    
    $(document).on("mousedown touchstart", ".demo__body", function(e) {
      if (animating) return;
      var startY =  e.pageY || e.originalEvent.touches[0].pageY;
      
      $(document).on("mousemove touchmove", function(e) {
        var y = e.pageY || e.originalEvent.touches[0].pageY,
            diff = y - startY;
        transDiff = diff;
        curY = diff*2 - 300;
        if (transDiff >= 20) $content.addClass("hidden");
        if (transDiff < 0) transDiff = 0;
        if (transDiff > 150) transDiff = 150;
        $body.css("transform", "translate3d(0,"+ transDiff +"px,0)");
        if (curY <= 0) curY = 0;
        if (curY > 140) curY = 140;
        changeQ($path, 200, curY);
      });
      
    });
    
    $(document).on("mouseup touchend", function(e) {
      $(document).off("mousemove touchmove");
      if (animating) return;
      if (!transDiff) {
        $content.removeClass("hidden");
        return;
      }
      if (curY < 50) {
        $body.addClass("withTransition");
        $body.css("top");
        $body.css("transform", "translate3d(0,0,0)");
        animatePathD($path, createD(0,0), animTime/2);
        $content.removeClass("hidden");
        setTimeout(function() {
          $body.removeClass("withTransition");
        }, animTime/2);
        setTimeout(function() {
          animating = false;
        }, animTime);
        return;
      }
      animatePathD($path, createD(0,0), animTime);
      setTimeout(function() {
        $ball.addClass("jump");
        // WE
        setTimeout(function() {
          $progress.attr("class", $progress.attr("class") + " animate");
          // NEED
          setTimeout(function() {
            $ball.removeClass("jump");
            // TO
            setTimeout(function() {
              $body.addClass("withTransition");
              $body.css("top");
              $body.css("transform", "translate3d(0,0,0)");
              $progress.attr("class", "demo__progress");
              $content.removeClass("hidden");
              // GO
              setTimeout(function() {
                $body.removeClass("withTransition");
                animating = false;
                // DEEPER
              }, animTime/2);
            }, 300);
          }, 2300);
        }, 700);
      }, animTime/3);
    });
    
  }
  
  handlers();
  
});
            
          
!
999px
Loading ..................

Console