class Location{ color fillColor = #523D00; color txtColor = #aaaaaa; color idColor = #0026cc; int x1; int y1; int id; String idOsc; int wdth; int distMouseLoc; float vol; boolean closeGate = true; Location(int _x1, int _y1, int _id){ x1 = _x1; y1 = _y1; id = _id; idOsc = '/' + str(_id); wdth = 10; } void draw(){ fill(fillColor); noStroke(); ellipse(x1, y1, wdth, wdth); fill(fillColor); textFont(font, 10); text(id, x1-20, y1+4); distMouseLoc = int(dist(mouseX, mouseY, x1, y1)); if(distMouseLoc < areaWidth/2){ fillColor = #cc9900; vol = map(distMouseLoc, areaWidth/2, 0, 0, 0.1); fill(txtColor); noStroke(); textFont(font, 10); text("dist: " + distMouseLoc, x1+10, y1+4); fill(#3EBDFF); text("vol: " + nf(vol, 0, 3), x1+54, y1+4); locSendOsc(); closeGate = false; }else if (closeGate == false){ vol = 0; locSendOsc(); closeGate = true; }else{ fillColor = #523D00; } } void locSendOsc(){ OscMessage oscMsg = oscP5.newMsg(idOsc); oscMsg.add(vol); // send the osc message try{ oscP5.send(oscMsg); }catch(Exception e){ println("No permissions for TCP/IP..."); } } }