xxxxxxxxxx
41
function setup() {
let rectX = 0;
let rectY = 0;
createCanvas(400, 400);
background(220);
translate(width/2, height/2);
// rotate(PI/4);
line(0, height/2, 0, -height/2);
line(width/2, 0, -width/2, 0);
fill(0, 0, 0, 255);
text("+x", width/2-20, -8);
text("-x", -width/2+5, -8);
text("+y", 5, height/2-8);
text("-y", 5, -height/2+13);
stroke("red");
fill(0, 0, 0, 0);
rectMode(CENTER);
rect(rectX, rectY, 50, 50);
rotate(PI/4);
stroke("blue");
drawingContext.setLineDash([5, 15]);
line(0, height/2, 0, -height/2);
line(width/2, 0, -width/2, 0);
drawingContext.setLineDash([]);
fill(0, 0, 0, 255);
text("+x", width/2-20, -8);
text("-x", -width/2+5, -8);
text("+y", 5, height/2-8);
text("-y", 5, -height/2+13);
stroke("blue");
fill(0, 0, 0, 0);
rect(rectX, rectY, 50, 50);
}
function draw() {
}