@tsparticles/preset-bubbles 3.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Matteo Bruni
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,200 @@
1
+ [![banner](https://particles.js.org/images/banner3.png)](https://particles.js.org)
2
+
3
+ # tsParticles Bubbles Preset
4
+
5
+ [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/@tsparticles/preset-bubbles/badge)](https://www.jsdelivr.com/package/npm/@tsparticles/preset-bubbles) [![npmjs](https://badge.fury.io/js/@tsparticles/preset-bubbles.svg)](https://www.npmjs.com/package/@tsparticles/preset-bubbles) [![npmjs](https://img.shields.io/npm/dt/@tsparticles/preset-bubbles)](https://www.npmjs.com/package/@tsparticles/preset-bubbles) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
6
+
7
+ [tsParticles](https://github.com/matteobruni/tsparticles) preset for colored bubbles coming from the bottom of the
8
+ screen on a white background.
9
+
10
+ [![Slack](https://particles.js.org/images/slack.png)](https://join.slack.com/t/tsparticles/shared_invite/enQtOTcxNTQxNjQ4NzkxLWE2MTZhZWExMWRmOWI5MTMxNjczOGE1Yjk0MjViYjdkYTUzODM3OTc5MGQ5MjFlODc4MzE0N2Q1OWQxZDc1YzI) [![Discord](https://particles.js.org/images/discord.png)](https://discord.gg/hACwv45Hme) [![Telegram](https://particles.js.org/images/telegram.png)](https://t.me/tsparticles)
11
+
12
+ [![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") <a href="https://www.buymeacoffee.com/matteobruni"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a beer&emoji=🍺&slug=matteobruni&button_colour=5F7FFF&font_colour=ffffff&font_family=Arial&outline_colour=000000&coffee_colour=FFDD00"></a>
13
+
14
+ ## Sample
15
+
16
+ [![demo](https://raw.githubusercontent.com/matteobruni/tsparticles/main/presets/bubbles/images/sample.png)](https://particles.js.org/samples/presets/bubbles)
17
+
18
+ ## How to use it
19
+
20
+ ### CDN / Vanilla JS / jQuery
21
+
22
+ The first step is installing [tsParticles](https://github.com/matteobruni/tsparticles) following the instructions for
23
+ vanilla javascript in the main project [here](https://github.com/matteobruni/tsparticles)
24
+
25
+ Once installed you need one more script to be included in your page (or you can download that
26
+ from [jsDelivr](https://www.jsdelivr.com/package/npm/@tsparticles/preset-bubbles):
27
+
28
+ ```html
29
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-engine@2/tsparticles.engine.min.js"></script>
30
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-move-base@2/tsparticles.move.base.min.js"></script>
31
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-plugin-emitters@2/tsparticles.plugin.emitters.min.js"></script>
32
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-shape-circle@2/tsparticles.shape.circle.min.js"></script>
33
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-color@2/tsparticles.updater.color.min.js"></script>
34
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-opacity@2/tsparticles.updater.opacity.min.js"></script>
35
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-out-modes@2/tsparticles.updater.out-modes.min.js"></script>
36
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-size@2/tsparticles.updater.size.min.js"></script>
37
+ <script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-bubbles@2/tsparticles.preset.bubbles.min.js"></script>
38
+ ```
39
+
40
+ #### Bundle
41
+
42
+ A bundled script can also be used, this will include every needed plugin needed by the preset.
43
+
44
+ ```html
45
+ <script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-bubbles@2/tsparticles.preset.bubbles.bundle.min.js"></script>
46
+ ```
47
+
48
+ ### Usage
49
+
50
+ Once the scripts are loaded you can set up `tsParticles` like this:
51
+
52
+ ```javascript
53
+ (async () => {
54
+ await loadBubblesPreset(tsParticles); // this is required only if you are not using the bundle script
55
+
56
+ await tsParticles.load("tsparticles", {
57
+ preset: "bubbles",
58
+ });
59
+ })();
60
+ ```
61
+
62
+ #### Customization
63
+
64
+ **Important ⚠️**
65
+ You can override all the options defining the properties like in any standard `tsParticles` installation.
66
+
67
+ ```javascript
68
+ tsParticles.load("tsparticles", {
69
+ particles: {
70
+ shape: {
71
+ type: "square", // starting from v2, this require the square shape script
72
+ },
73
+ },
74
+ preset: "bubbles",
75
+ });
76
+ ```
77
+
78
+ Like in the sample above, the circles will be replaced by squares.
79
+
80
+ ### React.js / Preact / Inferno
81
+
82
+ _The syntax for `React.js`, `Preact` and `Inferno` is the same_.
83
+
84
+ This sample uses the class component syntax, but you can use hooks as well (if the library supports it).
85
+
86
+ ```typescript jsx
87
+ import Particles from "react-particles";
88
+ import type { Engine } from "tsparticles-engine";
89
+ import { loadBubblesPreset } from "@tsparticles/preset-bubbles";
90
+
91
+ export class ParticlesContainer extends React.PureComponent<IProps> {
92
+ // this customizes the component tsParticles installation
93
+ async customInit(engine: Engine): Promise<void> {
94
+ // this adds the preset to tsParticles, you can safely use the
95
+ await loadBubblesPreset(engine);
96
+ }
97
+
98
+ render() {
99
+ const options = {
100
+ preset: "bubbles",
101
+ };
102
+
103
+ return <Particles options={options} init={this.customInit} />;
104
+ }
105
+ }
106
+ ```
107
+
108
+ ### Vue (2.x and 3.x)
109
+
110
+ _The syntax for `Vue.js 2.x` and `3.x` is the same_
111
+
112
+ ```vue
113
+ <Particles id="tsparticles" :particlesInit="particlesInit" :options="particlesOptions" />
114
+ ```
115
+
116
+ ```ts
117
+ const particlesOptions = {
118
+ preset: "bubbles",
119
+ };
120
+
121
+ async function particlesInit(engine: Engine): Promise<void> {
122
+ await loadBubblesPreset(engine);
123
+ }
124
+ ```
125
+
126
+ ### Angular
127
+
128
+ ```html
129
+ <angular-particles [id]="id" [options]="particlesOptions" [particlesInit]="particlesInit"></angular-particles>
130
+ ```
131
+
132
+ ```ts
133
+ const particlesOptions = {
134
+ preset: "bubbles",
135
+ };
136
+
137
+ async function particlesInit(engine: Engine): Promise<void> {
138
+ await loadBubblesPreset(engine);
139
+ }
140
+ ```
141
+
142
+ ### Svelte
143
+
144
+ ```sveltehtml
145
+
146
+ <Particles
147
+ id="tsparticles"
148
+ options={particlesOptions}
149
+ particlesInit={particlesInit}
150
+ />
151
+ ```
152
+
153
+ ```js
154
+ let particlesOptions = {
155
+ preset: "bubbles",
156
+ };
157
+
158
+ let particlesInit = async (engine) => {
159
+ await loadBubblesPreset(engine);
160
+ };
161
+ ```
162
+
163
+ ---
164
+
165
+ ```mermaid
166
+ flowchart TD
167
+
168
+ subgraph m [Movers]
169
+ mb[Base]
170
+ end
171
+
172
+ e[tsParticles Engine] --> m
173
+
174
+ subgraph pl [Plugins]
175
+ ple[Emitters]
176
+ end
177
+
178
+ e --> pl
179
+
180
+ subgraph s [Shapes]
181
+ sc[Circle]
182
+ end
183
+
184
+ e --> s
185
+
186
+ subgraph u [Updaters]
187
+ uc[Color]
188
+ uop[Opacity]
189
+ uou[Out Modes]
190
+ usi[Size]
191
+ end
192
+
193
+ e --> u
194
+
195
+ subgraph pr [Presets]
196
+ prbu[Bubbles]
197
+ end
198
+
199
+ mb & ple & sc & uc & uop & uou & usi --> prbu
200
+ ```
@@ -0,0 +1,6 @@
1
+ import { loadBubblesPreset } from ".";
2
+ import { tsParticles } from "@tsparticles/engine";
3
+ (async () => {
4
+ await loadBubblesPreset(tsParticles);
5
+ })();
6
+ export { loadBubblesPreset, tsParticles };
@@ -0,0 +1,18 @@
1
+ import { loadBaseMover } from "@tsparticles/move-base";
2
+ import { loadCircleShape } from "@tsparticles/shape-circle";
3
+ import { loadColorUpdater } from "@tsparticles/updater-color";
4
+ import { loadEmittersPlugin } from "@tsparticles/plugin-emitters";
5
+ import { loadOpacityUpdater } from "@tsparticles/updater-opacity";
6
+ import { loadOutModesUpdater } from "@tsparticles/updater-out-modes";
7
+ import { loadSizeUpdater } from "@tsparticles/updater-size";
8
+ import { options } from "./options";
9
+ export async function loadBubblesPreset(engine) {
10
+ await loadBaseMover(engine);
11
+ await loadCircleShape(engine);
12
+ await loadColorUpdater(engine);
13
+ await loadSizeUpdater(engine);
14
+ await loadOpacityUpdater(engine);
15
+ await loadOutModesUpdater(engine);
16
+ await loadEmittersPlugin(engine);
17
+ await engine.addPreset("bubbles", options);
18
+ }
@@ -0,0 +1,51 @@
1
+ export const options = {
2
+ fpsLimit: 120,
3
+ particles: {
4
+ number: {
5
+ value: 0,
6
+ },
7
+ color: {
8
+ value: "random",
9
+ },
10
+ shape: {
11
+ type: "circle",
12
+ },
13
+ opacity: {
14
+ value: 0.3,
15
+ },
16
+ size: {
17
+ value: { min: 5, max: 10 },
18
+ },
19
+ move: {
20
+ angle: {
21
+ offset: 0,
22
+ value: 30,
23
+ },
24
+ enable: true,
25
+ speed: 15,
26
+ direction: "top",
27
+ random: false,
28
+ straight: false,
29
+ outModes: {
30
+ default: "destroy",
31
+ },
32
+ },
33
+ },
34
+ detectRetina: true,
35
+ background: {
36
+ color: "#fff",
37
+ },
38
+ emitters: [
39
+ {
40
+ direction: "top",
41
+ position: {
42
+ y: 100,
43
+ },
44
+ life: {
45
+ duration: 3,
46
+ delay: 5,
47
+ count: 0,
48
+ },
49
+ },
50
+ ],
51
+ };
package/cjs/bundle.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.tsParticles = exports.loadBubblesPreset = void 0;
13
+ const _1 = require(".");
14
+ Object.defineProperty(exports, "loadBubblesPreset", { enumerable: true, get: function () { return _1.loadBubblesPreset; } });
15
+ const engine_1 = require("@tsparticles/engine");
16
+ Object.defineProperty(exports, "tsParticles", { enumerable: true, get: function () { return engine_1.tsParticles; } });
17
+ (() => __awaiter(void 0, void 0, void 0, function* () {
18
+ yield (0, _1.loadBubblesPreset)(engine_1.tsParticles);
19
+ }))();
package/cjs/index.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.loadBubblesPreset = void 0;
13
+ const move_base_1 = require("@tsparticles/move-base");
14
+ const shape_circle_1 = require("@tsparticles/shape-circle");
15
+ const updater_color_1 = require("@tsparticles/updater-color");
16
+ const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
17
+ const updater_opacity_1 = require("@tsparticles/updater-opacity");
18
+ const updater_out_modes_1 = require("@tsparticles/updater-out-modes");
19
+ const updater_size_1 = require("@tsparticles/updater-size");
20
+ const options_1 = require("./options");
21
+ function loadBubblesPreset(engine) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ yield (0, move_base_1.loadBaseMover)(engine);
24
+ yield (0, shape_circle_1.loadCircleShape)(engine);
25
+ yield (0, updater_color_1.loadColorUpdater)(engine);
26
+ yield (0, updater_size_1.loadSizeUpdater)(engine);
27
+ yield (0, updater_opacity_1.loadOpacityUpdater)(engine);
28
+ yield (0, updater_out_modes_1.loadOutModesUpdater)(engine);
29
+ yield (0, plugin_emitters_1.loadEmittersPlugin)(engine);
30
+ yield engine.addPreset("bubbles", options_1.options);
31
+ });
32
+ }
33
+ exports.loadBubblesPreset = loadBubblesPreset;
package/cjs/options.js ADDED
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.options = void 0;
4
+ exports.options = {
5
+ fpsLimit: 120,
6
+ particles: {
7
+ number: {
8
+ value: 0,
9
+ },
10
+ color: {
11
+ value: "random",
12
+ },
13
+ shape: {
14
+ type: "circle",
15
+ },
16
+ opacity: {
17
+ value: 0.3,
18
+ },
19
+ size: {
20
+ value: { min: 5, max: 10 },
21
+ },
22
+ move: {
23
+ angle: {
24
+ offset: 0,
25
+ value: 30,
26
+ },
27
+ enable: true,
28
+ speed: 15,
29
+ direction: "top",
30
+ random: false,
31
+ straight: false,
32
+ outModes: {
33
+ default: "destroy",
34
+ },
35
+ },
36
+ },
37
+ detectRetina: true,
38
+ background: {
39
+ color: "#fff",
40
+ },
41
+ emitters: [
42
+ {
43
+ direction: "top",
44
+ position: {
45
+ y: 100,
46
+ },
47
+ life: {
48
+ duration: 3,
49
+ delay: 5,
50
+ count: 0,
51
+ },
52
+ },
53
+ ],
54
+ };
package/esm/bundle.js ADDED
@@ -0,0 +1,6 @@
1
+ import { loadBubblesPreset } from ".";
2
+ import { tsParticles } from "@tsparticles/engine";
3
+ (async () => {
4
+ await loadBubblesPreset(tsParticles);
5
+ })();
6
+ export { loadBubblesPreset, tsParticles };
package/esm/index.js ADDED
@@ -0,0 +1,18 @@
1
+ import { loadBaseMover } from "@tsparticles/move-base";
2
+ import { loadCircleShape } from "@tsparticles/shape-circle";
3
+ import { loadColorUpdater } from "@tsparticles/updater-color";
4
+ import { loadEmittersPlugin } from "@tsparticles/plugin-emitters";
5
+ import { loadOpacityUpdater } from "@tsparticles/updater-opacity";
6
+ import { loadOutModesUpdater } from "@tsparticles/updater-out-modes";
7
+ import { loadSizeUpdater } from "@tsparticles/updater-size";
8
+ import { options } from "./options";
9
+ export async function loadBubblesPreset(engine) {
10
+ await loadBaseMover(engine);
11
+ await loadCircleShape(engine);
12
+ await loadColorUpdater(engine);
13
+ await loadSizeUpdater(engine);
14
+ await loadOpacityUpdater(engine);
15
+ await loadOutModesUpdater(engine);
16
+ await loadEmittersPlugin(engine);
17
+ await engine.addPreset("bubbles", options);
18
+ }
package/esm/options.js ADDED
@@ -0,0 +1,51 @@
1
+ export const options = {
2
+ fpsLimit: 120,
3
+ particles: {
4
+ number: {
5
+ value: 0,
6
+ },
7
+ color: {
8
+ value: "random",
9
+ },
10
+ shape: {
11
+ type: "circle",
12
+ },
13
+ opacity: {
14
+ value: 0.3,
15
+ },
16
+ size: {
17
+ value: { min: 5, max: 10 },
18
+ },
19
+ move: {
20
+ angle: {
21
+ offset: 0,
22
+ value: 30,
23
+ },
24
+ enable: true,
25
+ speed: 15,
26
+ direction: "top",
27
+ random: false,
28
+ straight: false,
29
+ outModes: {
30
+ default: "destroy",
31
+ },
32
+ },
33
+ },
34
+ detectRetina: true,
35
+ background: {
36
+ color: "#fff",
37
+ },
38
+ emitters: [
39
+ {
40
+ direction: "top",
41
+ position: {
42
+ y: 100,
43
+ },
44
+ life: {
45
+ duration: 3,
46
+ delay: 5,
47
+ count: 0,
48
+ },
49
+ },
50
+ ],
51
+ };
package/package.json ADDED
@@ -0,0 +1,98 @@
1
+ {
2
+ "name": "@tsparticles/preset-bubbles",
3
+ "version": "3.0.0-alpha.1",
4
+ "description": "tsParticles bubbles preset",
5
+ "homepage": "https://particles.js.org",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/matteobruni/tsparticles.git",
9
+ "directory": "presets/bubbles"
10
+ },
11
+ "keywords": [
12
+ "front-end",
13
+ "frontend",
14
+ "tsparticles",
15
+ "particles.js",
16
+ "particlesjs",
17
+ "particles",
18
+ "particle",
19
+ "canvas",
20
+ "jsparticles",
21
+ "xparticles",
22
+ "particles-js",
23
+ "particles-bg",
24
+ "particles-bg-vue",
25
+ "particles-ts",
26
+ "particles.ts",
27
+ "react-particles-js",
28
+ "react-particles.js",
29
+ "react-particles",
30
+ "react",
31
+ "reactjs",
32
+ "vue-particles",
33
+ "ngx-particles",
34
+ "angular-particles",
35
+ "particleground",
36
+ "vue",
37
+ "vuejs",
38
+ "preact",
39
+ "preactjs",
40
+ "jquery",
41
+ "angularjs",
42
+ "angular",
43
+ "typescript",
44
+ "javascript",
45
+ "animation",
46
+ "web",
47
+ "html5",
48
+ "web-design",
49
+ "webdesign",
50
+ "css",
51
+ "html",
52
+ "css3",
53
+ "animated",
54
+ "background",
55
+ "confetti",
56
+ "canvas",
57
+ "fireworks",
58
+ "fireworks-js",
59
+ "confetti-js",
60
+ "confettijs",
61
+ "fireworksjs",
62
+ "canvas-confetti",
63
+ "tsparticles-preset"
64
+ ],
65
+ "author": "Matteo Bruni <matteo.bruni@me.com>",
66
+ "license": "MIT",
67
+ "bugs": {
68
+ "url": "https://github.com/matteobruni/tsparticles/issues"
69
+ },
70
+ "funding": [
71
+ {
72
+ "type": "github",
73
+ "url": "https://github.com/sponsors/matteobruni"
74
+ },
75
+ {
76
+ "type": "buymeacoffee",
77
+ "url": "https://www.buymeacoffee.com/matteobruni"
78
+ }
79
+ ],
80
+ "main": "cjs/index.js",
81
+ "jsdelivr": "tsparticles.preset.bubbles.min.js",
82
+ "unpkg": "tsparticles.preset.bubbles.min.js",
83
+ "module": "esm/index.js",
84
+ "types": "types/index.d.ts",
85
+ "publishConfig": {
86
+ "access": "public"
87
+ },
88
+ "dependencies": {
89
+ "@tsparticles/engine": "^3.0.0-alpha.1",
90
+ "@tsparticles/move-base": "^3.0.0-alpha.1",
91
+ "@tsparticles/plugin-emitters": "^3.0.0-alpha.1",
92
+ "@tsparticles/shape-circle": "^3.0.0-alpha.1",
93
+ "@tsparticles/updater-color": "^3.0.0-alpha.1",
94
+ "@tsparticles/updater-opacity": "^3.0.0-alpha.1",
95
+ "@tsparticles/updater-out-modes": "^3.0.0-alpha.1",
96
+ "@tsparticles/updater-size": "^3.0.0-alpha.1"
97
+ }
98
+ }