xxxxxxxxxx
var thesize = 1;
var fillcolor;
var strokecolor = 0;// ask why is it not letting me just set it as black??
var backgroundcolor = "White";
var shapetype = 0;
function setup() {
createCanvas(windowWidth, windowHeight);
background(backgroundcolor);
fillcolor = color("Black")
rectMode(CENTER);
}
function draw() {
var speed = dist(mouseX, mouseY, pmouseX, pmouseY);
strokeWeight(speed);
fill(fillcolor);
stroke(strokecolor, 70);
if(mouseIsPressed) {
if(shapetype==0) ellipse(mouseX, mouseY, speed, speed);
if(shapetype==1) rect(mouseX, mouseY, speed, speed);
if(shapetype==2) triangle(mouseX, mouseY, speed, speed);
//ellipse(mouseX, mouseY, thesize, thesize);
}
thesize = speed;
}
function keyTyped(){
//----------------------------------shape color change--------------------------------------
if(key=='a'){// change shape color to pink
fillcolor = color("HotPink");
strokecolor = color("HotPink");
strokecolor.setAlpha(70);
}
if(key=='b'){ // change shape color to red
fillcolor = color("Crimson");
strokecolor = color("Crimson");
strokecolor.setAlpha(70);
}
if(key=='c'){ // change shape color to green
fillcolor = color("Lime");
strokecolor = color("Lime");
strokecolor.setAlpha(70);
}
if(key=='d'){ // change shape color to yellow
fillcolor = color("Yellow");
strokecolor = color("Tellow");
strokecolor.setAlpha(70);
}
if(key=='e'){ // change shape color to Aquamarine
fillcolor = color("Aquamarine");
strokecolor = color("Aquamarine");
strokecolor.setAlpha(70);
}
if(key=='f'){ // change shape color to purle
fillcolor = color("MediumOrchid");
strokecolor = color("MediumOrchid");
strokecolor.setAlpha(70);
}
if(key=='g'){ // change shape color to black
fillcolor = color("Black");
strokecolor = color("Black");
strokecolor.setAlpha(70);
}
//----------------------------------background color change--------------------------------------
if(key=='h'){
backgroundcolor = "Black";
background(backgroundcolor);
}
if(key=='i'){
backgroundcolor = "Indigo";
background(backgroundcolor);
}
if(key=='j'){
backgroundcolor = "Navy";
background(backgroundcolor);
}
//----------------------------------Shape change--------------------------------------
if(key=='k') {
shapetype = 2;
}
if(key=='l') {
shapetype = 1;
}
if(key=='m') {
shapetype = 0;
}
//---------------------------------------back to zero------------------------------------------------
if(key=='z'){
background(255);
thesize = 1
}
}