Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

[G4P] Issue with new Window

$
0
0

Hello.

I have a problem with the drawHandler of a new window created with G4P. The window is created when a button is pressed, this is where the window is created and its drawHandler:

void createWindow(){
  window = GWindow.getWindow(this, "Label", 400, 400, 400, 400, JAVA2D);
  window.addDrawHandler(this, "windowDraw");
  window.setActionOnClose(G4P.CLOSE_WINDOW);
}

public void windowDraw(PApplet appc, GWinData data){

  if(frameCount%50 == 0 && frames < 15){
      appc.fill(random(x,y), random(x,y), random(x,y), random(x,y));
      appc.noStroke();
      appc.ellipse(random(0,400), random(0,400),a, a);
  }
}

(a is a mapped value, originally from a rms-analysis, frames is variable that counts up every 50 frames) So the problem is, that it doesn't draw only one circle, but a seemingly random amount of circles every 50 frames. I hope somebody can help me with this. If you need more code, for better understanding let me know.

thanks in advance raiu


Viewing all articles
Browse latest Browse all 2896

Trending Articles