JS library to procedurally generate starships. Based on a procedural generation monthly challenge entry from Reddit by green_meklar, used with permission.
# npm
npm install starshipwright --save
# yarn
yarn add starshipwrightimport { generateShip, generateOutlineClassic } from 'starshipwright';
...
const colorSeed = 1;
const shipSeed = 2;
const layoutSeed = 3;
const outline = generateOutlineClassic(layoutSeed);
const shipCanvas = generateShip(outline, colorSeed, shipSeed); // HTML CanvasReturns a canvas that contains the generated ship based on an outline and 2 numeric seeds: color, ship (which determines that style), layout (size & shape), and optionally a forced size`.
Returns a canvas representing the outline of the ship; internally, it uses a voronoi algorithm to create the shape. The layout seed determines the size and shape, and it's possible to force a size with the forceSize parameter.
Returns a canvas representing the outline of the ship; internally, it uses the original algorithm to create the shape. The layout seed determines the size and shape, and it's possible to force a size with the forceSize parameter.
Returns a canvas representing the outline of the ship; internally, it uses a algorithm focused on byte size to create the shape. The layout seed determines the size and shape, and it's possible to force a size with the forceSize parameter.
Check it out here.