xxxxxxxxxx
70
let c;
let brush;
function setup() {
c = createCanvas(windowWidth, windowHeight);
frameRate(30);
background(220);
background("blue");
}
function draw() {
if (mouseIsPressed === true) {
if (brush === "1") {
let circleSize = map(mouseX, 0, width, 20, 400);
fill("white");
stroke('black');
circle(mouseX, mouseY, circleSize);
} else if (brush === "2") {
fill("white");
rect(mouseX, mouseY, 10);
} else if (brush === "3") {
noFill();
arc(mouseX, mouseY, random(20, 600, 80), random(300, 10, 180), random(0, -100, 200, 166, -250), random(HALF_PI, PI, QUARTER_PI, PIE + QUARTER_PI, TWO_PI));
} else if (brush === "4") {
fill('black');
stroke('white');
circle(mouseX, mouseY, random(10, 80, 200));
} else if (brush === "5"){
stroke('white');
line(mouseX, mouseY, random(mouseX + 100, mouseX + 180, mouseX + 120) , random(mouseY + 140, mouseY + 180, mouseY + 160));
} else if (brush === "6"){
fill('black')
strokeWeight(random(10, 2, 6));
point(mouseX, mouseY);
} else if (brush === "7"){
strokeWeight(5);
fill('black');
strokeCap(ROUND);
line(pmouseX, pmouseY, mouseX, mouseY);
} else if (brush === "8"){
fill('white');
stroke('black');
rect(mouseX, mouseY, 400, 200);
}
}
}
function keyPressed() {
// circle(200, 200, circlesize);
console.log("key pressed");
brush = key;
if (key === "s") {
saveCanvas(c, "moving mouse.jpeg");
} else if (key === "c") {
clear();
}
}
// saveCanvas(c,"moving mouse.jpeg")