2.12.0 • Published 1 year ago

tsparticles-preset-fountain v2.12.0

Weekly downloads
6
License
MIT
Repository
github
Last release
1 year ago

banner

tsParticles Fountain Preset

jsDelivr npmjs npmjs GitHub Sponsors

tsParticles preset creating random positioned falling colored particles that break when hitting the ground.

Slack Discord Telegram

tsParticles Product Hunt

Sample

demo

How to use it

CDN / Vanilla JS / jQuery

The first step is installing tsParticles following the instructions for vanilla javascript in the main project here

Once installed you need one more script to be included in your page (or you can download that from jsDelivr:

<script src="https://cdn.jsdelivr.net/npm/tsparticles-engine@2/tsparticles.engine.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-move-base@2/tsparticles.move.base.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-plugin-emitters@2/tsparticles.plugin.emitters.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-shape-circle@2/tsparticles.shape.circle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-color@2/tsparticles.updater.color.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-opacity@2/tsparticles.updater.opacity.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-out-modes@2/tsparticles.updater.out-modes.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-size@2/tsparticles.updater.size.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/tsparticles-preset-fountain@2/tsparticles.preset.fountain.min.js"></script>

This script MUST be placed after the tsParticles one.

Bundle

A bundled script can also be used, this will include every needed plugin needed by the preset.

<script src="https://cdn.jsdelivr.net/npm/tsparticles-preset-fountain@2/tsparticles.preset.fountain.bundle.min.js"></script>

Usage

Once the scripts are loaded you can set up tsParticles like this:

(async () => {
  await loadFountainPreset(tsParticles); // this is required only if you are not using the bundle script

  await tsParticles.load("tsparticles", {
    preset: "fountain",
  });
})();

Customization

Important ⚠️ You can override all the options defining the properties like in any standard tsParticles installation.

tsParticles.load("tsparticles", {
  particles: {
    shape: {
      type: "square", // starting from v2, this require the square shape script
    },
  },
  preset: "fountain",
});

Like in the sample above, the circles will be replaced by squares.

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-particles";
import type { Engine } from "tsparticles-engine";
import { loadFountainPreset } from "tsparticles-preset-fountain";

export class ParticlesContainer extends React.PureComponent<IProps> {
  // this customizes the component tsParticles installation
  async customInit(engine: Engine): Promise<void> {
    // this adds the preset to tsParticles, you can safely use the
    await loadFountainPreset(engine);
  }

  render() {
    const options = {
      preset: "fountain",
    };

    return <Particles options={options} init={this.customInit} />;
  }
}

Vue (2.x and 3.x)

The syntax for Vue.js 2.x and 3.x is the same

<Particles id="tsparticles" :particlesInit="particlesInit" :options="particlesOptions" />
const particlesOptions = {
  preset: "fountain",
};

async function particlesInit(engine: Engine): Promise<void> {
  await loadFountainPreset(engine);
}

Angular

<ng-particles [id]="id" [options]="particlesOptions" [particlesInit]="particlesInit"></ng-particles>
const particlesOptions = {
  preset: "fountain",
};

async function particlesInit(engine: Engine): Promise<void> {
  await loadFountainPreset(engine);
}

Svelte

<Particles
        id="tsparticles"
        options={particlesOptions}
        particlesInit={particlesInit}
/>
let particlesOptions = {
  preset: "fountain",
};

let particlesInit = async (engine) => {
  await loadFountainPreset(engine);
};

flowchart TD

subgraph m [Movers]
mb[Base]
end

e[tsParticles Engine] --> m

subgraph pl [Plugins]
ple[Emitters]
end

e --> pl

subgraph s [Shapes]
sc[Circle]
end

e --> s

subgraph u [Updaters]
uc[Color]
ud[Destroy]
uop[Opacity]
uou[Out Modes]
usi[Size]
end

e --> u

subgraph pr [Presets]
prfo[Fountain]
end

e --> pr

mb & ple & sc & uc & ud & uop & uou & usi --> prfo
2.11.0

1 year ago

2.10.1

1 year ago

2.10.0

1 year ago

2.12.0

1 year ago

2.8.0

2 years ago

2.9.2

2 years ago

2.9.1

2 years ago

2.9.3

2 years ago

2.9.0

2 years ago

2.4.0

2 years ago

2.7.0

2 years ago

2.7.1

2 years ago

2.6.0

2 years ago

2.5.0

2 years ago

2.5.2

2 years ago

2.5.1

2 years ago

2.5.3

2 years ago

2.3.0

2 years ago

2.3.2

2 years ago

2.3.1

2 years ago

2.3.4

2 years ago

2.3.3

2 years ago

2.2.4

2 years ago

2.2.1

2 years ago

2.2.0

2 years ago

2.2.3

2 years ago

2.2.2

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.4

2 years ago

2.1.3

2 years ago

2.1.0

2 years ago

2.0.3

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.6

3 years ago

1.42.0

3 years ago

1.42.2

3 years ago

1.42.1

3 years ago

1.42.4

3 years ago

1.42.3

3 years ago

1.43.1

3 years ago

1.43.0

3 years ago

1.41.6

3 years ago

2.0.2

3 years ago

1.40.0

3 years ago

1.40.2

3 years ago

1.40.1

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.41.1

3 years ago

1.41.0

3 years ago

2.0.0-beta.5

3 years ago

1.41.3

3 years ago

2.0.0-beta.4

3 years ago

1.41.2

3 years ago

2.0.0-beta.3

3 years ago

1.41.5

3 years ago

1.41.4

3 years ago

1.22.6

3 years ago

1.23.0

3 years ago

1.24.1

3 years ago

1.24.2

3 years ago

1.24.0

3 years ago

1.24.3

3 years ago

1.22.4

3 years ago

1.22.5

3 years ago

1.22.0

3 years ago

1.22.3

3 years ago

1.22.1

3 years ago

1.22.2

3 years ago

1.21.0

3 years ago

2.0.0-beta.2

3 years ago

2.0.0-beta.1

3 years ago

2.0.0-beta.0

3 years ago

1.20.4

3 years ago

1.20.3

3 years ago

1.20.2

3 years ago

1.20.1

3 years ago

1.20.0

3 years ago

1.19.1

3 years ago

1.19.0

3 years ago

1.18.3

3 years ago

1.18.2

3 years ago

1.18.1

3 years ago

1.18.0

3 years ago

1.17.0

3 years ago

1.16.1

3 years ago

1.16.0

3 years ago

1.15.4

3 years ago

1.15.3

3 years ago

1.15.2

3 years ago

1.15.0

3 years ago

1.15.1

3 years ago

1.14.1

3 years ago

1.14.2

3 years ago

1.14.0

3 years ago

1.13.2

3 years ago

1.13.1

3 years ago

1.13.0

3 years ago

1.12.0

4 years ago

1.11.3

4 years ago

2.0.0-alpha.7

4 years ago

1.11.2

4 years ago

1.11.1

4 years ago

1.11.0

4 years ago

1.10.0

4 years ago

1.9.3

4 years ago

2.0.0-alpha.6

4 years ago

1.9.2

4 years ago

1.9.1

4 years ago

1.9.0

4 years ago

1.8.0

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

2.0.0-alpha.5

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

2.0.0-alpha.4

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

2.0.0-alpha.3

4 years ago

1.3.12

4 years ago

2.0.0-alpha.1

4 years ago

2.0.0-alpha.2

4 years ago

2.0.0-alpha.0

4 years ago

1.4.0-alpha.5

4 years ago

1.4.0-alpha.4

4 years ago

1.4.0-alpha.3

4 years ago

1.4.0-alpha.2

4 years ago

1.4.0-alpha.1

4 years ago

1.4.0-alpha.0

4 years ago

1.3.11

4 years ago

1.3.10

4 years ago

1.3.9

4 years ago

1.3.8

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.3.0-beta.5

4 years ago

1.3.0-beta.4

4 years ago

1.3.0-beta.1

4 years ago

1.3.0-beta.2

4 years ago

1.3.0-beta.3

4 years ago

1.3.0-beta.0

4 years ago

1.3.0-alpha.14

4 years ago