Created
September 29, 2010 08:53
-
-
Save cpietsch/602476 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import TUIO.*; | |
TuioProcessing tuio; | |
PFont font; | |
int x,y; | |
void setup () { | |
size(800, 600); | |
tuio = new TuioProcessing(this); | |
font = loadFont("font.vlw"); | |
textFont(font); | |
rectMode(CENTER); | |
smooth(); | |
} | |
void draw () { | |
background(0, 0, 0); | |
// Eine Liste aller Finger abfragen | |
Vector fingers = tuio.getTuioCursors(); | |
// Schleife mit der Liste, durch die Liste durchloopen, wie auch immer man's nennt | |
for (int i = 0; i < fingers.size(); i++) { | |
// Den einzelnen Finger in eine Variable speichern | |
TuioCursor finger = (TuioCursor) fingers.get(i); | |
x=finger.getScreenX(width); | |
y=finger.getScreenY(width); | |
// Ein Rechteck an die Position des Fingers malen | |
stroke(255,255,255,40); | |
strokeWeight(1); | |
line(0,y,width,y); | |
line(x,0,x,height); | |
stroke(255,255,255,200); | |
for (int a = 0; a < fingers.size(); a++) { | |
TuioCursor fingerTmp = (TuioCursor) fingers.get(a); | |
float distance=finger.getDistance(fingerTmp); | |
//println(distance); | |
strokeWeight(abs(5-map(distance,0,1.0,0,4.0))); | |
line(x,y,fingerTmp.getScreenX(width),fingerTmp.getScreenY(width)); | |
} | |
fill(255-finger.getMotionSpeed()*100,255,255); | |
rect(x, y, 20, 20); | |
fill(255); | |
text(finger.getCursorID() +" x:"+x+" y:"+y+" speed:"+finger.getMotionSpeed(), x+20, y+10); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment