@tsparticles/path-polygon 4.0.0-beta.0 → 4.0.0-beta.2

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/42.min.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";(this.webpackChunk_tsparticles_path_polygon=this.webpackChunk_tsparticles_path_polygon||[]).push([[42],{42(t,e,s){s.d(e,{PolygonPathGenerator:()=>n});var i=s(303);s(400);let o={sides:6,turnSteps:20,angle:30};class n{dirsList;options;_container;_res;constructor(t){this._container=t,this._res=i.Vector.origin,this.dirsList=[],this.options=(0,i.deepExtend)({},o)}generate(t){let{sides:e,turnSteps:s}=this.options;t.hexStep??=0,t.hexDirection??=6===e?(3*(0,i.getRandom)()|0)*2:(0,i.getRandom)()*e|0,t.hexSpeed??=t.velocity.length,t.hexStep%s==0&&(t.hexDirection=(0,i.getRandom)()>.5?(t.hexDirection+1)%e:(t.hexDirection+e-1)%e),t.velocity.x=0,t.velocity.y=0,t.hexStep++;let o=this.dirsList[t.hexDirection];return this._res.x=o.x*t.hexSpeed,this._res.y=o.y*t.hexSpeed,this._res}init(){let t=this._container.actualOptions.particles.move.path.options;this.options.sides=t.sides>0?t.sides:this.options.sides,this.options.angle=t.angle??this.options.angle,this.options.turnSteps=t.turnSteps>=0?t.turnSteps:this.options.turnSteps,this._createDirs()}reset(t){delete t.hexStep,delete t.hexDirection,delete t.hexSpeed}update(){}_createDirs=()=>{let{options:t}=this;this.dirsList=[];for(let e=0;e<360;e+=360/t.sides){let s=t.angle+e;this.dirsList.push(i.Vector.create(Math.cos(s*Math.PI/180),Math.sin(s*Math.PI/180)))}}}}}]);
@@ -1,4 +1,5 @@
1
1
  import { Vector, deepExtend, getRandom } from "@tsparticles/engine";
2
+ import {} from "@tsparticles/plugin-move";
2
3
  const defaultOptions = {
3
4
  sides: 6,
4
5
  turnSteps: 20,
package/browser/index.js CHANGED
@@ -1,10 +1,12 @@
1
+ import {} from "@tsparticles/engine";
2
+ import {} from "@tsparticles/plugin-move";
1
3
  export const polygonPathName = "polygonPathGenerator";
2
4
  export async function loadPolygonPath(engine) {
3
- engine.checkVersion("4.0.0-beta.0");
4
- await engine.register(async (e) => {
5
+ engine.checkVersion("4.0.0-beta.2");
6
+ await engine.pluginManager.register(async (e) => {
5
7
  const { ensureBaseMoverLoaded } = await import("@tsparticles/plugin-move");
6
8
  ensureBaseMoverLoaded(e);
7
- e.addPathGenerator?.(polygonPathName, async (container) => {
9
+ e.pluginManager.addPathGenerator?.(polygonPathName, async (container) => {
8
10
  const { PolygonPathGenerator } = await import("./PolygonPathGenerator.js");
9
11
  return new PolygonPathGenerator(container);
10
12
  });
@@ -1,4 +1,5 @@
1
1
  import { Vector, deepExtend, getRandom } from "@tsparticles/engine";
2
+ import {} from "@tsparticles/plugin-move";
2
3
  const defaultOptions = {
3
4
  sides: 6,
4
5
  turnSteps: 20,
package/cjs/index.js CHANGED
@@ -1,10 +1,12 @@
1
+ import {} from "@tsparticles/engine";
2
+ import {} from "@tsparticles/plugin-move";
1
3
  export const polygonPathName = "polygonPathGenerator";
2
4
  export async function loadPolygonPath(engine) {
3
- engine.checkVersion("4.0.0-beta.0");
4
- await engine.register(async (e) => {
5
+ engine.checkVersion("4.0.0-beta.2");
6
+ await engine.pluginManager.register(async (e) => {
5
7
  const { ensureBaseMoverLoaded } = await import("@tsparticles/plugin-move");
6
8
  ensureBaseMoverLoaded(e);
7
- e.addPathGenerator?.(polygonPathName, async (container) => {
9
+ e.pluginManager.addPathGenerator?.(polygonPathName, async (container) => {
8
10
  const { PolygonPathGenerator } = await import("./PolygonPathGenerator.js");
9
11
  return new PolygonPathGenerator(container);
10
12
  });
@@ -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
- * v4.0.0-beta.0
7
+ * v4.0.0-beta.2
8
8
  */
9
9
  "use strict";
10
10
  /*
@@ -23,7 +23,7 @@
23
23
  \**********************************************/
24
24
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
25
 
26
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PolygonPathGenerator: () => (/* binding */ PolygonPathGenerator)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst defaultOptions = {\n sides: 6,\n turnSteps: 20,\n angle: 30\n};\nclass PolygonPathGenerator {\n dirsList;\n options;\n _container;\n _res;\n constructor(container){\n this._container = container;\n this._res = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.origin;\n this.dirsList = [];\n this.options = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, defaultOptions);\n }\n generate(p) {\n const { sides, turnSteps } = this.options;\n p.hexStep ??= 0;\n p.hexDirection ??= sides === 6 ? ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * 3 | 0) * 2 : (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * sides | 0;\n p.hexSpeed ??= p.velocity.length;\n if (p.hexStep % turnSteps === 0) {\n p.hexDirection = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() > 0.5 ? (p.hexDirection + 1) % sides : (p.hexDirection + sides - 1) % sides;\n }\n p.velocity.x = 0;\n p.velocity.y = 0;\n p.hexStep++;\n const direction = this.dirsList[p.hexDirection];\n this._res.x = direction.x * p.hexSpeed;\n this._res.y = direction.y * p.hexSpeed;\n return this._res;\n }\n init() {\n const container = this._container, sourceOptions = container.actualOptions.particles.move.path.options;\n this.options.sides = sourceOptions[\"sides\"] > 0 ? sourceOptions[\"sides\"] : this.options.sides;\n this.options.angle = sourceOptions[\"angle\"] ?? this.options.angle;\n this.options.turnSteps = sourceOptions[\"turnSteps\"] >= 0 ? sourceOptions[\"turnSteps\"] : this.options.turnSteps;\n this._createDirs();\n }\n reset(particle) {\n delete particle.hexStep;\n delete particle.hexDirection;\n delete particle.hexSpeed;\n }\n update() {}\n _createDirs = ()=>{\n const { options } = this;\n this.dirsList = [];\n for(let i = 0; i < 360; i += 360 / options.sides){\n const angle = options.angle + i;\n this.dirsList.push(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(Math.cos(angle * Math.PI / 180), Math.sin(angle * Math.PI / 180)));\n }\n };\n}\n\n\n//# sourceURL=webpack://@tsparticles/path-polygon/./dist/browser/PolygonPathGenerator.js?\n}");
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PolygonPathGenerator: () => (/* binding */ PolygonPathGenerator)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_plugin_move__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/plugin-move */ \"@tsparticles/plugin-move\");\n\n\nconst defaultOptions = {\n sides: 6,\n turnSteps: 20,\n angle: 30\n};\nclass PolygonPathGenerator {\n dirsList;\n options;\n _container;\n _res;\n constructor(container){\n this._container = container;\n this._res = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.origin;\n this.dirsList = [];\n this.options = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, defaultOptions);\n }\n generate(p) {\n const { sides, turnSteps } = this.options;\n p.hexStep ??= 0;\n p.hexDirection ??= sides === 6 ? ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * 3 | 0) * 2 : (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * sides | 0;\n p.hexSpeed ??= p.velocity.length;\n if (p.hexStep % turnSteps === 0) {\n p.hexDirection = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() > 0.5 ? (p.hexDirection + 1) % sides : (p.hexDirection + sides - 1) % sides;\n }\n p.velocity.x = 0;\n p.velocity.y = 0;\n p.hexStep++;\n const direction = this.dirsList[p.hexDirection];\n this._res.x = direction.x * p.hexSpeed;\n this._res.y = direction.y * p.hexSpeed;\n return this._res;\n }\n init() {\n const container = this._container, sourceOptions = container.actualOptions.particles.move.path.options;\n this.options.sides = sourceOptions[\"sides\"] > 0 ? sourceOptions[\"sides\"] : this.options.sides;\n this.options.angle = sourceOptions[\"angle\"] ?? this.options.angle;\n this.options.turnSteps = sourceOptions[\"turnSteps\"] >= 0 ? sourceOptions[\"turnSteps\"] : this.options.turnSteps;\n this._createDirs();\n }\n reset(particle) {\n delete particle.hexStep;\n delete particle.hexDirection;\n delete particle.hexSpeed;\n }\n update() {}\n _createDirs = ()=>{\n const { options } = this;\n this.dirsList = [];\n for(let i = 0; i < 360; i += 360 / options.sides){\n const angle = options.angle + i;\n this.dirsList.push(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.Vector.create(Math.cos(angle * Math.PI / 180), Math.sin(angle * Math.PI / 180)));\n }\n };\n}\n\n\n//# sourceURL=webpack://@tsparticles/path-polygon/./dist/browser/PolygonPathGenerator.js?\n}");
27
27
 
28
28
  /***/ }
29
29
 
@@ -1,4 +1,5 @@
1
1
  import { Vector, deepExtend, getRandom } from "@tsparticles/engine";
2
+ import {} from "@tsparticles/plugin-move";
2
3
  const defaultOptions = {
3
4
  sides: 6,
4
5
  turnSteps: 20,
package/esm/index.js CHANGED
@@ -1,10 +1,12 @@
1
+ import {} from "@tsparticles/engine";
2
+ import {} from "@tsparticles/plugin-move";
1
3
  export const polygonPathName = "polygonPathGenerator";
2
4
  export async function loadPolygonPath(engine) {
3
- engine.checkVersion("4.0.0-beta.0");
4
- await engine.register(async (e) => {
5
+ engine.checkVersion("4.0.0-beta.2");
6
+ await engine.pluginManager.register(async (e) => {
5
7
  const { ensureBaseMoverLoaded } = await import("@tsparticles/plugin-move");
6
8
  ensureBaseMoverLoaded(e);
7
- e.addPathGenerator?.(polygonPathName, async (container) => {
9
+ e.pluginManager.addPathGenerator?.(polygonPathName, async (container) => {
8
10
  const { PolygonPathGenerator } = await import("./PolygonPathGenerator.js");
9
11
  return new PolygonPathGenerator(container);
10
12
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/path-polygon",
3
- "version": "4.0.0-beta.0",
3
+ "version": "4.0.0-beta.2",
4
4
  "description": "tsParticles polygon path",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -98,14 +98,13 @@
98
98
  "browser": "./browser/index.js",
99
99
  "import": "./esm/index.js",
100
100
  "require": "./cjs/index.js",
101
- "umd": "./umd/index.js",
102
- "default": "./cjs/index.js"
101
+ "default": "./esm/index.js"
103
102
  },
104
103
  "./package.json": "./package.json"
105
104
  },
106
- "dependencies": {
107
- "@tsparticles/engine": "4.0.0-beta.0",
108
- "@tsparticles/plugin-move": "4.0.0-beta.0"
105
+ "peerDependencies": {
106
+ "@tsparticles/engine": "4.0.0-beta.1",
107
+ "@tsparticles/plugin-move": "4.0.0-beta.1"
109
108
  },
110
109
  "type": "module"
111
110
  }