well ive done it but its running super slow :s
Code:import tuioZones.*;
import oscP5.*;
import netP5.*;
TUIOzoneCollection zones;
Bolas b1 = new Bolas();
PImage butao;
void setup(){
size(screen.width,screen.height);
smooth();
butao = loadImage("butao.png");
zones=new TUIOzoneCollection(this);
zones.setZone("zone1", 50,height-150,100,100);
zones.setZone("zone2", width-150,height-150,100,100);
image(butao,zones.getZoneX("zone2"),zones.getZoneY("zone2"),zones.getZoneWidth("zone2"),zones.getZoneHeight("zone2"));
stroke(0);
rect(zones.getZoneX("zone1"),zones.getZoneY("zone1"),zones.getZoneWidth("zone1"),zones.getZoneHeight("zone1"));
}
void draw(){
//if (zones.isZoneToggleOn("zone1")){
if (key=='s'){
fill(255);
stroke(0);
b1.desenhar();
}
if (zones.isZoneToggleOn("zone2")){
exit();
}
}
class Bolas{
float xplus = random(0.09);
float yplus = random(0.09);
float xinc = random(1);
float yinc = random(1);
float xx = random(width);
float yy = random(height);
PGraphics cena;
void desenhar(){
cena = createGraphics(width,height,JAVA2D);
cena.beginDraw();
cena.smooth();
cena.stroke(0);
//noStroke();
float x3 = random(xx);
//float y3 = noise(yy);
float x = noise(xx)*width;
float y = noise(yy)*height;
xx += xplus;
yy += yplus;
int x2 = (int)x;
int y2 = (int)y;
//color col = img.get(x2,y2);
//fill(col);
//float prop = random(90,100);
float prop = random(9,20);
cena.ellipse(x, y, prop, prop);
cena.endDraw();
image(cena,0,0);
}
}
so even if it was fast what how would i draw the image button on the draw(){ to make it transparent? would i make a noLoop()? would that affect the PGraphic too?