index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
path: root/index.html
diff options
author | Catalin Mititiuc <Catalin.Mititiuc@gmail.com> | 2024-03-17 19:24:27 -0700 |
---|---|---|
committer | Catalin Mititiuc <Catalin.Mititiuc@gmail.com> | 2024-03-17 19:36:24 -0700 |
commit | ffd47d49c73d4301b3bfdd30c1cc28420587b65a (patch) | |
tree | 88b23a0f1ee514718531f33bf0924eeb9446cf9e /index.html | |
parent | 3a1a981506da2c214596942780e493d1142d150f (diff) |
Best points align
Diffstat (limited to 'index.html')
-rw-r--r-- | index.html | 29 |
1 files changed, 14 insertions, 15 deletions
@@ -11,10 +11,11 @@ circle { fill: red; + opacity: 0.33; } image { - transform: scale(3.41); + transform: scale(3.41) rotate(-0.15deg); opacity: 0.33; } </style> @@ -42,7 +43,7 @@ var columnCount = 33, rowCount = 25, - pointDistanceInInches = 1.05; + pointDistanceInInches = 1.044; var isOdd = n => n % 2 === 1; @@ -50,24 +51,22 @@ rows = [...Array(rowCount).keys()], columnCoords = columns.map(x => x * pointDistanceInInches), rowCoords = rows.map(y => y * pointDistanceInInches), - pointCoords = rowCoords.map((y, index) => isOdd(index) ? columnCoords.slice(0, -1).map(x => [x, y]) : columnCoords.map(x => [x, y])); + pointCoords = rowCoords.map((y, index) => + (isOdd(index) ? columnCoords.slice(0, -1) : columnCoords).map(x => [x, y]) + ); - var xOffset = yOffset = 0.25; + var xOffset = 0.4, + yOffset = 0.2; + calcY = Math.sqrt(3) * pointDistanceInInches / 2 * 0.945, + alternatingOffset = pointDistanceInInches / 2; pointCoords.forEach((row, index) => row.forEach(([x, y]) => { var circle = document.createElementNS(svgns, 'circle'), - calcY = Math.sqrt(3) * pointDistanceInInches / 2 * 0.93; - - if (isOdd(index)) { - var alternatingOffset = pointDistanceInInches / 2; - - circle.setAttributeNS(null, 'cx', `${x + xOffset + alternatingOffset}in`); - circle.setAttributeNS(null, 'cy', `${calcY * y + yOffset}in`); - } else { - circle.setAttributeNS(null, 'cx', `${x + xOffset}in`); - circle.setAttributeNS(null, 'cy', `${calcY * y + yOffset}in`); - } + cx = x + xOffset + (isOdd(index) ? alternatingOffset : 0), + cy = calcY * y + yOffset; + circle.setAttributeNS(null, 'cx', `${cx}in`); + circle.setAttributeNS(null, 'cy', `${cy}in`); circle.setAttributeNS(null, 'r', '0.1in'); svg.appendChild(circle); })); |