1.0.1 • Published 2 years ago

pixel-character v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

🚀 pixel-character

1. Installation

npm i pixel-character

2. Loading

import pixelCharacter from "pixel-character"

3. Usage

const dots = pixelCharacter(character, row, column)
  • character \<number>\<string>
    • The characters you need to convert
    • default: "F"
  • row\<number>

    • The number of rows in the generated two-dimensional lattice array
    • The number must be greater than 12
    • default: 12
  • column<number>

    • The number of columns in the generated two-dimensional lattice array
    • The number must be greater than 12
    • default: 12

4. Example

import pixelCharacter from "pixel-character"
const dots = pixelCharacter("A",12,12)
console.log(dots)
/* console result */
//0 => blank
//1 => fill
[
	[0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0],
	[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],
	[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],
	[0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],
	[0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0],
	[0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0],
	[0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0],
	[0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0],
	[0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0],
	[0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0],
	[0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0],
	[0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0],
]
const dots = pixelCharacter("哈",20,20)
/* console result */
//0 => blank
//1 => fill
[
	[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0],
	[1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
	[1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
	[1, 1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