@tsparticles/preset-squares 3.0.0-beta.4

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,194 @@
1
+ [![banner](https://particles.js.org/images/banner3.png)](https://particles.js.org)
2
+
3
+ # tsParticles Squares Preset
4
+
5
+ [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/@tsparticles/preset-squares/badge)](https://www.jsdelivr.com/package/npm/@tsparticles/preset-squares) [![npmjs](https://badge.fury.io/js/@tsparticles/preset-squares.svg)](https://www.npmjs.com/package/@tsparticles/preset-squares) [![npmjs](https://img.shields.io/npm/dt/@tsparticles/preset-squares)](https://www.npmjs.com/package/@tsparticles/preset-squares) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
6
+
7
+ [tsParticles](https://github.com/matteobruni/tsparticles) preset creating a squares effect with falling particles.
8
+
9
+ [![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)
10
+
11
+ [![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>
12
+
13
+ ## Sample
14
+
15
+ [![demo](https://raw.githubusercontent.com/matteobruni/tsparticles/main/presets/squares/images/sample.png)](https://particles.js.org/samples/presets/squares)
16
+
17
+ ## How to use it
18
+
19
+ ### CDN / Vanilla JS / jQuery
20
+
21
+ The first step is installing [tsParticles](https://github.com/matteobruni/tsparticles) following the instructions for
22
+ vanilla javascript in the main project [here](https://github.com/matteobruni/tsparticles)
23
+
24
+ Once installed you need one more script to be included in your page (or you can download that
25
+ from [jsDelivr](https://www.jsdelivr.com/package/npm/@tsparticles/preset-squares):
26
+
27
+ ```html
28
+ <script src="https://cdn.jsdelivr.net/npm/@tsparticles/engine@2/tsparticles.engine.min.js"></script>
29
+ <script src="https://cdn.jsdelivr.net/npm/@tsparticles/plugin-emitters@2/tsparticles.plugin.emitters.min.js"></script>
30
+ <script src="https://cdn.jsdelivr.net/npm/@tsparticles/shape-square@2/tsparticles.shape.square.min.js"></script>
31
+ <script src="https://cdn.jsdelivr.net/npm/@tsparticles/updater-rotate@2/tsparticles.updater.rotate.min.js"></script>
32
+ <script src="https://cdn.jsdelivr.net/npm/@tsparticles/updater-size@2/tsparticles.updater.size.min.js"></script>
33
+ <script src="https://cdn.jsdelivr.net/npm/@tsparticles/updater-stroke-color@2/tsparticles.updater.stroke-color.min.js"></script>
34
+ <script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-squares@2/tsparticles.preset.squares.min.js"></script>
35
+ ```
36
+
37
+ This script **MUST** be placed after the `tsParticles` one.
38
+
39
+ #### Bundle
40
+
41
+ A bundled script can also be used, this will include every needed plugin needed by the preset.
42
+
43
+ ```html
44
+ <script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-squares@2/tsparticles.preset.squares.bundle.min.js"></script>
45
+ ```
46
+
47
+ ### Usage
48
+
49
+ Once the scripts are loaded you can set up `tsParticles` like this:
50
+
51
+ ```javascript
52
+ (async () => {
53
+ await loadSquaresPreset(tsParticles); // this is required only if you are not using the bundle script
54
+
55
+ await tsParticles.load("tsparticles", {
56
+ preset: "squares",
57
+ });
58
+ })();
59
+ ```
60
+
61
+ #### Customization
62
+
63
+ **Important ⚠️**
64
+ You can override all the options defining the properties like in any standard `tsParticles` installation.
65
+
66
+ ```javascript
67
+ tsParticles.load("tsparticles", {
68
+ particles: {
69
+ shape: {
70
+ type: "circle", // starting from v2, this require the circle shape script
71
+ },
72
+ },
73
+ preset: "squares",
74
+ });
75
+ ```
76
+
77
+ Like in the sample above, the circles will be replaced by squares.
78
+
79
+ ### React.js / Preact / Inferno
80
+
81
+ _The syntax for `React.js`, `Preact` and `Inferno` is the same_.
82
+
83
+ This sample uses the class component syntax, but you can use hooks as well (if the library supports it).
84
+
85
+ ```typescript jsx
86
+ import Particles from "react-particles";
87
+ import type { Engine } from "@tsparticles/engine";
88
+ import { loadSquaresPreset } from "@tsparticles/preset-squares";
89
+
90
+ export class ParticlesContainer extends React.PureComponent<IProps> {
91
+ // this customizes the component tsParticles installation
92
+ async customInit(engine: Engine): Promise<void> {
93
+ // this adds the preset to tsParticles, you can safely use the
94
+ await loadSquaresPreset(engine);
95
+ }
96
+
97
+ render() {
98
+ const options = {
99
+ preset: "squares",
100
+ };
101
+
102
+ return <Particles options={options} init={this.customInit} />;
103
+ }
104
+ }
105
+ ```
106
+
107
+ ### Vue (2.x and 3.x)
108
+
109
+ _The syntax for `Vue.js 2.x` and `3.x` is the same_
110
+
111
+ ```vue
112
+ <Particles id="tsparticles" :particlesInit="particlesInit" :options="particlesOptions" />
113
+ ```
114
+
115
+ ```ts
116
+ const particlesOptions = {
117
+ preset: "squares",
118
+ };
119
+
120
+ async function particlesInit(engine: Engine): Promise<void> {
121
+ await loadSquaresPreset(engine);
122
+ }
123
+ ```
124
+
125
+ ### Angular
126
+
127
+ ```html
128
+ <ng-particles [id]="id" [options]="particlesOptions" [particlesInit]="particlesInit"></ng-particles>
129
+ ```
130
+
131
+ ```ts
132
+ const particlesOptions = {
133
+ preset: "squares",
134
+ };
135
+
136
+ async function particlesInit(engine: Engine): Promise<void> {
137
+ await loadSquaresPreset(engine);
138
+ }
139
+ ```
140
+
141
+ ### Svelte
142
+
143
+ ```sveltehtml
144
+
145
+ <Particles
146
+ id="tsparticles"
147
+ options={particlesOptions}
148
+ particlesInit={particlesInit}
149
+ />
150
+ ```
151
+
152
+ ```js
153
+ let particlesOptions = {
154
+ preset: "bubbles",
155
+ };
156
+
157
+ let particlesInit = async (engine) => {
158
+ await loadSquaresPreset(engine);
159
+ };
160
+ ```
161
+
162
+ ---
163
+
164
+ ```mermaid
165
+ flowchart TD
166
+
167
+ e[tsParticles Engine]
168
+
169
+ subgraph pl [Plugins]
170
+ ple[Emitters]
171
+ end
172
+
173
+ e --> pl
174
+
175
+ subgraph s [Shapes]
176
+ ssq[Square]
177
+ end
178
+
179
+ e --> s
180
+
181
+ subgraph u [Updaters]
182
+ urot[Rotate]
183
+ usi[Size]
184
+ usc[Stroke Color]
185
+ end
186
+
187
+ e --> u
188
+
189
+ subgraph pr [Presets]
190
+ prsn[Squares]
191
+ end
192
+
193
+ e & ple & ssq & urot & usi & usc --> prsn
194
+ ```
@@ -0,0 +1,4 @@
1
+ import { loadSquaresPreset } from ".";
2
+ import { tsParticles } from "@tsparticles/engine";
3
+ loadSquaresPreset(tsParticles);
4
+ export { loadSquaresPreset, tsParticles };
@@ -0,0 +1,14 @@
1
+ import { loadEmittersPlugin } from "@tsparticles/plugin-emitters";
2
+ import { loadRotateUpdater } from "@tsparticles/updater-rotate";
3
+ import { loadSizeUpdater } from "@tsparticles/updater-size";
4
+ import { loadSquareShape } from "@tsparticles/shape-square";
5
+ import { loadStrokeColorUpdater } from "@tsparticles/updater-stroke-color";
6
+ import { options } from "./options";
7
+ export async function loadSquaresPreset(engine, refresh = true) {
8
+ await loadEmittersPlugin(engine, false);
9
+ await loadSquareShape(engine, false);
10
+ await loadRotateUpdater(engine, false);
11
+ await loadSizeUpdater(engine, false);
12
+ await loadStrokeColorUpdater(engine, false);
13
+ await engine.addPreset("squares", options, refresh);
14
+ }
@@ -0,0 +1,60 @@
1
+ export const options = {
2
+ particles: {
3
+ stroke: {
4
+ width: 5,
5
+ color: {
6
+ value: [
7
+ "#5bc0eb",
8
+ "#fde74c",
9
+ "#9bc53d",
10
+ "#e55934",
11
+ "#fa7921",
12
+ "#2FF3E0",
13
+ "#F8D210",
14
+ "#FA26A0",
15
+ "#F51720",
16
+ ],
17
+ },
18
+ },
19
+ shape: {
20
+ type: "square",
21
+ options: {
22
+ square: {
23
+ fill: false,
24
+ },
25
+ },
26
+ },
27
+ rotate: {
28
+ value: 0,
29
+ direction: "counter-clockwise",
30
+ animation: {
31
+ enable: true,
32
+ speed: 2,
33
+ sync: true,
34
+ },
35
+ },
36
+ size: {
37
+ value: { min: 1, max: 500 },
38
+ animation: {
39
+ enable: true,
40
+ startValue: "min",
41
+ speed: 60,
42
+ sync: true,
43
+ destroy: "max",
44
+ },
45
+ },
46
+ },
47
+ background: {
48
+ color: "#000",
49
+ },
50
+ emitters: {
51
+ position: {
52
+ y: 50,
53
+ x: 50,
54
+ },
55
+ rate: {
56
+ delay: 1,
57
+ quantity: 1,
58
+ },
59
+ },
60
+ };
package/cjs/bundle.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tsParticles = exports.loadSquaresPreset = void 0;
4
+ const _1 = require(".");
5
+ Object.defineProperty(exports, "loadSquaresPreset", { enumerable: true, get: function () { return _1.loadSquaresPreset; } });
6
+ const engine_1 = require("@tsparticles/engine");
7
+ Object.defineProperty(exports, "tsParticles", { enumerable: true, get: function () { return engine_1.tsParticles; } });
8
+ (0, _1.loadSquaresPreset)(engine_1.tsParticles);
package/cjs/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadSquaresPreset = void 0;
4
+ const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
5
+ const updater_rotate_1 = require("@tsparticles/updater-rotate");
6
+ const updater_size_1 = require("@tsparticles/updater-size");
7
+ const shape_square_1 = require("@tsparticles/shape-square");
8
+ const updater_stroke_color_1 = require("@tsparticles/updater-stroke-color");
9
+ const options_1 = require("./options");
10
+ async function loadSquaresPreset(engine, refresh = true) {
11
+ await (0, plugin_emitters_1.loadEmittersPlugin)(engine, false);
12
+ await (0, shape_square_1.loadSquareShape)(engine, false);
13
+ await (0, updater_rotate_1.loadRotateUpdater)(engine, false);
14
+ await (0, updater_size_1.loadSizeUpdater)(engine, false);
15
+ await (0, updater_stroke_color_1.loadStrokeColorUpdater)(engine, false);
16
+ await engine.addPreset("squares", options_1.options, refresh);
17
+ }
18
+ exports.loadSquaresPreset = loadSquaresPreset;
package/cjs/options.js ADDED
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.options = void 0;
4
+ exports.options = {
5
+ particles: {
6
+ stroke: {
7
+ width: 5,
8
+ color: {
9
+ value: [
10
+ "#5bc0eb",
11
+ "#fde74c",
12
+ "#9bc53d",
13
+ "#e55934",
14
+ "#fa7921",
15
+ "#2FF3E0",
16
+ "#F8D210",
17
+ "#FA26A0",
18
+ "#F51720",
19
+ ],
20
+ },
21
+ },
22
+ shape: {
23
+ type: "square",
24
+ options: {
25
+ square: {
26
+ fill: false,
27
+ },
28
+ },
29
+ },
30
+ rotate: {
31
+ value: 0,
32
+ direction: "counter-clockwise",
33
+ animation: {
34
+ enable: true,
35
+ speed: 2,
36
+ sync: true,
37
+ },
38
+ },
39
+ size: {
40
+ value: { min: 1, max: 500 },
41
+ animation: {
42
+ enable: true,
43
+ startValue: "min",
44
+ speed: 60,
45
+ sync: true,
46
+ destroy: "max",
47
+ },
48
+ },
49
+ },
50
+ background: {
51
+ color: "#000",
52
+ },
53
+ emitters: {
54
+ position: {
55
+ y: 50,
56
+ x: 50,
57
+ },
58
+ rate: {
59
+ delay: 1,
60
+ quantity: 1,
61
+ },
62
+ },
63
+ };
package/esm/bundle.js ADDED
@@ -0,0 +1,4 @@
1
+ import { loadSquaresPreset } from ".";
2
+ import { tsParticles } from "@tsparticles/engine";
3
+ loadSquaresPreset(tsParticles);
4
+ export { loadSquaresPreset, tsParticles };
package/esm/index.js ADDED
@@ -0,0 +1,14 @@
1
+ import { loadEmittersPlugin } from "@tsparticles/plugin-emitters";
2
+ import { loadRotateUpdater } from "@tsparticles/updater-rotate";
3
+ import { loadSizeUpdater } from "@tsparticles/updater-size";
4
+ import { loadSquareShape } from "@tsparticles/shape-square";
5
+ import { loadStrokeColorUpdater } from "@tsparticles/updater-stroke-color";
6
+ import { options } from "./options";
7
+ export async function loadSquaresPreset(engine, refresh = true) {
8
+ await loadEmittersPlugin(engine, false);
9
+ await loadSquareShape(engine, false);
10
+ await loadRotateUpdater(engine, false);
11
+ await loadSizeUpdater(engine, false);
12
+ await loadStrokeColorUpdater(engine, false);
13
+ await engine.addPreset("squares", options, refresh);
14
+ }
package/esm/options.js ADDED
@@ -0,0 +1,60 @@
1
+ export const options = {
2
+ particles: {
3
+ stroke: {
4
+ width: 5,
5
+ color: {
6
+ value: [
7
+ "#5bc0eb",
8
+ "#fde74c",
9
+ "#9bc53d",
10
+ "#e55934",
11
+ "#fa7921",
12
+ "#2FF3E0",
13
+ "#F8D210",
14
+ "#FA26A0",
15
+ "#F51720",
16
+ ],
17
+ },
18
+ },
19
+ shape: {
20
+ type: "square",
21
+ options: {
22
+ square: {
23
+ fill: false,
24
+ },
25
+ },
26
+ },
27
+ rotate: {
28
+ value: 0,
29
+ direction: "counter-clockwise",
30
+ animation: {
31
+ enable: true,
32
+ speed: 2,
33
+ sync: true,
34
+ },
35
+ },
36
+ size: {
37
+ value: { min: 1, max: 500 },
38
+ animation: {
39
+ enable: true,
40
+ startValue: "min",
41
+ speed: 60,
42
+ sync: true,
43
+ destroy: "max",
44
+ },
45
+ },
46
+ },
47
+ background: {
48
+ color: "#000",
49
+ },
50
+ emitters: {
51
+ position: {
52
+ y: 50,
53
+ x: 50,
54
+ },
55
+ rate: {
56
+ delay: 1,
57
+ quantity: 1,
58
+ },
59
+ },
60
+ };
package/package.json ADDED
@@ -0,0 +1,100 @@
1
+ {
2
+ "name": "@tsparticles/preset-squares",
3
+ "version": "3.0.0-beta.4",
4
+ "description": "tsParticles squares preset",
5
+ "homepage": "https://particles.js.org",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/tsparticles/presets.git",
9
+ "directory": "presets/squares"
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/tsparticles/presets/issues"
69
+ },
70
+ "funding": [
71
+ {
72
+ "type": "github",
73
+ "url": "https://github.com/sponsors/matteobruni"
74
+ },
75
+ {
76
+ "type": "github",
77
+ "url": "https://github.com/sponsors/tsparticles"
78
+ },
79
+ {
80
+ "type": "buymeacoffee",
81
+ "url": "https://www.buymeacoffee.com/matteobruni"
82
+ }
83
+ ],
84
+ "main": "cjs/index.js",
85
+ "jsdelivr": "tsparticles.preset.squares.min.js",
86
+ "unpkg": "tsparticles.preset.squares.min.js",
87
+ "module": "esm/index.js",
88
+ "types": "types/index.d.ts",
89
+ "dependencies": {
90
+ "@tsparticles/engine": "^3.0.0-beta.4",
91
+ "@tsparticles/plugin-emitters": "^3.0.0-beta.4",
92
+ "@tsparticles/shape-square": "^3.0.0-beta.4",
93
+ "@tsparticles/updater-rotate": "^3.0.0-beta.4",
94
+ "@tsparticles/updater-size": "^3.0.0-beta.4",
95
+ "@tsparticles/updater-stroke-color": "^3.0.0-beta.4"
96
+ },
97
+ "publishConfig": {
98
+ "access": "public"
99
+ }
100
+ }