svg+js实现勾选动画效果代码

代码语言:html

所属分类:表单美化

代码描述:svg+js实现勾选动画效果代码

代码标签: svg js 勾选 动画

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

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

<head>
    <meta charset="UTF-8">

    <style>
        body {
      margin: 0;
    }
    
    .container,
    .panel,
    .card {
      display: flex;
      justify-content: center;
      align-items: center;
    }
    
    .card,
    .panel {
      width: 200px;
    }
    
    .container {
      height: 100vh;
      width: 100vw;
      flex-direction: column;
      background: linear-gradient(to right, #e52d27, #b31217);
    }
    
    .panel {
      border: 3px solid #f0ead6;
      border-radius: 10px;
      height: 300px;
      flex-direction: column;
    }
    
    .card {
      height: 50px;
      position: relative;
      color: #f0ead6;
    }
    
    svg {
      transition: all 1s;
      position: absolute;
      top: 15px;
      right: 15px;
    }
    
    line {
      stroke: #f0ead6;
      stroke-width: 4;
      transition: all 1s;
    }
    
    label,
    .svgHolder {
      width: 40%;
    }
    
    label {
      padding: 20px;
    }
    
    .svgHolder {
      height: 50px;
      position: relative;
    }
    </style>
</head>

<body>

    <div class="container">
        <div class="panel">
            <div class="card">
                <div class="svgHolder">
                    <svg height="20" width="20">
          <line class="top" x1="0" y1="0" x2="20" y2="0" />
          <line class="right" x1="20" y1="0" x2="20" y2="20" />
          <line class="bottom" x1="20" y1="20" x2="0" y2="20" />
          <line class="left" x1="0" y1="20" x2="0" y2="0" />
        </svg>
                </div>
                <label>Eat</label>
            </div>

            <div class="card">
                <div class="svgHolder">
                    <svg height="20" width="20">
          <line class="top" x1="0" y1="0" x2="20" y2="0" />
          <line class="right" x1="20" y1="0" x2="20" y2="20" />
          <line class="bottom" x1="20" y1="20" x2="0" y2="20" />
          <line class="left" x1="0" y1="20" x2="0" y2="0" />
        </svg>
                </div>
                <label>Sleep</label>
            </div>

            <div class="card">
                <div class="svgHolder">
                    <svg height="20" wi.........完整代码请登录后点击上方下载按钮下载查看

网友评论0