Skip to content

Commit 52d5ed6

Browse files
committed
added multi-touch example
1 parent 719704d commit 52d5ed6

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
float scale;
2+
3+
void setup() {
4+
fullScreen();
5+
noStroke();
6+
scale = displayDensity / 2.65;
7+
colorMode(HSB, 350, 100, 100);
8+
textFont(createFont("SansSerif", scale * 60));
9+
}
10+
11+
void draw() {
12+
background(30, 0, 100);
13+
fill(30, 0, 20);
14+
text("Number of touch points: " + touches.length, 20, scale * 100);
15+
for (int i = 0; i < touches.length; i++) {
16+
float s = scale * map(touches[i].area, 0, 1, 50, 500);
17+
println(touches[i].area);
18+
fill(30, map(touches[i].pressure, 0.6, 1.6, 0, 100), 70, 200);
19+
ellipse(touches[i].x, touches[i].y, s, s);
20+
}
21+
}
22+
23+
void touchStarted() {
24+
println("Touch started");
25+
}
26+
27+
void touchEnded() {
28+
println("Touch ended");
29+
}
30+
31+
void touchMoved() {
32+
println("Touch moved");
33+
}

0 commit comments

Comments
 (0)