From 08557e51a49cd5be6ed04689ff9139b6ba86c3ca Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 31 May 2024 01:07:55 +0200 Subject: pieces --- pieces/cube_austria.svg | 6 ++ pieces/cube_bavaria.svg | 6 ++ pieces/cube_france.svg | 6 ++ pieces/cube_pragmatic.svg | 6 ++ pieces/cube_prussia.svg | 6 ++ pieces/cube_saxony.svg | 6 ++ pieces/cylinder_austria_1.svg | 11 +++ pieces/cylinder_austria_2.svg | 11 +++ pieces/cylinder_austria_3.svg | 11 +++ pieces/cylinder_austria_4.svg | 11 +++ pieces/cylinder_austria_5.svg | 11 +++ pieces/cylinder_austria_6.svg | 11 +++ pieces/cylinder_bavaria_1.svg | 11 +++ pieces/cylinder_france_1.svg | 11 +++ pieces/cylinder_france_2.svg | 11 +++ pieces/cylinder_france_3.svg | 11 +++ pieces/cylinder_france_4.svg | 11 +++ pieces/cylinder_france_5.svg | 11 +++ pieces/cylinder_pragmatic_1.svg | 11 +++ pieces/cylinder_pragmatic_2.svg | 11 +++ pieces/cylinder_pragmatic_3.svg | 11 +++ pieces/cylinder_prussia_1.svg | 11 +++ pieces/cylinder_prussia_2.svg | 11 +++ pieces/cylinder_prussia_3.svg | 11 +++ pieces/cylinder_prussia_4.svg | 11 +++ pieces/cylinder_saxony_1.svg | 11 +++ pieces/disc_hussar.svg | 11 +++ tools/genpieces.mjs | 200 +++++++++++++++++++--------------------- 28 files changed, 361 insertions(+), 106 deletions(-) create mode 100644 pieces/cube_austria.svg create mode 100644 pieces/cube_bavaria.svg create mode 100644 pieces/cube_france.svg create mode 100644 pieces/cube_pragmatic.svg create mode 100644 pieces/cube_prussia.svg create mode 100644 pieces/cube_saxony.svg create mode 100644 pieces/cylinder_austria_1.svg create mode 100644 pieces/cylinder_austria_2.svg create mode 100644 pieces/cylinder_austria_3.svg create mode 100644 pieces/cylinder_austria_4.svg create mode 100644 pieces/cylinder_austria_5.svg create mode 100644 pieces/cylinder_austria_6.svg create mode 100644 pieces/cylinder_bavaria_1.svg create mode 100644 pieces/cylinder_france_1.svg create mode 100644 pieces/cylinder_france_2.svg create mode 100644 pieces/cylinder_france_3.svg create mode 100644 pieces/cylinder_france_4.svg create mode 100644 pieces/cylinder_france_5.svg create mode 100644 pieces/cylinder_pragmatic_1.svg create mode 100644 pieces/cylinder_pragmatic_2.svg create mode 100644 pieces/cylinder_pragmatic_3.svg create mode 100644 pieces/cylinder_prussia_1.svg create mode 100644 pieces/cylinder_prussia_2.svg create mode 100644 pieces/cylinder_prussia_3.svg create mode 100644 pieces/cylinder_prussia_4.svg create mode 100644 pieces/cylinder_saxony_1.svg create mode 100644 pieces/disc_hussar.svg diff --git a/pieces/cube_austria.svg b/pieces/cube_austria.svg new file mode 100644 index 0000000..ccf11af --- /dev/null +++ b/pieces/cube_austria.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/pieces/cube_bavaria.svg b/pieces/cube_bavaria.svg new file mode 100644 index 0000000..e681459 --- /dev/null +++ b/pieces/cube_bavaria.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/pieces/cube_france.svg b/pieces/cube_france.svg new file mode 100644 index 0000000..89f7171 --- /dev/null +++ b/pieces/cube_france.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/pieces/cube_pragmatic.svg b/pieces/cube_pragmatic.svg new file mode 100644 index 0000000..bc2ee56 --- /dev/null +++ b/pieces/cube_pragmatic.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/pieces/cube_prussia.svg b/pieces/cube_prussia.svg new file mode 100644 index 0000000..bc4e702 --- /dev/null +++ b/pieces/cube_prussia.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/pieces/cube_saxony.svg b/pieces/cube_saxony.svg new file mode 100644 index 0000000..ebec074 --- /dev/null +++ b/pieces/cube_saxony.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/pieces/cylinder_austria_1.svg b/pieces/cylinder_austria_1.svg new file mode 100644 index 0000000..eb0fd9a --- /dev/null +++ b/pieces/cylinder_austria_1.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_austria_2.svg b/pieces/cylinder_austria_2.svg new file mode 100644 index 0000000..151f0dc --- /dev/null +++ b/pieces/cylinder_austria_2.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_austria_3.svg b/pieces/cylinder_austria_3.svg new file mode 100644 index 0000000..8c4de32 --- /dev/null +++ b/pieces/cylinder_austria_3.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_austria_4.svg b/pieces/cylinder_austria_4.svg new file mode 100644 index 0000000..aa71d5d --- /dev/null +++ b/pieces/cylinder_austria_4.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_austria_5.svg b/pieces/cylinder_austria_5.svg new file mode 100644 index 0000000..24abe49 --- /dev/null +++ b/pieces/cylinder_austria_5.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_austria_6.svg b/pieces/cylinder_austria_6.svg new file mode 100644 index 0000000..f070deb --- /dev/null +++ b/pieces/cylinder_austria_6.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_bavaria_1.svg b/pieces/cylinder_bavaria_1.svg new file mode 100644 index 0000000..6379132 --- /dev/null +++ b/pieces/cylinder_bavaria_1.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_france_1.svg b/pieces/cylinder_france_1.svg new file mode 100644 index 0000000..4137a73 --- /dev/null +++ b/pieces/cylinder_france_1.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_france_2.svg b/pieces/cylinder_france_2.svg new file mode 100644 index 0000000..9bca443 --- /dev/null +++ b/pieces/cylinder_france_2.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_france_3.svg b/pieces/cylinder_france_3.svg new file mode 100644 index 0000000..daa1f2a --- /dev/null +++ b/pieces/cylinder_france_3.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_france_4.svg b/pieces/cylinder_france_4.svg new file mode 100644 index 0000000..d2f8bdf --- /dev/null +++ b/pieces/cylinder_france_4.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_france_5.svg b/pieces/cylinder_france_5.svg new file mode 100644 index 0000000..a635d14 --- /dev/null +++ b/pieces/cylinder_france_5.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_pragmatic_1.svg b/pieces/cylinder_pragmatic_1.svg new file mode 100644 index 0000000..0a7e1ca --- /dev/null +++ b/pieces/cylinder_pragmatic_1.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_pragmatic_2.svg b/pieces/cylinder_pragmatic_2.svg new file mode 100644 index 0000000..ae02ca2 --- /dev/null +++ b/pieces/cylinder_pragmatic_2.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_pragmatic_3.svg b/pieces/cylinder_pragmatic_3.svg new file mode 100644 index 0000000..50c507b --- /dev/null +++ b/pieces/cylinder_pragmatic_3.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_prussia_1.svg b/pieces/cylinder_prussia_1.svg new file mode 100644 index 0000000..c2a434d --- /dev/null +++ b/pieces/cylinder_prussia_1.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_prussia_2.svg b/pieces/cylinder_prussia_2.svg new file mode 100644 index 0000000..2ea5301 --- /dev/null +++ b/pieces/cylinder_prussia_2.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_prussia_3.svg b/pieces/cylinder_prussia_3.svg new file mode 100644 index 0000000..e7cd7ab --- /dev/null +++ b/pieces/cylinder_prussia_3.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_prussia_4.svg b/pieces/cylinder_prussia_4.svg new file mode 100644 index 0000000..7e1131e --- /dev/null +++ b/pieces/cylinder_prussia_4.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/cylinder_saxony_1.svg b/pieces/cylinder_saxony_1.svg new file mode 100644 index 0000000..808d92c --- /dev/null +++ b/pieces/cylinder_saxony_1.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/pieces/disc_hussar.svg b/pieces/disc_hussar.svg new file mode 100644 index 0000000..62ca5b8 --- /dev/null +++ b/pieces/disc_hussar.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/tools/genpieces.mjs b/tools/genpieces.mjs index 01f3ab2..d52bf64 100644 --- a/tools/genpieces.mjs +++ b/tools/genpieces.mjs @@ -17,69 +17,99 @@ const color_pragmatic = make_piece_colors("#5f5c5c") const color_prussia = make_piece_colors("#005988") const color_saxony = make_piece_colors("#157d36") -function print_cylinder(output, icon_file, c) { - let icon = fs.readFileSync(icon_file).toString('base64') +const IMAGE_W = 40 +const IMAGE_H = Math.round( IMAGE_W * 3/4 ) + +const RX = (IMAGE_W - 1) / 2 +const RY = (IMAGE_H - 1) / 2 +const SVG_W = RX * 2 + 3 +const SVG_H = RY * 2 + 3 +const CX = (RX * 2 + 3) / 2 +const CY = (RY * 2 + 3) / 2 + +console.log("CYLINDER", SVG_W, SVG_H) + +function mkarc(cx, cy, rx, ry, h) { + return [ + 'M', cx - rx, cy, + 'L', cx - rx, cy + h, + 'A', rx, ry, 0, 0, 0, cx + rx, cy + h, + 'L', cx + rx, cy, + 'z' + ].join(" ") +} + +function print_cylinder(output, icon_file, c, TALL=15) { + let icon = icon_file ? fs.readFileSync(icon_file).toString('base64') : null let svg = [] - svg.push('') - svg.push('') - svg.push(``) - svg.push(``) - svg.push(``) - svg.push(``) - svg.push('') + svg.push(``) + + if (icon) + svg.push(``) + + if (1) { + svg.push(``) + svg.push(``) + svg.push(``) + svg.push(``) + svg.push('') + svg.push(``) + } else { + svg.push(``) + } - svg.push(``) - svg.push(``) - svg.push(``) + if (icon) { + svg.push(``) + svg.push(``) + } else { + svg.push(``) + } svg.push('') fs.writeFileSync(output, svg.join("\n") + "\n") } function print_disc(output, icon_file, c) { - let icon = fs.readFileSync(icon_file).toString('base64') - let svg = [] - svg.push('') - svg.push('') + print_cylinder(output, icon_file, c, 8) +} - svg.push(``) - svg.push(``) - svg.push(``) - svg.push(``) - svg.push('') +const CUBE_SIDE = 20 +const CUBE_ASPECT = 3/4 +const CUBE_TALL = 15 - svg.push(``) - svg.push(``) - svg.push(``) +const CUBE_W = Math.round( CUBE_SIDE * Math.sqrt(2) ) +const CUBE_H = Math.round( CUBE_SIDE * Math.sqrt(2) * CUBE_ASPECT ) - svg.push('') - fs.writeFileSync(output, svg.join("\n") + "\n") -} +const CUBE_SVG_W = CUBE_W + 3 +const CUBE_SVG_H = CUBE_TALL + CUBE_H + 3 + +console.log("CUBE", CUBE_SVG_W, CUBE_SVG_H, CUBE_W) function print_cube(output, c) { let svg = [] - let xo = 0 - let yo = 0 - let ys = 2/3 + // let xo = 0 + // let yo = 0 + // let ys = 1 // 2/3 + + // let w = 20 + // let d = Math.sqrt(w * w + w * w) + // let h = Math.round(w * 0.8) - let w = 20 - let d = Math.sqrt(w * w + w * w) - let h = Math.round(w * 0.8) + let xo = 1.5 + let yo = 1.5 + let dx = CUBE_W + let dy = CUBE_H + let h = CUBE_TALL let v = [ - [ xo + (d/2), yo + (0) * ys ], - [ xo + (d), yo + (d/2) * ys ], - [ xo + (d/2), yo + (d) * ys ], - [ xo + (0), yo + (d/2) * ys ], + [ xo + (dx/2), yo + (0) ], + [ xo + (dx), yo + (dy/2) ], + [ xo + (dx/2), yo + (dy) ], + [ xo + (0), yo + (dy/2) ], ] - for (let xy of v) { - xy[0] = Math.round(xy[0]) + 0.5 - xy[1] = Math.round(xy[1]) + 0.5 - } - let v2 = [ [ v[1][0], v[1][1] ], [ v[1][0], v[1][1] + h ], @@ -107,7 +137,7 @@ function print_cube(output, c) { [ v[3][0], v[3][1] ], ] - svg.push('') + svg.push(``) svg.push(``) svg.push(``) @@ -119,33 +149,33 @@ function print_cube(output, c) { fs.writeFileSync(output, svg.join("\n") + "\n") } -print_cylinder("pieces/cylinder_austria_1.svg", "tools/cylinders/face_austria_1.png", color_austria) -print_cylinder("pieces/cylinder_austria_2.svg", "tools/cylinders/face_austria_2.png", color_austria) -print_cylinder("pieces/cylinder_austria_3.svg", "tools/cylinders/face_austria_3.png", color_austria) -print_cylinder("pieces/cylinder_austria_4.svg", "tools/cylinders/face_austria_4.png", color_austria) -print_cylinder("pieces/cylinder_austria_5.svg", "tools/cylinders/face_austria_5.png", color_austria) -print_cylinder("pieces/cylinder_austria_6.svg", "tools/cylinders/face_austria_6.png", color_austria) +print_cylinder("pieces/cylinder_austria_1.svg", "tools/cylinders.2x/face_austria_1.png", color_austria) +print_cylinder("pieces/cylinder_austria_2.svg", "tools/cylinders.2x/face_austria_2.png", color_austria) +print_cylinder("pieces/cylinder_austria_3.svg", "tools/cylinders.2x/face_austria_3.png", color_austria) +print_cylinder("pieces/cylinder_austria_4.svg", "tools/cylinders.2x/face_austria_4.png", color_austria) +print_cylinder("pieces/cylinder_austria_5.svg", "tools/cylinders.2x/face_austria_5.png", color_austria) +print_cylinder("pieces/cylinder_austria_6.svg", "tools/cylinders.2x/face_austria_6.png", color_austria) -print_cylinder("pieces/cylinder_bavaria_1.svg", "tools/cylinders/face_bavaria_1.png", color_bavaria) +print_cylinder("pieces/cylinder_bavaria_1.svg", "tools/cylinders.2x/face_bavaria_1.png", color_bavaria) -print_cylinder("pieces/cylinder_france_1.svg", "tools/cylinders/face_france_1.png", color_france) -print_cylinder("pieces/cylinder_france_2.svg", "tools/cylinders/face_france_2.png", color_france) -print_cylinder("pieces/cylinder_france_3.svg", "tools/cylinders/face_france_3.png", color_france) -print_cylinder("pieces/cylinder_france_4.svg", "tools/cylinders/face_france_4.png", color_france) -print_cylinder("pieces/cylinder_france_5.svg", "tools/cylinders/face_france_5.png", color_france) +print_cylinder("pieces/cylinder_france_1.svg", "tools/cylinders.2x/face_france_1.png", color_france) +print_cylinder("pieces/cylinder_france_2.svg", "tools/cylinders.2x/face_france_2.png", color_france) +print_cylinder("pieces/cylinder_france_3.svg", "tools/cylinders.2x/face_france_3.png", color_france) +print_cylinder("pieces/cylinder_france_4.svg", "tools/cylinders.2x/face_france_4.png", color_france) +print_cylinder("pieces/cylinder_france_5.svg", "tools/cylinders.2x/face_france_5.png", color_france) -print_cylinder("pieces/cylinder_pragmatic_1.svg", "tools/cylinders/face_pragmatic_1.png", color_pragmatic) -print_cylinder("pieces/cylinder_pragmatic_2.svg", "tools/cylinders/face_pragmatic_2.png", color_pragmatic) -print_cylinder("pieces/cylinder_pragmatic_3.svg", "tools/cylinders/face_pragmatic_3.png", color_pragmatic) +print_cylinder("pieces/cylinder_pragmatic_1.svg", "tools/cylinders.2x/face_pragmatic_1.png", color_pragmatic) +print_cylinder("pieces/cylinder_pragmatic_2.svg", "tools/cylinders.2x/face_pragmatic_2.png", color_pragmatic) +print_cylinder("pieces/cylinder_pragmatic_3.svg", "tools/cylinders.2x/face_pragmatic_3.png", color_pragmatic) -print_cylinder("pieces/cylinder_prussia_1.svg", "tools/cylinders/face_prussia_1.png", color_prussia) -print_cylinder("pieces/cylinder_prussia_2.svg", "tools/cylinders/face_prussia_2.png", color_prussia) -print_cylinder("pieces/cylinder_prussia_3.svg", "tools/cylinders/face_prussia_3.png", color_prussia) -print_cylinder("pieces/cylinder_prussia_4.svg", "tools/cylinders/face_prussia_4.png", color_prussia) +print_cylinder("pieces/cylinder_prussia_1.svg", "tools/cylinders.2x/face_prussia_1.png", color_prussia) +print_cylinder("pieces/cylinder_prussia_2.svg", "tools/cylinders.2x/face_prussia_2.png", color_prussia) +print_cylinder("pieces/cylinder_prussia_3.svg", "tools/cylinders.2x/face_prussia_3.png", color_prussia) +print_cylinder("pieces/cylinder_prussia_4.svg", "tools/cylinders.2x/face_prussia_4.png", color_prussia) -print_cylinder("pieces/cylinder_saxony_1.svg", "tools/cylinders/face_saxony_1.png", color_saxony) +print_cylinder("pieces/cylinder_saxony_1.svg", "tools/cylinders.2x/face_saxony_1.png", color_saxony) -print_disc("pieces/disc_hussar.svg", "tools/cylinders/face_hussar.png", color_austria) +print_disc("pieces/disc_hussar.svg", "tools/cylinders.2x/face_hussar.png", color_austria) print_cube("pieces/cube_austria.svg", color_austria) print_cube("pieces/cube_bavaria.svg", color_bavaria) @@ -153,45 +183,3 @@ print_cube("pieces/cube_france.svg", color_france) print_cube("pieces/cube_pragmatic.svg", color_pragmatic) print_cube("pieces/cube_prussia.svg", color_prussia) print_cube("pieces/cube_saxony.svg", color_saxony) - -let css = [ "/* TOKEN BORDER COLORS */" ] - -function border(base, sel) { - let rgb = parseHex(base) - // let hic = convertRgbToOklab(rgb); hic.l = Math.min(1,hic.l+0.1) - // let loc = convertRgbToOklab(rgb); loc.l = Math.max(0,loc.l-0.1) - // let shc = convertRgbToOklab(rgb); shc.l = Math.max(0,shc.l-0.4) - let hic = convertRgbToOklab(rgb); hic.l = Math.min(1,hic.l*1.2) - let loc = convertRgbToOklab(rgb); loc.l = Math.max(0,loc.l*0.8) - let shc = convertRgbToOklab(rgb); shc.l = Math.max(0,shc.l*0.4) - let sh = formatHex(shc) - let hi = formatHex(hic) - let lo = formatHex(loc) - css.push(`${sel} { background-color: ${base}; border-color: ${hi} ${lo} ${lo} ${hi}; box-shadow: 0 0 0 1px ${sh}, 0px 1px 4px #0008; }`) -} - -border("#006cb7", "#token_total_support") -border("#80643e", "#token_prop_card") -border("#d74729", "#token_oppose_plus_bases") -border("#004e81", "#token_el_presidente") -border("#6a8796", "#token_aid") -border("#01904b", ".token.shipment") -border("#4b87c0", ".token.passive_support") -border("#b75f61", ".token.passive_opposition") -border("#0054a6", ".token.active_support") -border("#991a1e", ".token.active_opposition") -border("#0054a6", ".token.govt_control") -border("#991a1e", ".token.farc_control") -border("#ffc509", ".token.farc_zone") -//border("#22010e", ".token.terror") -border("#535052", ".token.terror") -border("#535052", ".token.sabotage") -border("#9dadb3", ".token.unshaded") -border("#465c80", ".token.shaded") -border("#6d5735", ".token.reminder.sucumbios") -border("#cf1f30", ".token.reminder.senado_farc") -border("#6d9f3b", ".token.reminder.senado_cartels") -border("#ffcf00", ".token.reminder.senado_auc") -border("#8dc73f", ".token.reminder.darien") - -console.log(css.join("\n")) -- cgit v1.2.3