Socket
Socket
Sign inDemoInstall

tsparticles-shape-polygon

Package Overview
Dependencies
Maintainers
2
Versions
52
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 2.9.3 to 2.10.0

3

browser/PolygonDrawerBase.js

@@ -18,6 +18,5 @@ import { getRangeValue } from "tsparticles-engine";

getSidesCount(particle) {
var _a, _b;
const polygon = particle.shapeData, sides = Math.round(getRangeValue((_b = (_a = polygon === null || polygon === void 0 ? void 0 : polygon.sides) !== null && _a !== void 0 ? _a : polygon === null || polygon === void 0 ? void 0 : polygon.nb_sides) !== null && _b !== void 0 ? _b : 5));
const polygon = particle.shapeData, sides = Math.round(getRangeValue(polygon?.sides ?? polygon?.nb_sides ?? 5));
return sides;
}
}
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -15,20 +6,14 @@ exports.loadPolygonShape = exports.loadTriangleShape = exports.loadGenericPolygonShape = void 0;

const TriangleDrawer_1 = require("./TriangleDrawer");
function loadGenericPolygonShape(engine) {
return __awaiter(this, void 0, void 0, function* () {
yield engine.addShape("polygon", new PolygonDrawer_1.PolygonDrawer());
});
async function loadGenericPolygonShape(engine) {
await engine.addShape("polygon", new PolygonDrawer_1.PolygonDrawer());
}
exports.loadGenericPolygonShape = loadGenericPolygonShape;
function loadTriangleShape(engine) {
return __awaiter(this, void 0, void 0, function* () {
yield engine.addShape("triangle", new TriangleDrawer_1.TriangleDrawer());
});
async function loadTriangleShape(engine) {
await engine.addShape("triangle", new TriangleDrawer_1.TriangleDrawer());
}
exports.loadTriangleShape = loadTriangleShape;
function loadPolygonShape(engine) {
return __awaiter(this, void 0, void 0, function* () {
yield loadGenericPolygonShape(engine);
yield loadTriangleShape(engine);
});
async function loadPolygonShape(engine) {
await loadGenericPolygonShape(engine);
await loadTriangleShape(engine);
}
exports.loadPolygonShape = loadPolygonShape;

@@ -21,4 +21,3 @@ "use strict";

getSidesCount(particle) {
var _a, _b;
const polygon = particle.shapeData, sides = Math.round((0, tsparticles_engine_1.getRangeValue)((_b = (_a = polygon === null || polygon === void 0 ? void 0 : polygon.sides) !== null && _a !== void 0 ? _a : polygon === null || polygon === void 0 ? void 0 : polygon.nb_sides) !== null && _b !== void 0 ? _b : 5));
const polygon = particle.shapeData, sides = Math.round((0, tsparticles_engine_1.getRangeValue)(polygon?.sides ?? polygon?.nb_sides ?? 5));
return sides;

@@ -25,0 +24,0 @@ }

@@ -18,6 +18,5 @@ import { getRangeValue } from "tsparticles-engine";

getSidesCount(particle) {
var _a, _b;
const polygon = particle.shapeData, sides = Math.round(getRangeValue((_b = (_a = polygon === null || polygon === void 0 ? void 0 : polygon.sides) !== null && _a !== void 0 ? _a : polygon === null || polygon === void 0 ? void 0 : polygon.nb_sides) !== null && _b !== void 0 ? _b : 5));
const polygon = particle.shapeData, sides = Math.round(getRangeValue(polygon?.sides ?? polygon?.nb_sides ?? 5));
return sides;
}
}
{
"name": "tsparticles-shape-polygon",
"version": "2.9.3",
"version": "2.10.0",
"description": "tsParticles polygon shape",

@@ -49,4 +49,4 @@ "homepage": "https://particles.js.org",

"dependencies": {
"tsparticles-engine": "^2.9.3"
"tsparticles-engine": "^2.10.0"
}
}

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

* How to use? : Check the GitHub README
* v2.9.3
* v2.10.0
*/

@@ -95,5 +95,5 @@ (function webpackUniversalModuleDefinition(root, factory) {

__webpack_require__.d(__webpack_exports__, {
"loadGenericPolygonShape": () => (/* binding */ loadGenericPolygonShape),
"loadPolygonShape": () => (/* binding */ loadPolygonShape),
"loadTriangleShape": () => (/* binding */ loadTriangleShape)
loadGenericPolygonShape: () => (/* binding */ loadGenericPolygonShape),
loadPolygonShape: () => (/* binding */ loadPolygonShape),
loadTriangleShape: () => (/* binding */ loadTriangleShape)
});

@@ -126,5 +126,4 @@

getSidesCount(particle) {
var _a, _b;
const polygon = particle.shapeData,
sides = Math.round((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getRangeValue)((_b = (_a = polygon === null || polygon === void 0 ? void 0 : polygon.sides) !== null && _a !== void 0 ? _a : polygon === null || polygon === void 0 ? void 0 : polygon.nb_sides) !== null && _b !== void 0 ? _b : 5));
sides = Math.round((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getRangeValue)(polygon?.sides ?? polygon?.nb_sides ?? 5));
return sides;

@@ -131,0 +130,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 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=>(()=>{"use strict";var t={961: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:()=>i,loadPolygonShape:()=>d,loadTriangleShape:()=>s});var e=o(961);class t{draw(e,t,n){const o=this.getCenter(t,n),r=this.getSidesData(t,n),a=r.count.numerator*r.count.denominator,i=r.count.numerator/r.count.denominator,s=180*(i-2)/i,d=Math.PI-Math.PI*s/180;if(e){e.beginPath(),e.translate(o.x,o.y),e.moveTo(0,0);for(let t=0;t<a;t++)e.lineTo(r.length,0),e.translate(r.length,0),e.rotate(d)}}getSidesCount(t){var n,o;const r=t.shapeData;return Math.round((0,e.getRangeValue)(null!==(o=null!==(n=null==r?void 0:r.sides)&&void 0!==n?n:null==r?void 0:r.nb_sides)&&void 0!==o?o:5))}}class n extends t{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 a extends t{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 i(e){await e.addShape("polygon",new n)}async function s(e){await e.addShape("triangle",new a)}async function d(e){await i(e),await s(e)}})(),r})()));
!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=>(()=>{"use strict";var t={961: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:()=>i,loadPolygonShape:()=>d,loadTriangleShape:()=>s});var e=o(961);class t{draw(e,t,n){const o=this.getCenter(t,n),r=this.getSidesData(t,n),a=r.count.numerator*r.count.denominator,i=r.count.numerator/r.count.denominator,s=180*(i-2)/i,d=Math.PI-Math.PI*s/180;if(e){e.beginPath(),e.translate(o.x,o.y),e.moveTo(0,0);for(let t=0;t<a;t++)e.lineTo(r.length,0),e.translate(r.length,0),e.rotate(d)}}getSidesCount(t){const n=t.shapeData;return Math.round((0,e.getRangeValue)(n?.sides??n?.nb_sides??5))}}class n extends t{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 a extends t{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 i(e){await e.addShape("polygon",new n)}async function s(e){await e.addShape("triangle",new a)}async function d(e){await i(e),await s(e)}})(),r})()));

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

/*! tsParticles Polygon Shape v2.9.3 by Matteo Bruni */
/*! tsParticles Polygon Shape v2.10.0 by Matteo Bruni */

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

import type { ICoordinates, IShapeDrawer, Particle } from "tsparticles-engine";
import { type ICoordinates, type IShapeDrawer, type Particle } from "tsparticles-engine";
import type { ISide } from "./ISide";

@@ -3,0 +3,0 @@ export declare abstract class PolygonDrawerBase implements IShapeDrawer {

@@ -30,4 +30,3 @@ (function (factory) {

getSidesCount(particle) {
var _a, _b;
const polygon = particle.shapeData, sides = Math.round((0, tsparticles_engine_1.getRangeValue)((_b = (_a = polygon === null || polygon === void 0 ? void 0 : polygon.sides) !== null && _a !== void 0 ? _a : polygon === null || polygon === void 0 ? void 0 : polygon.nb_sides) !== null && _b !== void 0 ? _b : 5));
const polygon = particle.shapeData, sides = Math.round((0, tsparticles_engine_1.getRangeValue)(polygon?.sides ?? polygon?.nb_sides ?? 5));
return sides;

@@ -34,0 +33,0 @@ }

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