vue+gsap实现麦克风点击录音动画效果代码

代码语言:html

所属分类:动画

代码描述:vue+gsap实现麦克风点击录音动画效果代码

代码标签: 点击 录音 动画 效果

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


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

<head>

  <meta charset="UTF-8">
  

  
<style>
@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  height: 100vh;
  display: grid;
  place-items: center;
  font-family: "Poppins", sans-serif;
  overflow: hidden;
  background-image: radial-gradient(
    circle at center center,
    rgb(71, 71, 71),
    rgb(8, 8, 8)
  );

  --purple: #c203c2;
  --grey: #d1d1d1;
}

.container {
  display: grid;
  place-items: center;
  width: 300px;
  height: 200px;
  position: relative;
}

input[type="checkbox"] {
  position: fixed;
  top: 3000px;
}

svg {
  width: 80px;
  height: 80px;
  cursor: pointer;
}
svg path {
  stroke: var(--purple);
  stroke-width: 4;
  stroke-linecap: round;
  fill: none;
}
svg rect {
  fill: none;
  stroke: var(--purple);
  stroke-width: 4;
}

#bars {
  transform: translateY(30px);
}
#bars path {
  transform: translateX(calc(7px * var(--i)));
}

.container p {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.9rem;
  color: var(--grey);
  text-align: center;
  text-transform: uppercase;
}
</style>


</head>

<body >
  <div class="container" id="app">
  <input type="checkbox" id="on" v-model="checked">
  <label for="on">
    <svg viewBox="0 0 100 100">
      <g id="mic">
        <path id="base" d="M35 90 L65 90" />
        <path id="stem" d="M50 90 L50 70" />
        <path id="bow" d="M31 48 C30 75, 70 75, 68 48" />
        <rect id="mouth" x="37" y="7" width="25" height="55" rx="15" />
      </g>
      <g id="bars" v-show="showEq">
        <path d="M1 10 L1 35" v-for="bar in 13" id="bar" :style="`--i:${bar}`" />
      </g>
    </svg>
    <p>{{ status }}</p>
  </label>
</div>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue@2.6.1..........完整代码请登录后点击上方下载按钮下载查看

网友评论0