1.0.1 • Published 4 years ago
tsparticles-preset-halloween-bats v1.0.1
tsParticles Preset Halloween Bats
Sample

This is my presset for tsparticles
You can find more details at tsparticles's document and its github repository
How to use it
React.js / Preact / Inferno
The syntax for React.js, Preact and Inferno is the same.
This sample uses the class component syntax, but you can use hooks as well (if the library supports it).
import Particles from "react-tsparticles";
import { Main } from "tsparticles";
import { loadFlyingBat } from "tsparticles-preset-halloween-bats";
export class ParticlesContainer extends React.PureComponent<IProps> {
// this customizes the component tsParticles installation
customInit(main: Main) {
// this adds the preset to tsParticles, you can safely use the
loadFlyingBat(main);
}
render() {
const options = {
preset: "FlyingBat",
};
return <Particles options={options} init={this.customInit} />;
}
}If you preffer using function :
import Particles from "react-tsparticles";
import { Main } from "tsparticles";
import { loadFlyingBat } from "tsparticles-preset-halloween-bats";
function particlesInit(Main) {
loadFlyingBat(Main);
}
export default function Bat() {
return (
<Particles
options={{
preset: "FlyingBat",
}}
init={particlesInit}
/>
);
}Customization
Important ⚠️
You can override all the options defining the properties like in any standard tsParticles installation.
const options = {
background: {
color: "#e83b00",
},
preset: "FlyingBat",
};Options
You can find all options available here 📖