xxxxxxxxxx
41
let inTouch = false;
function setup() {
createCanvas(windowWidth, windowHeight);
textSize(60);
textAlign(CENTER);
fill(225);
pixelDensity(displayDensity());
}
function draw() {
background(225, 0, 0);
if (touches.length > 0) {
for (let i = 0; i < touches.length; i++) {
ellipse(touches[i].x, touches[i].y, 350, 350);
}
text("IN TOUCH", width / 2, height / 2);
text("TOUCHES: " + touches.length, width / 2, height / 2 + 60);
} else {
if (inTouch) ellipse(mouseX, mouseY, 350, 350);
}
// if (inTouch) text ("IN TOUCH", width/2, height/2);
// if(touches.length > 0) {
// text("TOUCHES: "+touches.length,width/2,height/2+60);
// }
}
function touchStarted() {
inTouch = true;
return false;
}
function touchEnded() {
inTouch = false;
return false;
}