update:优化测试页面音波样式

This commit is contained in:
hrz
2025-11-16 14:39:53 +08:00
parent 3fe1acd153
commit e37618423d
2 changed files with 9 additions and 2 deletions
+6 -1
View File
@@ -126,7 +126,12 @@ export class UIController {
for (let i = 0; i < dataArray.length; i++) {
barHeight = dataArray[i] / 2;
this.visualizerContext.fillStyle = `rgb(${barHeight + 100}, 50, 50)`;
// 创建渐变色:从紫色到蓝色到青色
const hue = 200 + (barHeight / this.visualizerCanvas.height) * 60; // 200-260度,从青色到紫色
const saturation = 80 + (barHeight / this.visualizerCanvas.height) * 20; // 饱和度 80-100%
const lightness = 45 + (barHeight / this.visualizerCanvas.height) * 15; // 亮度 45-60%
this.visualizerContext.fillStyle = `hsl(${hue}, ${saturation}%, ${lightness}%)`;
this.visualizerContext.fillRect(x, this.visualizerCanvas.height - barHeight, barWidth, barHeight);
x += barWidth + 1;