Hi guys,
I'm new to the forum and hope one of you can help me. I started working with processing after quite some time and love the ease of use. Also started with the HYPE framework and am amazed at the possibilities.
I want to know how to clear the stage before a draw loop. I have a perlin noise field and want to rotate the arrows, based on the z value of the perlin noise. It draws the stage, but with every loop, it keeps adding more lines. I somewhat understand what's going on, since I keep on adding more and more objects to H with each loop. But I can't find how to remove all objects or clear the stage for that matter.
Hopefully one of you can help me out, since I'm not finding anything in the documentation so far. Thanks!
import hype.*;
float inc = 0.05;
float scl = 10;
int cols,rows;
float zOff, xOff, yOff = 0;
HRect d;
void setup() {
size(500,500);
smooth();
cols = floor(width/scl);
rows = floor(height/scl);
H.init(this).background(#ffffff).autoClear(true);
}
void draw(){
yOff = 0;
for (int y = 0; y < rows; ++y) {
xOff = 0;
for (int x = 0; x < cols; ++x) {
float r = noise(xOff, yOff, zOff) * 255;
d = new HRect();
d
.loc(x*scl, y*scl)
.fill(#000000)
.size(1,scl)
.strokeWeight(0)
.rotate(r);
;
xOff += inc;
H.add(d);
}
yOff += inc;
}
H.drawStage();
zOff +=0.1;
}