How to increase or decrease the number of shapes/objects each millisecond
in
Programming Questions
•
1 year ago
Hello,
I'm new to processing and I really need some help to implement some ideas for a simple sketch.
How can I increase or decrease the number of shapes/objects each x milliseconds ?
Let's say, I would like to increase 10 points each 100 milliseconds during 3 seconds(for example).
Could someone help?
Here's a test code I made:
int counter = 0;
int[]x=new int[400];
int[]y=new int[400];
int[]z=new int[400];
void setup() {
size(500, 400, P3D);
background(0);
noFill();
stroke(250);
strokeWeight(1);
for(int i=0; i<400; i++) {
x[i] = int(random(-150, 150));
y[i] = int(random(-150, 150));
z[i] = int(random(-150, 150));
}
}
void draw() {
counter++;
//if (counter == 3000) counter = 0;
if (counter < 250){
drawOne();
}
else if (counter < 500) {
drawTwo();
}
else {
drawThree();
}
}
void drawOne(){
background(0);
translate(width/2, height/2);
rotateY(frameCount /100.0);
//rotateX(frameCount /100.0);
//rotateZ(frameCount /50.0);
//box(150);
for(int i =0; i<150; i++) {
point(x[i], y[i], z[i]);
}
}
void drawTwo(){
background(0);
translate(width/2, height/2);
rotateY(frameCount /100.0);
//rotateX(frameCount /100.0);
//rotateZ(frameCount /50.0);
//box(150);
for(int i =0; i<300; i++) {
point(x[i], y[i], z[i]);
}
}
void drawThree(){
background(0);
translate(width/2, height/2);
rotateY(frameCount /100.0);
//rotateX(frameCount /100.0);
//rotateZ(frameCount /50.0);
//box(150);
for(int i =0; i<400; i++) {
point(x[i], y[i], z[i]);
}
}
1