Hi everyone! I am new to processing. I am trying to draw a shape and store 5 shapes before the current one, so the fade consequently (like in this example: https://processing.org/examples/storinginput.html).
(or maybe I can use some redraw function, I dunno)
But I cannot manage to combine it within my code… Can anyone help?
Here is the code:
int memory = 5; // the amount of stored shapes
void setup() {
size(200, 200, P3D);
}
void draw() {
background(204);
float misha = random(200,800);
translate(width/2, height/2);
int amnt = 10; //amnt of lines
PVector[][] pp = new PVector[amnt][amnt];
for (int i = 0; i < amnt; i++) {
float lat = map(i, 0, amnt-1, -HALF_PI, HALF_PI);
for (int j = 0; j < amnt; j++) {
float lon = map(j, 0, amnt-1, -PI, PI);
int imnd = i + j * amnt;
float r = 20 + misha; // begin radius * max radius
float x = r * cos(lat) * cos(lon);
float y = r * sin(lat) * sin(lon);
float z = r * sin(lon);
pp[i][j] = new PVector(x,y,z);
}
}
for (int i = 0; i < amnt-1; i++) {
beginShape(TRIANGLE_STRIP);
stroke(500,20, misha); //blending colors
noFill();
for (int j = 0; j < amnt; j++) {
vertex(pp[i][j].x,pp[i][j].y,pp[i][j].z);
vertex(pp[i+1][j].x,pp[i+1][j].y,pp[i+1][j].z);
}
endShape();
}
}