Last active
March 2, 2017 17:54
-
-
Save slambert/6937465cc0a121f386c5c777fce8ca14 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Modulo Example | |
| // Steve Lambert March 2, 2017 | |
| // v0.2 | |
| // initializing variables | |
| int interval; // how often changes | |
| int xPos; | |
| int yPos; | |
| int circleW = 10; | |
| void setup() { | |
| size(300,300); | |
| smooth(); | |
| noStroke(); | |
| background(255); | |
| } // end setup | |
| void draw() { | |
| ellipseMode(TOP); | |
| // top circle | |
| if (interval % 96 == 0) { | |
| fill(0); | |
| ellipse(xPos,yPos,circleW,circleW); | |
| } | |
| // 2nd circle | |
| if (interval % 48 == 0) { | |
| fill(51); | |
| ellipse(xPos,yPos+(circleW*1),circleW,circleW); | |
| } | |
| // 3rd circle | |
| if (interval % 24 == 0) { | |
| fill(102); | |
| ellipse(xPos,yPos+(circleW*2),circleW,circleW); | |
| } | |
| // 4th circle | |
| if (interval % 12 == 0) { | |
| fill(153); | |
| ellipse(xPos,yPos+(circleW*3),circleW,circleW); | |
| } | |
| // 5th circle | |
| if (interval % 6 == 0) { | |
| fill(204); | |
| ellipse(xPos,yPos+(circleW*4),circleW,circleW); | |
| } | |
| interval = interval+ 1; // count each loop! | |
| println("interval: "+interval); | |
| xPos++; // increment xPos | |
| println("xPos: "+xPos); | |
| if (xPos >= width){ // if it gets to the edge, move down 1 row | |
| xPos = 0; | |
| yPos = yPos + (circleW * 5); | |
| } | |
| if (yPos >= height){ // if it gets to the bottom, start at the top again | |
| yPos = 0; | |
| background(255ou); | |
| } | |
| } // end draw |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment