xxxxxxxxxx
30
let fps = 60;
let g = 0.01;
// Clicking in the box toggles fullscreen on and off.
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
background(0);
fill(255);
noStroke();
textSize(50);
text(fps.toFixed(3),100,120);
text(frameCount,100,180);
fps = (1-g)*fps + g * frameRate();
}
function mousePressed() {
if (mouseX > 0 && mouseX < windowWidth && mouseY > 0 && mouseY < windowHeight) {
let fs = fullscreen();
fullscreen(!fs);
}
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}