xxxxxxxxxx
52
let pixelheart = [
[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]
];
let H = [];
let scale = 40;
function setup() {
createCanvas(400, 400);
cx = width / 2
cy = height / 2
chx = pixelheart.length[0] / 2
chy = pixelheart.length / 2
strokeWeight(15);
stroke(200)
for (y = 0; y < pixelheart.length; y++) {
for (x = 0; x < pixelheart[0].length; x++) {
if(pixelheart[y][x] === 1) {
px = x - chy
py = y - chy
H.push(createVector(px, py))
}
}
}
}
function draw() {
background(22);
strokeWeight(8)
stroke(255)
for (i in H) {
point(
cx - (H[i].x * scale),
cy + H[i].y * scale)
}
strokeWeight(1)
stroke(2555, 50)
line(cx, 0, cx, height)
line(0, cy, width, cy)
}