# @theatrejs/theatrejs

> 🎮 A JavaScript 2D Game Engine focused on creating pixel art games.

Latest version **1.38.0** (published 2026-06-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @theatrejs/theatrejs
pnpm add @theatrejs/theatrejs
yarn add @theatrejs/theatrejs
bun add @theatrejs/theatrejs
```

## Health

**Score 55/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; has provenance.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.38.0 |
| Published | 2026-06-12 |
| First published | 2024-09-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | 24.14.0 |
| Dependencies | 0 |
| Unpacked size | 1.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 6 |
| Author | Alexandre Blondeau |
| Maintainers | deformhead |
| Keywords | 2d, canvas, engine, game, game-engine, html, html5, javascript, pixel-art, theatrejs, webgl, webgl2 |

## Links

- npm: https://www.npmjs.com/package/@theatrejs/theatrejs
- Repository: https://github.com/theatrejs/theatrejs
- Issues: https://github.com/theatrejs/theatrejs/issues
- npm.io page: https://npm.io/package/@theatrejs/theatrejs

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.38.0 (latest) — 2026-06-12
- 1.37.0 — 2026-04-30
- 1.36.0 — 2026-04-10
- 1.35.0 — 2026-04-09
- 1.34.0 — 2026-03-26
- 1.33.0 — 2026-03-22
- 1.32.0 — 2026-03-21
- 1.31.0 — 2026-03-18
- 1.30.0 — 2026-03-10
- 1.29.0 — 2026-03-06
- 1.28.0 — 2026-02-13
- 1.27.1 — 2026-02-11
- 1.27.0 — 2026-02-09
- 1.26.0 — 2026-01-07
- 1.25.2 — 2025-12-30
- … 34 more at https://npm.io/package/@theatrejs/theatrejs/versions

## README

[![Copyright](https://img.shields.io/badge/©-deformhead-white.svg)](https://github.com/deformhead) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/theatrejs/theatrejs/blob/master/LICENSE) [![Bundle Size (Gzipped)](https://img.shields.io/bundlejs/size/@theatrejs/theatrejs@latest)](https://www.npmjs.com/package/@theatrejs/theatrejs/v/latest) [![NPM Version](https://img.shields.io/npm/v/@theatrejs/theatrejs/latest)](https://www.npmjs.com/package/@theatrejs/theatrejs/v/latest)

# Theatre.js

> *🎮 A JavaScript 2D Game Engine focused on creating pixel art games.*

## Installation

```shell
npm install @theatrejs/theatrejs --save
```

## Quick Start

> *⚠️ This example does not include the preloading of assets.*

```javascript
import {Actor, Engine, Sprite, Stage, Vector2} from '@theatrejs/theatrejs';

import textureHero from './hero-16x16.png';

class Hero extends Actor {
    onCreate() {
        this.setSprite(new Sprite({
            $sizeTarget: new Vector2(16, 16),
            $texture: textureHero
        }));
    }
}

class Level1 extends Stage {
    onCreate() {
        this.createActor(Hero);
    }
}

const engine = new Engine();
engine.initiate();
engine.createStage(Level1);
```

## With Preloading

> *⚠️ Assets are preloaded asynchronously.*

#### `asynchronous module`

```javascript
import {Engine, FACTORIES, Sprite, Vector2} from '@theatrejs/theatrejs';

import textureHero from './hero-16x16.png';

class Hero extends FACTORIES.ActorWithPreloadables([FACTORIES.PreloadableTexture(textureHero)]) {
    onCreate() {
        this.setSprite(new Sprite({
            $sizeTarget: new Vector2(16, 16),
            $texture: textureHero
        }));
    }
}

class Level1 extends FACTORIES.StageWithPreloadables([Hero]) {
    onCreate() {
        this.createActor(Hero);
    }
}

const engine = new Engine();
engine.initiate();

await engine.preload(Level1);

engine.createStage(Level1);
```

#### `synchronous module`

```javascript
...

const engine = new Engine();
engine.initiate();

engine.preload(Level1).then(() => {
    engine.createStage(Level1);
});
```

## [API](https://theatrejs.github.io/theatrejs/index.html)

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