当前位置: 首页 > news >正文

uniapp语音时的动态音波的实现

一、实现效果

该文做出来的效果:图片中的音波是动态的

二、实现代码

将它写为一个组件,方便之后用。命名为“audioWave.vue”

<template>
	<view class="audio-wave">
		<view class="wave-bar" v-for="i in 10" :key="i"></view>
	</view>
</template>
<script setup lang="ts">

</script>
<style lang="scss">
	.audio-wave {
		position: absolute;
		left: 0;
		top: 50%;
		transform: translateY(-50%);
		width: 100%;
		height: 40rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 6rpx;
	}

	.wave-bar {
		width: 4rpx;
		height: 20rpx;
		background-color: #FFFFFF;
		border-radius: 2rpx;
		animation: waveAnimation 1s ease-in-out infinite;
		opacity: 0.8;
	}

	.wave-bar:nth-child(1) {
		animation-delay: 0s;
	}

	.wave-bar:nth-child(2) {
		animation-delay: 0.1s;
	}

	.wave-bar:nth-child(3) {
		animation-delay: 0.2s;
	}

	.wave-bar:nth-child(4) {
		animation-delay: 0.3s;
	}

	.wave-bar:nth-child(5) {
		animation-delay: 0.4s;
	}

	.wave-bar:nth-child(6) {
		animation-delay: 0.5s;
	}

	.wave-bar:nth-child(7) {
		animation-delay: 0.6s;
	}

	.wave-bar:nth-child(8) {
		animation-delay: 0.7s;
	}

	.wave-bar:nth-child(9) {
		animation-delay: 0.8s;
	}

	.wave-bar:nth-child(10) {
		animation-delay: 0.9s;
	}

	@keyframes waveAnimation {

		0%,
		100% {
			height: 20rpx;
		}

		50% {
			height: 40rpx;
		}
	}
</style>

http://www.dtcms.com/a/18335.html

相关文章:

  • 木材表面缺陷检测数据集,支持YOLO+COCO JSON+PASICAL VOC XML+DARKNET格式标注信息,平均正确识别率95.0%
  • Linux 服务器部署deepseek
  • 多媒体术语扫盲备忘录
  • SAP-ABAP:SAP的Screen Layout Designer屏幕布局设计器详解及示例
  • c#中“事件-event”的经典示例与理解
  • nsc account 及user管理
  • .NET 9.0 的 Blazor Web App 项目,进度条 <progress> 组件使用注意事项
  • DeepSeek全生态接入指南:官方通道+三大云平台
  • 论文笔记:Multi-Head Mixture-of-Experts
  • Flutter 双屏双引擎通信插件加入 GitCode:解锁双屏开发新潜能
  • 麒麟操作系统-rabbitmq二进制安装
  • React 高级教程
  • 【ArcGIS Pro二次开发】(87):样式_Style的用法
  • 【Spring AI】基于SpringAI+Vue3+ElementPlus的QA系统实现(前端)
  • flutter ListView Item复用源码解析
  • MySQL Workbench工具 导出导入数据库
  • spring学习(spring-DI(setter注入、构造器注入、自动装配方式))
  • 在 CentOS 系统中配置交换空间(Swap)解决内存不足
  • Android和DLT日志系统
  • 13.推荐系统的性能优化
  • Go语言协程Goroutine高级用法(一)
  • 分布式版本控制系统---git
  • 【openresty服务器】:源码编译openresty支持ssl,增加service系统服务,开机启动,自己本地签名证书,配置https访问
  • 基于巨控GRM552YW-CHE:西门子S7-1200 PLC远程程序上下载与实时调试方案
  • spring cloud 使用 webSocket
  • 怎麼使用靜態住宅IP進行多社媒帳號管理
  • A4988一款带转换器和过流保护的 DMOS 微步驱动器的使用方式
  • 探索高通骁龙游戏超分辨率技术:移动游戏的未来
  • 20240911 光迅科技 笔试
  • ProxySQL构建PolarDB-X标准版高可用路由服务三节点集群