a little fixes

This commit is contained in:
Arsen Mirzaev Tatyano-Muradovich 2023-11-18 21:50:03 +07:00
parent fe527eba45
commit c86be37622

View File

@ -16,8 +16,8 @@ class womb {
// Поле отрисовки
this.canvas = this.shell.getContext("2d");
this.shell.width = window.innerWidth;
this.shell.height = window.innerHeight;
this.shell.width = document.body.offsetWidth;
this.shell.height = document.body.offsetHeight;
return this;
}
@ -67,14 +67,14 @@ class womb {
init() {
// Запись размеров полотна
this.shell.width = window.innerWidth;
this.shell.height = window.innerHeight;
this.shell.width = document.body.offsetWidth;
this.shell.height = document.body.offsetHeight;
// Генерация шума
// noise.seed(Math.random());
}
generate(offset = 0) {
generate(offset = 0, color = 'red') {
for (let y = 0; y < this.shell.height; y += this.block.height) {
// Перебор колонок
@ -85,14 +85,14 @@ class womb {
this.draw(
x,
y,
"red",
color,
0.5 + noise.simplex2(x + offset, y + offset) / 2
);
}
}
}
interactive(offset = 0) {
interactive(offset = 0, color = 'red') {
for (let y = 0; y < this.shell.height; y += this.block.height) {
// Перебор колонок
@ -111,10 +111,6 @@ class womb {
if (x === block.x && y === block.y) {
// Блок найден
if (x === 0 && y === 0) {
console.log(block.alpha);
}
if (block.smooth === 0) {
// Резкий переход
@ -183,7 +179,7 @@ class womb {
}
}
this.draw(x, y, "red", alpha);
this.draw(x, y, color, alpha);
}
}
}