Shapes appear in the window view all the time now

This commit is contained in:
Luke Murphy 2020-02-12 21:56:12 +01:00
parent a42c04da65
commit 0dd497342b
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -216,12 +216,6 @@ class GeneratedShape {
this.accelX = 0.0;
this.accelY = 0.0;
// The x, y destination values which the shape moves towards. This can be
// calculated against the `mouseX` and `mouseY` values, for example. Then
// the shape will follow the mouse.
this.deltaX = 0.0;
this.deltaY = 0.0;
// The speed at which the shape 'springs' towards its final destination.
this.springing = 0.0009;
@ -275,13 +269,19 @@ class GeneratedShape {
this.angle = radians(360 / this.edges);
// ???
this.centerX = random(windowWidth);
this.centerY = random(windowHeight);
this.centerX = random(windowWidth) - toScreenX;
this.centerY = random(windowHeight) - toScreenY;
// new destination for the shapes
this.destX = random(windowWidth);
this.destY = random(windowHeight);
// The x, y destination values which the shape moves towards. This can be
// calculated against the `mouseX` and `mouseY` values, for example. Then
// the shape will follow the mouse.
this.deltaX = this.destX - this.centerX - toScreenX;
this.deltaY = this.destY - this.centerY - toScreenY;
this.initialise();
}