- commit
- fbb2f86e36209b9fa5b35d5491d777dd88b96c63
- parent
- d6497db3737463a932025bffb8064190d9f6b66a
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2024-05-10 18:29
alternative: weighted insted of boolean
Diffstat
| M | mondrian.js | 6 | +++--- |
1 files changed, 3 insertions, 3 deletions
diff --git a/mondrian.js b/mondrian.js
@@ -82,10 +82,10 @@ var animate = function(element, delta) {
82 82 }
83 83
84 84 var rect = element.getBoundingClientRect();
85 -1 if (rect.height > rect.width) {
86 -1 div.dataset.dir = (Math.random() < 0.2) ? "vertical" : "horizontal";
-1 85 if (Math.random() * rect.height < 0.5 * rect.width) {
-1 86 div.dataset.dir = "vertical";
87 87 } else {
88 -1 div.dataset.dir = (Math.random() < 0.8) ? "vertical" : "horizontal";
-1 88 div.dataset.dir = "horizontal";
89 89 }
90 90 }
91 91 };