From 47d83a59196e52dc5a99903877489ba6ea6418b6 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Wed, 12 Feb 2020 23:09:56 +0100 Subject: [PATCH] Fix background colour loading --- voicegardens/static/voicegardens.js | 31 ++++++++++++++++------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/voicegardens/static/voicegardens.js b/voicegardens/static/voicegardens.js index c1a1d5a..7303934 100644 --- a/voicegardens/static/voicegardens.js +++ b/voicegardens/static/voicegardens.js @@ -56,19 +56,8 @@ var amplitude; var duration; // The background colour choices for the environment -var bgChoices [ - color("#F6B2FF"), - color("#F58F6C"), - color("#C3EFDB"), - color("#CFE4D9"), - color("#ADCA95"), - color("#F58F6C"), - color("#A5F1F7"), - color("#FFC266"), - color("#FF66BB"), - color("#F6B2FF"), -]; -var bgColour = bgChoices[floor(random(0, bgChoices.length - 1))]; +var bgChoices; +var bgColour; function record() { /** @@ -532,13 +521,27 @@ function setup() { createCanvas(windowWidth, windowHeight); frameRate(frameRate); setupRecording(); + + bgChoices = [ + color("#F6B2FF"), + color("#F58F6C"), + color("#C3EFDB"), + color("#CFE4D9"), + color("#ADCA95"), + color("#F58F6C"), + color("#A5F1F7"), + color("#FFC266"), + color("#FF66BB"), + color("#F6B2FF") + ]; + bgColour = bgChoices[floor(random(0, bgChoices.length - 1))]; } function draw() { /** * The draw loop which is called x times a second where x is the frameRate. **/ - background(backgroundColour); + background(bgColour); blendMode(BLEND); smooth(); noStroke();