# kami-batch2

> sprite batching for kami

Latest version **2.0.4** (published 2019-12-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install kami-batch2
pnpm add kami-batch2
yarn add kami-batch2
bun add kami-batch2
```

## 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 | 2.0.4 |
| Published | 2019-12-18 |
| First published | 2019-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 17.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | implicit-invocation |
| Keywords | webgl, glsl, batch, sprite, batching, image, 2d, images, kami, rendering, render, renderer |

## Links

- npm: https://www.npmjs.com/package/kami-batch2
- Repository: https://github.com/implicit-invocation/kami-batch
- Homepage: https://github.com/implicit-invocation/kami-batch#readme
- Issues: https://github.com/implicit-invocation/kami-batch/issues
- npm.io page: https://npm.io/package/kami-batch2

## Dependencies (6)

- [klasse](https://npm.io/package/klasse.md) ~1.0.8
- [gl-matrix](https://npm.io/package/gl-matrix.md) ^2.8.1
- [kami-shader](https://npm.io/package/kami-shader.md) ~1.0.0
- [number-util](https://npm.io/package/number-util.md) ~1.0.2
- [kami-base-batch](https://npm.io/package/kami-base-batch.md) ^1.0.5
- [kami-mesh-buffer](https://npm.io/package/kami-mesh-buffer.md) ^1.0.3

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 2.0.4 (latest) — 2019-12-18

## README

# kami-batch

[![unstable](http://badges.github.io/stability-badges/dist/unstable.svg)](http://github.com/badges/stability-badges)

A fast and efficient 2D sprite batcher based loosely on LibGDX's implementation.

## Usage

[![NPM](https://nodei.co/npm/kami-batch.png)](https://nodei.co/npm/kami-batch/)

See [examples](examples/) folder for details. A full program could look like this:

```js
//setup a canvas
var gl = require('webgl-context')({
    width: 512,
    height: 512
});

//an opaque white texture, useful for tinting lines and rectangles
var tex = require('kami-white-texture')(gl);

//create a sprite batcher
var batch = require('kami-batch')(gl);

batch.begin();

//tint the vertex attributes
batch.setColor(1,0,0);

//draw some sprites
batch.draw(tex, 0, 0, 256, 256);
batch.draw(tex, 5, 5, 12, 51);

//submit to GPU
batch.end();

//add to DOM
document.body.appendChild( gl.canvas );
```

## Planned Changes

- use projection matrices instead of a vector
- support rotation on the fly

## License

MIT, see [LICENSE.md](http://github.com/mattdesl/kami-batch/blob/master/LICENSE.md) for details.

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