声音波浪 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;
  }
}
相关推荐
IMPYLH4 小时前
HTML 的 <embed> 元素
前端·数据库·html
必须会一定会4 小时前
用纯 HTML/JS 做一个 AI 需求澄清器:把模糊想法转换成可执行任务书
开发语言·前端·javascript·人工智能·html·ai编程
2401_881828321 天前
简易文本处理网页工具|AI 通识课第三次作业
前端·javascript·html
芳心粽伙饭1 天前
HTML第六章 链接标签
前端·html
用户0332126663671 天前
使用 Python 将 HTML 内容添加到 PowerPoint 演示文稿中
python·html
Mh1 天前
如何使用GSAP实现一个 `pinned` 滚动楼层叙事?
前端·javascript·css
eric-sjq2 天前
10 分钟实战:用 0.6B 本地模型生成中文网页(WanlyFrontend + 编译器全流程)
javascript·机器学习·自然语言处理·html
郭wes代码2 天前
纯 CSS+JS 实战:手搓一张支持自定义的通用金色电子奖状(万字详细拆解)
前端·javascript·css
竹枝溪2 天前
从零吃透CSS(一):CSS基础语法与样式美化
前端·css·选择器·前端三剑客
用户059540174463 天前
把AI对话记忆测试从手动比对到Pytest+Redis自动化,验证效率提升了10倍,还顺带揪出3个隐蔽bug
前端·css