From dfb398a8f87ceefb1852050dbefd5eda4d1f57fa Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Wed, 18 Dec 2019 22:45:12 +0700 Subject: [PATCH] Abstract canvas width/height into variables --- vocoder/static/vocoder.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vocoder/static/vocoder.js b/vocoder/static/vocoder.js index 9d0a918..b97c1c2 100644 --- a/vocoder/static/vocoder.js +++ b/vocoder/static/vocoder.js @@ -8,6 +8,8 @@ // var archiveUrl = serverUrl + "/add-to-archive/"; +var canvasHeight = 500; +var canvasWidth = 500; var microphone; var newSoundJustRecorded = false; var playButton; @@ -120,7 +122,7 @@ class GeneratedShape { /** * Show the shape on the canvas. **/ - ellipse(random(600), random(600), 10, 10); // TODO: experimenting for now ... + ellipse(random(canvasWidth), random(canvasHeight), 10, 10); // TODO: experimenting for now ... this.displayed = true; } } @@ -136,7 +138,7 @@ function setup() { /** * The p5.js initial setup function. **/ - createCanvas(600, 600); // TODO: experimenting for now ... + createCanvas(canvasWidth, canvasHeight); // TODO: experimenting for now ... setupRecording(); }