xxxxxxxxxx
111
//let img;
var bgcolor;
let brush = "1";
let canvas;
//function preload(){img= loadImage('./uglu cat.jpeg')
function setup() {
bgcolor = color(random(255), random(255), random(255));
//text('MSPAINT',CENTER)
//textSize(100)
canvas = createCanvas(windowWidth, windowWidth);
//frameRate(2);
background(bgcolor);
colorMode(HSL);
blendMode(MULTIPLY);
}
function star(x, y, radius1, radius2, npoints) {
let angle = TWO_PI / npoints;
let halfAngle = angle / 2.0;
beginShape();
for (let a = 0; a < TWO_PI; a += angle) {
let sx = x + cos(a) * radius2;
let sy = y + sin(a) * radius2;
vertex(sx, sy);
sx = x + cos(a + halfAngle) * radius1;
sy = y + sin(a + halfAngle) * radius1;
vertex(sx, sy);
}
endShape(CLOSE);
}
function draw() {
r = random(255);
g = random(255);
b = random(255);
fill(r, g, b);
if (mouseIsPressed === true) {
//----La cretura----
//circle(mouseX, mouseY, 99);{
let hslColor = random(0, 360);
noStroke();
blendMode(BLEND);
if (brush === "1") {
// strokeWeight(8)
//line(pmouseX, pmouseY, pmouseX, pmouseY);
circle(mouseX, mouseY, 75);
//end
} else if (brush === "2") {
blendMode(MULTIPLY);
//line(width/2, heigh5t/2,mouseX, mouseY);
noStroke();
fill("pink");
rect(mouseX, mouseY, 75);
//burenya
} else if (brush === "3") {
// strokeWeight(6);
stroke("black");
line(width / 3, height / 2, mouseX, mouseY);
stroke("red")
line(width / 3, height / 55, mouseX, mouseY);
} else if (brush === "4") {
stroke("blue");
line(width / 2, height / 5, mouseX, mouseY);
//yeeee
} else if (brush === "5") {
stroke(2);
fill("pink");
line(width / 78, height / 2, mouseX, mouseY);
circle(mouseX, mouseY, 20);
//burenyaaaaaaaa
} else if (brush === "6") {
stroke("red");
square(mouseX, mouseY, 50);
} else if (brush === "7") {
//frameRate(100);
fill("black");
noStroke();
circle(mouseX, mouseY, 12);
} else if (brush === "8") {
stroke(30);
fill("orange");
line(width / 78, height / 30, mouseX, mouseY);
rect(mouseX, mouseY, 20);
//yeeee
} else if (brush === "s") {
//frameRate(100);
stroke("black");
fill("yellow");
push();
translate(mouseX, mouseY, 3);
star(0, 0, 30, 70, 5);
pop();
}
}
}
function keyPressed() {
brush = key;
if (key === "0") {
saveCanvas(canvas, "sketch.jpg");
} else if (key === "9") {
clear();
background(bgcolor);
// console.log ('ive been clicked')
// circleSize=circleSize *2
// saveCanvas(canvas,'circle.jpg')
}
}