@tsparticles/preset-squares 3.0.1 → 3.1.0
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/README.md +21 -113
- package/browser/bundle.js +0 -1
- package/browser/index.js +2 -1
- package/browser/options.js +4 -3
- package/cjs/bundle.js +0 -1
- package/cjs/index.js +2 -1
- package/cjs/options.js +4 -3
- package/esm/bundle.js +0 -1
- package/esm/index.js +2 -1
- package/esm/options.js +4 -3
- package/package.json +7 -7
- package/report.html +2 -2
- package/tsparticles.preset.squares.bundle.js +1566 -1037
- package/tsparticles.preset.squares.bundle.min.js +1 -1
- package/tsparticles.preset.squares.bundle.min.js.LICENSE.txt +1 -1
- package/tsparticles.preset.squares.js +35 -52
- package/tsparticles.preset.squares.min.js +1 -1
- package/tsparticles.preset.squares.min.js.LICENSE.txt +1 -1
- package/umd/bundle.js +0 -1
- package/umd/index.js +2 -1
- package/umd/options.js +5 -4
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.jsdelivr.com/package/npm/@tsparticles/preset-squares) [](https://www.npmjs.com/package/@tsparticles/preset-squares) [](https://www.npmjs.com/package/@tsparticles/preset-squares) [](https://github.com/sponsors/matteobruni)
|
|
6
6
|
|
|
7
|
-
[tsParticles](https://github.com/
|
|
7
|
+
[tsParticles](https://github.com/tsparticles/tsparticles) preset creating a squares effect with falling particles.
|
|
8
8
|
|
|
9
9
|
[](https://join.slack.com/t/tsparticles/shared_invite/enQtOTcxNTQxNjQ4NzkxLWE2MTZhZWExMWRmOWI5MTMxNjczOGE1Yjk0MjViYjdkYTUzODM3OTc5MGQ5MjFlODc4MzE0N2Q1OWQxZDc1YzI) [](https://discord.gg/hACwv45Hme) [](https://t.me/tsparticles)
|
|
10
10
|
|
|
@@ -12,36 +12,14 @@
|
|
|
12
12
|
|
|
13
13
|
## Sample
|
|
14
14
|
|
|
15
|
-
[](https://particles.js.org/samples/presets/squares)
|
|
16
16
|
|
|
17
17
|
## How to use it
|
|
18
18
|
|
|
19
19
|
### CDN / Vanilla JS / jQuery
|
|
20
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
21
|
```html
|
|
44
|
-
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-squares@
|
|
22
|
+
<script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-squares@3/tsparticles.preset.squares.bundle.min.js"></script>
|
|
45
23
|
```
|
|
46
24
|
|
|
47
25
|
### Usage
|
|
@@ -50,10 +28,13 @@ Once the scripts are loaded you can set up `tsParticles` like this:
|
|
|
50
28
|
|
|
51
29
|
```javascript
|
|
52
30
|
(async () => {
|
|
53
|
-
await loadSquaresPreset(tsParticles);
|
|
31
|
+
await loadSquaresPreset(tsParticles);
|
|
54
32
|
|
|
55
|
-
await tsParticles.load(
|
|
56
|
-
|
|
33
|
+
await tsParticles.load({
|
|
34
|
+
id: "tsparticles",
|
|
35
|
+
options: {
|
|
36
|
+
preset: "squares",
|
|
37
|
+
},
|
|
57
38
|
});
|
|
58
39
|
})();
|
|
59
40
|
```
|
|
@@ -64,100 +45,27 @@ Once the scripts are loaded you can set up `tsParticles` like this:
|
|
|
64
45
|
You can override all the options defining the properties like in any standard `tsParticles` installation.
|
|
65
46
|
|
|
66
47
|
```javascript
|
|
67
|
-
tsParticles.load(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
48
|
+
tsParticles.load({
|
|
49
|
+
id: "tsparticles",
|
|
50
|
+
options: {
|
|
51
|
+
particles: {
|
|
52
|
+
shape: {
|
|
53
|
+
type: "circle", // starting from v2, this require the circle shape script
|
|
54
|
+
},
|
|
71
55
|
},
|
|
56
|
+
preset: "squares",
|
|
72
57
|
},
|
|
73
|
-
preset: "squares",
|
|
74
58
|
});
|
|
75
59
|
```
|
|
76
60
|
|
|
77
61
|
Like in the sample above, the circles will be replaced by squares.
|
|
78
62
|
|
|
79
|
-
###
|
|
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
|
-
```
|
|
63
|
+
### Frameworks with a tsParticles component library
|
|
106
64
|
|
|
107
|
-
|
|
65
|
+
Checkout the documentation in the component library repository and call the `loadSquaresPreset` function instead
|
|
66
|
+
of `loadFull`, `loadSlim` or similar functions.
|
|
108
67
|
|
|
109
|
-
|
|
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
|
-
```
|
|
68
|
+
The options shown above are valid for all the component libraries.
|
|
161
69
|
|
|
162
70
|
---
|
|
163
71
|
|
package/browser/bundle.js
CHANGED
package/browser/index.js
CHANGED
|
@@ -10,5 +10,6 @@ export async function loadSquaresPreset(engine, refresh = true) {
|
|
|
10
10
|
await loadRotateUpdater(engine, false);
|
|
11
11
|
await loadSizeUpdater(engine, false);
|
|
12
12
|
await loadStrokeColorUpdater(engine, false);
|
|
13
|
-
await engine.addPreset("squares", options,
|
|
13
|
+
await engine.addPreset("squares", options, false);
|
|
14
|
+
await engine.refresh(refresh);
|
|
14
15
|
}
|
package/browser/options.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DestroyType, RotateDirection, StartValueType } from "@tsparticles/engine";
|
|
1
2
|
export const options = {
|
|
2
3
|
particles: {
|
|
3
4
|
stroke: {
|
|
@@ -26,7 +27,7 @@ export const options = {
|
|
|
26
27
|
},
|
|
27
28
|
rotate: {
|
|
28
29
|
value: 0,
|
|
29
|
-
direction:
|
|
30
|
+
direction: RotateDirection.counterClockwise,
|
|
30
31
|
animation: {
|
|
31
32
|
enable: true,
|
|
32
33
|
speed: 2,
|
|
@@ -37,10 +38,10 @@ export const options = {
|
|
|
37
38
|
value: { min: 1, max: 500 },
|
|
38
39
|
animation: {
|
|
39
40
|
enable: true,
|
|
40
|
-
startValue:
|
|
41
|
+
startValue: StartValueType.min,
|
|
41
42
|
speed: 60,
|
|
42
43
|
sync: true,
|
|
43
|
-
destroy:
|
|
44
|
+
destroy: DestroyType.max,
|
|
44
45
|
},
|
|
45
46
|
},
|
|
46
47
|
},
|
package/cjs/bundle.js
CHANGED
|
@@ -5,4 +5,3 @@ const index_js_1 = require("./index.js");
|
|
|
5
5
|
Object.defineProperty(exports, "loadSquaresPreset", { enumerable: true, get: function () { return index_js_1.loadSquaresPreset; } });
|
|
6
6
|
const engine_1 = require("@tsparticles/engine");
|
|
7
7
|
Object.defineProperty(exports, "tsParticles", { enumerable: true, get: function () { return engine_1.tsParticles; } });
|
|
8
|
-
void (0, index_js_1.loadSquaresPreset)(engine_1.tsParticles);
|
package/cjs/index.js
CHANGED
|
@@ -13,6 +13,7 @@ async function loadSquaresPreset(engine, refresh = true) {
|
|
|
13
13
|
await (0, updater_rotate_1.loadRotateUpdater)(engine, false);
|
|
14
14
|
await (0, updater_size_1.loadSizeUpdater)(engine, false);
|
|
15
15
|
await (0, updater_stroke_color_1.loadStrokeColorUpdater)(engine, false);
|
|
16
|
-
await engine.addPreset("squares", options_js_1.options,
|
|
16
|
+
await engine.addPreset("squares", options_js_1.options, false);
|
|
17
|
+
await engine.refresh(refresh);
|
|
17
18
|
}
|
|
18
19
|
exports.loadSquaresPreset = loadSquaresPreset;
|
package/cjs/options.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.options = void 0;
|
|
4
|
+
const engine_1 = require("@tsparticles/engine");
|
|
4
5
|
exports.options = {
|
|
5
6
|
particles: {
|
|
6
7
|
stroke: {
|
|
@@ -29,7 +30,7 @@ exports.options = {
|
|
|
29
30
|
},
|
|
30
31
|
rotate: {
|
|
31
32
|
value: 0,
|
|
32
|
-
direction:
|
|
33
|
+
direction: engine_1.RotateDirection.counterClockwise,
|
|
33
34
|
animation: {
|
|
34
35
|
enable: true,
|
|
35
36
|
speed: 2,
|
|
@@ -40,10 +41,10 @@ exports.options = {
|
|
|
40
41
|
value: { min: 1, max: 500 },
|
|
41
42
|
animation: {
|
|
42
43
|
enable: true,
|
|
43
|
-
startValue:
|
|
44
|
+
startValue: engine_1.StartValueType.min,
|
|
44
45
|
speed: 60,
|
|
45
46
|
sync: true,
|
|
46
|
-
destroy:
|
|
47
|
+
destroy: engine_1.DestroyType.max,
|
|
47
48
|
},
|
|
48
49
|
},
|
|
49
50
|
},
|
package/esm/bundle.js
CHANGED
package/esm/index.js
CHANGED
|
@@ -10,5 +10,6 @@ export async function loadSquaresPreset(engine, refresh = true) {
|
|
|
10
10
|
await loadRotateUpdater(engine, false);
|
|
11
11
|
await loadSizeUpdater(engine, false);
|
|
12
12
|
await loadStrokeColorUpdater(engine, false);
|
|
13
|
-
await engine.addPreset("squares", options,
|
|
13
|
+
await engine.addPreset("squares", options, false);
|
|
14
|
+
await engine.refresh(refresh);
|
|
14
15
|
}
|
package/esm/options.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DestroyType, RotateDirection, StartValueType } from "@tsparticles/engine";
|
|
1
2
|
export const options = {
|
|
2
3
|
particles: {
|
|
3
4
|
stroke: {
|
|
@@ -26,7 +27,7 @@ export const options = {
|
|
|
26
27
|
},
|
|
27
28
|
rotate: {
|
|
28
29
|
value: 0,
|
|
29
|
-
direction:
|
|
30
|
+
direction: RotateDirection.counterClockwise,
|
|
30
31
|
animation: {
|
|
31
32
|
enable: true,
|
|
32
33
|
speed: 2,
|
|
@@ -37,10 +38,10 @@ export const options = {
|
|
|
37
38
|
value: { min: 1, max: 500 },
|
|
38
39
|
animation: {
|
|
39
40
|
enable: true,
|
|
40
|
-
startValue:
|
|
41
|
+
startValue: StartValueType.min,
|
|
41
42
|
speed: 60,
|
|
42
43
|
sync: true,
|
|
43
|
-
destroy:
|
|
44
|
+
destroy: DestroyType.max,
|
|
44
45
|
},
|
|
45
46
|
},
|
|
46
47
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/preset-squares",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "tsParticles squares preset",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -87,12 +87,12 @@
|
|
|
87
87
|
"module": "esm/index.js",
|
|
88
88
|
"types": "types/index.d.ts",
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@tsparticles/engine": "^3.
|
|
91
|
-
"@tsparticles/plugin-emitters": "^3.
|
|
92
|
-
"@tsparticles/shape-square": "^3.
|
|
93
|
-
"@tsparticles/updater-rotate": "^3.
|
|
94
|
-
"@tsparticles/updater-size": "^3.
|
|
95
|
-
"@tsparticles/updater-stroke-color": "^3.
|
|
90
|
+
"@tsparticles/engine": "^3.4.0",
|
|
91
|
+
"@tsparticles/plugin-emitters": "^3.4.0",
|
|
92
|
+
"@tsparticles/shape-square": "^3.4.0",
|
|
93
|
+
"@tsparticles/updater-rotate": "^3.4.0",
|
|
94
|
+
"@tsparticles/updater-size": "^3.4.0",
|
|
95
|
+
"@tsparticles/updater-stroke-color": "^3.4.0"
|
|
96
96
|
},
|
|
97
97
|
"publishConfig": {
|
|
98
98
|
"access": "public"
|