How do I Make every third ellipse a different color?

edited January 2016 in How To...

Hey guys I am working on a project for my programming class. I am stuck trying to make every third ellipse a different color. I am attaching the sketch that I made in Photoshop. I am trying to recreate it in Processing. Thank you!!!!!!!

photoshop_concept2

Tagged:

Answers

  • if (countEllipse % 3 == 0) 
          fillColor = RED; 
    
  • that's every third ellipse, yes, but looking at the picture...

    if (count % 6 < 3) {
      fillColor = GREENISH_BLUE;
    } else {
      fillColor = RED;
    }
    
  • edited January 2016

    fillColor = count%6 < 3? GREENISH_BLUE : RED;

  • How would I code that whole part? Like the ellipses and everything? I tried adding these codes to what I have and I keep getting "count cannot be resolved to a variable"

    Sorry! I'm new...

  • count tells you in which column of ellipses you are...

    since we don't know your code we just invented the word count

    you have to replace count by your own word or adapt our code to your structure

    we just posted a term for change something after 3 times or do something 3 times and the next 3 times differently...

    if you just need count, you have to do int count = 0; before setup() but this makes only sense when you use count....

    or post your code....

Sign In or Register to comment.