Browse Source

Get shape size changing based on sound

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

13
voicegardens/static/voicegardens.js

@ -209,8 +209,10 @@ class GeneratedShape {
// Number of edges of the shape
this.edges = amplitude + 3;
// ???
this.radius = random(120, 140);
// The distance between the xs and ys influencing the size of the shape.
// The randomXs, randomYs also influence the shape size as they are added
// when drawing the space between xs and ys.
this.radius = ceil(duration * 40);
// ???
this.angle = radians(360 / this.edges);
@ -232,8 +234,11 @@ class GeneratedShape {
this.ys[i] = 0;
this.xs[i] = 0;
this.angles[i] = 0;
this.randXs[i] = random(-77, 77);
this.randYs[i] = random(-77, 77);
// this directly influences the shape of the size alongside the
// this.radius shape value
this.randXs[i] = ceil(duration * random(-30, 30));
this.randYs[i] = ceil(duration * random(-30, 30));
}
for (let i = 0; i < this.edges; i++) {

Loading…
Cancel
Save