@tsparticles/preset-triangles 3.0.0-alpha.1

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,212 @@
1
+ [![banner](https://particles.js.org/images/banner3.png)](https://particles.js.org)
2
+
3
+ # tsParticles Triangles Preset
4
+
5
+ [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/@tsparticles/preset-triangles/badge)](https://www.jsdelivr.com/package/npm/@tsparticles/preset-triangles) [![npmjs](https://badge.fury.io/js/@tsparticles/preset-links.svg)](https://www.npmjs.com/package/@tsparticles/preset-links) [![npmjs](https://img.shields.io/npm/dt/@tsparticles/preset-triangles)](https://www.npmjs.com/package/@tsparticles/preset-triangles) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
6
+
7
+ [tsParticles](https://github.com/matteobruni/tsparticles) preset for creating a particles web created by link lines
8
+ between them.
9
+
10
+ [![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)
11
+
12
+ [![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>
13
+
14
+ ## Sample
15
+
16
+ [![demo](https://raw.githubusercontent.com/matteobruni/tsparticles/main/presets/triangles/images/sample.png)](https://particles.js.org/samples/presets/triangles)
17
+
18
+ ## How to use it
19
+
20
+ ### CDN / Vanilla JS / jQuery
21
+
22
+ The first step is installing [tsParticles](https://github.com/matteobruni/tsparticles) following the instructions for
23
+ vanilla javascript in the main project [here](https://github.com/matteobruni/tsparticles)
24
+
25
+ Once installed you need one more script to be included in your page (or you can download that
26
+ from [jsDelivr](https://www.jsdelivr.com/package/npm/@tsparticles/preset-triangles):
27
+
28
+ ```html
29
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-engine@2/tsparticles.engine.min.js"></script>
30
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-interaction-particles-links@2/tsparticles.interaction.particles.links.min.js"></script>
31
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-move-base@2/tsparticles.move.base.min.js"></script>
32
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-shape-circle@2/tsparticles.shape.circle.min.js"></script>
33
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-color@2/tsparticles.updater.color.min.js"></script>
34
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-opacity@2/tsparticles.updater.opacity.min.js"></script>
35
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-out-modes@2/tsparticles.updater.out-modes.min.js"></script>
36
+ <script src="https://cdn.jsdelivr.net/npm/tsparticles-updater-size@2/tsparticles.updater.size.min.js"></script>
37
+ <script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-triangles@2/tsparticles.preset.triangles.min.js"></script>
38
+ ```
39
+
40
+ This script **MUST** be placed after the `tsParticles` one.
41
+
42
+ #### Bundle
43
+
44
+ A bundled script can also be used, this will include every needed plugin needed by the preset.
45
+
46
+ ```html
47
+ <script src="https://cdn.jsdelivr.net/npm/@tsparticles/preset-triangles@2/tsparticles.preset.triangles.bundle.min.js"></script>
48
+ ```
49
+
50
+ ### Usage
51
+
52
+ Once the scripts are loaded you can set up `tsParticles` like this:
53
+
54
+ ```javascript
55
+ (async () => {
56
+ await loadTrianglesPreset(tsParticles); // this is required only if you are not using the bundle script
57
+
58
+ await tsParticles.load("tsparticles", {
59
+ preset: "triangles",
60
+ });
61
+ })();
62
+ ```
63
+
64
+ #### Customization
65
+
66
+ **Important ⚠️**
67
+ You can override all the options defining the properties like in any standard `tsParticles` installation.
68
+
69
+ ```javascript
70
+ tsParticles.load("tsparticles", {
71
+ particles: {
72
+ shape: {
73
+ type: "square", // starting from v2, this require the square shape script
74
+ },
75
+ },
76
+ preset: "triangles",
77
+ });
78
+ ```
79
+
80
+ Like in the sample above, the circles will be replaced by squares.
81
+
82
+ ### React.js / Preact / Inferno
83
+
84
+ _The syntax for `React.js`, `Preact` and `Inferno` is the same_.
85
+
86
+ This sample uses the class component syntax, but you can use hooks as well (if the library supports it).
87
+
88
+ ```typescript jsx
89
+ import Particles from "react-particles";
90
+ import type { Engine } from "tsparticles-engine";
91
+ import { loadTrianglesPreset } from "@tsparticles/preset-triangles";
92
+
93
+ export class ParticlesContainer extends React.PureComponent<IProps> {
94
+ // this customizes the component tsParticles installation
95
+ async customInit(engine: Engine): Promise<void> {
96
+ // this adds the preset to tsParticles, you can safely use the
97
+ await loadTrianglesPreset(engine);
98
+ }
99
+
100
+ render() {
101
+ const options = {
102
+ preset: "triangles",
103
+ };
104
+
105
+ return <Particles options={options} init={this.customInit} />;
106
+ }
107
+ }
108
+ ```
109
+
110
+ ### Vue (2.x and 3.x)
111
+
112
+ _The syntax for `Vue.js 2.x` and `3.x` is the same_
113
+
114
+ ```vue
115
+ <Particles id="tsparticles" :particlesInit="particlesInit" :options="particlesOptions" />
116
+ ```
117
+
118
+ ```ts
119
+ const particlesOptions = {
120
+ preset: "triangles",
121
+ };
122
+
123
+ async function particlesInit(engine: Engine): Promise<void> {
124
+ await loadTrianglesPreset(engine);
125
+ }
126
+ ```
127
+
128
+ ### Angular
129
+
130
+ ```html
131
+ <angular-particles [id]="id" [options]="particlesOptions" [particlesInit]="particlesInit"></angular-particles>
132
+ ```
133
+
134
+ ```ts
135
+ const particlesOptions = {
136
+ preset: "triangles",
137
+ };
138
+
139
+ async function particlesInit(engine: Engine): Promise<void> {
140
+ await loadTrianglesPreset(engine);
141
+ }
142
+ ```
143
+
144
+ ### Svelte
145
+
146
+ ```sveltehtml
147
+
148
+ <Particles
149
+ id="tsparticles"
150
+ options={particlesOptions}
151
+ particlesInit={particlesInit}
152
+ />
153
+ ```
154
+
155
+ ```js
156
+ let particlesOptions = {
157
+ preset: "triangles",
158
+ };
159
+
160
+ let particlesInit = async (engine) => {
161
+ await loadTrianglesPreset(engine);
162
+ };
163
+ ```
164
+
165
+ ---
166
+
167
+ ```mermaid
168
+ flowchart TD
169
+
170
+ e[tsParticles Engine]
171
+
172
+ subgraph i [Interactions]
173
+
174
+ subgraph ip [Particles]
175
+ ipl[Links]
176
+ end
177
+
178
+ end
179
+
180
+ i --> ip
181
+
182
+ e --> i
183
+
184
+ subgraph m [Movers]
185
+ mb[Base]
186
+ end
187
+
188
+ e --> m
189
+
190
+ subgraph s [Shapes]
191
+ sc[Circle]
192
+ end
193
+
194
+ e --> s
195
+
196
+ subgraph u [Updaters]
197
+ uc[Color]
198
+ uop[Opacity]
199
+ uou[Out Modes]
200
+ usi[Size]
201
+ end
202
+
203
+ e --> u
204
+
205
+ subgraph pr [Presets]
206
+ prt[Triangles]
207
+ end
208
+
209
+ e --> pr
210
+
211
+ ipl & mb & sc & uc & uop & uou & usi --> prt
212
+ ```
@@ -0,0 +1,6 @@
1
+ import { loadTrianglesPreset } from ".";
2
+ import { tsParticles } from "@tsparticles/engine";
3
+ (async () => {
4
+ await loadTrianglesPreset(tsParticles);
5
+ })();
6
+ export { loadTrianglesPreset, tsParticles };
@@ -0,0 +1,18 @@
1
+ import { loadBaseMover } from "@tsparticles/move-base";
2
+ import { loadCircleShape } from "@tsparticles/shape-circle";
3
+ import { loadColorUpdater } from "@tsparticles/updater-color";
4
+ import { loadOpacityUpdater } from "@tsparticles/updater-opacity";
5
+ import { loadOutModesUpdater } from "@tsparticles/updater-out-modes";
6
+ import { loadParticlesLinksInteraction } from "@tsparticles/interaction-particles-links";
7
+ import { loadSizeUpdater } from "@tsparticles/updater-size";
8
+ import { options } from "./options";
9
+ export async function loadTrianglesPreset(engine) {
10
+ await loadBaseMover(engine);
11
+ await loadCircleShape(engine);
12
+ await loadColorUpdater(engine);
13
+ await loadParticlesLinksInteraction(engine);
14
+ await loadOutModesUpdater(engine);
15
+ await loadOpacityUpdater(engine);
16
+ await loadSizeUpdater(engine);
17
+ await engine.addPreset("triangles", options);
18
+ }
@@ -0,0 +1,25 @@
1
+ export const options = {
2
+ background: {
3
+ color: "#000000",
4
+ },
5
+ particles: {
6
+ links: {
7
+ distance: 125,
8
+ enable: true,
9
+ triangles: {
10
+ enable: true,
11
+ opacity: 0.1,
12
+ },
13
+ },
14
+ move: {
15
+ enable: true,
16
+ speed: 5,
17
+ },
18
+ size: {
19
+ value: 1,
20
+ },
21
+ shape: {
22
+ type: "circle",
23
+ },
24
+ },
25
+ };
package/cjs/bundle.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.tsParticles = exports.loadTrianglesPreset = void 0;
13
+ const _1 = require(".");
14
+ Object.defineProperty(exports, "loadTrianglesPreset", { enumerable: true, get: function () { return _1.loadTrianglesPreset; } });
15
+ const engine_1 = require("@tsparticles/engine");
16
+ Object.defineProperty(exports, "tsParticles", { enumerable: true, get: function () { return engine_1.tsParticles; } });
17
+ (() => __awaiter(void 0, void 0, void 0, function* () {
18
+ yield (0, _1.loadTrianglesPreset)(engine_1.tsParticles);
19
+ }))();
package/cjs/index.js ADDED
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.loadTrianglesPreset = void 0;
13
+ const move_base_1 = require("@tsparticles/move-base");
14
+ const shape_circle_1 = require("@tsparticles/shape-circle");
15
+ const updater_color_1 = require("@tsparticles/updater-color");
16
+ const updater_opacity_1 = require("@tsparticles/updater-opacity");
17
+ const updater_out_modes_1 = require("@tsparticles/updater-out-modes");
18
+ const interaction_particles_links_1 = require("@tsparticles/interaction-particles-links");
19
+ const updater_size_1 = require("@tsparticles/updater-size");
20
+ const options_1 = require("./options");
21
+ function loadTrianglesPreset(engine) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ yield (0, move_base_1.loadBaseMover)(engine);
24
+ yield (0, shape_circle_1.loadCircleShape)(engine);
25
+ yield (0, updater_color_1.loadColorUpdater)(engine);
26
+ yield (0, interaction_particles_links_1.loadParticlesLinksInteraction)(engine);
27
+ yield (0, updater_out_modes_1.loadOutModesUpdater)(engine);
28
+ yield (0, updater_opacity_1.loadOpacityUpdater)(engine);
29
+ yield (0, updater_size_1.loadSizeUpdater)(engine);
30
+ yield engine.addPreset("triangles", options_1.options);
31
+ });
32
+ }
33
+ exports.loadTrianglesPreset = loadTrianglesPreset;
package/cjs/options.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.options = void 0;
4
+ exports.options = {
5
+ background: {
6
+ color: "#000000",
7
+ },
8
+ particles: {
9
+ links: {
10
+ distance: 125,
11
+ enable: true,
12
+ triangles: {
13
+ enable: true,
14
+ opacity: 0.1,
15
+ },
16
+ },
17
+ move: {
18
+ enable: true,
19
+ speed: 5,
20
+ },
21
+ size: {
22
+ value: 1,
23
+ },
24
+ shape: {
25
+ type: "circle",
26
+ },
27
+ },
28
+ };
package/esm/bundle.js ADDED
@@ -0,0 +1,6 @@
1
+ import { loadTrianglesPreset } from ".";
2
+ import { tsParticles } from "@tsparticles/engine";
3
+ (async () => {
4
+ await loadTrianglesPreset(tsParticles);
5
+ })();
6
+ export { loadTrianglesPreset, tsParticles };
package/esm/index.js ADDED
@@ -0,0 +1,18 @@
1
+ import { loadBaseMover } from "@tsparticles/move-base";
2
+ import { loadCircleShape } from "@tsparticles/shape-circle";
3
+ import { loadColorUpdater } from "@tsparticles/updater-color";
4
+ import { loadOpacityUpdater } from "@tsparticles/updater-opacity";
5
+ import { loadOutModesUpdater } from "@tsparticles/updater-out-modes";
6
+ import { loadParticlesLinksInteraction } from "@tsparticles/interaction-particles-links";
7
+ import { loadSizeUpdater } from "@tsparticles/updater-size";
8
+ import { options } from "./options";
9
+ export async function loadTrianglesPreset(engine) {
10
+ await loadBaseMover(engine);
11
+ await loadCircleShape(engine);
12
+ await loadColorUpdater(engine);
13
+ await loadParticlesLinksInteraction(engine);
14
+ await loadOutModesUpdater(engine);
15
+ await loadOpacityUpdater(engine);
16
+ await loadSizeUpdater(engine);
17
+ await engine.addPreset("triangles", options);
18
+ }
package/esm/options.js ADDED
@@ -0,0 +1,25 @@
1
+ export const options = {
2
+ background: {
3
+ color: "#000000",
4
+ },
5
+ particles: {
6
+ links: {
7
+ distance: 125,
8
+ enable: true,
9
+ triangles: {
10
+ enable: true,
11
+ opacity: 0.1,
12
+ },
13
+ },
14
+ move: {
15
+ enable: true,
16
+ speed: 5,
17
+ },
18
+ size: {
19
+ value: 1,
20
+ },
21
+ shape: {
22
+ type: "circle",
23
+ },
24
+ },
25
+ };
package/package.json ADDED
@@ -0,0 +1,98 @@
1
+ {
2
+ "name": "@tsparticles/preset-triangles",
3
+ "version": "3.0.0-alpha.1",
4
+ "description": "tsParticles triangles preset",
5
+ "homepage": "https://particles.js.org",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/matteobruni/tsparticles.git",
9
+ "directory": "presets/triangles"
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/matteobruni/tsparticles/issues"
69
+ },
70
+ "funding": [
71
+ {
72
+ "type": "github",
73
+ "url": "https://github.com/sponsors/matteobruni"
74
+ },
75
+ {
76
+ "type": "buymeacoffee",
77
+ "url": "https://www.buymeacoffee.com/matteobruni"
78
+ }
79
+ ],
80
+ "main": "cjs/index.js",
81
+ "jsdelivr": "tsparticles.preset.triangles.min.js",
82
+ "unpkg": "tsparticles.preset.triangles.min.js",
83
+ "module": "esm/index.js",
84
+ "types": "types/index.d.ts",
85
+ "publishConfig": {
86
+ "access": "public"
87
+ },
88
+ "dependencies": {
89
+ "@tsparticles/engine": "^3.0.0-alpha.1",
90
+ "@tsparticles/interaction-particles-links": "^3.0.0-alpha.1",
91
+ "@tsparticles/move-base": "^3.0.0-alpha.1",
92
+ "@tsparticles/shape-circle": "^3.0.0-alpha.1",
93
+ "@tsparticles/updater-color": "^3.0.0-alpha.1",
94
+ "@tsparticles/updater-opacity": "^3.0.0-alpha.1",
95
+ "@tsparticles/updater-out-modes": "^3.0.0-alpha.1",
96
+ "@tsparticles/updater-size": "^3.0.0-alpha.1"
97
+ }
98
+ }