xxxxxxxxxx
33
let b1;
let b2;
let thickness = 1;
let colorPicker;
function setup() {
createCanvas(700, 700);
background(255);
b1 = createButton("+");
b2 = createButton("-");
colorPicker = createColorPicker();
}
function draw() {
b1.mousePressed(addThick);
b2.mousePressed(removeThick);
if(mouseIsPressed) {
strokeWeight(thickness);
stroke(colorPicker.value());
line(pmouseX, pmouseY, mouseX, mouseY);
}
}
function addThick() {
thickness += 2;
}
function removeThick() {
thickness -= 2;
}