symbol2array
v1.4.15
Published
symbol2array generates a two-dimensional array from circle, square, diamond and triangle
Downloads
42
Readme
symbol2array
symbol2array generates a two-dimensional array from circle, square, diamond and triangle
examples
import { SymbolCreator } from 'symbol2array'
const symbolCreator = new SymbolCreator()
symbolCreator.createSymbol('circle', 10, 1).toArray()
// [
// [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
// [0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
// [0, 1, 1, 0, 0, 0, 0, 1, 1, 0],
// [0, 1, 0, 0, 0, 0, 0, 0, 1, 0],
// [0, 1, 0, 0, 0, 0, 0, 0, 1, 0],
// [0, 1, 0, 0, 0, 0, 0, 0, 1, 0],
// [0, 1, 0, 0, 0, 0, 0, 0, 1, 0],
// [0, 1, 1, 0, 0, 0, 0, 1, 1, 0],
// [0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
// [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
// ]
symbolCreator.createSymbol('square', 10, 1).toArray()
// [
// [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
// [1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
// [1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
// [1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
// [1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
// [1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
// [1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
// [1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
// [1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
// [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
// ]
symbolCreator.createSymbol('diamond', 11, 1).toArray()
// [
// [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
// [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0],
// [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],
// [0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0],
// [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0],
// [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
// [0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0],
// [0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0],
// [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],
// [0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0],
// [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
// ]
symbolCreator.createSymbol('triangle', 13, 1).toArray()
// [
// [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
// [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
// [0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0],
// [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
// [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0],
// [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
// [0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0],
// [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
// [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
// [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
// [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
// [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
// [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
// ]