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

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.kler.cn/a/547060.html

相关文章:

  • SpringBoot中Mybatis记录执行sql日志
  • 基于 STM32 平台的音频特征提取与歌曲风格智能识别系统
  • TypeScript装饰器 ------- 学习笔记分享
  • DeepSeek 模型部署与使用技术评测(基于阿里云零门槛解决方案)
  • 部署onlyoffice后,php版的callback及小魔改(logo和关于)
  • Java项目引入DeepSeek搭建私有AI
  • React历代主要更新
  • 使用EVE-NG-锐捷实现NAT
  • 尚硅谷爬虫note003
  • 微软AutoGen介绍——Managing State保存并加载持续会话的Agents和Teams
  • ML.NET库学习006:成人人口普查数据分析与分类预测
  • 第十一篇:EMC的“电磁护盾”——三电系统干扰抑制实战
  • uniapp中对于文件和文件夹的处理,内存的查询
  • 132,【1】 buuctf web [EIS 2019]EzPOP
  • Scrapy:任务队列底层设计详解
  • Unity 接入Tripo API 文生模型,模型制作动画并下载使用
  • 提供可传递的易受攻击的依赖项
  • 最新国内 ChatGPT Plus/Pro 获取教程
  • 【STM32】舵机SG90
  • 使用Java爬虫获取京东JD.item_sku API接口数据