Skip to content

Voice Orb ​

Vue 已实现 · 还原验收 0/1 · 上游演示 · 固定版本源码

预览 ​

用法 ​

vue
<script setup lang="ts">
import { VoiceOrb } from 'beui-vue'
import { useAnimationFrame, useMotionValue, useReducedMotion } from 'motion-v'
const activity = useMotionValue(0)
const reduce = useReducedMotion()
useAnimationFrame(time => {
  const seconds = time / 1000
  const syllable = Math.max(0, Math.sin(seconds * 9.3 + Math.sin(seconds * 2.1)))
  activity.set(reduce.value ? 0 : Math.max(0, Math.sin(seconds * .85)) * (.12 + syllable ** 2 * .72))
})
</script>
<template><VoiceOrb :activity="activity" aria-label="Voice visualization" /></template>

API ​

传入 0 到 1 的 activity、MotionValue 或 analyser 驱动上游 WebGL 材质。colors、active、speed 控制外观与动画,@error 报告渲染故障。

还原验收 ​

基于 beUI 的独立 Vue 移植,依 MIT 许可证分发。