Module: canvas

A html5 canvas implementation of grid.base.BaseHexagonalGrid, with some helper functions.
Source:

Classes

CanvasHexagonalGrid

Methods

(inner) fillHexagon(ctx, x, y, radius)

Fills a hexagon, similar to `ctx.fillRect`
Parameters:
Name Type Description
ctx CanvasRenderingContext2D The context where the path should be defined
x Number The x coordinate of the center of the hexagon
y Number The y coordinate of the center of the hexagon
radius Number The distance from the center of the hexagon to each corner
Source:

(inner) pathHexagon(ctx, x, y, radius)

Helper function, defines a path for a regular hexagon
Parameters:
Name Type Description
ctx CanvasRenderingContext2D The context where the path should be defined
x Number The x coordinate of the center of the hexagon
y Number The y coordinate of the center of the hexagon
radius Number The distance from the center of the hexagon to each corner
Source:

(inner) strokeHexagon(ctx, x, y, radius)

Strokes a hexagon, similar to `ctx.strokeRect`
Parameters:
Name Type Description
ctx CanvasRenderingContext2D The context where the path should be defined
x Number The x coordinate of the center of the hexagon
y Number The y coordinate of the center of the hexagon
radius Number The distance from the center of the hexagon to each corner
Source: