No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with
10 additions and
6 deletions
-
voicegardens/static/voicegardens.js
|
@ -55,7 +55,7 @@ var amplitude; |
|
|
var duration; |
|
|
var duration; |
|
|
|
|
|
|
|
|
// random shape positioning
|
|
|
// random shape positioning
|
|
|
var secondTick = false; |
|
|
var positionTick = false; |
|
|
var timer = 0; |
|
|
var timer = 0; |
|
|
|
|
|
|
|
|
function record() { |
|
|
function record() { |
|
@ -390,8 +390,12 @@ function draw() { |
|
|
smooth(); |
|
|
smooth(); |
|
|
noStroke(); |
|
|
noStroke(); |
|
|
|
|
|
|
|
|
if (millis() >= 1000 + timer) { |
|
|
// count random waiting times in seconds until choosing a new destX, destY
|
|
|
secondTick = true; |
|
|
// for a moving shape
|
|
|
|
|
|
let nextPositionTick = random(3000, 8000); |
|
|
|
|
|
let tickingTime = millis(); |
|
|
|
|
|
if (tickingTime >= nextPositionTick + timer) { |
|
|
|
|
|
positionTick = true; |
|
|
timer = millis(); |
|
|
timer = millis(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -414,11 +418,11 @@ function draw() { |
|
|
shape.draw(); |
|
|
shape.draw(); |
|
|
shape.move(); |
|
|
shape.move(); |
|
|
|
|
|
|
|
|
if (secondTick) { |
|
|
if (positionTick) { |
|
|
setTimeout(function() { |
|
|
setTimeout(function() { |
|
|
shape.destX = random(windowWidth); |
|
|
shape.destX = random(windowWidth); |
|
|
shape.destY = random(windowHeight); |
|
|
shape.destY = random(windowHeight); |
|
|
}, random(100, 3000)); |
|
|
}, random(1000, 5000)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (shape.collide(shapes) === true) { |
|
|
if (shape.collide(shapes) === true) { |
|
@ -426,7 +430,7 @@ function draw() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
secondTick = false; |
|
|
positionTick = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function mouseDragged() { |
|
|
function mouseDragged() { |
|
|