(index)
| 952 | const spheres = []; |
| 953 | |
| 954 | function createSphereVisualization(index) { |
| 955 | |
| 956 | // Spheres default frequencies |
| 957 | const defaultFrequencies = [ |
| 958 | { minFrequency: 20, maxFrequency: 80 }, // Sub-bass |
| 959 | { minFrequency: 120, maxFrequency: 250 }, // Bass |
| 960 | { minFrequency: 250, maxFrequency: 800 }, // Mid |
| 961 | { minFrequency: 1000, maxFrequency: 4000 }, // High mid |
| 962 | { minFrequency: 5000, maxFrequency: 10000 } // High |
| 963 | ]; |
| 964 | |
| 965 | const sphereParams = { |
| 966 | enabled: index === 0, |
| 967 | sphereRadius: 1.0, |
| 968 | innerSphereRadius: 0.25, |
| 969 | rotationSpeed: 0.001, |
| 970 | rotationSpeedMin: 0, |
| 971 | rotationSpeedMax: 0.065, |
| 972 | rotationSmoothness: 0.3, |
| 973 | particleCount: 20000, |
| 974 | particleSize: 0.003, |
| 975 | particleLifetime: 3.0, |
| 976 | minFrequency: defaultFrequencies[index]?.minFrequency || 0, |
| 977 | maxFrequency: defaultFrequencies[index]?.maxFrequency || 22050, |
| 978 | minFrequencyBeat: defaultFrequencies[index]?.minFrequency || 0, |
| 979 | maxFrequencyBeat: defaultFrequencies[index]?.maxFrequency || 22050, |
| 980 | noiseScale: 4.0, |
| 981 | dynamicNoiseScale: true, |
| 982 | minNoiseScale: 0.5, |
| 983 | maxNoiseScale: 5.0, |
| 984 | noiseStep: 0.2, |
| 985 | noiseSpeed: 0.1, |
| 986 | turbulenceStrength: 0.005, |
| 987 | colorStart: '#ff3366', |
| 988 | colorEnd: '#3366ff', |
| 989 | volumeChangeThreshold: 0.1, |
| 990 | peakSensitivity: 1.1, |
| 991 | beatThreshold: 200, |
| 992 | baseWaveStrength: 20.0, |
| 993 | beatStrength: 0.01, |
| 994 | gainMultiplier: 1 |
| 995 | }; |
| 996 | |
| 997 | const sphereGeometry = new THREE.BufferGeometry(); |
| 998 | const spherePositions = new Float32Array(sphereParams.particleCount * 3); |
| 999 | const sphereColors = new Float32Array(sphereParams.particleCount * 3); |
| 1000 | const velocities = new Float32Array(sphereParams.particleCount * 3); |
| 1001 | const basePositions = new Float32Array(sphereParams.particleCount * 3); |
| 1002 | const lifetimes = new Float32Array(sphereParams.particleCount); |
| 1003 | const maxLifetimes = new Float32Array(sphereParams.particleCount); |
| 1004 | const beatEffects = new Float32Array(sphereParams.particleCount); |
| 1005 | |
| 1006 | // Init particles |
| 1007 | for (let i = 0; i < sphereParams.particleCount; i++) { |
| 1008 | const i3 = i * 3; |
| 1009 | const radius = THREE.MathUtils.lerp(0, sphereParams.sphereRadius, sphereParams.innerSphereRadius); |
| 1010 | const theta = Math.random() * Math.PI * 2; |
| 1011 | const phi = Math.acos(2 * Math.random() - 1); |
no test coverage detected