xxxxxxxxxx
86
function setup() {
createCanvas(800, 800);
strokeWeight(2);
/*
//New pattern button.
var patternButton = createButton('New Pattern');
patternButton.mousePressed(pattern);
patternButton.style('color', 'rgb(45,28,243)');
//Save pattern button.
function savePattern(){
save('-pattern');
}
var saveButton = createButton('Save Pattern');
saveButton.mousePressed(savePattern);
saveButton.style('color', 'rgb(45,28,243');
pattern();
*/
buttom();
}
/*function pattern() {
background(1);
let cols = random(12,16);
let w = width / cols;
let rows = random(12,16);
let h = height / rows;
for (let x = w/2; x <= width; x +=w) {
for (let y = h/2; y <= height; y +=h) {
buttom(x, y);
}
}
}
*/
function buttom(x, y, r, g, b) {
background(255);
x = width * 2/3;
y = height * 2/3;
//sizes
let sizeCircle = 800;
let sizeSquare = 800;
//random(5, 15)
//random(3, 13)
if (y > height * 2/3 && x > width * 2/3) {
r = random(200, 255);
g = random(100);
b = random(100, 200);
} else if (y < height * 1/3 && x < width * 1/3) {
r = random(200, 255);
g = random(0);
b = random(100, 200);
} else if (y > height * 1/3 && y < height * 2/3 && x > width * 1/3 && x < width * 2/3){
r = random(100, 200);
g = random(200, 255);
b = random(25, 100);
} else {
r = random(50);
g = random(0);
b = random(100, 200);
}
fill(r, g, b);
rectMode(CENTER);
square(x, y, sizeSquare);
ellipse(x, y, sizeCircle);
}