xxxxxxxxxx
66
var p;
var h1;
var canvas;
var button ;
var button1;
var brushcColor;
var bgColor;
function setup() {
p = createP("");
h1 = createElement ("h1", " Please Draw");
h1.position (50,5);
clearcanvas();
button = createButton("clear Canvas");
button1= createButton("change Color");
brushColor = color( random(255), random(255), random(255) );
button1.mousePressed(changeColor);
button.mousePressed(clearcanvas);
button.position (550, 70);
button1.position(450,70);
}
function changeColor(){
brushColor = color( random(255), random(255), random(255) );
}
function clearcanvas(){
canvas = createCanvas(1000,650);
canvas.position (50, 100);
bgColor = random(255);
background(bgColor);
}
function changeSize(){
sizex = random (5,50);
sizey = random (5,50);
}
function draw() {
frameRate(500);
var brush1= {
x : mouseX,
y: mouseY
};
var brush2= {
x :1000-mouseX,
y:mouseY
};
fill (brushColor);
noStroke();
rect(brush1.x, brush1.y, 40,20,10);
fill(brushColor);
noStroke();
rect(brush2.x, brush2.y, 40,20,10);
}