# particles-renderer

> Particles renderer in canvas

Latest version **1.0.11** (published 2018-09-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install particles-renderer
pnpm add particles-renderer
yarn add particles-renderer
bun add particles-renderer
```

## 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 | 1.0.11 |
| Published | 2018-09-11 |
| First published | 2018-09-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Bibek Pandey |
| Maintainers | bewakes |
| Keywords | canvas, art, particles, physics |

## Links

- npm: https://www.npmjs.com/package/particles-renderer
- Repository: https://github.com/bewakes/html-js-stuffs
- Homepage: https://github.com/bewakes/html-js-stuffs/tree/master/particles
- Issues: https://github.com/bewakes/html-js-stuffs/issues
- npm.io page: https://npm.io/package/particles-renderer

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 1.0.11 (latest) — 2018-09-11
- 1.0.10 — 2018-09-10
- 1.0.9 — 2018-09-10
- 1.0.8 — 2018-09-10
- 1.0.7 — 2018-09-10
- 1.0.6 — 2018-09-10
- 1.0.5 — 2018-09-10
- 1.0.4 — 2018-09-10
- 1.0.3 — 2018-09-10
- 1.0.2 — 2018-09-10
- 1.0.1 — 2018-09-09
- 1.0.0 — 2018-09-09

## README

# PARTICLES

A simple package to rendet text as particles in HTML canvas element.  
Demo [here](https://bewakes.com/html-js-stuffs/particles/index.html)

![Demo](https://bewakes.com/media/blog-images/demo.gif "Demo")


## Usage
Import `{ ParticlesRenderer }` and use it as
```javascript
const renderer = new ParticlesRenderer(<canvas element>);
renderer.renderTextparticles('TEXT'); // Shorter text is better
renderer.start();
```
Just these lines should do the task. For further customization, you can pass in properties for renderer, particles and force(the mouse pointer) as,
```javascript
const renderer = new ParticlesRenderer(canvas, rendererProps, particleProps, forceProps);
// rendererProps, particlceProps, forceProps are just plain JS objects
```
The following are default values for renderer props:
```javascript
defaultRendererProps = {
    fps:80,
    bgColor:'black',
    width:900,
    height:900,
    particlesSpacing: 2,
}
```
The following are default values for particles props:
```javascript
{
    size: 2,
    position: {x: 0, y: 0}, // origin is center of canvas and +y is up
    velocity: {x: 0, y: 0},
    acceleration: {x: 0, y: 0},
    color: 'cyan',
    damping: 0.1,
    K: 0.01,
    restless: true, // particle won't stay static, will have small random motions even if no force acting
}
```
The following are default values for force props: 
```javascript
// force is the mouse pointer exerting some force to particles rendered
defaultForceProps = {
    position: {x: 1000, y: 1000},
    radius: 20,
    maxMagnitude: 50,
}
```
So, in case of any dynamic events, for example: resizing the page, the `cleanUp()` method should be called.
```javascfript
// The following code is the initialization
const renderer = new ParticlesRenderer(canvas);
renderer.renderTextparticles('TEXT');
renderer.start();
// Now, when you need to do cleanUp, call the method(it's recommended)
renderer.cleanUp();
```

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