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

https://github.com/tsparticles/inferno

Inferno.js tsParticles official component
https://github.com/tsparticles/inferno

hacktoberfest inferno javascript tsparticles typescript

Last synced: 5 months ago
JSON representation

Inferno.js tsParticles official component

Awesome Lists containing this project

README

          

[![banner](https://particles.js.org/images/banner3.png)](https://particles.js.org)

# inferno-particles

[![npm](https://img.shields.io/npm/v/inferno-particles)](https://www.npmjs.com/package/inferno-particles) [![npm](https://img.shields.io/npm/dm/inferno-particles)](https://www.npmjs.com/package/inferno-particles) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)

Official [tsParticles](https://github.com/matteobruni/tsparticles) Inferno component

[![Discord](https://particles.js.org/images/discord.png)](https://discord.gg/hACwv45Hme) [![Telegram](https://particles.js.org/images/telegram.png)](https://t.me/tsparticles)

[![tsParticles Product Hunt](https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=186113&theme=light)](https://www.producthunt.com/posts/tsparticles?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-tsparticles")

## Installation

```shell
npm install inferno-particles
```

or

```shell
yarn add inferno-particles
```

## How to use

### Code

Examples:

_Remote url_

```javascript
import Particles from "inferno-particles";
import { loadFull } from "tsparticles";

class App extends Component {
constructor(props) {
super(props);

this.particlesInit = this.particlesInit.bind(this);
this.particlesLoaded = this.particlesLoaded.bind(this);
}

particlesInit(main) {
console.log(main);

// you can initialize the tsParticles instance (main) here, adding custom shapes or presets
// this loads the tsparticles package bundle, it's the easiest method for getting everything ready
// starting from v2 you can add only the features you need reducing the bundle size
loadFull(main);
}

particlesLoaded(container) {
console.log(container);
}

render() {
return (

);
}
}
```

_Options object_

```javascript
import Particles from "inferno-particles";
import { loadFull } from "tsparticles";

class App extends Component {
constructor(props) {
super(props);

this.particlesInit = this.particlesInit.bind(this);
this.particlesLoaded = this.particlesLoaded.bind(this);
}

particlesInit(main) {
console.log(main);

// you can initialize the tsParticles instance (main) here, adding custom shapes or presets
// this loads the tsparticles package bundle, it's the easiest method for getting everything ready
// starting from v2 you can add only the features you need reducing the bundle size
loadFull(main);
}

particlesLoaded(container) {
console.log(container);
}

render() {
return (

);
}
}
```

### Props

| Prop | Type | Definition |
| --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| id | string | The id of the element. |
| width | string | The width of the canvas. |
| height | string | The height of the canvas. |
| options | object | The options of the particles instance. |
| url | string | The remote options url, called using an AJAX request |
| style | object | The style of the canvas element. |
| className | string | The class name of the canvas wrapper. |
| canvasClassName | string | the class name of the canvas. |
| container | object | The instance of the [particles container](https://particles.js.org/docs/modules/Core_Container.html) |
| init | function | This function is called after the tsParticles instance initialization, the instance is the parameter and you can load custom presets or shapes here |
| loaded | function | This function is called when particles are correctly loaded in canvas, the current container is the parameter and you can customize it here |

Find your parameters configuration [here](https://particles.js.org).

## Demos

The demo website is [here](https://particles.js.org)

There's also a CodePen collection actively maintained and updated [here](https://codepen.io/collection/DPOage)