Browse Source

Polish colours and add archive button

main
Luke Murphy 4 years ago
parent
commit
07612e4a1b
No known key found for this signature in database GPG Key ID: 5E2EF5A63E3718CC
  1. 28
      voicegardens/static/voicegardens.js

28
voicegardens/static/voicegardens.js

@ -7,6 +7,7 @@
var archiveUrl = window.location + "add-to-archive"; var archiveUrl = window.location + "add-to-archive";
var canvas; var canvas;
var microphone; var microphone;
var frameRate = 60;
var mouseInitialDrag = false; var mouseInitialDrag = false;
var newSoundJustRecorded = false; var newSoundJustRecorded = false;
var playButton; var playButton;
@ -72,6 +73,10 @@ function archive() {
}); });
} }
function showArchive() {
window.location.href = "/archive";
}
function setupRecording() { function setupRecording() {
/** /**
* Setup logic for recording. * Setup logic for recording.
@ -99,6 +104,10 @@ function setupRecording() {
playButton = createButton("archive"); playButton = createButton("archive");
playButton.position(10, 110); playButton.position(10, 110);
playButton.mousePressed(archive); playButton.mousePressed(archive);
playButton = createButton("view archive");
playButton.position(10, 145);
playButton.mousePressed(showArchive);
} }
function getSoundInfo() { function getSoundInfo() {
@ -127,14 +136,14 @@ class GeneratedShape {
/** /**
* Initialise the new shape. * Initialise the new shape.
**/ **/
this.w = 20; this.w = 40;
this.h = 20; this.h = 40;
this.x = windowWidth / 2; this.x = random(windowWidth);
this.y = windowHeight / 2; this.y = random(windowHeight);
this.xSpeed = 1.8; this.xSpeed = 1.4;
this.ySpeed = 1.8; this.ySpeed = 1.6;
this.xDirection = 1; this.xDirection = 1;
this.yDirection = 1; this.yDirection = 1;
@ -214,19 +223,18 @@ function setup() {
* The p5.js initial setup function. * The p5.js initial setup function.
**/ **/
createCanvas(windowWidth, windowHeight); createCanvas(windowWidth, windowHeight);
screenX = toScreenX = 0; screenX = toScreenX = 0;
screenY = toScreenY = 0; screenY = toScreenY = 0;
setupRecording(); setupRecording();
fill("red"); frameRate(frameRate);
fill("#F38630");
} }
function draw() { function draw() {
/** /**
* The p5.js draw loop. * The p5.js draw loop.
**/ **/
background("pink"); background("#69D2E7");
screenX = lerp(screenX, toScreenX, 0.1); screenX = lerp(screenX, toScreenX, 0.1);
screenY = lerp(screenY, toScreenY, 0.1); screenY = lerp(screenY, toScreenY, 0.1);

Loading…
Cancel
Save