Beispiel aus dem Kapitel Processing in JavaScript.
Sie müssen dieses Beispiel mit einem Touch-fähigen Gerät ausprobieren, z.B. einem Smartphone, Tablet oder Touch-Notebook.
function setup() {
createCanvas(600, 400);
}
function draw() {
background(0);
fill(255);
noStroke();
textSize(14);
textAlign(LEFT);
text("touches: " + touches.length, 10, 20);
textAlign(CENTER);
for (let i = 0; i < touches.length; i++) {
noStroke();
textSize(16);
fill(0, 255, 0);
text("" + i, touches[i].x, touches[i].y-35);
strokeWeight(3);
stroke(0, 255, 0);
noFill();
ellipse(touches[i].x, touches[i].y, 55, 55);
}
}