xxxxxxxxxx
// inspired by professor Luke
var color0 = "blanchedalmond";
var color1 = "fuchsia";
var color2 = "teal";
var color3 = "darkorange";
function setup() {
createCanvas(windowWidth, windowHeight);
background(0);
frameRate(400);
}
function draw() {
var speed = dist(mouseX, mouseY, pmouseX, pmouseY);
if(mouseIsPressed) ellipse(mouseX, mouseY, speed, speed);
strokeWeight(random(5, 15));
var whichcolor = floor(random(4));
if(whichcolor==0) stroke(color0);
if(whichcolor==1) stroke(color1);
if(whichcolor==2) stroke(color2);
if(whichcolor==3) stroke(color3);
var x1 = random(width);
var y1 = random(height);
var x2 = random(width);
var y2 = random(height);
whichcolor = floor(random(4)); 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()
{
if(key=='c') {
color0 = "darkviolet";
color1 = "lightcoral";
color2 = "midnightblue";
color3 = "lavender";
}
if(key=='h') {
color0 = "paleturquoise";
color1 = "springgreen";
color2 = "sandybrown";
color3 = "mediumvioletred";
}
if(key=='i') background(42,212,210);
console.log("magic " + key);
}