@tsparticles/interaction-external-pop 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,76 @@
1
+ [![banner](https://particles.js.org/images/banner2.png)](https://particles.js.org)
2
+
3
+ # tsParticles External Pop Interaction
4
+
5
+ [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/@tsparticles/interaction-external-pop/badge)](https://www.jsdelivr.com/package/npm/@tsparticles/interaction-external-pop)
6
+ [![npmjs](https://badge.fury.io/js/@tsparticles/interaction-external-pop.svg)](https://www.npmjs.com/package/@tsparticles/interaction-external-pop)
7
+ [![npmjs](https://img.shields.io/npm/dt/@tsparticles/interaction-external-pop)](https://www.npmjs.com/package/@tsparticles/interaction-external-pop) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
8
+
9
+ [tsParticles](https://github.com/tsparticles/tsparticles) interaction plugin for pop effect around mouse or HTML
10
+ elements.
11
+
12
+ ## How to use it
13
+
14
+ ### CDN / Vanilla JS / jQuery
15
+
16
+ The CDN/Vanilla version JS has one required file in vanilla configuration:
17
+
18
+ Including the `tsparticles.interaction.external.pop.min.js` file will export the function to load the interaction
19
+ plugin:
20
+
21
+ ```javascript
22
+ loadExternalPopInteraction;
23
+ ```
24
+
25
+ ### Usage
26
+
27
+ Once the scripts are loaded you can set up `tsParticles` and the interaction plugin like this:
28
+
29
+ ```javascript
30
+ (async () => {
31
+ await loadExternalPopInteraction(tsParticles);
32
+
33
+ await tsParticles.load({
34
+ id: "tsparticles",
35
+ options: {
36
+ /* options */
37
+ },
38
+ });
39
+ })();
40
+ ```
41
+
42
+ ### ESM / CommonJS
43
+
44
+ This package is compatible also with ES or CommonJS modules, firstly this needs to be installed, like this:
45
+
46
+ ```shell
47
+ $ npm install @tsparticles/interaction-external-pop
48
+ ```
49
+
50
+ or
51
+
52
+ ```shell
53
+ $ yarn add @tsparticles/interaction-external-pop
54
+ ```
55
+
56
+ Then you need to import it in the app, like this:
57
+
58
+ ```javascript
59
+ const { tsParticles } = require("@tsparticles/engine");
60
+ const { loadExternalPopInteraction } = require("@tsparticles/interaction-external-pop");
61
+
62
+ (async () => {
63
+ await loadExternalPopInteraction(tsParticles);
64
+ })();
65
+ ```
66
+
67
+ or
68
+
69
+ ```javascript
70
+ import { tsParticles } from "@tsparticles/engine";
71
+ import { loadExternalPopInteraction } from "@tsparticles/interaction-external-pop";
72
+
73
+ (async () => {
74
+ await loadExternalPopInteraction(tsParticles);
75
+ })();
76
+ ```
@@ -0,0 +1,35 @@
1
+ import { ExternalInteractorBase } from "@tsparticles/engine";
2
+ const popMode = "pop";
3
+ export class Popper extends ExternalInteractorBase {
4
+ constructor(container) {
5
+ super(container);
6
+ this.handleClickMode = (mode) => {
7
+ const container = this.container;
8
+ if (mode !== popMode) {
9
+ return;
10
+ }
11
+ const clickPos = container.interactivity.mouse.clickPosition;
12
+ if (!clickPos) {
13
+ return;
14
+ }
15
+ const poppedParticles = container.particles.quadTree.queryCircle(clickPos, container.retina.pixelRatio);
16
+ if (!poppedParticles.length) {
17
+ return;
18
+ }
19
+ for (const particle of poppedParticles) {
20
+ container.particles.remove(particle);
21
+ }
22
+ };
23
+ }
24
+ clear() {
25
+ }
26
+ init() {
27
+ }
28
+ async interact() {
29
+ }
30
+ isEnabled() {
31
+ return true;
32
+ }
33
+ reset() {
34
+ }
35
+ }
@@ -0,0 +1,4 @@
1
+ import { Popper } from "./Popper.js";
2
+ export async function loadExternalPopInteraction(engine, refresh = true) {
3
+ await engine.addInteractor("externalPop", (container) => new Popper(container), refresh);
4
+ }
@@ -0,0 +1 @@
1
+ { "type": "module" }
package/cjs/Popper.js ADDED
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Popper = void 0;
4
+ const engine_1 = require("@tsparticles/engine");
5
+ const popMode = "pop";
6
+ class Popper extends engine_1.ExternalInteractorBase {
7
+ constructor(container) {
8
+ super(container);
9
+ this.handleClickMode = (mode) => {
10
+ const container = this.container;
11
+ if (mode !== popMode) {
12
+ return;
13
+ }
14
+ const clickPos = container.interactivity.mouse.clickPosition;
15
+ if (!clickPos) {
16
+ return;
17
+ }
18
+ const poppedParticles = container.particles.quadTree.queryCircle(clickPos, container.retina.pixelRatio);
19
+ if (!poppedParticles.length) {
20
+ return;
21
+ }
22
+ for (const particle of poppedParticles) {
23
+ container.particles.remove(particle);
24
+ }
25
+ };
26
+ }
27
+ clear() {
28
+ }
29
+ init() {
30
+ }
31
+ async interact() {
32
+ }
33
+ isEnabled() {
34
+ return true;
35
+ }
36
+ reset() {
37
+ }
38
+ }
39
+ exports.Popper = Popper;
package/cjs/index.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadExternalPopInteraction = void 0;
4
+ const Popper_js_1 = require("./Popper.js");
5
+ async function loadExternalPopInteraction(engine, refresh = true) {
6
+ await engine.addInteractor("externalPop", (container) => new Popper_js_1.Popper(container), refresh);
7
+ }
8
+ exports.loadExternalPopInteraction = loadExternalPopInteraction;
@@ -0,0 +1 @@
1
+ { "type": "commonjs" }
package/esm/Popper.js ADDED
@@ -0,0 +1,35 @@
1
+ import { ExternalInteractorBase } from "@tsparticles/engine";
2
+ const popMode = "pop";
3
+ export class Popper extends ExternalInteractorBase {
4
+ constructor(container) {
5
+ super(container);
6
+ this.handleClickMode = (mode) => {
7
+ const container = this.container;
8
+ if (mode !== popMode) {
9
+ return;
10
+ }
11
+ const clickPos = container.interactivity.mouse.clickPosition;
12
+ if (!clickPos) {
13
+ return;
14
+ }
15
+ const poppedParticles = container.particles.quadTree.queryCircle(clickPos, container.retina.pixelRatio);
16
+ if (!poppedParticles.length) {
17
+ return;
18
+ }
19
+ for (const particle of poppedParticles) {
20
+ container.particles.remove(particle);
21
+ }
22
+ };
23
+ }
24
+ clear() {
25
+ }
26
+ init() {
27
+ }
28
+ async interact() {
29
+ }
30
+ isEnabled() {
31
+ return true;
32
+ }
33
+ reset() {
34
+ }
35
+ }
package/esm/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { Popper } from "./Popper.js";
2
+ export async function loadExternalPopInteraction(engine, refresh = true) {
3
+ await engine.addInteractor("externalPop", (container) => new Popper(container), refresh);
4
+ }
@@ -0,0 +1 @@
1
+ { "type": "module" }
package/package.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "@tsparticles/interaction-external-pop",
3
+ "version": "3.0.0-beta.4",
4
+ "description": "tsParticles pop external interaction",
5
+ "homepage": "https://particles.js.org",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/tsparticles/tsparticles.git",
9
+ "directory": "interactions/external/pop"
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-plugin",
64
+ "@tsparticles/interaction"
65
+ ],
66
+ "author": "Matteo Bruni <matteo.bruni@me.com>",
67
+ "license": "MIT",
68
+ "bugs": {
69
+ "url": "https://github.com/tsparticles/tsparticles/issues"
70
+ },
71
+ "sideEffects": false,
72
+ "jsdelivr": "tsparticles.interaction.external.pop.min.js",
73
+ "unpkg": "tsparticles.interaction.external.pop.min.js",
74
+ "browser": "browser/index.js",
75
+ "main": "cjs/index.js",
76
+ "module": "esm/index.js",
77
+ "types": "types/index.d.ts",
78
+ "exports": {
79
+ ".": {
80
+ "types": "./types/index.d.ts",
81
+ "browser": "./browser/index.js",
82
+ "import": "./esm/index.js",
83
+ "require": "./cjs/index.js",
84
+ "umd": "./umd/index.js",
85
+ "default": "./cjs/index.js"
86
+ },
87
+ "./package.json": "./package.json"
88
+ },
89
+ "dependencies": {
90
+ "@tsparticles/engine": "^3.0.0-beta.4"
91
+ },
92
+ "publishConfig": {
93
+ "access": "public"
94
+ }
95
+ }