xxxxxxxxxx
72
let value = 0;
function setup() {
createCanvas(550, 550);
}
function mouseClicked() {
if (
mouseX >= width / 3 &&
mouseX <= width / 3 + width / 30 &&
mouseY >= height / 2 &&
mouseY <= height / 2 + height / 20
) {
if (value === 0) {
value = 255;
} else {
value = 0;
}
}
}
function draw() {
background(255 - value);
push();
//the "room"
stroke(value);
line(0, height, width / 4, (height / 4) * 3);
line(width / 4, (height / 4) * 3, width, (height / 4) * 3);
line(width / 4, (height / 4) * 3, width / 4, height / 5);
fill(value);
rect(width / 3, height / 2, width / 30, height / 20);
pop();
//my sleep paralisis demon
fill(255);
stroke(255);
circle((width / 4) * 3, height / 2, height / 8);
line(
(width / 4) * 3,
(height / 2),
(width / 4) * 3,
(height / 16) * 13);
line(
(width / 4) * 3,
(height / 16) * 13,
(width / 4) * 3 + height / 8,
(height / 16) * 15
);
line(
(width / 4) * 3,
(height / 16) * 13,
(width / 4) * 3 - height / 8,
(height / 16) * 15
);
line(
(width / 4) * 3,
(height / 16) * 10,
(width / 4) * 3 + height / 8,
(height / 16) * 8
);
line(
(width / 4) * 3,
(height / 16) * 10,
(width / 4) * 3 - height / 8,
(height / 16) * 8
);
}