int vNum = 50;
PVector [] vertexP = new PVector[vNum];
PVector [] vertexV = new PVector[vNum];
void setup(){
size(1000,1000);
for(int c = 0; c < vNum; c++){
vertexP[c] = new PVector(random(-width/2,width/2),random(-height/2,height/2));
vertexV[c] = new PVector(random(-10,10),random(-10,10));
}
}
void draw(){
background(0);
fill(255);
translate(width/2,height/2);
beginShape();
for(int c = 0; c < vNum; c++){
vertex(vertexP[c].x,vertexP[c].y);
vertexP[c].add(vertexV[c]);
if(vertexP[c].x >= height/2 || vertexP[c].x <= -height/2|| vertexP[c].y >= height/2 || vertexP[c].y <= -height/2){
vertexV[c].x *= -1;
vertexV[c].y *= -1;
}
}
endShape();
}
PVector [] vertexP = new PVector[vNum];
PVector [] vertexV = new PVector[vNum];
void setup(){
size(1000,1000);
for(int c = 0; c < vNum; c++){
vertexP[c] = new PVector(random(-width/2,width/2),random(-height/2,height/2));
vertexV[c] = new PVector(random(-10,10),random(-10,10));
}
}
void draw(){
background(0);
fill(255);
translate(width/2,height/2);
beginShape();
for(int c = 0; c < vNum; c++){
vertex(vertexP[c].x,vertexP[c].y);
vertexP[c].add(vertexV[c]);
if(vertexP[c].x >= height/2 || vertexP[c].x <= -height/2|| vertexP[c].y >= height/2 || vertexP[c].y <= -height/2){
vertexV[c].x *= -1;
vertexV[c].y *= -1;
}
}
endShape();
}