From e41be01623194d287cc02ae38fc57b24edb7de61 Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-3VIS1T9\\junguler" Date: Tue, 25 Oct 2022 00:05:00 +0330 Subject: [PATCH] animate the visualizer's colors --- stuff/style.css | 11 +++++++++++ stuff/visualizer.js | 7 ++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/stuff/style.css b/stuff/style.css index cda7adef5..e6c722757 100755 --- a/stuff/style.css +++ b/stuff/style.css @@ -37,3 +37,14 @@ text-align: center; border-radius: 0px; border: none; } + +@keyframes animate { +0% { +filter: hue-rotate(0deg);} +100% { +filter: hue-rotate(360deg);} +} + +canvas { +animation: animate linear 30s infinite ; +} diff --git a/stuff/visualizer.js b/stuff/visualizer.js index c8b07664f..224c91263 100755 --- a/stuff/visualizer.js +++ b/stuff/visualizer.js @@ -41,9 +41,10 @@ var start = function() { capYPositionArray = []; ////store the vertical position of hte caps for the preivous frame ctx = canvas.getContext('2d'), gradient = ctx.createLinearGradient(0, 0, 600, 0); - gradient.addColorStop(1, '#0ff'); - gradient.addColorStop(0.5, '#f0f'); - gradient.addColorStop(0, '#ff0'); + gradient.addColorStop(1, '#ff0'); + gradient.addColorStop(0.66, '#0ff'); + gradient.addColorStop(0.33, '#ff0'); + gradient.addColorStop(0, '#0ff'); // loop function renderFrame() { var array = new Uint8Array(analyser.frequencyBinCount);