声音波浪 js+css

html 复制代码
<span class="voice-wave">
  <span class="voice-line"></span>
  <span class="voice-line"></span>
  <span class="voice-line"></span>
  <span class="voice-line"></span>
  <span class="voice-line"></span>
</span>
css 复制代码
// 语音输入波浪动画
.voice-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;

  .voice-line {
    display: inline-block;
    width: 2px;
    height: 12px;
    background-color: #3366FF;
    margin: 0 1px;
    border-radius: 2px;
    animation: voice-pulse 1.2s infinite ease-in-out;
  }

  // 为每个线条设置不同的动画延迟,形成波浪效果
  .voice-line:nth-child(1) {
    animation-delay: 0s;
  }

  .voice-line:nth-child(2) {
    animation-delay: 0.2s;
  }

  .voice-line:nth-child(3) {
    animation-delay: 0.4s;
  }

  .voice-line:nth-child(4) {
    animation-delay: 0.6s;
  }

  .voice-line:nth-child(5) {
    animation-delay: 0.8s;
  }
}

// 语音波浪动画定义
@keyframes voice-pulse {

  0%,
  100% {
    height: 4px;
    opacity: 0.3;
  }

  50% {
    height: 16px;
    opacity: 1;
  }
}
相关推荐
三年三月5 小时前
React 中 CSS Modules 详解
前端·css
期待のcode5 小时前
Thymeleaf模板引擎
java·html·springboot
van久7 小时前
.Net Core 学习:Razor Pages中 HTML 表头字段的两种写法对比
学习·html·.netcore
苏打水com7 小时前
第十二篇:Day34-36 前端工程化进阶——从“单人开发”到“团队协作”(对标职场“大型项目协作”需求)
前端·javascript·css·vue.js·html
软件技术NINI7 小时前
盒模型在实际项目中有哪些应用场景?
前端·css·html
小此方9 小时前
VS2022二次元背景板痛改教程!
html
苏打水com11 小时前
第十篇:Day28-30 工程化优化与部署——从“能跑”到“好用”(对标职场“项目上线”需求)
前端·css·vue·html·js
用户66006766853911 小时前
纯 CSS 复刻星战开场:让文字在宇宙中滚动
前端·css
李少兄11 小时前
前端开发中的多列布局(Multi-column Layout)
前端·css