Created
September 29, 2016 22:19
-
-
Save sabotai/42b94850e6084946d884c69843a31faf to your computer and use it in GitHub Desktop.
GD105 Week 6 Basic Loop
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
int howMany; | |
void setup(){ | |
size(1280,720); | |
//use center mode so it doesnt draw the first one off-screen | |
ellipseMode(CORNER); | |
howMany = 5; | |
} | |
void draw(){ | |
//we use 'i' to iterate through our loop | |
//we run the loop again as long as (i<howMany) | |
// | |
for ( int i = 0; i < howMany; i++ ) { | |
//how can we make howMany fit within the space of width... | |
int size = width/howMany; | |
int x = i * width/howMany; //space these out based on howMany | |
int y =height/2 - size/2; //put it in the middle | |
ellipse(x,y,size,size); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment