You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.6 KiB
105 lines
2.6 KiB
|
|
import oscP5.*;
|
|
import netP5.*;
|
|
|
|
int sliderRX = 0;
|
|
int sliderRY = 0;
|
|
int sliderLX = 0;
|
|
int sliderLY = 0;
|
|
int fingersR[] = {0, 0, 0, 0};
|
|
int fingersL[] = {0, 0, 0, 0};
|
|
|
|
OscP5 oscP5;
|
|
|
|
void setup() {
|
|
size(400, 250);
|
|
frameRate(25);
|
|
oscP5 = new OscP5(this, 7000);
|
|
}
|
|
|
|
void draw() {
|
|
background(0);
|
|
fill(255);
|
|
stroke(255);
|
|
strokeWeight(4);
|
|
|
|
line(100, 25, 100, 175);
|
|
line(25, 100, 175, 100);
|
|
circle(100, map(sliderLY, -16000, 16000, 25, 175), 20);
|
|
circle(map(sliderLX, -16000, 16000, 175, 25), 100, 20);
|
|
|
|
line(300, 25, 300, 175);
|
|
line(225, 100, 375, 100);
|
|
circle(300, map(sliderRY, -16000, 16000, 25, 175), 20);
|
|
circle(map(sliderRX, -16000, 16000, 375, 225), 100, 20);
|
|
|
|
fill(fingersL[0] == 1 ? 255 : 0);
|
|
circle(40, 210, 20);
|
|
fill(fingersL[1] == 1 ? 255 : 0);
|
|
circle(80, 210, 20);
|
|
fill(fingersL[2] == 1 ? 255 : 0);
|
|
circle(120, 210, 20);
|
|
fill(fingersL[3] == 1 ? 255 : 0);
|
|
circle(160, 210, 20);
|
|
|
|
fill(fingersR[0] == 1 ? 255 : 0);
|
|
circle(240, 210, 20);
|
|
fill(fingersR[1] == 1 ? 255 : 0);
|
|
circle(280, 210, 20);
|
|
fill(fingersR[2] == 1 ? 255 : 0);
|
|
circle(320, 210, 20);
|
|
fill(fingersR[3] == 1 ? 255 : 0);
|
|
circle(360, 210, 20);
|
|
}
|
|
|
|
void oscEvent(OscMessage theOscMessage) {
|
|
if(theOscMessage.checkTypetag("i")){
|
|
switch(theOscMessage.addrPattern()) {
|
|
case "/movedulation/sliderRX":
|
|
sliderRX = theOscMessage.get(0).intValue();
|
|
break;
|
|
case "/movedulation/sliderRY":
|
|
sliderRY = theOscMessage.get(0).intValue();
|
|
break;
|
|
case "/movedulation/sliderLX":
|
|
sliderLX = theOscMessage.get(0).intValue();
|
|
break;
|
|
case "/movedulation/sliderLY":
|
|
sliderLY = theOscMessage.get(0).intValue();
|
|
break;
|
|
|
|
case "/movedulation/toggleR1":
|
|
fingersR[0] = theOscMessage.get(0).intValue();
|
|
break;
|
|
case "/movedulation/toggleR2":
|
|
fingersR[1] = theOscMessage.get(0).intValue();
|
|
break;
|
|
case "/movedulation/toggleR3":
|
|
fingersR[2] = theOscMessage.get(0).intValue();
|
|
break;
|
|
case "/movedulation/toggleR4":
|
|
fingersR[3] = theOscMessage.get(0).intValue();
|
|
break;
|
|
|
|
case "/movedulation/toggleL1":
|
|
fingersL[0] = theOscMessage.get(0).intValue();
|
|
break;
|
|
case "/movedulation/toggleL2":
|
|
fingersL[1] = theOscMessage.get(0).intValue();
|
|
break;
|
|
case "/movedulation/toggleL3":
|
|
fingersL[2] = theOscMessage.get(0).intValue();
|
|
break;
|
|
case "/movedulation/toggleL4":
|
|
fingersL[3] = theOscMessage.get(0).intValue();
|
|
break;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
//if(theOscMessage.checkTypetag("i")){
|
|
//println(" Value: "+theOscMessage);
|
|
//}
|
|
|
|
}
|