2023-09-25 18:56:08 +02:00

25 lines
625 B
Plaintext

void setup()
{
size(800, 600);
}
void draw()
{
// Clear Background to prevent shadows
background(40, 40, 40, 256);
//First circle
fill(0, 50, 256);
circle(mouseX, mouseY, 100);
// Second circle
// project mouse pos between 0 and 1. Take inverse to get the point symmetric postion
PVector fitMouse = new PVector((float) mouseX / (float) width, (float) mouseY / (float) height);
PVector twinPos = new PVector((1.0f - fitMouse.x) * width, (1.0f - fitMouse.y) * height);
fill(256, 50, 0);
circle(twinPos.x, twinPos.y, 100);
//println(fitMouseX + ", " + inverseMouseX );
}