@tsparticles/preset-fountain 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,205 @@
1
+ [![banner](https://particles.js.org/images/banner3.png)](https://particles.js.org)
2
+
3
+ # tsParticles Fountain Preset
4
+
5
+ [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/@tsparticles/preset-fountain/badge)](https://www.jsdelivr.com/package/npm/@tsparticles/preset-fountain) [![npmjs](https://badge.fury.io/js/@tsparticles/preset-fountain.svg)](https://www.npmjs.com/package/@tsparticles/preset-fountain) [![npmjs](https://img.shields.io/npm/dt/@tsparticles/preset-fountain)](https://www.npmjs.com/package/@tsparticles/preset-fountain) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
6
+
7
+ [tsParticles](https://github.com/matteobruni/tsparticles) preset creating random positioned falling colored particles
8
+ that break when hitting the ground.
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/fountain/images/sample.png)](https://particles.js.org/samples/presets/fountain)
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-fountain):
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-fountain@2/tsparticles.preset.fountain.min.js"></script>
38
+ ```
39
+
40
+ This script **MUST** be placed after the `tsParticles` one.
41
+
42
+ #### Bundle
43
+
44
+ A bundled script can also be used, this will include every needed plugin needed by the preset.
45
+
46
+ ```html
47
+ <script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-fountain@2/tsparticles.preset.fountain.bundle.min.js"></script>
48
+ ```
49
+
50
+ ### Usage
51
+
52
+ Once the scripts are loaded you can set up `tsParticles` like this:
53
+
54
+ ```javascript
55
+ (async () => {
56
+ await loadFountainPreset(tsParticles); // this is required only if you are not using the bundle script
57
+
58
+ await tsParticles.load("tsparticles", {
59
+ preset: "fountain",
60
+ });
61
+ })();
62
+ ```
63
+
64
+ #### Customization
65
+
66
+ **Important ⚠️**
67
+ You can override all the options defining the properties like in any standard `tsParticles` installation.
68
+
69
+ ```javascript
70
+ tsParticles.load("tsparticles", {
71
+ particles: {
72
+ shape: {
73
+ type: "square", // starting from v2, this require the square shape script
74
+ },
75
+ },
76
+ preset: "fountain",
77
+ });
78
+ ```
79
+
80
+ Like in the sample above, the circles will be replaced by squares.
81
+
82
+ ### React.js / Preact / Inferno
83
+
84
+ _The syntax for `React.js`, `Preact` and `Inferno` is the same_.
85
+
86
+ This sample uses the class component syntax, but you can use hooks as well (if the library supports it).
87
+
88
+ ```typescript jsx
89
+ import Particles from "react-particles";
90
+ import type { Engine } from "tsparticles-engine";
91
+ import { loadFountainPreset } from "@tsparticles/preset-fountain";
92
+
93
+ export class ParticlesContainer extends React.PureComponent<IProps> {
94
+ // this customizes the component tsParticles installation
95
+ async customInit(engine: Engine): Promise<void> {
96
+ // this adds the preset to tsParticles, you can safely use the
97
+ await loadFountainPreset(engine);
98
+ }
99
+
100
+ render() {
101
+ const options = {
102
+ preset: "fountain",
103
+ };
104
+
105
+ return <Particles options={options} init={this.customInit} />;
106
+ }
107
+ }
108
+ ```
109
+
110
+ ### Vue (2.x and 3.x)
111
+
112
+ _The syntax for `Vue.js 2.x` and `3.x` is the same_
113
+
114
+ ```vue
115
+ <Particles id="tsparticles" :particlesInit="particlesInit" :options="particlesOptions" />
116
+ ```
117
+
118
+ ```ts
119
+ const particlesOptions = {
120
+ preset: "fountain",
121
+ };
122
+
123
+ async function particlesInit(engine: Engine): Promise<void> {
124
+ await loadFountainPreset(engine);
125
+ }
126
+ ```
127
+
128
+ ### Angular
129
+
130
+ ```html
131
+ <angular-particles [id]="id" [options]="particlesOptions" [particlesInit]="particlesInit"></angular-particles>
132
+ ```
133
+
134
+ ```ts
135
+ const particlesOptions = {
136
+ preset: "fountain",
137
+ };
138
+
139
+ async function particlesInit(engine: Engine): Promise<void> {
140
+ await loadFountainPreset(engine);
141
+ }
142
+ ```
143
+
144
+ ### Svelte
145
+
146
+ ```sveltehtml
147
+
148
+ <Particles
149
+ id="tsparticles"
150
+ options={particlesOptions}
151
+ particlesInit={particlesInit}
152
+ />
153
+ ```
154
+
155
+ ```js
156
+ let particlesOptions = {
157
+ preset: "fountain",
158
+ };
159
+
160
+ let particlesInit = async (engine) => {
161
+ await loadFountainPreset(engine);
162
+ };
163
+ ```
164
+
165
+ ---
166
+
167
+ ```mermaid
168
+ flowchart TD
169
+
170
+ subgraph m [Movers]
171
+ mb[Base]
172
+ end
173
+
174
+ e[tsParticles Engine] --> m
175
+
176
+ subgraph pl [Plugins]
177
+ ple[Emitters]
178
+ end
179
+
180
+ e --> pl
181
+
182
+ subgraph s [Shapes]
183
+ sc[Circle]
184
+ end
185
+
186
+ e --> s
187
+
188
+ subgraph u [Updaters]
189
+ uc[Color]
190
+ ud[Destroy]
191
+ uop[Opacity]
192
+ uou[Out Modes]
193
+ usi[Size]
194
+ end
195
+
196
+ e --> u
197
+
198
+ subgraph pr [Presets]
199
+ prfo[Fountain]
200
+ end
201
+
202
+ e --> pr
203
+
204
+ mb & ple & sc & uc & ud & uop & uou & usi --> prfo
205
+ ```
@@ -0,0 +1,6 @@
1
+ import { loadFountainPreset } from ".";
2
+ import { tsParticles } from "@tsparticles/engine";
3
+ (async () => {
4
+ await loadFountainPreset(tsParticles);
5
+ })();
6
+ export { loadFountainPreset, tsParticles };
@@ -0,0 +1,20 @@
1
+ import { loadBaseMover } from "@tsparticles/move-base";
2
+ import { loadCircleShape } from "@tsparticles/shape-circle";
3
+ import { loadColorUpdater } from "@tsparticles/updater-color";
4
+ import { loadDestroyUpdater } from "@tsparticles/updater-destroy";
5
+ import { loadEmittersPlugin } from "@tsparticles/plugin-emitters";
6
+ import { loadOpacityUpdater } from "@tsparticles/updater-opacity";
7
+ import { loadOutModesUpdater } from "@tsparticles/updater-out-modes";
8
+ import { loadSizeUpdater } from "@tsparticles/updater-size";
9
+ import { options } from "./options";
10
+ export async function loadFountainPreset(engine) {
11
+ await loadBaseMover(engine);
12
+ await loadCircleShape(engine);
13
+ await loadDestroyUpdater(engine);
14
+ await loadEmittersPlugin(engine);
15
+ await loadColorUpdater(engine);
16
+ await loadOpacityUpdater(engine);
17
+ await loadOutModesUpdater(engine);
18
+ await loadSizeUpdater(engine);
19
+ await engine.addPreset("fountain", options);
20
+ }
@@ -0,0 +1,90 @@
1
+ export const options = {
2
+ fpsLimit: 120,
3
+ particles: {
4
+ bounce: {
5
+ vertical: {
6
+ value: {
7
+ min: 0.75,
8
+ max: 0.85,
9
+ },
10
+ },
11
+ },
12
+ color: {
13
+ value: ["#3998D0", "#2EB6AF", "#A9BD33", "#FEC73B", "#F89930", "#F45623", "#D62E32", "#EB586E", "#9952CF"],
14
+ },
15
+ number: {
16
+ value: 0,
17
+ },
18
+ destroy: {
19
+ mode: "split",
20
+ split: {
21
+ count: 2,
22
+ factor: {
23
+ value: {
24
+ min: 1.1,
25
+ max: 2,
26
+ },
27
+ },
28
+ rate: {
29
+ value: {
30
+ min: 2,
31
+ max: 3,
32
+ },
33
+ },
34
+ },
35
+ },
36
+ opacity: {
37
+ value: 0.5,
38
+ },
39
+ size: {
40
+ value: {
41
+ min: 10,
42
+ max: 20,
43
+ },
44
+ },
45
+ move: {
46
+ enable: true,
47
+ gravity: {
48
+ enable: true,
49
+ maxSpeed: 50,
50
+ },
51
+ speed: {
52
+ min: 10,
53
+ max: 20,
54
+ },
55
+ direction: "none",
56
+ random: false,
57
+ straight: false,
58
+ outModes: {
59
+ bottom: "split",
60
+ default: "bounce",
61
+ top: "none",
62
+ },
63
+ trail: {
64
+ enable: true,
65
+ fillColor: "#fff",
66
+ length: 3,
67
+ },
68
+ },
69
+ },
70
+ detectRetina: true,
71
+ background: {
72
+ color: "#fff",
73
+ },
74
+ emitters: {
75
+ direction: "top",
76
+ life: {
77
+ count: 0,
78
+ duration: 0.15,
79
+ delay: 3,
80
+ },
81
+ rate: {
82
+ delay: 0.1,
83
+ quantity: 5,
84
+ },
85
+ size: {
86
+ width: 0,
87
+ height: 0,
88
+ },
89
+ },
90
+ };
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.loadFountainPreset = void 0;
13
+ const _1 = require(".");
14
+ Object.defineProperty(exports, "loadFountainPreset", { enumerable: true, get: function () { return _1.loadFountainPreset; } });
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.loadFountainPreset)(engine_1.tsParticles);
19
+ }))();
package/cjs/index.js ADDED
@@ -0,0 +1,35 @@
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.loadFountainPreset = 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 updater_destroy_1 = require("@tsparticles/updater-destroy");
17
+ const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
18
+ const updater_opacity_1 = require("@tsparticles/updater-opacity");
19
+ const updater_out_modes_1 = require("@tsparticles/updater-out-modes");
20
+ const updater_size_1 = require("@tsparticles/updater-size");
21
+ const options_1 = require("./options");
22
+ function loadFountainPreset(engine) {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ yield (0, move_base_1.loadBaseMover)(engine);
25
+ yield (0, shape_circle_1.loadCircleShape)(engine);
26
+ yield (0, updater_destroy_1.loadDestroyUpdater)(engine);
27
+ yield (0, plugin_emitters_1.loadEmittersPlugin)(engine);
28
+ yield (0, updater_color_1.loadColorUpdater)(engine);
29
+ yield (0, updater_opacity_1.loadOpacityUpdater)(engine);
30
+ yield (0, updater_out_modes_1.loadOutModesUpdater)(engine);
31
+ yield (0, updater_size_1.loadSizeUpdater)(engine);
32
+ yield engine.addPreset("fountain", options_1.options);
33
+ });
34
+ }
35
+ exports.loadFountainPreset = loadFountainPreset;
package/cjs/options.js ADDED
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.options = void 0;
4
+ exports.options = {
5
+ fpsLimit: 120,
6
+ particles: {
7
+ bounce: {
8
+ vertical: {
9
+ value: {
10
+ min: 0.75,
11
+ max: 0.85,
12
+ },
13
+ },
14
+ },
15
+ color: {
16
+ value: ["#3998D0", "#2EB6AF", "#A9BD33", "#FEC73B", "#F89930", "#F45623", "#D62E32", "#EB586E", "#9952CF"],
17
+ },
18
+ number: {
19
+ value: 0,
20
+ },
21
+ destroy: {
22
+ mode: "split",
23
+ split: {
24
+ count: 2,
25
+ factor: {
26
+ value: {
27
+ min: 1.1,
28
+ max: 2,
29
+ },
30
+ },
31
+ rate: {
32
+ value: {
33
+ min: 2,
34
+ max: 3,
35
+ },
36
+ },
37
+ },
38
+ },
39
+ opacity: {
40
+ value: 0.5,
41
+ },
42
+ size: {
43
+ value: {
44
+ min: 10,
45
+ max: 20,
46
+ },
47
+ },
48
+ move: {
49
+ enable: true,
50
+ gravity: {
51
+ enable: true,
52
+ maxSpeed: 50,
53
+ },
54
+ speed: {
55
+ min: 10,
56
+ max: 20,
57
+ },
58
+ direction: "none",
59
+ random: false,
60
+ straight: false,
61
+ outModes: {
62
+ bottom: "split",
63
+ default: "bounce",
64
+ top: "none",
65
+ },
66
+ trail: {
67
+ enable: true,
68
+ fillColor: "#fff",
69
+ length: 3,
70
+ },
71
+ },
72
+ },
73
+ detectRetina: true,
74
+ background: {
75
+ color: "#fff",
76
+ },
77
+ emitters: {
78
+ direction: "top",
79
+ life: {
80
+ count: 0,
81
+ duration: 0.15,
82
+ delay: 3,
83
+ },
84
+ rate: {
85
+ delay: 0.1,
86
+ quantity: 5,
87
+ },
88
+ size: {
89
+ width: 0,
90
+ height: 0,
91
+ },
92
+ },
93
+ };
package/esm/bundle.js ADDED
@@ -0,0 +1,6 @@
1
+ import { loadFountainPreset } from ".";
2
+ import { tsParticles } from "@tsparticles/engine";
3
+ (async () => {
4
+ await loadFountainPreset(tsParticles);
5
+ })();
6
+ export { loadFountainPreset, tsParticles };
package/esm/index.js ADDED
@@ -0,0 +1,20 @@
1
+ import { loadBaseMover } from "@tsparticles/move-base";
2
+ import { loadCircleShape } from "@tsparticles/shape-circle";
3
+ import { loadColorUpdater } from "@tsparticles/updater-color";
4
+ import { loadDestroyUpdater } from "@tsparticles/updater-destroy";
5
+ import { loadEmittersPlugin } from "@tsparticles/plugin-emitters";
6
+ import { loadOpacityUpdater } from "@tsparticles/updater-opacity";
7
+ import { loadOutModesUpdater } from "@tsparticles/updater-out-modes";
8
+ import { loadSizeUpdater } from "@tsparticles/updater-size";
9
+ import { options } from "./options";
10
+ export async function loadFountainPreset(engine) {
11
+ await loadBaseMover(engine);
12
+ await loadCircleShape(engine);
13
+ await loadDestroyUpdater(engine);
14
+ await loadEmittersPlugin(engine);
15
+ await loadColorUpdater(engine);
16
+ await loadOpacityUpdater(engine);
17
+ await loadOutModesUpdater(engine);
18
+ await loadSizeUpdater(engine);
19
+ await engine.addPreset("fountain", options);
20
+ }
package/esm/options.js ADDED
@@ -0,0 +1,90 @@
1
+ export const options = {
2
+ fpsLimit: 120,
3
+ particles: {
4
+ bounce: {
5
+ vertical: {
6
+ value: {
7
+ min: 0.75,
8
+ max: 0.85,
9
+ },
10
+ },
11
+ },
12
+ color: {
13
+ value: ["#3998D0", "#2EB6AF", "#A9BD33", "#FEC73B", "#F89930", "#F45623", "#D62E32", "#EB586E", "#9952CF"],
14
+ },
15
+ number: {
16
+ value: 0,
17
+ },
18
+ destroy: {
19
+ mode: "split",
20
+ split: {
21
+ count: 2,
22
+ factor: {
23
+ value: {
24
+ min: 1.1,
25
+ max: 2,
26
+ },
27
+ },
28
+ rate: {
29
+ value: {
30
+ min: 2,
31
+ max: 3,
32
+ },
33
+ },
34
+ },
35
+ },
36
+ opacity: {
37
+ value: 0.5,
38
+ },
39
+ size: {
40
+ value: {
41
+ min: 10,
42
+ max: 20,
43
+ },
44
+ },
45
+ move: {
46
+ enable: true,
47
+ gravity: {
48
+ enable: true,
49
+ maxSpeed: 50,
50
+ },
51
+ speed: {
52
+ min: 10,
53
+ max: 20,
54
+ },
55
+ direction: "none",
56
+ random: false,
57
+ straight: false,
58
+ outModes: {
59
+ bottom: "split",
60
+ default: "bounce",
61
+ top: "none",
62
+ },
63
+ trail: {
64
+ enable: true,
65
+ fillColor: "#fff",
66
+ length: 3,
67
+ },
68
+ },
69
+ },
70
+ detectRetina: true,
71
+ background: {
72
+ color: "#fff",
73
+ },
74
+ emitters: {
75
+ direction: "top",
76
+ life: {
77
+ count: 0,
78
+ duration: 0.15,
79
+ delay: 3,
80
+ },
81
+ rate: {
82
+ delay: 0.1,
83
+ quantity: 5,
84
+ },
85
+ size: {
86
+ width: 0,
87
+ height: 0,
88
+ },
89
+ },
90
+ };