PImage ball;
void setup(){
size(600,500);
background(255);
ball = loadImage("ball.png");
}
void draw(){
float oldx = 0;
float oldy = 0.5*height;
int dif = 1;
for(float x = 0; x < width; x++) {
float y = map(noise(x/250),0,1,0.2*height, 0.8*height);
noiseDetail(dif);
stroke(0,255,0);
fill(0,255,0);
beginShape();
vertex(oldx,oldy);
vertex(x,y);
endShape(CLOSE);
oldx = x;
oldy = y;
if(x == 1){
image(ball,x+10,y-10,10,10);
}
}
}
I tried what someone had recommended which was to create a custom shape using beginShape() but I was still unable to fill underneath the line. Any help would be greatly appreciated.