Can I, in this example of code, somehow stop the animation of the tiles changing but still be able to change the amount of tiles (with an Arduino pot)?
If yes, how?
Right now, when I stop the loop, the ability to change anything else disappears.
Thanks!
//GRID
tilesX = serialInArray[0];
tilesY = serialInArray[1];
float tileW = width / tilesX;
float tileH = height / tilesY;
for (int x = 0; x<tilesX; x++) {
for ( int y = 0; y<tilesY; y++) {
int posX = int(tileW *x);
int posY = int(tileH *y);
//WAVE ROOD
float wave = cos(radians(frameCount *x +y));
float mappedWave = map(wave, -1, 1, 0, 16);
int selector = int(mappedWave);
//GRID ROOD
pushMatrix();
translate(posX, posY);
if (selector == 0) {
fill(#ff0000);
rect(0, 0, tileW, tileH);
//image(img, 200, 0, tileW, tileH);
} else if (selector == 1) {
fill(#ff0000);
rect(0, 0, tileW, tileH);
// image(img, width/2, height/2, tileW, tileH);
} else if (selector == 2) {
push();
//noFill();
rect(0, 0, tileW, tileH);
pop();
} else if (selector == 3) {
fill(#ff0000);
arc(0, 0, tileW*2, tileH*2, radians(0), radians(90));
} else if (selector == 4) {
fill(#ff0000);
arc(tileW, 0, tileW*2, tileH*2, radians(90), radians(180));
} else if (selector == 5) {
fill(#ff0000);
arc(tileW, tileH, tileW*2, tileH*2, radians(180), radians(270));
} else if (selector == 6) {
fill(#ff0000);
arc(0, tileH, tileW*2, tileH*2, radians(270), radians(360));
} else if (selector == 7) {
fill(#ff0000);
ellipse(tileW/2, tileH/2, tileW, tileH);
} else if (selector == 8) {
fill(#ff0000);
triangle(0, tileH, 0, 0, tileW, tileH);
} else if (selector == 9) {
fill(#ff0000);
triangle(0, tileH, tileW, 0, tileW, tileH);
} else if (selector == 10) {
fill(#ff0000);
triangle(0, 0, tileW, 0, tileW, tileH);
} else if (selector == 11) {
fill(#ff0000);
triangle(0, 0, tileW, 0, 0, tileH);
} else if (selector == 12) {
fill(#ff0000);
arc(tileW/2, 0, tileW, tileH, radians(0), radians(180));
} else if (selector == 13) {
fill(#ff0000);
arc(tileW/2, tileH, tileW, tileH, radians(180), radians(360));
} else if (selector == 14) {
fill(#ff0000);
arc(tileW/2, tileH/2, tileW, tileH, radians(90), radians(270));
} else if (selector == 15) {
fill(#ff0000);
arc(0, tileH/2, tileW, tileH, radians(270), radians(450));
}
popMatrix();