# thpace

> Thpace is a pretty canvas creation of mine. It makes a space animation out of triangles.

Latest version **2.0.3** (published 2024-11-06) · ISC license · 0 weekly downloads

## Install

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

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2024-11-06 |
| First published | 2020-02-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 171.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 60 |
| Author | Braedin Jared |
| Maintainers | imbaedin |

## Links

- npm: https://www.npmjs.com/package/thpace
- Repository: https://github.com/ImBaedin/Thpace
- Homepage: https://github.com/ImBaedin/Thpace#readme
- Issues: https://github.com/ImBaedin/Thpace/issues
- npm.io page: https://npm.io/package/thpace

## Dependencies (4)

- [tslib](https://npm.io/package/tslib.md) ^2.8.1
- [stats.js](https://npm.io/package/stats.js.md) ^0.17.0
- [delaunator](https://npm.io/package/delaunator.md) ^4.0.1
- [color-interpolate](https://npm.io/package/color-interpolate.md) ^1.0.5

## Recent versions

- 2.0.3 (latest) — 2024-11-06
- 2.0.2 — 2022-06-02
- 2.0.1 — 2022-03-16
- 2.0.0 — 2022-03-16
- 1.3.0 — 2021-02-15
- 1.2.0 — 2020-05-26
- 1.1.2 — 2020-02-28
- 1.1.1 — 2020-02-26
- 1.1.0 — 2020-02-25
- 1.0.5 — 2020-02-19
- 1.0.4 — 2020-02-19
- 1.0.3 — 2020-02-19
- 1.0.2 — 2020-02-19
- 1.0.1 — 2020-02-19
- 1.0.0 — 2020-02-19

## README

# Thpace

Thpace is a pretty canvas creation of mine. It makes a space animation out of triangles.

[Example](https://www.braedin.com/Thpace/)

# Usage

You can install Thpace through NPM as a module, or through a CDN

## NPM

`yarn add thpace` \- or - `npm install thpace`

## CDN

`https://unpkg.com/thpace` Will get you the minified build

Then, you can import:

```html
<script src="https://unpkg.com/thpace"></script>
```

## Ok but like what code do I write to use it?

```js
import { ThpaceGL } from 'thpace';
// or
const { ThpaceGL } = require('thpace');
// or, if you used the CDN, skip those

const canvas = document.querySelector('#make-me-cool');

const settings = {
	colors: ['#4CB1EF', '#424959', '#FF4B44'],
	triangleSize: 100,
};

ThpaceGL.create(canvas, settings);
```

# Some Info

## Settings

| Setting | Accepts | Default | Description |
| --- | --- | --- | --- |
| `triangleSize` | number | `130` | Triangle size (px) |
| `bleed` | number | `120` | Bleed amount over canvas edges (px) |
| `noise` | number | `60` | Noise used when calculating points (px) |
| `colors` | Array\<string> | `['rgba(11,135,147,1)', 'rgba(54,0,51,1)']` | Array of colors to use for the gradient |
| `pointVariationX` | number | `20` | How much the points should shift on the x-axis (px) |
| `pointVariationY` | number | `35` | How much the points should shift on the y-axis (px) |
| `pointAnimationSpeed` | number | `7500` | How fast the points should complete a loop (ms) |
| `animationOffset` | number | `250` | Interval on the x-axis for the animation offset (px) |
| `maxFps` | number | `144` | Limit how many frames are drawn per second |
| `automaticResize` | boolean | `true` | Set to false to prevent Thpace from reacting to resize events |
| `particleSettings` | ParticleSettings | `{}` | Settings for the particles |

### Particle Settings

| Setting | Accepts | Default | Description |
| --- | --- | --- | --- |
| `count` | number \|\| `[min, max]` | `[2, 5]` | How many particles should be generated per 100 pixels |
| `interval` | number \|\| `[min, max]` | `[5000, 10000]` | Interval for a particle to complete it's animation (ms) |
| `radius` | number \|\| `[min, max]` | `[1, 2]` | Particle radius (px) |
| `opacity` | number \|\| `[min, max]` | `[.1, .7]` | Particle opacity |
| `variationX` | number \|\| `[min, max]` | `[5, 15]` | Variation in the particle animation on the x-axis (px) |
| `variationY` | number \|\| `[min, max]` | `[2.5, 7.5]` | Variation in the particle animation on the y-axis (px) |
| `color` | string | `#ffffff` | Color of the particles |

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