液体下载动画效果

代码语言:html

所属分类:动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<title>Fluid download animation</title>

<style>
      .upload {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  position: relative;
  border: 2px solid #419AFE;
  cursor: pointer;
  -webkit-transform: translateZ(0);
          transform: translateZ(0);
  transition: -webkit-transform .2s ease;
  transition: transform .2s ease;
  transition: transform .2s ease, -webkit-transform .2s ease;
}
.upload .path {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  margin: -36px 0 0 -36px;
  width: 72px;
  height: 72px;
}
.upload .path .arrow {
  bottom: 27px;
  width: 2px;
  height: 21px;
  position: absolute;
  left: 50%;
  border-radius: 1px;
  margin: 0 0 0 -1px;
  -webkit-transform-origin: 50% 100%;
          transform-origin: 50% 100%;
}
.upload .path .arrow:before, .upload .path .arrow:after {
  content: '';
  display: block;
  width: 2px;
  height: 14px;
  bottom: -2px;
  background: #fff;
  position: absolute;
  border-radius: 1px;
  -webkit-transform-origin: 50% 100%;
          transform-origin: 50% 100%;
}
.upload .path .arrow:before {
  right: 50%;
  -webkit-transform: rotate(-44deg) translateX(2px);
          transform: rotate(-44deg) translateX(2px);
}
.upload .path .arrow:after {
  left: 50%;
  -webkit-transform: rotate(44deg) translateX(-2px);
          transform: rotate(44deg) translateX(-2px);
}
.upload .path svg {
  width: 72px;
  height: 72px;
  display: block;
  fill: none;
  stroke: #fff;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-dashoffset: 592.73;
  stroke-dasharray: 0 592.73 20 592.73;
}
.upload .circle {
  position: absolute;
  width: 58px;
  height: 58px;
  margin: -29px 0 0 -29px;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  overflow: hidden;
}
.upload .circle .water {
  -webkit-transform: translateY(116%);
          transform: translateY(116%);
  background: #419AFE;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}
.upload .circle .water svg {
  display: block;
  width: 116px;
  height: 6px;
  position: absolute;
  bottom: 100%;
}
.upload .circle .water svg:nth-child(1) {
  right: 0;
  fill: #308FFA;
  -webkit-animation: forward 1.65s infinite;
          animation: forward 1.65s infinite;
}
.upload .circle .water svg:nth-child(2) {
  left: 0;
  fill: #419AFE;
  margin-bottom: -1px;
  -webkit-animation: backward .825s infinite linear;
          animation: backward .825s infinite linear;
}
.upload.loading .path {
  -webkit-animation: movePath .4s linear forwards;
          animation: movePath .4s linear forwards;
}
.upload.loading .path .arrow {
  -webkit-animation: arrow .5s linear forwards 3.7s;
          animation: arrow .5s linear forwards 3.7s;
}
.upload.loading .path .arrow:before {
  -webkit-animation: arrowB .4s linear forwards, arrowBCheck .5s linear forwards 3.7s;
          animation: arrowB .4s linear forwards, arrowBCheck .5s linear forwards 3.7s;
}
.upload.loading .path .arrow:after {
  -webkit-animation: arrowA .4s linear forwards, arrowACheck .5s linear forwards 3.7s;
          animation: arrowA .4s linear forwards, arrowACheck .5s linear forwards 3.7s;
}
.upload.loading .path svg {
  -webkit-animation: load 3s linear forwards .45s, reset .7s linear forwards 3.7s;
          animation: load 3s linear forwards .45s, reset .7s linear forwards 3.7s;
}
.upload.loading .circle .water {
  -webkit-animation: fill 3s linear forwards .45s;
          animation: fill 3s linear forwards .45s;
}
.upload:active {
  -webkit-transform: scale(0.92) translateZ(0);
          transform: scale(0.92) translateZ(0);
}

@-webkit-keyframes load {
  0% {
    stroke-dashoffset: 592.73;
    stroke-dasharray: 0 592.73 20 592.73;
  }
  42% {
    stroke-dasharray: 0 592.73 80 592.73;
  }
  85% {
    stroke-dashoffset: 80;
    stroke-dasharray: 0 592.73 32 592.73;
  }
  100% {
    stroke-dashoffset: 32;
    stroke-dasharray: 0 592.73 32 592.73;
  }
}

@keyframes load {
  0% {
    stroke-dashoffset: 592.73;
    stroke-dasharray: 0 592.73 20 592.73;
  }
  42% {
    stroke-dasharray: 0 592.73 80 592.73;
  }
  85% {
    stroke-dashoffset: 80;
    stroke-dasharray: 0 592.73 32 592.73;
  }
  100% {
    stroke-dashoffset: 32;
    stroke-dasharray: 0 592.73 32 592.73;
  }
}
@-webkit-keyframes reset {
  0%,
    99% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
@keyframes reset {
  0%,
    99% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
@-webkit-keyframes movePath {
  70% {
    -webkit-transform: translateY(-10px);
            transform: translateY(-10px);
  }
}
@keyframes movePath {
  70% {
    -webkit-transform: translateY(-10px);
            transform: translateY(-10px);
  }
}
@-webkit-keyframes arrow {
  0% {
    background: #fff;
    -webkit-transform: rotate(34deg) translate(-2.5px, 2px);
            transform: rotate(34deg) translate(-2.5px, 2px);
  }
  40% {
    -webkit-transform: rotate(-7deg) translate(0, 0);
            transform: rotate(-7deg) translate(0, 0);
  }
  99% {
    -webkit-transform: rotate(0) translate(0, 0);
            transform: rotate(0) translate(0, 0);
  }
  100% {
    background: #fff;
  }
}
@keyframes arrow {
  0% {
    background: #fff;
    -webkit-transform: rotate(34deg) translate(-2.5px, 2px);
            transform: rotate(34deg) translate(-2.5px, 2px);
  }
  40% {
    -webkit-transform: rotate(-7deg) translate(0, 0);
            transform: rotate(-7deg) translate(0, 0);
  }
  99% {
    -webkit-transform: rotate(0) translate(0, 0);
            transform: rotate(0) translate(0, 0);
  }
  100% {
    background: #fff;
  }
}
@-webkit-keyframes arrowBCheck {
  0%,
    20% {
    -webkit-transform: rotate(-86deg) translateX(2px) translateY(1px) scaleY(0.714);
            transform: rotate(-86deg) translateX(2px) translateY(1px) scaleY(0.714);
    opacity: 1;
  }
  100% {
    -webkit-transform: rotate(-44deg) translateX(2px) scaleY(1) translateY(0);
            transform: rotate(-44deg) translateX(2px) scaleY(1) translateY(0);
    opacity: 1;
  }
}
@keyframes arrowBCheck {
  0%,
    20% {
    -webkit-transform: rotate(-86deg) translateX(2px) translateY(1px) scaleY(0.714);
            transform: rotate(-86deg) translateX(2px) translateY(1px) scaleY(0.714);
    opacity: 1;
  }
  100% {
    -webkit-transform: rotate(-44deg) translateX(2px) scaleY(1) translateY(0);
            transform: rotate(-44deg) translateX(2px) scaleY(1) translateY(0);
    opacity: 1;
  }
}
@-webkit-keyframes .........完整代码请登录后点击上方下载按钮下载查看

网友评论0