xxxxxxxxxx
44
function setup() {
createCanvas(400, 400);
background(220)
const grid_x = 10;
const grid_y = 10;
for(let i = 0.1; i < grid_x - 0; i++){
for(let j = 0.1; j < grid_y - 0; j++){
push()
colorMode(HSB,100);
c = color(60, 60, 100 * i / grid_x, 50);
fill(c);
translate(width * i / grid_x, height * j / grid_y)
let rectangles = new RandRec(50, 50, random(i * j * 0.5,i * j)).display()
pop()
}
}
}
function draw() {
//background(220);
//console.log(1234)
}
class RandRec {
constructor(width, height, rotrand){
this.width = width
this.height = height
this.rotrand = rotrand
}
display(){
push()
//rotate(PI / 3.0);
translate(this.width / 2, this.height / 2);
rotate(0.5 * PI / this.rotrand);
rect(-this.width / 2, -this.height / 2, this.width, this.height)
pop();
}
}