xxxxxxxxxx
31
let pg;
function setup() {
// createCanvas(windowWidth, windowHeight);
createCanvas(200, 200);
pg = createGraphics(200, 200);
pg.fill(0,200,200);
pg.stroke(0,200,0);
pg.ellipse(50, 50, 20, 20);
}
function draw() {
background(200, 0, 0);
draw_obj();
image(pg,0,0,width,height);
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight); // disable that for test
print(" windowinfo width: " + width + " height: " + height + " windowWidth " + windowWidth + " windowHeight " + windowHeight);
}
function draw_obj() {
push();
translate(width / 2, height / 2);
fill(0, 0, 200);
ellipse(0, 0, 80, 50);
fill(200, 200, 0);
ellipse(50, 50, width / 5, height / 10); // test where object size depends on windows
pop();
}