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".........完整代码请登录后点击上方下载按钮下载查看

网友评论0