# pixelmapper

> Maps 2D coordinates to an array of pixels, useful for LED strip mapping

Latest version **1.2.0** (published 2016-10-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install pixelmapper
pnpm add pixelmapper
yarn add pixelmapper
bun add pixelmapper
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2016-10-22 |
| First published | 2016-08-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Stijn Martens |
| Maintainers | seymar |
| Keywords | pixel, pixels, mapping, pixel mapping, led, led strip, ledstrip, matrix, ledmatrix, led matrix |

## Links

- npm: https://www.npmjs.com/package/pixelmapper
- Repository: https://github.com/seymar/pixelmapper
- Homepage: https://github.com/seymar/pixelmapper#readme
- Issues: https://github.com/seymar/pixelmapper/issues
- npm.io page: https://npm.io/package/pixelmapper

## Recent versions

- 1.2.0 (latest) — 2016-10-22
- 1.1.7 — 2016-09-01
- 1.1.6 — 2016-09-01
- 1.1.5 — 2016-08-16
- 1.1.4 — 2016-08-16
- 1.0.3 — 2016-08-15
- 1.0.2 — 2016-08-15
- 1.0.1 — 2016-08-15
- 1.0.0 — 2016-08-15

## README

## Documentation

### Creating a mapping from components
add - Adds a single pixel<br>
line - Adds a line of pixels<br>
zigzag - Adds a zigzag pattern rectangle of pixels<br>
fillEmpty - Adds a number of pixels without corresponding coordinate<br>

Example:
```javascript
// Create a 3x3 zigzag mapping
var mapping = new Pixelmapper()
.zigzag(0, 0, 3, 3, false);
```

### Functions to do something with the created mapping
getPixel - Get the pixel at a coordinate<br>
getCoordinate - Get the coordinate of a pixel

### Object functions
toJSON - Creates a JSON string that can be used to re-create the mapping using `fromJSON`<br>
fromJSON - Used to create a mapping from a JSON string created with `toSJON`<br>
Instead of using `fromJSON` you can also use the constructor:

### Using the JSON conversion functions
The object can be converted and created to JSON:
<br><br>
Example:
```javascript
// Create a 3x3 zigzag mapping
var mapping = new Pixelmapper()
.zigzag(0, 0, 3, 3, false);

// Convert object to JSON string
var json = mapping.toJSON();

// Create new mapping object from JSON string
var mapping2 = new Pixelmapper(json);

// Or:
var mapping3 = new Pixelmapper().fromJSON(json);
```
<br><br>
For the exact arguments of the functions themselves take a look at the comments in `pixelmapper.js`.

---
_Source: https://npm.io/package/pixelmapper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
