Have you considered adding debugging instructions (System.out.println) and viewing the Java console?
There may be a huge amount of output and a final slowdown, but you can at least see what happens when nothing happens.
I think the logical error is the expression fill if; every iteration you define the color of this iteration and fill it with color. Only iterations with i == 11, 13 or 17 are filled with color. And the next iteration that the color will be overwritten in gray. I would think that this tends to flicker, possibly fasting fast.
Didnβt you want something like
public class Main extends PApplet { ... int currentColor = gray; public Main(){} ... public void draw() { if( i % 11 == 0 ) currentColor = green; else if( i % 13 == 0 ) currentColor = blue; else if( i % 17 == 0 ) currentColor = pink; else {
So you start with gray, go to green, blue, pink, green, blue, pink, etc. If you also want to see gray at some point you need to add something like
else if ( i % 19 ) { currentColor = gray; }
Hope this helps.
source share