xxxxxxxxxx
17
// To demonstrate, put two windows side by side.
// Click on the window that the p5 sketch isn't in!
function draw() {
background(200);
noStroke();
fill(0, 200, 0);
ellipse(25, 25, 50, 50);
if (!focused) {
// or "if (focused === false)"
stroke(200, 0, 0);
line(0, 0, 100, 100);
line(100, 0, 0, 100);
}
}
// https://discourse.processing.org/t/focused-in-ios-safari/12007/3
// https://p5js.org/reference/#/p5/focused