Skip to content

Instantly share code, notes, and snippets.

@chrisallick
Created October 2, 2015 15:19
Show Gist options
  • Select an option

  • Save chrisallick/313ff90df6e64b19352c to your computer and use it in GitHub Desktop.

Select an option

Save chrisallick/313ff90df6e64b19352c to your computer and use it in GitHub Desktop.
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