changing speed of translation of array
in
Programming Questions
•
3 years ago
Hello, i made this code that create animations translating the content of an array .
Its based on some example found in the processing book.
I would like to know how can i change the speed of the movement using this technique for animation?
For example i would like to be able to control the speed of the moving spheres . Any idea of how can i do this?
thanks in advace
Seb.
Its based on some example found in the processing book.
I would like to know how can i change the speed of the movement using this technique for animation?
For example i would like to be able to control the speed of the moving spheres . Any idea of how can i do this?
thanks in advace
Seb.
- float[] corre = new float[100];
float[] nuevo_corre = new float[100];
void setup(){
size(1200, 1200);
for(int i=0 ; i<100 ; i++){
corre[i]= random(121 );
nuevo_corre[i] = corre[i];
}
}
void draw(){
background(250, 250, 0);
for(int i=0 ; i<100 ; i++){
if(i < 99) {
nuevo_corre[i ] = corre[i + 1 ];
}
else if (i ==99 ){
nuevo_corre[i] = random(121 );
}
}
for(int i=0 ; i<100 ; i++){
corre[i ] = nuevo_corre[i ];
ellipse( i * 5 , 20 , corre[i]/8 , corre[i]/8);
}
}
1
