diff options
author | Anthony Wang | 2024-01-29 17:06:38 -0500 |
---|---|---|
committer | Anthony Wang | 2024-04-13 04:32:13 +0000 |
commit | 178b73465b54141ec99e96f589a928b089252a88 (patch) | |
tree | 6f668e718933c998e929fb5920328fc202078a5b /script.js | |
parent | b94b24ab0d7411cb7f26f2e671ba7ed7d6e99e41 (diff) |
Position objects more compactly
Diffstat (limited to 'script.js')
-rw-r--r-- | script.js | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -10,10 +10,11 @@ let rad = 10 // Stroke radius let size = 200 // SVG width and height let A = [] // Objects let cnt = 0 +let rowsize = Math.floor(window.innerWidth / 1.1 / size) document.querySelectorAll("svg").forEach(function(svg) { // Move objects so they aren't overlapping - svg.style.left = 1.5 * size * (cnt % 2) + "px" - svg.style.top = 1.5 * size * Math.floor(cnt / 2) + "px" + svg.style.left = 1.1 * size * (cnt % rowsize) + "px" + svg.style.top = 1.1 * size * Math.floor(cnt / rowsize) + "px" cnt++ let a = { id: svg.id, // Unique ID |