xxxxxxxxxx
28
function setup() {
createCanvas(400, 400);
}
function draw() {
background(20);
center = createVector(width / 2, height / 2);
mouse = createVector(mouseX, mouseY);
strokeWeight(4)
stroke(200)
// line(0, 0, mouse.x, mouse.y)
// line(0, 0, center.x, center.y)
stroke(220);
mouse.sub(center);
mouse.normalize()
mouse.mult(80);
let m = mouse.mag();
rect(0, 0, m, 20)
translate(width / 2, height / 2);
line(0, 0, mouse.x, mouse.y);
stroke(150,0,0)
line(0, 0, 0, height);
line(0, 0, width, 0);
}