xxxxxxxxxx
37
let heart = [
[0, 1, 1, 0, 1, 1, 0],
[1, 1, 1, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1],
[0, 1, 1, 1, 1, 1, 0],
[0, 0, 1, 1, 1, 0, 0],
[0, 0, 0, 1, 0, 0, 0]
];
class PBN {
constructor () {
let pixelsize = width/20;
for (let i = 0; i < heart.length; i++) {
for (let j = 0; j < heart[0].length; j++) {
this.x = width/2 - (heart.length/2) * pixelsize + (j * pixelsize)
this.y = height/2 - (heart.length/3) * pixelsize + (i * pixelsize)
if (heart[i][j] === 1) {
blocks.push(new (this.x, this.y, this.pixelsize))
}
}
}
this.pos = createVector(x, y);
this.s = s;
}
show() {
rectMode(CENTER)
noFill();
stroke(190);
strokeWeight(2);
point(this.pos.x, this.pos.y, this.s )
rect(this.pos.x, this.pos.y, this.s)
}
}