|
|
@ -139,23 +139,31 @@ class GeneratedShape { |
|
|
|
|
|
|
|
this.accelX = 0.0; |
|
|
|
this.accelY = 0.0; |
|
|
|
|
|
|
|
this.deltaX = 0.0; |
|
|
|
this.deltaY = 0.0; |
|
|
|
|
|
|
|
this.springing = 0.0009; |
|
|
|
this.damping = 0.98; |
|
|
|
this.organicConstant = 1.0; |
|
|
|
this.organicConstant = random(-5, 5); |
|
|
|
|
|
|
|
this.startXs = []; |
|
|
|
this.startYs = []; |
|
|
|
|
|
|
|
this.xs = []; |
|
|
|
this.ys = []; |
|
|
|
|
|
|
|
this.angle = []; |
|
|
|
this.frequency = []; |
|
|
|
|
|
|
|
this.edges = 5; |
|
|
|
|
|
|
|
this.radius = random(10, 180); |
|
|
|
this.rotAngle = random(10, 140); |
|
|
|
|
|
|
|
this.randomX = random(-77, 77); |
|
|
|
this.randomY = random(-77, 77); |
|
|
|
|
|
|
|
this.initialise(); |
|
|
|
} |
|
|
|
|
|
|
@ -228,8 +236,10 @@ class GeneratedShape { |
|
|
|
fill(this.colour); |
|
|
|
|
|
|
|
for (let i = 0; i < this.edges; i++) { |
|
|
|
this.startXs[i] = centerX + cos(radians(this.rotAngle)) * this.radius; |
|
|
|
this.startYs[i] = centerY + sin(radians(this.rotAngle)) * this.radius; |
|
|
|
this.startXs[i] = |
|
|
|
centerX + cos(radians(this.rotAngle) * i) * this.radius + this.randomX; |
|
|
|
this.startYs[i] = |
|
|
|
centerY + sin(radians(this.rotAngle) * i) * this.radius + this.randomY; |
|
|
|
this.rotAngle += 360 / this.edges; |
|
|
|
} |
|
|
|
|
|
|
@ -245,12 +255,12 @@ class GeneratedShape { |
|
|
|
/** |
|
|
|
* Move the shape vectors. |
|
|
|
**/ |
|
|
|
|
|
|
|
this.deltaX = mouseX - centerX; |
|
|
|
this.deltaY = mouseY - centerY; |
|
|
|
|
|
|
|
this.deltaX *= this.springing; |
|
|
|
this.deltaY *= this.springing; |
|
|
|
|
|
|
|
this.accelX += this.deltaX; |
|
|
|
this.accelY += this.deltaY; |
|
|
|
|
|
|
|