xxxxxxxxxx
let colors = ["#5AAA95", "#087F8C", "#095256", "#86A873", "#BB9F06"];
let objectType;
function setup() {
createCanvas(600, 600);
background(255);
noLoop();
objectType = int(random(5)); // 0: Telefon, 1: Kahve fincanı, 2: Kitap, 3: Gözlük, 4: Lamba
}
function draw() {
noStroke();
if (objectType === 0) {
drawPhone();
} else if (objectType === 1) {
drawCoffeeCup();
} else if (objectType === 2) {
drawBook();
} else if (objectType === 3) {
drawGlasses();
} else if (objectType === 4) {
drawLamp();
}
}
function drawPhone() {
fill(colors[0]);
rect(200, 150, 200, 400, 30);
fill(255);
rect(220, 180, 160, 320, 20);
fill(50);
ellipse(300, 500, 40, 10);
}
function drawCoffeeCup() {
fill(colors[1]);
rect(250, 250, 100, 120, 20);
fill(255);
ellipse(300, 240, 80, 30);
fill(colors[1]);
ellipse(300, 250, 80, 20);
fill(colors[2]);
ellipse(330, 290, 40, 40);
}
function drawBook() {
fill(colors[2]);
rect(200, 250, 200, 120);
fill(255);
rect(210, 260, 180, 100);
}
function drawGlasses() {
fill(colors[3]);
ellipse(250, 300, 80, 50);
ellipse(350, 300, 80, 50);
rect(290, 295, 20, 10);
}
function drawLamp() {
fill(colors[4]);
triangle(250, 200, 350, 200, 300, 100);
fill(50);
rect(295, 200, 10, 200);
fill(colors[4]);
rect(270, 400, 60, 20);
}