xxxxxxxxxx
var color0 = "OliveDrab"; // edge color
var color1 = "ForrestGreen";
var color2 = "DarkSeaGreen";
var color3 = "LightGreen";
function setup() {
createCanvas(windowWidth, windowHeight);
background(0);
frameRate(30)
rectMode(CENTER);
}
function draw() {
var gridsize = 20;
strokeWeight(random(2, 5)); // this will make a thicker line
var whichcolor = floor(random(5)); // floor() hacks off the decimal point
if(whichcolor==0) stroke(color0);
if(whichcolor==1) stroke(color1);
if(whichcolor==2) stroke(color2);
if(whichcolor==3) stroke(color3);
var x1 = mouseX;
var y1 = mouseY;
var x2 = random(width);
var y2 = random(height); // what is this
line(x1, y1, x2, y2); // draw a line - arguments are x, y, x2, y2
whichcolor = floor(random(4)); // floor() hacks off the decimal point
//console.log(whichcolor);
if(whichcolor==0) stroke(color0);
if(whichcolor==1) stroke(color1);
if(whichcolor==2) stroke(color2);
if(whichcolor==3) stroke(color3);
point(x1, y1);
point(x2, y2);
}
function keyTyped() // this runs when i type a key on the keyboard
{
if(key=='a'){ // classic mondrian
color0 = "LightSkyBlue";
color1 = "DeepSkyBlue";
color2 = "RoyalBlue";
color3 = "DodgerBlue";
}
if(key=='b') {
color0 = "Magenta";
color1 = "Lavendar";
color2 = "HotPink";
color3 = "Red";
}
if(key=='c') background(0);
}