Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/litecanvas/utils

🛠️ Small collection of tools for developing games with litecanvas.
https://github.com/litecanvas/utils

camera litecanvas math utilities vector

Last synced: about 2 months ago
JSON representation

🛠️ Small collection of tools for developing games with litecanvas.

Awesome Lists containing this project

README

        

# Litecanvas Utilities

Small collection of tools for developing games with [Litecanvas](https://github.com/litecanvas/game-engine).

## Install

### NPM package

```
npm i @litecanvas/utils
```

```js
// import everything
import * as utils from "@litecanvas/utils"

const pos = utils.vec(0, 0)
```

```js
// or import just what you want
import { vec } from "@litecanvas/utils"

const pos = vec(0, 0)
```

### CDN

Download from https://unpkg.com/browse/@litecanvas/utils/dist/ and load in a `` tag in your HTML.

```js
// now the "utils" namespace is created
const pos = utils.vec(0, 0)
```

```js
// also, you can call this once to
// expose the components globally
utils.global()

// now the namescape is not required
const pos = vec(0, 0)
```

## Components

- **Camera**: Move-, zoom- and rotatable camera with shake. [Usage & Docs](https://github.com/litecanvas/utils/tree/main/src/camera)
- **Vector**: Modular 2D vector. [Usage & Docs](https://github.com/litecanvas/utils/tree/main/src/vector)
- **Actor**: class to represent game entities. [Usage & Docs](https://github.com/litecanvas/utils/tree/main/src/actor)
- **Grid**: class to handle retangular grid areas. [Usage & Docs](https://github.com/litecanvas/utils/tree/main/src/grid)
- **Collision** utilities. [Usage & Docs](https://github.com/litecanvas/utils/tree/main/src/collision)
- **Tween** to create animations. [Usage & Docs](https://github.com/litecanvas/utils/tree/main/src/tween)
- And some [math utilities](https://github.com/litecanvas/utils/tree/main/src/math)...