xxxxxxxxxx
// this is a comment
// control-shift J appears to open the developer console
// setup runs once when you hit play!
function setup() {
createCanvas(windowWidth, windowHeight); // this is saying how big our canvas is
background(255); // this is our background color
rectMode(CENTER); // rectangles will draw on center
}
// draw runs every frame over and over and over and over and over
function draw() {
var color0 = "black"; // edge color
var color1 = "red";
var color2 = "yellow";
var color3 = "blue";
// random makes random numbers: one argument is a range, two args are a min and a max
stroke(color0);
strokeWeight(random(2, 10)); // this will make a thicker line
var whichcolor = floor(random(3)); // floor() hacks off the decimal point
//console.log(whichcolor);
if(whichcolor==0) fill(color1);
if(whichcolor==1) fill(color2);
if(whichcolor==2) fill(color3);
// min gives the smallest of a list of values
// max gives the largest of a list of values
var x = (random(width) + random(width) + random(width) + random(width))/4;
var y = (random(height) + random(height) + random(height) + random(height))/4;
rect(x, y, random(80), random(80)); // draw a rectangle - arguments are x, y, width, height
}