Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tsparticles/shape-polygon

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsparticles/shape-polygon - npm Package Compare versions

Comparing version 3.3.0 to 3.4.0

8

browser/index.js

@@ -0,8 +1,8 @@

import { PolygonDrawer } from "./PolygonDrawer.js";
import { TriangleDrawer } from "./TriangleDrawer.js";
export async function loadGenericPolygonShape(engine, refresh = true) {
const { PolygonDrawer } = await import("./PolygonDrawer.js");
await engine.addShape("polygon", new PolygonDrawer(), refresh);
await engine.addShape(new PolygonDrawer(), refresh);
}
export async function loadTriangleShape(engine, refresh = true) {
const { TriangleDrawer } = await import("./TriangleDrawer.js");
await engine.addShape("triangle", new TriangleDrawer(), refresh);
await engine.addShape(new TriangleDrawer(), refresh);
}

@@ -9,0 +9,0 @@ export async function loadPolygonShape(engine, refresh = true) {

import { PolygonDrawerBase } from "./PolygonDrawerBase.js";
const sidesCenterFactor = 3.5, yFactor = 2.66, sidesFactor = 3;
export class PolygonDrawer extends PolygonDrawerBase {
constructor() {
super(...arguments);
this.validTypes = ["polygon"];
}
getCenter(particle, radius) {

@@ -5,0 +9,0 @@ return {

import { PolygonDrawerBase } from "./PolygonDrawerBase.js";
const yFactor = 1.66, sides = 3, double = 2;
export class TriangleDrawer extends PolygonDrawerBase {
constructor() {
super(...arguments);
this.validTypes = ["triangle"];
}
getCenter(particle, radius) {

@@ -5,0 +9,0 @@ return {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadPolygonShape = exports.loadTriangleShape = exports.loadGenericPolygonShape = void 0;
const PolygonDrawer_js_1 = require("./PolygonDrawer.js");
const TriangleDrawer_js_1 = require("./TriangleDrawer.js");
async function loadGenericPolygonShape(engine, refresh = true) {
const { PolygonDrawer } = await import("./PolygonDrawer.js");
await engine.addShape("polygon", new PolygonDrawer(), refresh);
await engine.addShape(new PolygonDrawer_js_1.PolygonDrawer(), refresh);
}
exports.loadGenericPolygonShape = loadGenericPolygonShape;
async function loadTriangleShape(engine, refresh = true) {
const { TriangleDrawer } = await import("./TriangleDrawer.js");
await engine.addShape("triangle", new TriangleDrawer(), refresh);
await engine.addShape(new TriangleDrawer_js_1.TriangleDrawer(), refresh);
}

@@ -13,0 +13,0 @@ exports.loadTriangleShape = loadTriangleShape;

@@ -7,2 +7,6 @@ "use strict";

class PolygonDrawer extends PolygonDrawerBase_js_1.PolygonDrawerBase {
constructor() {
super(...arguments);
this.validTypes = ["polygon"];
}
getCenter(particle, radius) {

@@ -9,0 +13,0 @@ return {

@@ -7,2 +7,6 @@ "use strict";

class TriangleDrawer extends PolygonDrawerBase_js_1.PolygonDrawerBase {
constructor() {
super(...arguments);
this.validTypes = ["triangle"];
}
getCenter(particle, radius) {

@@ -9,0 +13,0 @@ return {

@@ -0,8 +1,8 @@

import { PolygonDrawer } from "./PolygonDrawer.js";
import { TriangleDrawer } from "./TriangleDrawer.js";
export async function loadGenericPolygonShape(engine, refresh = true) {
const { PolygonDrawer } = await import("./PolygonDrawer.js");
await engine.addShape("polygon", new PolygonDrawer(), refresh);
await engine.addShape(new PolygonDrawer(), refresh);
}
export async function loadTriangleShape(engine, refresh = true) {
const { TriangleDrawer } = await import("./TriangleDrawer.js");
await engine.addShape("triangle", new TriangleDrawer(), refresh);
await engine.addShape(new TriangleDrawer(), refresh);
}

@@ -9,0 +9,0 @@ export async function loadPolygonShape(engine, refresh = true) {

import { PolygonDrawerBase } from "./PolygonDrawerBase.js";
const sidesCenterFactor = 3.5, yFactor = 2.66, sidesFactor = 3;
export class PolygonDrawer extends PolygonDrawerBase {
constructor() {
super(...arguments);
this.validTypes = ["polygon"];
}
getCenter(particle, radius) {

@@ -5,0 +9,0 @@ return {

import { PolygonDrawerBase } from "./PolygonDrawerBase.js";
const yFactor = 1.66, sides = 3, double = 2;
export class TriangleDrawer extends PolygonDrawerBase {
constructor() {
super(...arguments);
this.validTypes = ["triangle"];
}
getCenter(particle, radius) {

@@ -5,0 +9,0 @@ return {

{
"name": "@tsparticles/shape-polygon",
"version": "3.3.0",
"version": "3.4.0",
"description": "tsParticles polygon shape",

@@ -62,3 +62,3 @@ "homepage": "https://particles.js.org",

"dependencies": {
"@tsparticles/engine": "^3.3.0"
"@tsparticles/engine": "^3.4.0"
},

@@ -65,0 +65,0 @@ "publishConfig": {

@@ -7,3 +7,3 @@ /*!

* How to use? : Check the GitHub README
* v3.3.0
* v3.4.0
*/

@@ -32,2 +32,42 @@ /*

/***/ "./dist/browser/PolygonDrawer.js":
/*!***************************************!*\
!*** ./dist/browser/PolygonDrawer.js ***!
\***************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PolygonDrawer: () => (/* binding */ PolygonDrawer)\n/* harmony export */ });\n/* harmony import */ var _PolygonDrawerBase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PolygonDrawerBase.js */ \"./dist/browser/PolygonDrawerBase.js\");\n\nconst sidesCenterFactor = 3.5,\n yFactor = 2.66,\n sidesFactor = 3;\nclass PolygonDrawer extends _PolygonDrawerBase_js__WEBPACK_IMPORTED_MODULE_0__.PolygonDrawerBase {\n constructor() {\n super(...arguments);\n this.validTypes = [\"polygon\"];\n }\n getCenter(particle, radius) {\n return {\n x: -radius / (particle.sides / sidesCenterFactor),\n y: -radius / (yFactor / sidesCenterFactor)\n };\n }\n getSidesData(particle, radius) {\n const sides = particle.sides;\n return {\n count: {\n denominator: 1,\n numerator: sides\n },\n length: radius * yFactor / (sides / sidesFactor)\n };\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-polygon/./dist/browser/PolygonDrawer.js?");
/***/ }),
/***/ "./dist/browser/PolygonDrawerBase.js":
/*!*******************************************!*\
!*** ./dist/browser/PolygonDrawerBase.js ***!
\*******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ PolygonDrawerBase: () => (/* binding */ PolygonDrawerBase)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\nconst defaultSides = 5;\nclass PolygonDrawerBase {\n draw(data) {\n const {\n particle,\n radius\n } = data,\n start = this.getCenter(particle, radius),\n side = this.getSidesData(particle, radius);\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_1__.drawPolygon)(data, start, side);\n }\n getSidesCount(particle) {\n const polygon = particle.shapeData;\n return Math.round((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(polygon?.sides ?? defaultSides));\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-polygon/./dist/browser/PolygonDrawerBase.js?");
/***/ }),
/***/ "./dist/browser/TriangleDrawer.js":
/*!****************************************!*\
!*** ./dist/browser/TriangleDrawer.js ***!
\****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TriangleDrawer: () => (/* binding */ TriangleDrawer)\n/* harmony export */ });\n/* harmony import */ var _PolygonDrawerBase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PolygonDrawerBase.js */ \"./dist/browser/PolygonDrawerBase.js\");\n\nconst yFactor = 1.66,\n sides = 3,\n double = 2;\nclass TriangleDrawer extends _PolygonDrawerBase_js__WEBPACK_IMPORTED_MODULE_0__.PolygonDrawerBase {\n constructor() {\n super(...arguments);\n this.validTypes = [\"triangle\"];\n }\n getCenter(particle, radius) {\n return {\n x: -radius,\n y: radius / yFactor\n };\n }\n getSidesCount() {\n return sides;\n }\n getSidesData(particle, radius) {\n const diameter = radius * double;\n return {\n count: {\n denominator: 2,\n numerator: 3\n },\n length: diameter\n };\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-polygon/./dist/browser/TriangleDrawer.js?");
/***/ }),
/***/ "./dist/browser/Utils.js":
/*!*******************************!*\
!*** ./dist/browser/Utils.js ***!
\*******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawPolygon: () => (/* binding */ drawPolygon)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nconst piDeg = 180,\n origin = {\n x: 0,\n y: 0\n },\n sidesOffset = 2;\nfunction drawPolygon(data, start, side) {\n const {\n context\n } = data,\n sideCount = side.count.numerator * side.count.denominator,\n decimalSides = side.count.numerator / side.count.denominator,\n interiorAngleDegrees = piDeg * (decimalSides - sidesOffset) / decimalSides,\n interiorAngle = Math.PI - (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.degToRad)(interiorAngleDegrees);\n if (!context) {\n return;\n }\n context.beginPath();\n context.translate(start.x, start.y);\n context.moveTo(origin.x, origin.y);\n for (let i = 0; i < sideCount; i++) {\n context.lineTo(side.length, origin.y);\n context.translate(side.length, origin.y);\n context.rotate(interiorAngle);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/shape-polygon/./dist/browser/Utils.js?");
/***/ }),
/***/ "./dist/browser/index.js":

@@ -39,3 +79,3 @@ /*!*******************************!*\

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadGenericPolygonShape: () => (/* binding */ loadGenericPolygonShape),\n/* harmony export */ loadPolygonShape: () => (/* binding */ loadPolygonShape),\n/* harmony export */ loadTriangleShape: () => (/* binding */ loadTriangleShape)\n/* harmony export */ });\nasync function loadGenericPolygonShape(engine, refresh = true) {\n const {\n PolygonDrawer\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_PolygonDrawer_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./PolygonDrawer.js */ \"./dist/browser/PolygonDrawer.js\"));\n await engine.addShape(\"polygon\", new PolygonDrawer(), refresh);\n}\nasync function loadTriangleShape(engine, refresh = true) {\n const {\n TriangleDrawer\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_TriangleDrawer_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./TriangleDrawer.js */ \"./dist/browser/TriangleDrawer.js\"));\n await engine.addShape(\"triangle\", new TriangleDrawer(), refresh);\n}\nasync function loadPolygonShape(engine, refresh = true) {\n await loadGenericPolygonShape(engine, refresh);\n await loadTriangleShape(engine, refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/shape-polygon/./dist/browser/index.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadGenericPolygonShape: () => (/* binding */ loadGenericPolygonShape),\n/* harmony export */ loadPolygonShape: () => (/* binding */ loadPolygonShape),\n/* harmony export */ loadTriangleShape: () => (/* binding */ loadTriangleShape)\n/* harmony export */ });\n/* harmony import */ var _PolygonDrawer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PolygonDrawer.js */ \"./dist/browser/PolygonDrawer.js\");\n/* harmony import */ var _TriangleDrawer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TriangleDrawer.js */ \"./dist/browser/TriangleDrawer.js\");\n\n\nasync function loadGenericPolygonShape(engine, refresh = true) {\n await engine.addShape(new _PolygonDrawer_js__WEBPACK_IMPORTED_MODULE_0__.PolygonDrawer(), refresh);\n}\nasync function loadTriangleShape(engine, refresh = true) {\n await engine.addShape(new _TriangleDrawer_js__WEBPACK_IMPORTED_MODULE_1__.TriangleDrawer(), refresh);\n}\nasync function loadPolygonShape(engine, refresh = true) {\n await loadGenericPolygonShape(engine, refresh);\n await loadTriangleShape(engine, refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/shape-polygon/./dist/browser/index.js?");

@@ -80,5 +120,2 @@ /***/ }),

/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/

@@ -109,36 +146,2 @@ /******/ /* webpack/runtime/compat get default export */

/******/
/******/ /* webpack/runtime/ensure chunk */
/******/ (() => {
/******/ __webpack_require__.f = {};
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ __webpack_require__.e = (chunkId) => {
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
/******/ __webpack_require__.f[key](chunkId, promises);
/******/ return promises;
/******/ }, []));
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/get javascript chunk filename */
/******/ (() => {
/******/ // This function allow to reference async chunks
/******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "" + chunkId + ".js";
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/global */
/******/ (() => {
/******/ __webpack_require__.g = (function() {
/******/ if (typeof globalThis === 'object') return globalThis;
/******/ try {
/******/ return this || new Function('return this')();
/******/ } catch (e) {
/******/ if (typeof window === 'object') return window;
/******/ }
/******/ })();
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */

@@ -149,48 +152,2 @@ /******/ (() => {

/******/
/******/ /* webpack/runtime/load script */
/******/ (() => {
/******/ var inProgress = {};
/******/ var dataWebpackPrefix = "@tsparticles/shape-polygon:";
/******/ // loadScript function to load a script via script tag
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
/******/ var scripts = document.getElementsByTagName("script");
/******/ for(var i = 0; i < scripts.length; i++) {
/******/ var s = scripts[i];
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
/******/ }
/******/ }
/******/ if(!script) {
/******/ needAttach = true;
/******/ script = document.createElement('script');
/******/
/******/ script.charset = 'utf-8';
/******/ script.timeout = 120;
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
/******/
/******/ script.src = url;
/******/ }
/******/ inProgress[url] = [done];
/******/ var onScriptComplete = (prev, event) => {
/******/ // avoid mem leaks in IE.
/******/ script.onerror = script.onload = null;
/******/ clearTimeout(timeout);
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
/******/ needAttach && document.head.appendChild(script);
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */

@@ -207,117 +164,2 @@ /******/ (() => {

/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ var scriptUrl;
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
/******/ var document = __webpack_require__.g.document;
/******/ if (!scriptUrl && document) {
/******/ if (document.currentScript)
/******/ scriptUrl = document.currentScript.src;
/******/ if (!scriptUrl) {
/******/ var scripts = document.getElementsByTagName("script");
/******/ if(scripts.length) {
/******/ var i = scripts.length - 1;
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
/******/ }
/******/ }
/******/ }
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
/******/ __webpack_require__.p = scriptUrl;
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ // no baseURI
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "tsparticles.shape.polygon": 0
/******/ };
/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
/******/
/******/ // a Promise means "currently loading".
/******/ if(installedChunkData) {
/******/ promises.push(installedChunkData[2]);
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
/******/ // create error before stack unwound to get useful stacktrace later
/******/ var error = new Error();
/******/ var loadingEnded = (event) => {
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
/******/ installedChunkData = installedChunks[chunkId];
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
/******/ if(installedChunkData) {
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
/******/ var realSrc = event && event.target && event.target.src;
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
/******/ error.name = 'ChunkLoadError';
/******/ error.type = errorType;
/******/ error.request = realSrc;
/******/ installedChunkData[1](error);
/******/ }
/******/ }
/******/ };
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ }
/******/ }
/******/ }
/******/ };
/******/
/******/ // no prefetching
/******/
/******/ // no preloaded
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var chunkIds = data[0];
/******/ var moreModules = data[1];
/******/ var runtime = data[2];
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0;
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
/******/ for(moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) var result = runtime(__webpack_require__);
/******/ }
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_shape_polygon"] = this["webpackChunk_tsparticles_shape_polygon"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ })();
/******/
/************************************************************************/

@@ -324,0 +166,0 @@ /******/

/*! For license information please see tsparticles.shape.polygon.min.js.LICENSE.txt */
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e=>(()=>{var t,r,o={303:t=>{t.exports=e}},n={};function a(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,a),r.exports}a.m=o,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((t,r)=>(a.f[r](e,t),t)),[])),a.u=e=>e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/shape-polygon:",a.l=(e,o,n,i)=>{if(t[e])t[e].push(o);else{var s,l;if(void 0!==n)for(var p=document.getElementsByTagName("script"),c=0;c<p.length;c++){var u=p[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+n){s=u;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",r+n),s.src=e),t[e]=[o];var d=(r,o)=>{s.onerror=s.onload=null,clearTimeout(f);var n=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),n&&n.forEach((e=>e(o))),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),l&&document.head.appendChild(s)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={974:0};a.f.j=(t,r)=>{var o=a.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise(((r,n)=>o=e[t]=[r,n]));r.push(o[2]=n);var i=a.p+a.u(t),s=new Error;a.l(i,(r=>{if(a.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+n+": "+i+")",s.name="ChunkLoadError",s.type=n,s.request=i,o[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,n,i=r[0],s=r[1],l=r[2],p=0;if(i.some((t=>0!==e[t]))){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);if(l)l(a)}for(t&&t(r);p<i.length;p++)n=i[p],a.o(e,n)&&e[n]&&e[n][0](),e[n]=0},r=this.webpackChunk_tsparticles_shape_polygon=this.webpackChunk_tsparticles_shape_polygon||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};return(()=>{async function e(e,t=!0){const{PolygonDrawer:r}=await a.e(442).then(a.bind(a,442));await e.addShape("polygon",new r,t)}async function t(e,t=!0){const{TriangleDrawer:r}=await a.e(936).then(a.bind(a,936));await e.addShape("triangle",new r,t)}async function r(r,o=!0){await e(r,o),await t(r,o)}a.r(i),a.d(i,{loadGenericPolygonShape:()=>e,loadPolygonShape:()=>r,loadTriangleShape:()=>t})})(),i})()));
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var n="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,(e=>(()=>{var t={303:t=>{t.exports=e}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,o),a.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{o.r(r),o.d(r,{loadGenericPolygonShape:()=>d,loadPolygonShape:()=>c,loadTriangleShape:()=>u});var e=o(303);const t=0,n=0;class a{draw(o){const{particle:r,radius:a}=o;!function(o,r,a){const{context:i}=o,s=a.count.numerator*a.count.denominator,d=a.count.numerator/a.count.denominator,u=180*(d-2)/d,c=Math.PI-(0,e.degToRad)(u);if(i){i.beginPath(),i.translate(r.x,r.y),i.moveTo(t,n);for(let e=0;e<s;e++)i.lineTo(a.length,n),i.translate(a.length,n),i.rotate(c)}}(o,this.getCenter(r,a),this.getSidesData(r,a))}getSidesCount(t){const n=t.shapeData;return Math.round((0,e.getRangeValue)(n?.sides??5))}}class i extends a{constructor(){super(...arguments),this.validTypes=["polygon"]}getCenter(e,t){return{x:-t/(e.sides/3.5),y:-t/.76}}getSidesData(e,t){const n=e.sides;return{count:{denominator:1,numerator:n},length:2.66*t/(n/3)}}}class s extends a{constructor(){super(...arguments),this.validTypes=["triangle"]}getCenter(e,t){return{x:-t,y:t/1.66}}getSidesCount(){return 3}getSidesData(e,t){return{count:{denominator:2,numerator:3},length:2*t}}}async function d(e,t=!0){await e.addShape(new i,t)}async function u(e,t=!0){await e.addShape(new s,t)}async function c(e,t=!0){await d(e,t),await u(e,t)}})(),r})()));

@@ -1,1 +0,1 @@

/*! tsParticles Polygon Shape v3.3.0 by Matteo Bruni */
/*! tsParticles Polygon Shape v3.4.0 by Matteo Bruni */

@@ -5,4 +5,5 @@ import type { ICoordinates, Particle } from "@tsparticles/engine";

export declare class PolygonDrawer extends PolygonDrawerBase {
readonly validTypes: readonly ["polygon"];
getCenter(particle: Particle, radius: number): ICoordinates;
getSidesData(particle: Particle, radius: number): ISide;
}
import { type ICoordinates, type IShapeDrawData, type IShapeDrawer, type Particle } from "@tsparticles/engine";
import type { ISide } from "./ISide.js";
export declare abstract class PolygonDrawerBase implements IShapeDrawer {
abstract readonly validTypes: readonly string[];
draw(data: IShapeDrawData): void;

@@ -5,0 +6,0 @@ getSidesCount(particle: Particle): number;

@@ -5,2 +5,3 @@ import type { ICoordinates, Particle } from "@tsparticles/engine";

export declare class TriangleDrawer extends PolygonDrawerBase {
readonly validTypes: readonly ["triangle"];
getCenter(particle: Particle, radius: number): ICoordinates;

@@ -7,0 +8,0 @@ getSidesCount(): number;

@@ -1,24 +0,1 @@

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
(function (factory) {

@@ -30,17 +7,16 @@ if (typeof module === "object" && typeof module.exports === "object") {

else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
define(["require", "exports", "./PolygonDrawer.js", "./TriangleDrawer.js"], factory);
}
})(function (require, exports) {
"use strict";
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadPolygonShape = exports.loadTriangleShape = exports.loadGenericPolygonShape = void 0;
const PolygonDrawer_js_1 = require("./PolygonDrawer.js");
const TriangleDrawer_js_1 = require("./TriangleDrawer.js");
async function loadGenericPolygonShape(engine, refresh = true) {
const { PolygonDrawer } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./PolygonDrawer.js"))) : new Promise((resolve_1, reject_1) => { require(["./PolygonDrawer.js"], resolve_1, reject_1); }).then(__importStar));
await engine.addShape("polygon", new PolygonDrawer(), refresh);
await engine.addShape(new PolygonDrawer_js_1.PolygonDrawer(), refresh);
}
exports.loadGenericPolygonShape = loadGenericPolygonShape;
async function loadTriangleShape(engine, refresh = true) {
const { TriangleDrawer } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./TriangleDrawer.js"))) : new Promise((resolve_2, reject_2) => { require(["./TriangleDrawer.js"], resolve_2, reject_2); }).then(__importStar));
await engine.addShape("triangle", new TriangleDrawer(), refresh);
await engine.addShape(new TriangleDrawer_js_1.TriangleDrawer(), refresh);
}

@@ -47,0 +23,0 @@ exports.loadTriangleShape = loadTriangleShape;

@@ -16,2 +16,6 @@ (function (factory) {

class PolygonDrawer extends PolygonDrawerBase_js_1.PolygonDrawerBase {
constructor() {
super(...arguments);
this.validTypes = ["polygon"];
}
getCenter(particle, radius) {

@@ -18,0 +22,0 @@ return {

@@ -16,2 +16,6 @@ (function (factory) {

class TriangleDrawer extends PolygonDrawerBase_js_1.PolygonDrawerBase {
constructor() {
super(...arguments);
this.validTypes = ["triangle"];
}
getCenter(particle, radius) {

@@ -18,0 +22,0 @@ return {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc