terrain.js
Minimal JavaScript fantasy map generator.
Author: Leonardo FLorez
Can be used as a plain script, or a Node.js module.
Script tag usage
In the browser, include d3
and terrain.min.js
:
Optionally, a web worker may include terrain.worker.min.js
, which attempts to be as tiny as possible, and does not include drawing functions (drawMap
, colorMap
)
// Generate a Map.// terrain.generateMap(numberOfPoints, seedString, useSeed);var aMap = terrain; // Draw a map to a svg element.// terrain.drawMap(svgElement, points, coast, rivers);var svgElement = d3;terrain; // Color a map inside a svg element.// terrain.drawMap(svgElement, points, colorFn);terrain;
Node.js usage
npm install fantasy-map-generator
// Generate a Map.var terrain = ;terrain;
Version notes
-
Version 0.0.3
- Fix adding
web
andwebWorker
builds, ignored by.npmignore
- Fix adding
-
Version 0.0.2
- Add getting svg example in the
README
- Save to png in the demo (
gh-pages
branch) - Add
web
andwebWorker
builds (npm-module
branch)
- Add getting svg example in the
-
Version 0.0.1 initial release
License: MIT
Copyright 2017 Leonardo Florez.