声音波浪 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;
  }
}
相关推荐
xixixin_7 小时前
【CSS】字体大小不一致?px与vw渲染差异的底层原理与解决方案
前端·css
小J听不清7 小时前
CSS 内边距(padding)全解析:取值规则 + 表格实战
前端·javascript·css·html·css3
桐溪漂流7 小时前
Uni-app H5 环境下 ResizeObserver 监听 mp-html 动态高度
前端·uni-app·html
读忆8 小时前
你是否用过Tailwind CSS?你是在什么情况下使用的呢?
前端·css·经验分享·笔记·taiiwindcss
孙12~8 小时前
前端vue3+vite,后端SpringBoot+MySQL
前端·html·学习方法
我命由我123459 小时前
Element Plus 问题:选择框表单校验没有触发
开发语言·前端·javascript·html·ecmascript·html5·js
小同志009 小时前
HTML 基础
前端·javascript·html
小J听不清1 天前
CSS 字体样式全解析:字体类型 / 大小 / 粗细 / 样式
前端·javascript·css·html·css3
小J听不清1 天前
CSS 三种引入方式全解析:行内 / 内部 / 外部样式表(附优先级规则)
前端·javascript·css·html·css3
小璐资源网1 天前
如何写出干净、易维护的 HTML 结构
前端·html