声音波浪 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;
  }
}
相关推荐
JYeontu9 小时前
轮播图不够惊艳?试下这个立体卡片轮播图
前端·javascript·css
三乐22810 小时前
简单定位布局
html
Zzzzmo_10 小时前
【HTML+CSS+JavaScript】01 HTML标签
html
软件技术NINI15 小时前
泉州html+css 4页
前端·javascript·css·html
Python大数据分析@18 小时前
HTML会代替Markdown吗?为什么?
前端·html
一棵树735118 小时前
js总结介绍
前端·javascript·html
ZC跨境爬虫18 小时前
跟着 MDN 学CSS day_2:(连接样式表与选择器的实战艺术)
java·前端·css·ui·html·媒体
ZC跨境爬虫19 小时前
跟着 MDN 学CSS day_1:(CSS 基石与色彩的艺术)
前端·javascript·css·ui·html
艾伦野鸽ggg19 小时前
CSS 滤镜与动态特性知识梳理
前端·css
ZC跨境爬虫19 小时前
模块化烹饪小程序开发日记 Day4:网络层基础设施与接口治理实践
前端·javascript·数据库·ui·html