drive-on-metz-svgcountercalculator

creates svg images for Drive on Metz wargame

Usage no npm install needed!

<script type="module">
  import driveOnMetzSvgcountercalculator from 'https://cdn.skypack.dev/drive-on-metz-svgcountercalculator';
</script>

README

Create a script reads the unit data for the Drive on Metz wargame.

It then uses the svgCounterCalculator to create a svg text of the counter image, and then saves the svg data as an svg file.

usage:

var fs = require('fs');
var units = require('drive-on-metz-unit-data');
var SvgCounterCalculator = require('drive-on-metz-svgcountercalculator');
var svgCounterCalculator = new SvgCounterCalculator();

for(var i=0;i < units.length;i++){
    var unit = units[i];
    var filename = unit.id + ".svg";
    var svgData = svgCounterCalculator.getSVGtag(unit, '0.32');

    fs.unlink(filename, function (err) {
        if (err) throw err;
    });
    fs.appendFile(filename, svgData, function (err) {
        if (err) throw err;
    });
}