动态下载按钮动画效果

代码语言:html

所属分类:表单美化

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


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

<style>
.button {
  --default: rgba(255, 255, 255, .2);
  --active: #fff;
  position: relative;
  border: none;
  outline: none;
  background: none;
  padding: 0;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  -webkit-transform: scale(var(--s, 1));
          transform: scale(var(--s, 1));
  -webkit-transition: -webkit-transform .2s;
  transition: -webkit-transform .2s;
  transition: transform .2s;
  transition: transform .2s, -webkit-transform .2s;
}
.button:active {
  --s: .96;
}
.button svg {
  display: block;
  fill: none;
  stroke-width: var(--sw, 3px);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.button .circle {
  width: 76px;
  height: 76px;
  -webkit-transform: rotate(-90deg);
          transform: rotate(-90deg);
}
.button .circle circle.default {
  stroke: var(--default);
}
.button .circle circle.active {
  stroke: var(--active);
  stroke-dasharray: 227px;
  stroke-dashoffset: var(--active-offset, 227px);
  -webkit-transition: stroke-dashoffset var(--all-transition, 4s) ease var(--all-delay, 0.8s);
  transition: stroke-dashoffset var(--all-transition, 4s) ease var(--all-delay, 0.8s);
}
.button span {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  bottom: 13px;
  font-weight: 500;
  font-size: 10px;
  color: var(--active);
  opacity: var(--count-opacity, 0);
  -webkit-transform: translateY(var(--count-y, 4px));
          transform: translateY(var(--count-y, 4px));
  -webkit-animation: var(--count, none) 0.3s ease forwards var(--all-delay, 4.6s);
          animation: var(--count, none) 0.3s ease forwards var(--all-delay, 4.6s);
  -webkit-transition: opacity .2s ease .6s, -webkit-transform .3s ease .6s;
  transition: opacity .2s ease .6s, -webkit-transform .3s ease .6s;
  transition: opacity .2s ease .6s, transform .3s ease .6s;
  transition: opacity .2s ease .6s, transform .3s ease .6s, -webkit-transform .3s ease .6s;
}
.button .icon {
  --sw: 2px;
  width: 24px;
  height: 40px;
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -20px 0 0 -12px;
}
.button .icon svg.line {
  width: 4px;
  height: 37px;
  stroke: var(--active);
  position: absolute;
  left: 10px;
  top: 0;
  stroke-dasharray: 0 33px var(--line-array, 33px) 66px;
  stroke-dashoffset: var(--line-offset, 33px);
  -webkit-transform: translateY(var(--line-y, 0));
          transform: translateY(var(--line-y, 0));
  opacity: var(--line-opacity, 1);
  -webkit-transition: stroke-dasharray 0.2s, stroke-dashoffset 0.2s, -webkit-transform 0.32s ease var(--all-delay, 0.25s);
  transition: stroke-dasharray 0.2s, stroke-dashoffset 0.2s, -webkit-transform 0.32s ease var(--all-delay, 0.25s);
  transition: stroke-dasharray 0.2s, stroke-dashoffset 0.2s, transform 0.32s ease var(--all-delay, 0.25s);
  transition: stroke-dasharray 0.2s, stroke-dashoffset 0.2s, transform 0.32s ease var(--all-delay, 0.25s), -webkit-transform 0.32s ease var(--all-delay, 0.25s);
}
.button .icon div {
  width: 40px;
  height: 32px;
  position: absolute;
  overflow: hidden;
  left: 50%;
  bottom: 1px;
  margin-left: -20px;
  -webkit-transform: translate(var(--icon-x, 0), var(--icon-y, 0));
          transform: translate(var(--icon-x, 0), var(--icon-y, 0));
  -webkit-transition: -webkit-transform 0.3s ease var(--all-delay, 4.8s);
  transition: -webkit-transform 0.3s ease var(--all-delay, 4.8s);
  transition: transform 0.3s ease var(--all-delay, 4.8s);
  transition: transform 0.3s ease var(--all-delay, 4.8s), -webkit-transform 0.3s ease var(--all-delay, 4.8s);
  -webkit-animation: var(--overflow, none) 0s linear forwards var(--all-delay, 4.8s);
          animation: var(--overflow, none) 0s linear forwards var(--all-delay, 4.8s);
}
.button .icon div:before, .button .icon div:after {
  content: '';
  position: absolute;
  z-index: 1;
  height: 2px;
  left: var(--l, 0);
  top: 15px;
  width: var(--w, 16px);
  background: var(--active);
  border-radius: 1px;
  -webkit-transform-origin: var(--tx, 15px) 1px;
          transform-origin: var(--tx, 15px) 1px;
  -webkit-transform: rotate(var(--before-rotate, 0deg));
          transform: rotate(var(--before-rotate, 0deg));
  opacity: var(--tick-opacity, 0);
  -webkit-transition: opacity 0s linear var(--all-delay, 4.8s), -webkit-transform 0.4s ease var(--all-delay, 4.8s);
  transition: opacity 0s linear var(--all-delay, 4.8s), -webkit-transform 0.4s ease var(--all-delay, 4.8s);
  transition: transform 0.4s ease var(--all-delay, 4.8s), opacity 0s linear var(--all-delay, 4.8s);
  transition: transform 0.4s ease var(--all-delay, 4.8s), opacity 0s linear var(--all-delay, 4.8s), -webkit-transform 0.4s ease var(--all-delay, 4.8s);
}
.button .icon div:after {
  --l: 14px;
  --w: 26px;
  --tx: 1px;
  -webkit-transform: rotate(var(--after-rotate, 0deg));
          transform: rotate(var(--after-rotate, 0deg));
}
.button .icon div svg {
  stroke: var(--active);
}
.button .icon div svg.arrow {
  width: 40px;
  height: 32px;
  opacity: var(--arrow-opacity, 1);
  -webkit-transition: opacity 0s linear var(--all-delay, 1s);
  transition: opacity 0s linear var(--all-delay, 1s);
}
.button .icon div svg.progress {
  width: 444px;
  height: 10px;
  position: absolute;
  left: 0;
  top: 11px;
  -webkit-transform: translateX(var(--progress-x, 0));
          transform: translateX(var(--progress-x, 0));
  opacity: var(--progress-opacity, 0);
  -webkit-transition: opacity 0s linear var(--all-delay, 1s), -webkit-transform var(--all-transition, 4.4s) ease var(--all-delay, 0.4s);
  transition: opacity 0s linear var(--all-delay, 1s), -webkit-transform var(--all-transition, 4.4s) ease var(--all-delay, 0.4s);
  transition: transform var(--all-transition, 4.4s) ease var(--all-delay, 0.4s), opacity 0s linear var(--all-delay, 1s);
  transition: transform var(--all-transition, 4.4s) ease var(--all-delay, 0.4s), opacity 0s linear var(--all-delay, 1s), -webkit-transform var(--all-transition, 4.4s) ease var(--all-delay, 0.4s);
  -webkit-animation: var(--hide, none) 0s linear forwards var(--all-delay, 4.8s);
          animation: var(--hide, none) 0s linear forwards var(--all-delay, 4.8s);
}
.button.loading:not(.reset) {
  --line-y: -36px;
  --line-array: 0;
  --line-offset: 15px;
  --active-offset: 0;
  --arrow-opacity: 0;
  --progress-opacity: 1;
  --progress-x: -400px;
  --tick-opacity: 1;
  --before-rotate: 47deg;
  --after-rotate: -46deg;
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0