text-maze-render

1.1.3 • Public • Published

Text Maze Render

Rendering functions for mazes created with the text-maze package. Rendering is via the HTML Canvas API.

See it in use: https://littlesystem.com/maze

Install

npm install --save text-maze-render

Usage

Render a text maze with either the blocky, bordered or walled rendering function.

var tm  = require('text-maze');
var tmr = require('text-maze-render');
 
var maze = tm("I don't know half of you half as well as I should like.");
 
tmr.blocky(maze.maze, {
    cellSize: maze.cellSize,
    endpoints: maze.endpoints,
    showText: true,
    showSolution: true
});

Put a canvas tag in your HTML with an id of text-maze.

<canvas id="text-maze">

Bundle your code with something like browserify.

browserify code.js -o bundle.js

Load the bundle in your HTML.

<script src="path/to/bundle.js"></script>

Package Sidebar

Install

npm i text-maze-render

Weekly Downloads

4

Version

1.1.3

License

MIT

Last publish

Collaborators

  • jesse-blake