anime.js+svg+css实现带进度条显示的操作按钮动画效果代码

代码语言:html

所属分类:进度条

代码描述:anime.js+svg+css实现带进度条显示的操作按钮动画效果代码

代码标签: anime.js svg css 进度条 显示 操作 按钮

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500&display=swap" rel="stylesheet">




    <style>
        * {
          box-sizing: border-box;
        }
        
        body {
          width: 100%;
          height: 100vh;
          background-color: #f8f7fc;
          font-family: "Plus Jakarta Sans", sans-serif;
        }
        body main {
          display: flex;
          justify-content: center;
          align-items: center;
          width: inherit;
          height: inherit;
        }
        body main .btn-area {
          position: relative;
          width: calc(210px + 2px);
          height: calc(60px + 2px);
        }
        body main .btn-area:hover .main-btn {
          opacity: 0.25;
        }
        body main .btn-area .main-btn {
          width: inherit;
          height: inherit;
          opacity: 0.15;
          transition: 250ms;
        }
        body main .btn-area .main-btn rect {
          width: 210px;
          height: 60px;
          transition: 250ms;
        }
        body main .btn-area .progress-area,
        body main .btn-area .complete-area {
          position: absolute;
          display: flex;
          justify-content: space-evenly;
          align-items: center;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          width: 100%;
          color: #1578ff;
          -webkit-user-select: none;
             -moz-user-select: none;
              -ms-user-select: none;
                  user-select: none;
          opacity: 1;
        }
        body main .btn-area .progress-area .area-left,
        body main .btn-area .complete-area .area-left {
          display: flex;
        }
        body main .btn-area .progress-area .area-left svg,
        body main .btn-area .complete-area .area-left svg {
          margin-right: 1rem;
          opacity: 0;
        }
        body main .btn-area .progress-area .area-left span,
        body main .btn-area .complete-area .area-left span {
          width: 50px;
          text-align: right;
        }
        body main .btn-area .progress-area .area-right,
        body main .btn-area .complete-area .area-right {
          position: relative;
          display: flex;
          align-items: center;
          height: 20px;
          margin-right: -1rem;
          padding-left: 1rem;
          border-left: 1px solid #1578ff44;
          overflow: hidden;
          cursor: pointer;
        }
        body main .btn-area .progress-area .area-right:hover,
        body main .btn-area .complete-area .area-right:hover {
          height: 40px;
          transition: 250ms height;
        }
        body main .btn-area .progress-area .area-right:hover svg,
        body main .btn-area .complete-area .area-right:hover svg {
          opacity: 1;
        }
        body main .btn-area .progress-area .area-right svg,
        body main .btn-area .complete-area .area-right svg {
          opacity: 0.5;
          transition: 250ms;
        }
        body main .btn-area .progress-area .area-right .btn-play,
        body main .btn-area .complete-area .area-right .btn-play {
          position: absolute;
          transform: translateY(40px);
        }
        body main .btn-area .complete-area {
          justify-content: space-around;
          display: none;
        }
        body main .btn-area .complete-area svg {
          width: 40px;
          height: 20px;
          margin-right: 1rem;
          padding-right: 1rem;
          border-right: 1px solid #fff6;
        }
        body main .btn-area .complete-area svg path {
          stroke-linecap: round;
          stroke-linejoin: round;
          stroke-width: 6px;
          opacity: 0;
        }
        body main .btn-area .complete-area span {
          color: #fffd;
          padding-bottom: 1px;
          opacity: 0;
        }
        body main .btn-area .frame-btn {
          position: absolute;
          top: 0;
          left: 0;
          width: inherit;
          height: inherit;
        }
        body main .btn-area .frame-btn rect {
          width: 210px;
          height: 60px;
          stroke-linecap: round;
          stroke-linejoin: round;
        }
        body .instagram-link {
          position: absolute;
          right: 50px;
          bottom: 50px;
        }
        body .instagram-link i {
          color: #1578ff;
          transition: 150ms;
          font-size: 2rem;
          opacity: 0.5;
        }
        body .instagram-link i:hover {
          opacity: 1;
        }
    </style>

</head>

<body>
    <main>
        <div class="btn-area">
            <svg class="main-btn" xmlns="http://www.w3.org/2000/svg" version="1.1">
      <rect fill="#fff" stroke="#1578ff" stroke-width="2" x="1" y="1" rx="10" ry="10" />
    </svg>
            <svg class="frame-btn" xmlns="http://www.w3.org/2000/svg" version="1.1">
      <rect fill="none" stroke="#1578ff" stroke-width="2" stroke-dasharray="525" stroke-dashoffset="525" x="1" y="1" rx="10" ry="10" />
    </svg>
            <div class="progress-area">
                <div class="area-left">
                    <svg width="18" height="18" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
          <path d="M18 3C17.1 3 16.5 3.6 16.5 4.5V8.25C16.5 9.15 17.1 9.75 18 9.75C18.9 9.75 19.5 9.15 19.5 8.25V4.5C19.5 3.6 18.9 3 18 3Z" fill="#1578ff" />
          <path d="M10.0504 12.1504C10.3504 12.4504 10.8004 12.6004 11.1004 12.6004C11.4004 12.6004 11.8504 12.4504 12.1504 12.1504C12.7504 11.5504 12.7504 10.6504 12.1504 10.0504L9.45039 7.35039C8.85039 6.75039 7.95039 6.75039 7.35039 7.35039C6.75039 7.95039 6.75039 8.85039 7.35039 9.45039L10.0504 12.1504Z" fill="#1578ff" />
          <path d="M9.75 18C9.75 17.1 9.15 16.5 8.25 16.5H4.5C3.6 16.5 3 17.1 3 18C3 18.9 3.6 19.5 4.5 19.5H8.25C9 19.5 9.75 18.9 9.75 18Z" fill="#1578ff" />
          <path d="M10.0508 23.8504L7.50078 26.4004C6.90078 27.0004 6.90078 27.9004 7.50078 28.5004C7.80078 28.8004 8.25078 28.9504 8.55078 28.9504C8.85078 28.9504 9.30078 28.8004 9.60078 28.5004L12.1508 25.9504C12.7508 25.3504 12.7508 24.4504 12.1508 23.8504C11.5508 23.2504 10.6508 23.2504 10.0508 23.8504Z" fill="#1578ff" />
          <path d="M18 26.25C17.1 26.25 16.5 26.85 16.5 27.75V31.5C16.5 32.4 17.1 33 18 33C18.9 33 19.5 32.4 19.5 31.5V27.75C19.5 27 18.9 26.25 18 26.25Z" fill="#1578ff" />
          <path d="M25.9504 23.8504C25.3504 23.2504 24.4504 23.2504 23.8504 23.8504C23.2504 24.4504 23.2504 25.3504 23.8504 25.9504L26.4004 28.5004C26.7004 28.8004 27.1504 28.9504 27.4504 28.9504C27.7504 28.9504 28.2004 28.8004 28.5004 28.5004C29.1004 27.9004 29.1004 27.0004 28.5004 26.4004L25.9504 23.8504Z" fill="#1578ff" />
          <path d="M31.5 16.5H27.75C26.85 16.5 26.25 17.1 26.25 18C26.25 18.9 26.85 19.5 27.75 19.5H31.5C32.4 19.5 33 18.9 33 18C33 17.1 32.4 16.5 31.5 16.5Z" fill="#1578ff" />
          <path d="M24.9004 12.5998C25.3504 12.5998 25.6504 12.4498 25.9504 12.1498L28.5004 9.5998C29.1004 8.9998 29.1004 8.0998 28.5004 7.4998C27.9004 6.8998 27.0004 6.8998 26.4004 7.4998L23.8504 10.0498C23.2504 10.6498 23.2504 11.5498 23.8504 12.1498C24.1504 12.4498 24.6004 12.5998 24.9004 12.5998Z" fill="#1578ff" />
        </svg>
                    <span>0 %</span>
                </div>
                <div class="area-right">
                    <svg width="18" height="18" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg" class="btn-pause">
          <path fill-rule="evenodd" clip-rule="evenodd" d=&q.........完整代码请登录后点击上方下载按钮下载查看

网友评论0