createSketch(p5 => {
const c = p5.color("#DC3F74");
let resizes = 0, playbacks = 0;
p5.setup = () => {
p5.createCanvas(...canvasSize());
p5.textFont("sans-serif");
p5.textStyle(p5.BOLD);
p5.fill(c);
p5.textSize(30);
};
p5.draw = () => {
p5.background(viewof background[1].valueAsNumber);
const str = `p5.js
${isFullscreen() ? "" : "not "}fullscreen
${resizes} resizes
${isFullscreen() ? `click to play (${playbacks})` : ""}`;
p5.translate(p5.millis() / 10 % p5.width, p5.height / 2 - 50);
p5.text(str, 0, 0);
p5.translate(-p5.width, 0);
p5.text(str, 0, 0);
};
const inBounds = (x, y) => x >= 0 && x < p5.width && y >= 0 && y < p5.height;
p5.mouseClicked = () => {
if (inBounds(p5.mouseX, p5.mouseY)) {
if (isFullscreen()){
playbacks++
doorbell.play();
} else {
fullscreen.click();
}
}
};
p5.windowResized = () => {
resizes++;
p5.resizeCanvas(...canvasSize());
};
})