diff --git a/womb3-simplex.js b/womb3-simplex.js index 9e846b9..1c203d6 100644 --- a/womb3-simplex.js +++ b/womb3-simplex.js @@ -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); } } }