From 4336c718fc416c0f8d5d5338045a7aed3782ef07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Sat, 13 Aug 2022 23:56:03 +0100 Subject: [PATCH] Haphazardly fix the animation not being very visible on some screens Would be *much* better to come up with a proper projection matrix, but I need some actual time to think about the maths. --- src/music/features/visualizer/Renderer.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/music/features/visualizer/Renderer.ts b/src/music/features/visualizer/Renderer.ts index c5f55da..3bb5191 100644 --- a/src/music/features/visualizer/Renderer.ts +++ b/src/music/features/visualizer/Renderer.ts @@ -230,7 +230,11 @@ class Renderer { this.rotation += (this.dTime / 1000.0) * ROTATION_SPEED; const modelViewMatrix = mat4.create(); - mat4.translate(modelViewMatrix, modelViewMatrix, [0.0, 0.025, -1.2]); + mat4.translate(modelViewMatrix, modelViewMatrix, [ + 0.0, + 0.025, + -((this.analyser.frequencyBinCount / gl.canvas.clientWidth) * 3), + ]); mat4.rotateX(modelViewMatrix, modelViewMatrix, Math.PI / 16); mat4.rotateY(modelViewMatrix, modelViewMatrix, this.rotation); mat4.translate(modelViewMatrix, modelViewMatrix, [-1.0, 0.0, 0.0]);