import React from "react"; const BAR_COUNT = 15; const BAR_ANIMATION_DELAYS = [ "0.3s", "0.7s", "0.1s", "0.9s", "0.4s", "0.2s", "0.8s", "0.5s", "0s", "0.6s", "0.3s", "0.9s", "0.1s", "0.7s", "0.4s", ]; export default function AudioVisualizer({ isSilent = false }) { // Define the base animation style const activeAnimation = "wave 2.5s ease-in-out infinite"; // Define the style for the silent state (dots) const silentStyle = { animation: "none", height: "5px", }; return (
{Array(BAR_COUNT).fill(0).map((_, index) => { // Determine the specific style for each bar const barStyle = isSilent ? silentStyle // If silent, use the fixed dot style : { // If not silent, use the full animation with its unique delay animation: activeAnimation, animationDelay: BAR_ANIMATION_DELAYS[index], }; return (
); })}
); }