Created
October 2, 2015 15:19
-
-
Save chrisallick/313ff90df6e64b19352c 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
| function setup() { | |
| createCanvas(640, 480); | |
| // use anti-aliasing | |
| smooth(); | |
| // no stroke on my shapes | |
| noStroke(); | |
| /* | |
| use upper left corner | |
| not the center | |
| */ | |
| ellipseMode( CORNER ); | |
| } | |
| /* | |
| draw a circle with random color | |
| but what if there were a way to make it easier to | |
| increase the x-value without doing the math ourselves? | |
| */ | |
| function draw() { | |
| // set the background color every loop | |
| background( 247, 250, 248 ); | |
| // fill with RGB | |
| fill( 46,213,101 ); | |
| ellipse( 20, 20, 20, 20 ); | |
| // fill with HEX | |
| fill( "#864DE1" ); | |
| ellipse( 50, 20, 20, 20 ); | |
| // fill with color variable | |
| fill( 242,123,158 ); | |
| ellipse( 80, 20, 20, 20 ); | |
| // fill with random color (but every loop) | |
| fill( random(0,255), random(0,255), random(0,255) ); | |
| ellipse( 110, 20, 20, 20 ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment