svg+css实现带进度提示上传动画效果代码

代码语言:html

所属分类:上传

代码描述:svg+css实现带进度提示上传动画效果代码

代码标签: 进度 提示 上传 动画 效果

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

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <style>
        @import url(https://fonts.googleapis.com/css?family=Lato);
    body {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
      font-family: Lato, sans-serif;
      background: #eceffc;
    }
    
    .upload {
      --btn-color: #3bafda;
      --progress-color: #2d334c;
      --ease-in-out-quartic: cubic-bezier(0.77, 0, 0.175, 1);
      position: relative;
      display: flex;
      font-size: 24px;
      background: white;
      border-radius: 10px;
      box-shadow: 0 1.7px 1.4px rgba(0, 0, 0, 0.02), 0 4px 3.3px rgba(0, 0, 0, 0.028), 0 7.5px 6.3px rgba(0, 0, 0, 0.035), 0 13.4px 11.2px rgba(0, 0, 0, 0.042), 0 25.1px 20.9px rgba(0, 0, 0, 0.05), 0 60px 50px rgba(0, 0, 0, 0.07);
      overflow: hidden;
    }
    .upload__info {
      display: flex;
      align-items: center;
      padding: 25px 30px;
      margin-right: 60px;
    }
    .upload__filename {
      padding-left: 12px;
    }
    .upload__button {
      position: relative;
      padding: 20px 20px;
      font-size: 24px;
      color: white;
      background: none;
      border: none;
      border-radius: inherit;
      outline: none;
      cursor: pointer;
      transform: scale(0.9);
    }
    .upload__button::before {
      position: absolute;
      content: "";
      z-index: -1;
      top: 0;
      left: 2px;
      width: 100%;
      height: 100%;
      background-color: var(--btn-color);
      border-radius: inherit;
      transform-origin: right;
    }
    .upload__hint {
      position: absolute;
      top: 0;
      left: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100%;
      height: 100%;
      color: white;
      transform: translateY(100%);
    }
    .upload__progress {
      position: absolute;
      content: "";
      top: 90%;
      left: 0;
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100%;
      height: 100%;
      color: white;
      background: var(--progress-color);
      transform: scaleX(0);
      transform-origin: left;
    }
    .upload__progress .check {
      stroke-dasharray: 20px;
      stroke-dashoffset: 20px;
      margin-right: 10px;
    }
    .upload.uploading .upload__button {
      animation: expand 0.3s forwards;
    }
    .upload.uploading .upload__button::before {
      animation: fill-left 1.2s 0.4s var(--ease-in-out-quartic) forwards;
    }
    .upload.uploading .upload__info > *,
    .upload.uploading .upload__button__text {
      animation: fade-up-out 0.4s 0.4s forwards;
    }
    .upload.uploading .upload__hint {
      animation: fade-up-in 0.4s 0.8s forwards;
    }
    .upload.uploading .upload__progress {
      animation: fill-right 2s 1s var(--ease-in-out-quartic) forwards;
    }
    .upload.uploaded .upload__progress {
      animation: slide-up 1s var(--ease-in-out-quartic) forwards;
    }
    .upload.uploaded .upload__progress .check {
      animation: stroke-in 0.6s 0.4s var(--ease-in-out-quartic) forwards;
    }
    .upload.uploaded-after .upload__info {
      animation: slide-down-info 1s var(--ease-in-out-quartic) forwards;
    }
    .upload.uploaded-after .upload__button {
      animation: slide-down-button 1s var(--ease-in-out-quartic) forwards;
    }
    .upload.uploaded-after .upload__progress {
      animation: slide-down-progress 1s var(--ease-in-out-quartic) forwards;
    }
    
    @keyframes expand {
      to {
        transform: scale(1);
      }
    }
    @keyframes fill-left {
      to {
        transform: scale(4, 1.2);
      }
    }
    @keyframes fade-up-out {
      to {
        opacity: 0;
        transform: translateY(-40%);
      }
    }
    @keyframes fade-up-in {
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }
    @keyframes fill-right {
      to {
        transform: scaleX(1);
      }
    }
    @keyframes slide-up {
      from {
        transform: scaleX(1) translateY(0);
      }
      to {
        transform: scaleX(1) translateY(-90%);
      }
    }
    @keyframes stroke-in {
      to {
        stroke-dashoffset: 0;
      }
    }
    @keyframes slide-down-info {
      from {
        transform: translateY(-100%);
      }
      to {
        transform: translateY(0);
      }
    }
    @keyframes slide-down-button {
      from {
        transform: scale(0.9) translateY(-100%);
      }
      to {
        transform: scale(0.9) translateY(0);
      }
    }
    @keyframes slide-down-progress {
      from {
        transform: scaleX(1) translateY(-90%);
      }
      to {
        transform: scaleX(1) translateY(10%);
      }
    }
    </style>

</head>

<body>

    <div class="upload">
        <div class="upload__info">
            <svg t="1581822650945" class="clip" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3250" width="30" height="30">
      <path
        d="M645.51621918 141.21142578c21.36236596 0 41.79528808 4.04901123 61.4025879 12.06298852a159.71594214 159.71594214 0 0 1 54.26367236 35.87255836c15.84503198 16.07739258 27.76959252 34.13726783 35.78356909 54.13513184 7.86071778 19.30572486 11.76635766 39.80291724 11.76635767 61.53607177 0 21.68371583-3.90563989 42.22045875-11.76635767 61.54101586-8.01397729 19.99291992-19.95831275 38.02807617-35.78356909 54.08569313l-301.39672877 302.0839231c-9.21038818 9.22027564-20.15112281 16.48278832-32.74310277 21.77270508-12.29040503 4.81036401-24.54125953 7.19329834-36.82177783 7.19329834-12.29040503 0-24.56103516-2.38293433-36.85638427-7.19329834-12.63647461-5.28991675-23.53271461-12.55737281-32.7381587-21.77270508-9.55151367-9.58117675-16.69042992-20.44775367-21.50573731-32.57995583-4.7856443-11.61804223-7.15869117-23.91339135-7.15869188-36.9255979 0-13.14074708 2.37304688-25.55474854 7.16363524-37.19256639 4.81036401-11.94927954 11.94927954-22.78619408 21.50079395-32.55029274l278.11614966-278.46221923c6.45172119-6.51104737 14.22344971-9.75421118 23.27563501-9.75421119 8.8692627 0 16.54705787 3.24316383 23.03338622 9.75421119 6.47644019 6.49127173 9.73937964 14.18389916 9.73937964 23.08282495 0 9.0521853-3.26293945 16.81896972-9.73937964 23.32012891L366.97489888 629.73773218c-6.32812477 6.2935183-9.48724342 14.08007836-9.48724415 23.30529736 0 9.06701684 3.15417457 16.75964356 9.48724414 23.08776904 6.80273414 6.50610328 14.55963111 9.75915528 23.26574683 9.75915527 8.67150855 0 16.43334961-3.25.........完整代码请登录后点击上方下载按钮下载查看

网友评论0