@tsparticles/pjs 3.0.0-alpha.1 → 3.0.0-beta.4
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +46 -8
- package/browser/VincentGarreau/particles.js +23 -0
- package/browser/bundle.js +2 -2
- package/browser/index.js +7 -20
- package/browser/marcbruederlin/Particles.js +83 -0
- package/browser/package.json +1 -0
- package/cjs/VincentGarreau/particles.js +26 -0
- package/cjs/bundle.js +3 -2
- package/cjs/index.js +7 -20
- package/cjs/marcbruederlin/Particles.js +87 -0
- package/cjs/package.json +1 -0
- package/esm/VincentGarreau/particles.js +23 -0
- package/esm/bundle.js +2 -2
- package/esm/index.js +7 -20
- package/esm/marcbruederlin/Particles.js +83 -0
- package/esm/package.json +1 -0
- package/package.json +36 -13
- package/report.html +5 -5
- package/tsparticles.pjs.bundle.js +2367 -2321
- package/tsparticles.pjs.bundle.min.js +1 -1
- package/tsparticles.pjs.bundle.min.js.LICENSE.txt +1 -8
- package/tsparticles.pjs.js +159 -12
- package/tsparticles.pjs.min.js +1 -1
- package/tsparticles.pjs.min.js.LICENSE.txt +1 -8
- package/types/VincentGarreau/particles.d.ts +7 -0
- package/types/bundle.d.ts +2 -2
- package/types/index.d.ts +11 -2
- package/types/marcbruederlin/Particles.d.ts +23 -0
- package/umd/VincentGarreau/particles.js +36 -0
- package/umd/bundle.js +3 -2
- package/umd/index.js +8 -21
- package/umd/marcbruederlin/Particles.js +97 -0
- /package/browser/{IParticlesJS.js → VincentGarreau/IParticlesJS.js} +0 -0
- /package/cjs/{IParticlesJS.js → VincentGarreau/IParticlesJS.js} +0 -0
- /package/esm/{IParticlesJS.js → VincentGarreau/IParticlesJS.js} +0 -0
- /package/types/{IParticlesJS.d.ts → VincentGarreau/IParticlesJS.d.ts} +0 -0
- /package/umd/{IParticlesJS.js → VincentGarreau/IParticlesJS.js} +0 -0
package/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
# tsParticles Particles.js Compatibility Package
|
4
4
|
|
5
|
-
[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/
|
5
|
+
[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/@tsparticles/particles.js/badge)](https://www.jsdelivr.com/package/npm/@tsparticles/particles.js) [![npmjs](https://badge.fury.io/js/@tsparticles/particles.js.svg)](https://www.npmjs.com/package/@tsparticles/particles.js) [![npmjs](https://img.shields.io/npm/dt/@tsparticles/particles.js)](https://www.npmjs.com/package/@tsparticles/particles.js) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
|
6
6
|
|
7
|
-
[tsParticles](https://github.com/
|
7
|
+
[tsParticles](https://github.com/tsparticles/tsparticles) particles.js compatibility library.
|
8
8
|
|
9
9
|
## How to use it
|
10
10
|
|
@@ -17,12 +17,8 @@ The CDN/Vanilla version JS has two different files:
|
|
17
17
|
|
18
18
|
#### Bundle
|
19
19
|
|
20
|
-
Including the `tsparticles.pjs.bundle.min.js` file will work exactly like `v1`, you can start using the `tsParticles
|
21
|
-
the `particlesJS` instance in the same way.
|
22
|
-
|
23
|
-
This is the easiest usage, since it's a single file with the some of the `v1` features.
|
24
|
-
|
25
|
-
All new features will be added as external packages, this bundle is recommended for migrating from `v1` easily.
|
20
|
+
Including the `tsparticles.pjs.bundle.min.js` file will work exactly like `v1`, you can start using the `tsParticles`,
|
21
|
+
the `particlesJS` instance, or the `Particles` object in the same way.
|
26
22
|
|
27
23
|
#### Not Bundle
|
28
24
|
|
@@ -49,3 +45,45 @@ tsParticles.load({
|
|
49
45
|
},
|
50
46
|
});
|
51
47
|
```
|
48
|
+
|
49
|
+
#### Options
|
50
|
+
|
51
|
+
Here you can use ParticlesJS or tsParticles options, they will work both fine.
|
52
|
+
|
53
|
+
### Alternative Usage
|
54
|
+
|
55
|
+
```javascript
|
56
|
+
const { Particles } = initPjs(tsParticles); // not needed if using the bundle script, required for any other installation
|
57
|
+
|
58
|
+
Particles.init({
|
59
|
+
/* options */
|
60
|
+
});
|
61
|
+
```
|
62
|
+
|
63
|
+
#### Particles Options (only for Particles.init)
|
64
|
+
|
65
|
+
| Option | Type | Default | Description |
|
66
|
+
| ------------------ | ------------------ | --------- | --------------------------------------------------------------------- |
|
67
|
+
| `selector` | string | - | _Required:_ The CSS selector of your canvas element |
|
68
|
+
| `maxParticles` | integer | `100` | _Optional:_ Maximum amount of particles |
|
69
|
+
| `sizeVariations` | integer | `3` | _Optional:_ Amount of size variations |
|
70
|
+
| `speed` | integer | `0.5` | _Optional:_ Movement speed of the particles |
|
71
|
+
| `color` | string or string[] | `#000000` | _Optional:_ Color(s) of the particles and connecting lines |
|
72
|
+
| `minDistance` | integer | `120` | _Optional:_ Distance in `px` for connecting lines |
|
73
|
+
| `connectParticles` | boolean | `false` | _Optional:_ `true`/`false` if connecting lines should be drawn or not |
|
74
|
+
| `responsive` | array | `null` | _Optional:_ Array of objects containing breakpoints and options |
|
75
|
+
|
76
|
+
##### Responsive Options
|
77
|
+
|
78
|
+
| Option | Type | Default | Description |
|
79
|
+
| ------------ | ------- | ------- | --------------------------------------------------------- |
|
80
|
+
| `breakpoint` | integer | - | _Required:_ Breakpoint in `px` |
|
81
|
+
| `options` | object | - | _Required:_ Options object, that overrides default values |
|
82
|
+
|
83
|
+
#### Methods
|
84
|
+
|
85
|
+
| Method | Description |
|
86
|
+
| ----------------- | ----------------------------------- |
|
87
|
+
| `pauseAnimation` | Pauses/stops the particle animation |
|
88
|
+
| `resumeAnimation` | Continues the particle animation |
|
89
|
+
| `destroy` | Destroys the plugin |
|
@@ -0,0 +1,23 @@
|
|
1
|
+
const initParticlesJS = (engine) => {
|
2
|
+
const particlesJS = (tagId, options) => {
|
3
|
+
return engine.load({ id: tagId, options });
|
4
|
+
};
|
5
|
+
particlesJS.load = (tagId, pathConfigJson, callback) => {
|
6
|
+
engine
|
7
|
+
.load({ id: tagId, url: pathConfigJson })
|
8
|
+
.then((container) => {
|
9
|
+
if (container) {
|
10
|
+
callback(container);
|
11
|
+
}
|
12
|
+
})
|
13
|
+
.catch(() => {
|
14
|
+
callback(undefined);
|
15
|
+
});
|
16
|
+
};
|
17
|
+
particlesJS.setOnClickHandler = (callback) => {
|
18
|
+
engine.setOnClickHandler(callback);
|
19
|
+
};
|
20
|
+
const pJSDom = engine.dom();
|
21
|
+
return { particlesJS, pJSDom };
|
22
|
+
};
|
23
|
+
export { initParticlesJS };
|
package/browser/bundle.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { initPjs } from ".";
|
2
2
|
import { tsParticles } from "@tsparticles/engine";
|
3
|
-
const { particlesJS, pJSDom } = initPjs(tsParticles);
|
3
|
+
const { particlesJS, pJSDom, Particles } = initPjs(tsParticles);
|
4
4
|
export * from "@tsparticles/engine";
|
5
|
-
export { particlesJS, pJSDom };
|
5
|
+
export { particlesJS, pJSDom, Particles };
|
package/browser/index.js
CHANGED
@@ -1,23 +1,10 @@
|
|
1
|
+
import { Particles } from "./marcbruederlin/Particles.js";
|
2
|
+
import { initParticlesJS } from "./VincentGarreau/particles.js";
|
1
3
|
const initPjs = (engine) => {
|
2
|
-
const particlesJS = (
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
.load({ id: tagId, url: pathConfigJson })
|
8
|
-
.then((container) => {
|
9
|
-
if (container) {
|
10
|
-
callback(container);
|
11
|
-
}
|
12
|
-
})
|
13
|
-
.catch(() => {
|
14
|
-
callback(undefined);
|
15
|
-
});
|
16
|
-
};
|
17
|
-
particlesJS.setOnClickHandler = (callback) => {
|
18
|
-
engine.setOnClickHandler(callback);
|
19
|
-
};
|
20
|
-
const pJSDom = engine.dom();
|
21
|
-
return { particlesJS, pJSDom };
|
4
|
+
const { particlesJS, pJSDom } = initParticlesJS(engine);
|
5
|
+
window.particlesJS = particlesJS;
|
6
|
+
window.pJSDom = pJSDom;
|
7
|
+
window.Particles = Particles;
|
8
|
+
return { particlesJS, pJSDom, Particles };
|
22
9
|
};
|
23
10
|
export { initPjs };
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import { tsParticles } from "@tsparticles/engine";
|
2
|
+
export class Particles {
|
3
|
+
static init(options) {
|
4
|
+
const particles = new Particles(), selector = options.selector;
|
5
|
+
if (!selector) {
|
6
|
+
throw new Error("No selector provided");
|
7
|
+
}
|
8
|
+
const el = document.querySelector(selector);
|
9
|
+
if (!el) {
|
10
|
+
throw new Error("No element found for selector");
|
11
|
+
}
|
12
|
+
tsParticles
|
13
|
+
.load({
|
14
|
+
id: selector.replace(".", "").replace("!", ""),
|
15
|
+
element: el,
|
16
|
+
options: {
|
17
|
+
fullScreen: {
|
18
|
+
enable: false,
|
19
|
+
},
|
20
|
+
particles: {
|
21
|
+
color: {
|
22
|
+
value: options.color ?? "!000000",
|
23
|
+
},
|
24
|
+
links: {
|
25
|
+
color: "random",
|
26
|
+
distance: options.minDistance ?? 120,
|
27
|
+
enable: options.connectParticles ?? false,
|
28
|
+
},
|
29
|
+
move: {
|
30
|
+
enable: true,
|
31
|
+
speed: options.speed ?? 0.5,
|
32
|
+
},
|
33
|
+
number: {
|
34
|
+
value: options.maxParticles ?? 100,
|
35
|
+
},
|
36
|
+
size: {
|
37
|
+
value: { min: 1, max: options.sizeVariations ?? 3 },
|
38
|
+
},
|
39
|
+
},
|
40
|
+
responsive: options.responsive?.map((responsive) => ({
|
41
|
+
maxWidth: responsive.breakpoint,
|
42
|
+
options: {
|
43
|
+
particles: {
|
44
|
+
color: {
|
45
|
+
value: responsive.options?.color,
|
46
|
+
},
|
47
|
+
links: {
|
48
|
+
distance: responsive.options?.minDistance,
|
49
|
+
enable: responsive.options?.connectParticles,
|
50
|
+
},
|
51
|
+
number: {
|
52
|
+
value: options.maxParticles,
|
53
|
+
},
|
54
|
+
move: {
|
55
|
+
enable: true,
|
56
|
+
speed: responsive.options?.speed,
|
57
|
+
},
|
58
|
+
size: {
|
59
|
+
value: responsive.options?.sizeVariations,
|
60
|
+
},
|
61
|
+
},
|
62
|
+
},
|
63
|
+
})),
|
64
|
+
},
|
65
|
+
})
|
66
|
+
.then((container) => {
|
67
|
+
particles._container = container;
|
68
|
+
});
|
69
|
+
return particles;
|
70
|
+
}
|
71
|
+
destroy() {
|
72
|
+
const container = this._container;
|
73
|
+
container && container.destroy();
|
74
|
+
}
|
75
|
+
pauseAnimation() {
|
76
|
+
const container = this._container;
|
77
|
+
container && container.pause();
|
78
|
+
}
|
79
|
+
resumeAnimation() {
|
80
|
+
const container = this._container;
|
81
|
+
container && container.play();
|
82
|
+
}
|
83
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{ "type": "module" }
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.initParticlesJS = void 0;
|
4
|
+
const initParticlesJS = (engine) => {
|
5
|
+
const particlesJS = (tagId, options) => {
|
6
|
+
return engine.load({ id: tagId, options });
|
7
|
+
};
|
8
|
+
particlesJS.load = (tagId, pathConfigJson, callback) => {
|
9
|
+
engine
|
10
|
+
.load({ id: tagId, url: pathConfigJson })
|
11
|
+
.then((container) => {
|
12
|
+
if (container) {
|
13
|
+
callback(container);
|
14
|
+
}
|
15
|
+
})
|
16
|
+
.catch(() => {
|
17
|
+
callback(undefined);
|
18
|
+
});
|
19
|
+
};
|
20
|
+
particlesJS.setOnClickHandler = (callback) => {
|
21
|
+
engine.setOnClickHandler(callback);
|
22
|
+
};
|
23
|
+
const pJSDom = engine.dom();
|
24
|
+
return { particlesJS, pJSDom };
|
25
|
+
};
|
26
|
+
exports.initParticlesJS = initParticlesJS;
|
package/cjs/bundle.js
CHANGED
@@ -14,10 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
exports.pJSDom = exports.particlesJS = void 0;
|
17
|
+
exports.Particles = exports.pJSDom = exports.particlesJS = void 0;
|
18
18
|
const _1 = require(".");
|
19
19
|
const engine_1 = require("@tsparticles/engine");
|
20
|
-
const { particlesJS, pJSDom } = (0, _1.initPjs)(engine_1.tsParticles);
|
20
|
+
const { particlesJS, pJSDom, Particles } = (0, _1.initPjs)(engine_1.tsParticles);
|
21
21
|
exports.particlesJS = particlesJS;
|
22
22
|
exports.pJSDom = pJSDom;
|
23
|
+
exports.Particles = Particles;
|
23
24
|
__exportStar(require("@tsparticles/engine"), exports);
|
package/cjs/index.js
CHANGED
@@ -1,26 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.initPjs = void 0;
|
4
|
+
const Particles_js_1 = require("./marcbruederlin/Particles.js");
|
5
|
+
const particles_js_1 = require("./VincentGarreau/particles.js");
|
4
6
|
const initPjs = (engine) => {
|
5
|
-
const particlesJS = (
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
.load({ id: tagId, url: pathConfigJson })
|
11
|
-
.then((container) => {
|
12
|
-
if (container) {
|
13
|
-
callback(container);
|
14
|
-
}
|
15
|
-
})
|
16
|
-
.catch(() => {
|
17
|
-
callback(undefined);
|
18
|
-
});
|
19
|
-
};
|
20
|
-
particlesJS.setOnClickHandler = (callback) => {
|
21
|
-
engine.setOnClickHandler(callback);
|
22
|
-
};
|
23
|
-
const pJSDom = engine.dom();
|
24
|
-
return { particlesJS, pJSDom };
|
7
|
+
const { particlesJS, pJSDom } = (0, particles_js_1.initParticlesJS)(engine);
|
8
|
+
window.particlesJS = particlesJS;
|
9
|
+
window.pJSDom = pJSDom;
|
10
|
+
window.Particles = Particles_js_1.Particles;
|
11
|
+
return { particlesJS, pJSDom, Particles: Particles_js_1.Particles };
|
25
12
|
};
|
26
13
|
exports.initPjs = initPjs;
|
@@ -0,0 +1,87 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Particles = void 0;
|
4
|
+
const engine_1 = require("@tsparticles/engine");
|
5
|
+
class Particles {
|
6
|
+
static init(options) {
|
7
|
+
const particles = new Particles(), selector = options.selector;
|
8
|
+
if (!selector) {
|
9
|
+
throw new Error("No selector provided");
|
10
|
+
}
|
11
|
+
const el = document.querySelector(selector);
|
12
|
+
if (!el) {
|
13
|
+
throw new Error("No element found for selector");
|
14
|
+
}
|
15
|
+
engine_1.tsParticles
|
16
|
+
.load({
|
17
|
+
id: selector.replace(".", "").replace("!", ""),
|
18
|
+
element: el,
|
19
|
+
options: {
|
20
|
+
fullScreen: {
|
21
|
+
enable: false,
|
22
|
+
},
|
23
|
+
particles: {
|
24
|
+
color: {
|
25
|
+
value: options.color ?? "!000000",
|
26
|
+
},
|
27
|
+
links: {
|
28
|
+
color: "random",
|
29
|
+
distance: options.minDistance ?? 120,
|
30
|
+
enable: options.connectParticles ?? false,
|
31
|
+
},
|
32
|
+
move: {
|
33
|
+
enable: true,
|
34
|
+
speed: options.speed ?? 0.5,
|
35
|
+
},
|
36
|
+
number: {
|
37
|
+
value: options.maxParticles ?? 100,
|
38
|
+
},
|
39
|
+
size: {
|
40
|
+
value: { min: 1, max: options.sizeVariations ?? 3 },
|
41
|
+
},
|
42
|
+
},
|
43
|
+
responsive: options.responsive?.map((responsive) => ({
|
44
|
+
maxWidth: responsive.breakpoint,
|
45
|
+
options: {
|
46
|
+
particles: {
|
47
|
+
color: {
|
48
|
+
value: responsive.options?.color,
|
49
|
+
},
|
50
|
+
links: {
|
51
|
+
distance: responsive.options?.minDistance,
|
52
|
+
enable: responsive.options?.connectParticles,
|
53
|
+
},
|
54
|
+
number: {
|
55
|
+
value: options.maxParticles,
|
56
|
+
},
|
57
|
+
move: {
|
58
|
+
enable: true,
|
59
|
+
speed: responsive.options?.speed,
|
60
|
+
},
|
61
|
+
size: {
|
62
|
+
value: responsive.options?.sizeVariations,
|
63
|
+
},
|
64
|
+
},
|
65
|
+
},
|
66
|
+
})),
|
67
|
+
},
|
68
|
+
})
|
69
|
+
.then((container) => {
|
70
|
+
particles._container = container;
|
71
|
+
});
|
72
|
+
return particles;
|
73
|
+
}
|
74
|
+
destroy() {
|
75
|
+
const container = this._container;
|
76
|
+
container && container.destroy();
|
77
|
+
}
|
78
|
+
pauseAnimation() {
|
79
|
+
const container = this._container;
|
80
|
+
container && container.pause();
|
81
|
+
}
|
82
|
+
resumeAnimation() {
|
83
|
+
const container = this._container;
|
84
|
+
container && container.play();
|
85
|
+
}
|
86
|
+
}
|
87
|
+
exports.Particles = Particles;
|
package/cjs/package.json
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{ "type": "commonjs" }
|
@@ -0,0 +1,23 @@
|
|
1
|
+
const initParticlesJS = (engine) => {
|
2
|
+
const particlesJS = (tagId, options) => {
|
3
|
+
return engine.load({ id: tagId, options });
|
4
|
+
};
|
5
|
+
particlesJS.load = (tagId, pathConfigJson, callback) => {
|
6
|
+
engine
|
7
|
+
.load({ id: tagId, url: pathConfigJson })
|
8
|
+
.then((container) => {
|
9
|
+
if (container) {
|
10
|
+
callback(container);
|
11
|
+
}
|
12
|
+
})
|
13
|
+
.catch(() => {
|
14
|
+
callback(undefined);
|
15
|
+
});
|
16
|
+
};
|
17
|
+
particlesJS.setOnClickHandler = (callback) => {
|
18
|
+
engine.setOnClickHandler(callback);
|
19
|
+
};
|
20
|
+
const pJSDom = engine.dom();
|
21
|
+
return { particlesJS, pJSDom };
|
22
|
+
};
|
23
|
+
export { initParticlesJS };
|
package/esm/bundle.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { initPjs } from ".";
|
2
2
|
import { tsParticles } from "@tsparticles/engine";
|
3
|
-
const { particlesJS, pJSDom } = initPjs(tsParticles);
|
3
|
+
const { particlesJS, pJSDom, Particles } = initPjs(tsParticles);
|
4
4
|
export * from "@tsparticles/engine";
|
5
|
-
export { particlesJS, pJSDom };
|
5
|
+
export { particlesJS, pJSDom, Particles };
|
package/esm/index.js
CHANGED
@@ -1,23 +1,10 @@
|
|
1
|
+
import { Particles } from "./marcbruederlin/Particles.js";
|
2
|
+
import { initParticlesJS } from "./VincentGarreau/particles.js";
|
1
3
|
const initPjs = (engine) => {
|
2
|
-
const particlesJS = (
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
.load({ id: tagId, url: pathConfigJson })
|
8
|
-
.then((container) => {
|
9
|
-
if (container) {
|
10
|
-
callback(container);
|
11
|
-
}
|
12
|
-
})
|
13
|
-
.catch(() => {
|
14
|
-
callback(undefined);
|
15
|
-
});
|
16
|
-
};
|
17
|
-
particlesJS.setOnClickHandler = (callback) => {
|
18
|
-
engine.setOnClickHandler(callback);
|
19
|
-
};
|
20
|
-
const pJSDom = engine.dom();
|
21
|
-
return { particlesJS, pJSDom };
|
4
|
+
const { particlesJS, pJSDom } = initParticlesJS(engine);
|
5
|
+
window.particlesJS = particlesJS;
|
6
|
+
window.pJSDom = pJSDom;
|
7
|
+
window.Particles = Particles;
|
8
|
+
return { particlesJS, pJSDom, Particles };
|
22
9
|
};
|
23
10
|
export { initPjs };
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import { tsParticles } from "@tsparticles/engine";
|
2
|
+
export class Particles {
|
3
|
+
static init(options) {
|
4
|
+
const particles = new Particles(), selector = options.selector;
|
5
|
+
if (!selector) {
|
6
|
+
throw new Error("No selector provided");
|
7
|
+
}
|
8
|
+
const el = document.querySelector(selector);
|
9
|
+
if (!el) {
|
10
|
+
throw new Error("No element found for selector");
|
11
|
+
}
|
12
|
+
tsParticles
|
13
|
+
.load({
|
14
|
+
id: selector.replace(".", "").replace("!", ""),
|
15
|
+
element: el,
|
16
|
+
options: {
|
17
|
+
fullScreen: {
|
18
|
+
enable: false,
|
19
|
+
},
|
20
|
+
particles: {
|
21
|
+
color: {
|
22
|
+
value: options.color ?? "!000000",
|
23
|
+
},
|
24
|
+
links: {
|
25
|
+
color: "random",
|
26
|
+
distance: options.minDistance ?? 120,
|
27
|
+
enable: options.connectParticles ?? false,
|
28
|
+
},
|
29
|
+
move: {
|
30
|
+
enable: true,
|
31
|
+
speed: options.speed ?? 0.5,
|
32
|
+
},
|
33
|
+
number: {
|
34
|
+
value: options.maxParticles ?? 100,
|
35
|
+
},
|
36
|
+
size: {
|
37
|
+
value: { min: 1, max: options.sizeVariations ?? 3 },
|
38
|
+
},
|
39
|
+
},
|
40
|
+
responsive: options.responsive?.map((responsive) => ({
|
41
|
+
maxWidth: responsive.breakpoint,
|
42
|
+
options: {
|
43
|
+
particles: {
|
44
|
+
color: {
|
45
|
+
value: responsive.options?.color,
|
46
|
+
},
|
47
|
+
links: {
|
48
|
+
distance: responsive.options?.minDistance,
|
49
|
+
enable: responsive.options?.connectParticles,
|
50
|
+
},
|
51
|
+
number: {
|
52
|
+
value: options.maxParticles,
|
53
|
+
},
|
54
|
+
move: {
|
55
|
+
enable: true,
|
56
|
+
speed: responsive.options?.speed,
|
57
|
+
},
|
58
|
+
size: {
|
59
|
+
value: responsive.options?.sizeVariations,
|
60
|
+
},
|
61
|
+
},
|
62
|
+
},
|
63
|
+
})),
|
64
|
+
},
|
65
|
+
})
|
66
|
+
.then((container) => {
|
67
|
+
particles._container = container;
|
68
|
+
});
|
69
|
+
return particles;
|
70
|
+
}
|
71
|
+
destroy() {
|
72
|
+
const container = this._container;
|
73
|
+
container && container.destroy();
|
74
|
+
}
|
75
|
+
pauseAnimation() {
|
76
|
+
const container = this._container;
|
77
|
+
container && container.pause();
|
78
|
+
}
|
79
|
+
resumeAnimation() {
|
80
|
+
const container = this._container;
|
81
|
+
container && container.play();
|
82
|
+
}
|
83
|
+
}
|
package/esm/package.json
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{ "type": "module" }
|
package/package.json
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tsparticles/pjs",
|
3
|
-
"version": "3.0.0-
|
3
|
+
"version": "3.0.0-beta.4",
|
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
|
"repository": {
|
7
7
|
"type": "git",
|
8
|
-
"url": "git+https://github.com/
|
8
|
+
"url": "git+https://github.com/tsparticles/tsparticles.git",
|
9
9
|
"directory": "bundles/pjs"
|
10
10
|
},
|
11
11
|
"keywords": [
|
@@ -64,21 +64,44 @@
|
|
64
64
|
"author": "Matteo Bruni <matteo.bruni@me.com>",
|
65
65
|
"license": "MIT",
|
66
66
|
"bugs": {
|
67
|
-
"url": "https://github.com/
|
67
|
+
"url": "https://github.com/tsparticles/tsparticles/issues"
|
68
68
|
},
|
69
|
-
"funding":
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
69
|
+
"funding": [
|
70
|
+
{
|
71
|
+
"type": "github",
|
72
|
+
"url": "https://github.com/sponsors/matteobruni"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"type": "github",
|
76
|
+
"url": "https://github.com/sponsors/tsparticles"
|
77
|
+
},
|
78
|
+
{
|
79
|
+
"type": "buymeacoffee",
|
80
|
+
"url": "https://www.buymeacoffee.com/matteobruni"
|
81
|
+
}
|
82
|
+
],
|
83
|
+
"sideEffects": false,
|
75
84
|
"jsdelivr": "tsparticles.pjs.min.js",
|
76
85
|
"unpkg": "tsparticles.pjs.min.js",
|
86
|
+
"browser": "browser/index.js",
|
87
|
+
"main": "cjs/index.js",
|
88
|
+
"module": "esm/index.js",
|
77
89
|
"types": "types/index.d.ts",
|
78
|
-
"
|
79
|
-
"
|
90
|
+
"exports": {
|
91
|
+
".": {
|
92
|
+
"types": "./types/index.d.ts",
|
93
|
+
"browser": "./browser/index.js",
|
94
|
+
"import": "./esm/index.js",
|
95
|
+
"require": "./cjs/index.js",
|
96
|
+
"umd": "./umd/index.js",
|
97
|
+
"default": "./cjs/index.js"
|
98
|
+
},
|
99
|
+
"./package.json": "./package.json"
|
80
100
|
},
|
81
101
|
"dependencies": {
|
82
|
-
"@tsparticles/engine": "^3.0.0-
|
102
|
+
"@tsparticles/engine": "^3.0.0-beta.4"
|
103
|
+
},
|
104
|
+
"publishConfig": {
|
105
|
+
"access": "public"
|
83
106
|
}
|
84
|
-
}
|
107
|
+
}
|