xxxxxxxxxx
//fontu tanımlama
var fontCrossroad;
//değişkenleri tanımlama
let cols = 4;
let rows = 5;
let squareColors;
let circleColors;
//fontu yükleme
function preload() {
fontCrossroad =loadFont("CrossroadsPersonalUseRegular-owql0.ttf");
}
//canvası ayarlama,renkleri jenere etme ve şekil çizmek için setup fonksiyonuu çağırma
function setup() {
createCanvas(400, 500);
generateColors();
drawShapes();
}
//boş bir ekrandan çağırma
function draw() {
}
//her tıklandığıda renkleri ve şekilleri tekrar çağırma
function mouseClicked() {
generateColors();
drawShapes();
}
//kare ve daireler için renkleri yaratma
function generateColors() {
squareColors = new Array(cols);
circleColors = new Array(cols);
//rastgele renklerle dizi oluşturma
for (let i = 0; i < cols; i++) {
squareColors[i] = new Array(rows);
circleColors[i] = new Array(rows);
//her bir kare ve daire için rastgele renkler oluşturma
for (let j = 0; j < rows; j++) {
squareColors[i][j] = color(random(255), random(255), random(255));
circleColors[i][j] = color(random(255), random(255), random(255));
}
}
}
//gridi oluşturma
function drawShapes() {
let squareSize = width / cols;
// ilk sütunu yarısı kadar kırpma
translate(-squareSize / 2, 0);
//nested for loop kullanarak her bir sütun ve satır için bi işlem yapma
for (let i = 0; i < cols; i++) {
for (let j = 0; j < rows; j++) {
//kareleri çizme
fill(squareColors[i][j]);
//çerçeve olmadan çizme
noStroke();
rect(i * squareSize, j * squareSize, squareSize, squareSize);
// daireleri çizme
fill(circleColors[i][j]);
ellipseMode(CENTER);
let circleX = i * squareSize + squareSize / 2;
let circleY = j * squareSize + squareSize / 2;
ellipse(circleX, circleY, squareSize * 0.8, squareSize * 0.8);
}
}
// sağ üstteki yazı
textFont(fontCrossroad);
//yazı boyutunu ayarlama
textSize(40);
//siyahla doldurma
fill(0);
text("weird", width - 100, 50);
textSize(20);
//beyazla doldurma
fill(255,255,255);
text("date", width - 80, 68);
// sol üstteki yazı
textSize(25);
fill(0);
text("İDEA",60, 40);
textSize(10);
fill(255,255,255);
text("Lorem ipsum dolor sit", 60, 50);
text("Quis nostrum exercitationem", 60, 60);
text("Ut labore et dolore", 60, 70);
// sol alttaki yazı
textSize(10);
text("velit esse cillum dolore eu ", 60, height - 20);
text("nisi ut aliquid ex ea commodi consequatur. ", 60, height - 30);
text("officia deserunt mollit corporis suscipit labo", 60, height - 40);
text(" quis nostrum exercitationem ullam corporis suscipit", 57, height - 50);
// klavyede "s" tuşuna basınca kaydetme
if (key == 's') {
save("export.jpg");
}
}