tsparticles 2.0.0-beta.2 → 2.0.0-beta.3
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/107.js +1 -1
- package/README.md +68 -50
- package/index.d.ts +1 -1
- package/index.js +22 -5
- package/package.json +11 -13
- package/report.html +6 -5
- package/tsparticles.bundle.js +2474 -896
- package/tsparticles.bundle.min.js +2 -2
- package/tsparticles.js +85 -18
- package/tsparticles.min.js +2 -2
package/107.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v2.0.0-beta.
|
|
7
|
+
* v2.0.0-beta.3
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
(this["webpackChunktsparticles"] = this["webpackChunktsparticles"] || []).push([[107],{
|
package/README.md
CHANGED
|
@@ -1,92 +1,87 @@
|
|
|
1
1
|
[](https://particles.js.org)
|
|
2
2
|
|
|
3
|
-
# tsParticles
|
|
3
|
+
# tsParticles Full Bundle
|
|
4
4
|
|
|
5
|
-
[](https://www.jsdelivr.com/package/npm/tsparticles) [](https://www.npmjs.com/package/tsparticles) [](https://www.npmjs.com/package/tsparticles)
|
|
6
6
|
|
|
7
|
-
[tsParticles](https://github.com/matteobruni/tsparticles)
|
|
8
|
-
|
|
7
|
+
[tsParticles](https://github.com/matteobruni/tsparticles) full bundle loads all the v1 features to
|
|
8
|
+
a `tsparticles-engine` instance.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
**Included Packages**
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- tsparticles-engine
|
|
13
|
+
- tsparticles-slim (and all its dependencies)
|
|
14
|
+
- tsparticles-interaction-external-trail
|
|
15
|
+
- tsparticles-plugin-absorbers
|
|
16
|
+
- tsparticles-plugin-emitters
|
|
17
|
+
- tsparticles-plugin-polygon-mask
|
|
18
|
+
- tsparticles-updater-roll
|
|
19
|
+
- tsparticles-updater-tilt
|
|
20
|
+
- tsparticles-updater-wobble
|
|
13
21
|
|
|
14
22
|
## How to use it
|
|
15
23
|
|
|
16
24
|
### CDN / Vanilla JS / jQuery
|
|
17
25
|
|
|
18
|
-
The
|
|
19
|
-
vanilla javascript in the main project [here](https://github.com/matteobruni/tsparticles)
|
|
26
|
+
The CDN/Vanilla version JS has two different files:
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
```html
|
|
25
|
-
<script src="https://cdn.jsdelivr.net/npm/tsparticles"></script>
|
|
26
|
-
<script src="https://cdn.jsdelivr.net/npm/tsparticles-preset-bubbles"></script>
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
This script **MUST** be placed after the `tsParticles` one.
|
|
28
|
+
- One is a bundle file with all the scripts included in a single file
|
|
29
|
+
- One is a file including just the `loadFull` function to load the tsParticles full preset, all dependencies must be
|
|
30
|
+
included manually
|
|
30
31
|
|
|
31
32
|
#### Bundle
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
Including the `tsparticles.bundle.min.js` file will work exactly like `v1`, you can start using the `tsParticles`
|
|
35
|
+
instance in the same way.
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
<script src="https://cdn.jsdelivr.net/npm/tsparticles-preset-bubbles/dist/tsparticles.preset.bubbles.bundle.min.js"></script>
|
|
37
|
-
```
|
|
37
|
+
This is the easiest usage, since it's a single file with the same `v1` features.
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
All new features will be added as external packages, this bundle is recommended for migrating from `v1` easily.
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
#### Not Bundle
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
This installation requires more work since all dependencies must be included in the page. Some lines above are all
|
|
44
|
+
specified in the **Included Packages** section.
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
```
|
|
46
|
+
A note about `tsparticles-slim` can be made: it's not mandatory to include all of its dependencies, the slim bundle file
|
|
47
|
+
is enough, and if this is done the `tsparticles-engine` is not needed, since it's already bundled in the slim bundle.
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
### Usage
|
|
52
50
|
|
|
53
|
-
|
|
54
|
-
You can override all the options defining the properties like in any standard `tsParticles` installation.
|
|
51
|
+
Once the scripts are loaded you can set up `tsParticles` like this:
|
|
55
52
|
|
|
56
53
|
```javascript
|
|
54
|
+
loadFull(tsParticles); // not needed if using the bundle script, required for any other installation
|
|
55
|
+
|
|
57
56
|
tsParticles.load("tsparticles", {
|
|
58
|
-
|
|
59
|
-
shape: {
|
|
60
|
-
type: "square",
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
preset: "bubbles",
|
|
57
|
+
/* options */
|
|
64
58
|
});
|
|
65
59
|
```
|
|
66
60
|
|
|
67
|
-
Like in the sample above, the circles will be replaced by squares.
|
|
68
|
-
|
|
69
61
|
### React.js / Preact / Inferno
|
|
70
62
|
|
|
71
63
|
_The syntax for `React.js`, `Preact` and `Inferno` is the same_.
|
|
72
64
|
|
|
73
65
|
This sample uses the class component syntax, but you can use hooks as well (if the library supports it).
|
|
74
66
|
|
|
75
|
-
|
|
67
|
+
_Class Components_
|
|
68
|
+
|
|
69
|
+
```typescript jsx
|
|
70
|
+
import React from "react";
|
|
76
71
|
import Particles from "react-tsparticles";
|
|
77
|
-
import { Main } from "tsparticles-engine";
|
|
78
|
-
import {
|
|
72
|
+
import type { Main } from "tsparticles-engine";
|
|
73
|
+
import { loadFull } from "tsparticles";
|
|
79
74
|
|
|
80
|
-
export class ParticlesContainer extends
|
|
75
|
+
export class ParticlesContainer extends PureComponent<unknown> {
|
|
81
76
|
// this customizes the component tsParticles installation
|
|
82
77
|
customInit(main: Main) {
|
|
83
|
-
// this adds the
|
|
84
|
-
|
|
78
|
+
// this adds the bundle to tsParticles
|
|
79
|
+
loadFull(main);
|
|
85
80
|
}
|
|
86
81
|
|
|
87
82
|
render() {
|
|
88
83
|
const options = {
|
|
89
|
-
|
|
84
|
+
/* custom options */
|
|
90
85
|
};
|
|
91
86
|
|
|
92
87
|
return <Particles options={options} init={this.customInit} />;
|
|
@@ -94,6 +89,29 @@ export class ParticlesContainer extends React.PureComponent<IProps> {
|
|
|
94
89
|
}
|
|
95
90
|
```
|
|
96
91
|
|
|
92
|
+
_Hooks / Functional Components_
|
|
93
|
+
|
|
94
|
+
```typescript jsx
|
|
95
|
+
import React, { useCallback } from "react";
|
|
96
|
+
import Particles from "react-tsparticles";
|
|
97
|
+
import type { Main } from "tsparticles-engine";
|
|
98
|
+
import { loadFull } from "tsparticles";
|
|
99
|
+
|
|
100
|
+
export function ParticlesContainer(props: unknown) {
|
|
101
|
+
// this customizes the component tsParticles installation
|
|
102
|
+
const customInit = useCallback((main: Main) => {
|
|
103
|
+
// this adds the bundle to tsParticles
|
|
104
|
+
loadFull(main);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const options = {
|
|
108
|
+
/* custom options */
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return <Particles options={options} init={this.customInit} />;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
97
115
|
### Vue (2.x and 3.x)
|
|
98
116
|
|
|
99
117
|
_The syntax for `Vue.js 2.x` and `3.x` is the same_
|
|
@@ -104,7 +122,7 @@ _The syntax for `Vue.js 2.x` and `3.x` is the same_
|
|
|
104
122
|
|
|
105
123
|
```js
|
|
106
124
|
function particlesInit(main: Main) {
|
|
107
|
-
|
|
125
|
+
loadFull(main);
|
|
108
126
|
}
|
|
109
127
|
```
|
|
110
128
|
|
|
@@ -121,7 +139,7 @@ function particlesInit(main: Main) {
|
|
|
121
139
|
|
|
122
140
|
```ts
|
|
123
141
|
function particlesInit(main: Main): void {
|
|
124
|
-
|
|
142
|
+
loadFull(main);
|
|
125
143
|
}
|
|
126
144
|
```
|
|
127
145
|
|
|
@@ -138,6 +156,6 @@ function particlesInit(main: Main): void {
|
|
|
138
156
|
|
|
139
157
|
```js
|
|
140
158
|
let onParticlesInit = (main) => {
|
|
141
|
-
|
|
159
|
+
loadFull(main);
|
|
142
160
|
};
|
|
143
161
|
```
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Main } from "tsparticles-engine";
|
|
2
|
-
export declare function loadFull(tsParticles: Main): void
|
|
2
|
+
export declare function loadFull(tsParticles: Main): Promise<void>;
|
package/index.js
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import { loadSlim } from "tsparticles-slim";
|
|
11
|
+
import { loadTiltUpdater } from "tsparticles-updater-tilt";
|
|
12
|
+
import { loadRollUpdater } from "tsparticles-updater-roll";
|
|
13
|
+
import { loadWobbleUpdater } from "tsparticles-updater-wobble";
|
|
2
14
|
import { loadExternalTrailInteraction } from "tsparticles-interaction-external-trail";
|
|
3
15
|
import { loadAbsorbersPlugin } from "tsparticles-plugin-absorbers";
|
|
4
16
|
import { loadEmittersPlugin } from "tsparticles-plugin-emitters";
|
|
5
17
|
import { loadPolygonMaskPlugin } from "tsparticles-plugin-polygon-mask";
|
|
6
18
|
export function loadFull(tsParticles) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
yield loadSlim(tsParticles);
|
|
21
|
+
yield loadTiltUpdater(tsParticles);
|
|
22
|
+
yield loadRollUpdater(tsParticles);
|
|
23
|
+
yield loadWobbleUpdater(tsParticles);
|
|
24
|
+
yield loadExternalTrailInteraction(tsParticles);
|
|
25
|
+
yield loadAbsorbersPlugin(tsParticles);
|
|
26
|
+
yield loadEmittersPlugin(tsParticles);
|
|
27
|
+
yield loadPolygonMaskPlugin(tsParticles);
|
|
28
|
+
});
|
|
12
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsparticles",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.3",
|
|
4
4
|
"description": "Easily create highly customizable particle animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.",
|
|
5
5
|
"homepage": "https://particles.js.org/",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/matteobruni/tsparticles.git",
|
|
12
|
-
"directory": "
|
|
12
|
+
"directory": "bundles/full"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"tsparticles",
|
|
@@ -51,11 +51,6 @@
|
|
|
51
51
|
"background"
|
|
52
52
|
],
|
|
53
53
|
"author": "Matteo Bruni <matteo.bruni@me.com>",
|
|
54
|
-
"contributors": [
|
|
55
|
-
"Gabriel Barker (https://github.com/gabrielbarker)",
|
|
56
|
-
"Tyler Burnett (https://github.com/TylerBurnett)",
|
|
57
|
-
"Jonathan Adams (https://github.com/PieceMaker)"
|
|
58
|
-
],
|
|
59
54
|
"license": "MIT",
|
|
60
55
|
"bugs": {
|
|
61
56
|
"url": "https://github.com/matteobruni/tsparticles/issues"
|
|
@@ -71,11 +66,14 @@
|
|
|
71
66
|
"browser": "index.js",
|
|
72
67
|
"types": "index.d.ts",
|
|
73
68
|
"dependencies": {
|
|
74
|
-
"tsparticles-engine": "^2.0.0-beta.
|
|
75
|
-
"tsparticles-interaction-external-trail": "^2.0.0-beta.
|
|
76
|
-
"tsparticles-plugin-absorbers": "^2.0.0-beta.
|
|
77
|
-
"tsparticles-plugin-emitters": "^2.0.0-beta.
|
|
78
|
-
"tsparticles-plugin-polygon-mask": "^2.0.0-beta.
|
|
79
|
-
"tsparticles-slim": "^2.0.0-beta.
|
|
69
|
+
"tsparticles-engine": "^2.0.0-beta.2",
|
|
70
|
+
"tsparticles-interaction-external-trail": "^2.0.0-beta.3",
|
|
71
|
+
"tsparticles-plugin-absorbers": "^2.0.0-beta.3",
|
|
72
|
+
"tsparticles-plugin-emitters": "^2.0.0-beta.3",
|
|
73
|
+
"tsparticles-plugin-polygon-mask": "^2.0.0-beta.3",
|
|
74
|
+
"tsparticles-slim": "^2.0.0-beta.3",
|
|
75
|
+
"tsparticles-updater-roll": "^2.0.0-beta.3",
|
|
76
|
+
"tsparticles-updater-tilt": "^2.0.0-beta.3",
|
|
77
|
+
"tsparticles-updater-wobble": "^2.0.0-beta.3"
|
|
80
78
|
}
|
|
81
79
|
}
|