```ts
import { createRenderer } from "spryte";

const draw = createRenderer(canvas);

function frame() {
  draw.begin("#111", 320, 180, 2);
  draw.sprite(hero, x, y, { rotation });
  draw.sprites(spark, sparks, live); // thousands, one call
  draw.text("score 42", 8, 8);
  draw.end();
  requestAnimationFrame(frame);
}
```

# spryte

Blazing fast 2D rendering for the web: 2-4x faster than the most popular 2D web renderer, at about a seventh of its size. Every number is open and pixel-checked in [2dbench](https://github.com/debuffjp/2dbench).

```bash
npm install spryte
```

```ts
import { createRenderer } from "spryte";

const draw = createRenderer(canvas);

function frame() {
  draw.begin("#111", 320, 180, 2);
  draw.sprite(hero, x, y, { rotation });
  draw.sprites(spark, sparks, live); // thousands, one call
  draw.text("score 42", 8, 8);
  draw.end();
  requestAnimationFrame(frame);
}
```

- **2-4x faster:** 400,000 particles with every property changing at 60 fps on a laptop GPU, against 100,000 for the most popular 2D web renderer.
- **Bulk sprites:** pass a Float32Array of positions and spryte uploads it as is, with no JavaScript per sprite on WebGL2.
- **Immediate mode:** no display objects to create, pool or destroy.
- **Shapes, panels, masks and filters:** antialiased polygons, strokes and rounded rectangles, nine-slice panels, tiled fills, masks by any shape, blur and colour filters, and five blend modes. Each is an import, so an app ships only the ones it uses.
- **Render targets and shaders:** offscreen targets and custom fragment shaders for post-processing.
- **Tiny:** about 13 kB of JavaScript at startup, no dependencies, with a Canvas 2D fallback loaded only when WebGL2 is missing.
- **Verified:** fast paths are checked pixel for pixel against the simple path on a real GPU.
- **Not just games:** data visualisation, creative coding and generative art, interactive sites, simulations: anything that draws lots of moving 2D things in a browser.
- **With debuff or alone:** the renderer inside every debuff game, and a standalone MIT package.

Guides: [Getting started](/spryte/getting-started), [Sprites and frames](/spryte/sprites), [Bulk sprites and particles](/spryte/bulk-sprites), [Shapes and text](/spryte/shapes-and-text), [Transforms and clipping](/spryte/transforms-and-clipping), [Render targets and shaders](/spryte/render-targets-and-shaders), [Pixel art](/spryte/pixel-art), [Migrating from PixiJS](/spryte/migrating-from-pixijs), [Migrating from Phaser](/spryte/migrating-from-phaser), [Checking a scene with Komadori](/komadori/). Reference: [API](/api/spryte/), [Benchmarks](/benchmarks), [GitHub](https://github.com/debuffjp/spryte). Sponsor: [GitHub Sponsors](https://github.com/sponsors/debuffjp).