xxxxxxxxxx
24
function setup() {
createCanvas(600, 600);
// createCanvas(windowWidth, windowHeight); for dyanmic canvas dimensions
rectMode(CENTER); //fixes the left corner issue
}
function draw() {
background(52, 204, 235); //0-255 greyscale, you can do name of color, or hex
let cx = width/2; //gets you perfectly centered
let cy= height/2;
fill(210);
strokeWeight(20);
stroke("blue");
ellipse(cx, cy, 300, 300); //(x, y, w, h) circles draw from middle point
noStroke();
fill("purple");
rect(cx, cy, 200, 200); //rectangles draw from left hand corner (x, y, w, h)
strokeWeight(10);
stroke(0);
line(mouseX, mouseY, cx, cy); //let's you move your mouse around x,y
print(mouseX, mouseY); //let's you know where mouse is, *love this function*
}