@tsparticles/shape-spiral 3.9.1 → 4.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/536.min.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see 536.min.js.LICENSE.txt */
2
+ (this.webpackChunk_tsparticles_shape_spiral=this.webpackChunk_tsparticles_shape_spiral||[]).push([[536],{536(a,i,s){s.d(i,{SpiralDrawer:()=>r});var n=s(303);class r{constructor(){this.validTypes=["spiral"]}draw(a){!function(a){const{context:i,particle:s,radius:n}=a;if(void 0===s.spiralInnerRadius||void 0===s.spiralLineSpacing||void 0===s.spiralWidthFactor)return;const r=(n-s.spiralInnerRadius)/s.spiralLineSpacing;for(let a=0;a<10*r;a++){const n=a/10,r=s.spiralInnerRadius+s.spiralLineSpacing*n,e={x:r*Math.cos(n),y:r*Math.sin(n)};i.lineTo(e.x,e.y)}}(a)}particleInit(a,i){const s=a.retina.pixelRatio,r=i.shapeData;i.spiralInnerRadius=(0,n.getRangeValue)(r?.innerRadius??1)*s,i.spiralLineSpacing=(0,n.getRangeValue)(r?.lineSpacing??1)*s,i.spiralWidthFactor=(0,n.getRangeValue)(r?.widthFactor??10)}}}}]);
@@ -0,0 +1 @@
1
+ /*! tsParticles Spiral Shape v4.0.0-alpha.1 by Matteo Bruni */
package/browser/index.js CHANGED
@@ -1,5 +1,7 @@
1
- import { SpiralDrawer } from "./SpiralDrawer.js";
2
- export async function loadSpiralShape(engine, refresh = true) {
3
- engine.checkVersion("3.9.1");
4
- await engine.addShape(new SpiralDrawer(), refresh);
1
+ export function loadSpiralShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(async (e) => {
4
+ const { SpiralDrawer } = await import("./SpiralDrawer.js");
5
+ e.addShape(new SpiralDrawer());
6
+ });
5
7
  }
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,21 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SpiralDrawer = void 0;
4
- const engine_1 = require("@tsparticles/engine");
5
- const Utils_js_1 = require("./Utils.js");
1
+ import { getRangeValue } from "@tsparticles/engine";
2
+ import { drawSpiral } from "./Utils.js";
6
3
  const defaultInnerRadius = 1, defaultLineSpacing = 1, defaultWidthFactor = 10;
7
- class SpiralDrawer {
4
+ export class SpiralDrawer {
8
5
  constructor() {
9
6
  this.validTypes = ["spiral"];
10
7
  }
11
8
  draw(data) {
12
- (0, Utils_js_1.drawSpiral)(data);
9
+ drawSpiral(data);
13
10
  }
14
11
  particleInit(container, particle) {
15
12
  const pixelRatio = container.retina.pixelRatio, shapeData = particle.shapeData;
16
- particle.spiralInnerRadius = (0, engine_1.getRangeValue)(shapeData?.innerRadius ?? defaultInnerRadius) * pixelRatio;
17
- particle.spiralLineSpacing = (0, engine_1.getRangeValue)(shapeData?.lineSpacing ?? defaultLineSpacing) * pixelRatio;
18
- particle.spiralWidthFactor = (0, engine_1.getRangeValue)(shapeData?.widthFactor ?? defaultWidthFactor);
13
+ particle.spiralInnerRadius = getRangeValue(shapeData?.innerRadius ?? defaultInnerRadius) * pixelRatio;
14
+ particle.spiralLineSpacing = getRangeValue(shapeData?.lineSpacing ?? defaultLineSpacing) * pixelRatio;
15
+ particle.spiralWidthFactor = getRangeValue(shapeData?.widthFactor ?? defaultWidthFactor);
19
16
  }
20
17
  }
21
- exports.SpiralDrawer = SpiralDrawer;
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/cjs/Utils.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.drawSpiral = drawSpiral;
4
- function drawSpiral(data) {
1
+ export function drawSpiral(data) {
5
2
  const { context, particle, radius } = data;
6
3
  if (particle.spiralInnerRadius === undefined ||
7
4
  particle.spiralLineSpacing === undefined ||
package/cjs/index.js CHANGED
@@ -1,8 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadSpiralShape = loadSpiralShape;
4
- const SpiralDrawer_js_1 = require("./SpiralDrawer.js");
5
- async function loadSpiralShape(engine, refresh = true) {
6
- engine.checkVersion("3.9.1");
7
- await engine.addShape(new SpiralDrawer_js_1.SpiralDrawer(), refresh);
1
+ export function loadSpiralShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(async (e) => {
4
+ const { SpiralDrawer } = await import("./SpiralDrawer.js");
5
+ e.addShape(new SpiralDrawer());
6
+ });
8
7
  }
@@ -0,0 +1,40 @@
1
+ /*!
2
+ * Author : Matteo Bruni
3
+ * MIT license: https://opensource.org/licenses/MIT
4
+ * Demo / Generator : https://particles.js.org/
5
+ * GitHub : https://www.github.com/matteobruni/tsparticles
6
+ * How to use? : Check the GitHub README
7
+ * v4.0.0-alpha.1
8
+ */
9
+ "use strict";
10
+ /*
11
+ * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
12
+ * This devtool is neither made for production nor for readable output files.
13
+ * It uses "eval()" calls to create a separate source file in the browser devtools.
14
+ * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
15
+ * or disable the default devtool with "devtool: false".
16
+ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
17
+ */
18
+ (this["webpackChunk_tsparticles_shape_spiral"] = this["webpackChunk_tsparticles_shape_spiral"] || []).push([["dist_browser_SpiralDrawer_js"],{
19
+
20
+ /***/ "./dist/browser/SpiralDrawer.js"
21
+ /*!**************************************!*\
22
+ !*** ./dist/browser/SpiralDrawer.js ***!
23
+ \**************************************/
24
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
25
+
26
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SpiralDrawer: () => (/* binding */ SpiralDrawer)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\nconst defaultInnerRadius = 1,\n defaultLineSpacing = 1,\n defaultWidthFactor = 10;\nclass SpiralDrawer {\n constructor() {\n this.validTypes = [\"spiral\"];\n }\n draw(data) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawSpiral)(data);\n }\n particleInit(container, particle) {\n const pixelRatio = container.retina.pixelRatio,\n shapeData = particle.shapeData;\n particle.spiralInnerRadius = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(shapeData?.innerRadius ?? defaultInnerRadius) * pixelRatio;\n particle.spiralLineSpacing = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(shapeData?.lineSpacing ?? defaultLineSpacing) * pixelRatio;\n particle.spiralWidthFactor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(shapeData?.widthFactor ?? defaultWidthFactor);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-spiral/./dist/browser/SpiralDrawer.js?\n}");
27
+
28
+ /***/ },
29
+
30
+ /***/ "./dist/browser/Utils.js"
31
+ /*!*******************************!*\
32
+ !*** ./dist/browser/Utils.js ***!
33
+ \*******************************/
34
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
35
+
36
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawSpiral: () => (/* binding */ drawSpiral)\n/* harmony export */ });\nfunction drawSpiral(data) {\n const {\n context,\n particle,\n radius\n } = data;\n if (particle.spiralInnerRadius === undefined || particle.spiralLineSpacing === undefined || particle.spiralWidthFactor === undefined) {\n return;\n }\n const realWidth = (radius - particle.spiralInnerRadius) / particle.spiralLineSpacing,\n widthFactor = 10;\n for (let i = 0; i < realWidth * widthFactor; i++) {\n const angle = i / widthFactor,\n factor = particle.spiralInnerRadius + particle.spiralLineSpacing * angle,\n pos = {\n x: factor * Math.cos(angle),\n y: factor * Math.sin(angle)\n };\n context.lineTo(pos.x, pos.y);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-spiral/./dist/browser/Utils.js?\n}");
37
+
38
+ /***/ }
39
+
40
+ }]);
package/esm/index.js CHANGED
@@ -1,5 +1,7 @@
1
- import { SpiralDrawer } from "./SpiralDrawer.js";
2
- export async function loadSpiralShape(engine, refresh = true) {
3
- engine.checkVersion("3.9.1");
4
- await engine.addShape(new SpiralDrawer(), refresh);
1
+ export function loadSpiralShape(engine) {
2
+ engine.checkVersion("4.0.0-alpha.1");
3
+ engine.register(async (e) => {
4
+ const { SpiralDrawer } = await import("./SpiralDrawer.js");
5
+ e.addShape(new SpiralDrawer());
6
+ });
5
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsparticles/shape-spiral",
3
- "version": "3.9.1",
3
+ "version": "4.0.0-alpha.1",
4
4
  "description": "tsParticles spiral shape",
5
5
  "homepage": "https://particles.js.org",
6
6
  "repository": {
@@ -100,9 +100,10 @@
100
100
  "./package.json": "./package.json"
101
101
  },
102
102
  "dependencies": {
103
- "@tsparticles/engine": "3.9.1"
103
+ "@tsparticles/engine": "4.0.0-alpha.1"
104
104
  },
105
105
  "publishConfig": {
106
106
  "access": "public"
107
- }
107
+ },
108
+ "type": "module"
108
109
  }