2.12.0 • Published 8 months ago

tsparticles-preset-bubbles v2.12.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

banner

tsParticles Bubbles Preset

jsDelivr npmjs npmjs GitHub Sponsors

tsParticles preset for colored bubbles coming from the bottom of the screen on a white background.

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-bubbles@2/tsparticles.preset.bubbles.min.js"></script>

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-bubbles@2/tsparticles.preset.bubbles.bundle.min.js"></script>

Usage

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

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

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

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: "bubbles",
});

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 { loadBubblesPreset } from "tsparticles-preset-bubbles";

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 loadBubblesPreset(engine);
  }

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

    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: "bubbles",
};

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

Angular

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

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

Svelte

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

let particlesInit = async (engine) => {
  await loadBubblesPreset(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]
uop[Opacity]
uou[Out Modes]
usi[Size]
end

e --> u

subgraph pr [Presets]
prbu[Bubbles]
end

mb & ple & sc & uc & uop & uou & usi --> prbu
2.11.0

9 months ago

2.10.1

10 months ago

2.10.0

10 months ago

2.12.0

8 months ago

2.8.0

1 year ago

2.9.2

1 year ago

2.9.1

1 year ago

2.9.3

1 year ago

2.9.0

1 year ago

2.4.0

1 year ago

2.7.0

1 year ago

2.7.1

1 year ago

2.6.0

1 year ago

2.5.0

1 year ago

2.5.2

1 year ago

2.5.1

1 year ago

2.5.3

1 year ago

2.3.0

2 years ago

2.3.2

2 years ago

2.3.1

2 years ago

2.3.4

1 year ago

2.3.3

1 year 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

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.6

2 years ago

1.42.0

2 years ago

1.42.2

2 years ago

1.42.1

2 years ago

1.42.4

2 years ago

1.42.3

2 years ago

1.43.1

2 years ago

1.43.0

2 years ago

1.41.6

2 years ago

2.0.2

2 years ago

1.40.0

2 years ago

1.40.2

2 years ago

1.40.1

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.23.0

2 years ago

1.41.1

2 years ago

1.41.0

2 years ago

2.0.0-beta.5

2 years ago

1.41.3

2 years ago

2.0.0-beta.4

2 years ago

1.41.2

2 years ago

2.0.0-beta.3

2 years ago

1.41.5

2 years ago

1.24.1

2 years ago

1.41.4

2 years ago

1.24.2

2 years ago

1.24.0

2 years ago

1.24.3

2 years ago

1.22.6

2 years ago

1.22.4

2 years ago

1.22.5

2 years ago

1.22.0

2 years ago

1.22.3

2 years ago

1.22.1

2 years ago

1.22.2

2 years ago

1.21.0

2 years ago

2.0.0-beta.2

2 years ago

2.0.0-beta.1

2 years ago

2.0.0-beta.0

2 years ago

1.20.4

2 years ago

1.20.3

2 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.13.2

3 years ago

1.14.0

3 years ago

1.13.1

3 years ago

1.13.0

3 years ago

1.11.3

3 years ago

1.12.0

3 years ago

2.0.0-alpha.7

3 years ago

1.11.2

3 years ago

1.11.1

3 years ago

1.11.0

3 years ago

1.10.0

3 years ago

1.9.3

3 years ago

2.0.0-alpha.6

3 years ago

1.9.2

3 years ago

1.9.1

3 years ago

1.9.0

3 years ago

1.8.0

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.0

3 years ago

1.5.1

3 years ago

2.0.0-alpha.5

3 years ago

1.5.0

3 years ago