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
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.10.1 to 2.11.0

14

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

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

getSidesCount(particle) {
const polygon = particle.shapeData, sides = Math.round(getRangeValue(polygon?.sides ?? polygon?.nb_sides ?? 5));
return sides;
const polygon = particle.shapeData;
return Math.round(getRangeValue(polygon?.sides ?? polygon?.nb_sides ?? 5));
}
}

@@ -6,14 +6,14 @@ "use strict";

const TriangleDrawer_1 = require("./TriangleDrawer");
async function loadGenericPolygonShape(engine) {
await engine.addShape("polygon", new PolygonDrawer_1.PolygonDrawer());
async function loadGenericPolygonShape(engine, refresh = true) {
await engine.addShape("polygon", new PolygonDrawer_1.PolygonDrawer(), refresh);
}
exports.loadGenericPolygonShape = loadGenericPolygonShape;
async function loadTriangleShape(engine) {
await engine.addShape("triangle", new TriangleDrawer_1.TriangleDrawer());
async function loadTriangleShape(engine, refresh = true) {
await engine.addShape("triangle", new TriangleDrawer_1.TriangleDrawer(), refresh);
}
exports.loadTriangleShape = loadTriangleShape;
async function loadPolygonShape(engine) {
await loadGenericPolygonShape(engine);
await loadTriangleShape(engine);
async function loadPolygonShape(engine, refresh = true) {
await loadGenericPolygonShape(engine, refresh);
await loadTriangleShape(engine, refresh);
}
exports.loadPolygonShape = loadPolygonShape;

@@ -21,6 +21,6 @@ "use strict";

getSidesCount(particle) {
const polygon = particle.shapeData, sides = Math.round((0, tsparticles_engine_1.getRangeValue)(polygon?.sides ?? polygon?.nb_sides ?? 5));
return sides;
const polygon = particle.shapeData;
return Math.round((0, tsparticles_engine_1.getRangeValue)(polygon?.sides ?? polygon?.nb_sides ?? 5));
}
}
exports.PolygonDrawerBase = PolygonDrawerBase;
import { PolygonDrawer } from "./PolygonDrawer";
import { TriangleDrawer } from "./TriangleDrawer";
export async function loadGenericPolygonShape(engine) {
await engine.addShape("polygon", new PolygonDrawer());
export async function loadGenericPolygonShape(engine, refresh = true) {
await engine.addShape("polygon", new PolygonDrawer(), refresh);
}
export async function loadTriangleShape(engine) {
await engine.addShape("triangle", new TriangleDrawer());
export async function loadTriangleShape(engine, refresh = true) {
await engine.addShape("triangle", new TriangleDrawer(), refresh);
}
export async function loadPolygonShape(engine) {
await loadGenericPolygonShape(engine);
await loadTriangleShape(engine);
export async function loadPolygonShape(engine, refresh = true) {
await loadGenericPolygonShape(engine, refresh);
await loadTriangleShape(engine, refresh);
}

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

getSidesCount(particle) {
const polygon = particle.shapeData, sides = Math.round(getRangeValue(polygon?.sides ?? polygon?.nb_sides ?? 5));
return sides;
const polygon = particle.shapeData;
return Math.round(getRangeValue(polygon?.sides ?? polygon?.nb_sides ?? 5));
}
}
{
"name": "tsparticles-shape-polygon",
"version": "2.10.1",
"version": "2.11.0",
"description": "tsParticles polygon shape",

@@ -48,5 +48,6 @@ "homepage": "https://particles.js.org",

"types": "types/index.d.ts",
"sideEffects": false,
"dependencies": {
"tsparticles-engine": "^2.10.1"
"tsparticles-engine": "^2.11.0"
}
}

@@ -28,8 +28,14 @@ [![banner](https://particles.js.org/images/banner2.png)](https://particles.js.org)

```javascript
loadPolygonShape(tsParticles);
(async () => {
await loadPolygonShape(tsParticles);
tsParticles.load("tsparticles", {
/* options */
/* here you can use particles.shape.type: "polygon" */
});
await tsParticles.load({
id: "tsparticles",
options: {
/* options */
/* here you can use particles.shape.type: "polygon" */
/* or you can use particles.shape.type: "triangle" */
},
});
})();
```

@@ -57,3 +63,5 @@

loadPolygonShape(tsParticles);
(async () => {
await loadPolygonShape(tsParticles);
})();
```

@@ -67,3 +75,5 @@

loadPolygonShape(tsParticles);
(async () => {
await loadPolygonShape(tsParticles);
})();
```

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

* How to use? : Check the GitHub README
* v2.10.1
* v2.11.0
*/

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

getSidesCount(particle) {
const polygon = particle.shapeData,
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;
const polygon = particle.shapeData;
return Math.round((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getRangeValue)(polygon?.sides ?? polygon?.nb_sides ?? 5));
}

@@ -176,11 +175,11 @@ }

async function loadGenericPolygonShape(engine) {
await engine.addShape("polygon", new PolygonDrawer());
async function loadGenericPolygonShape(engine, refresh = true) {
await engine.addShape("polygon", new PolygonDrawer(), refresh);
}
async function loadTriangleShape(engine) {
await engine.addShape("triangle", new TriangleDrawer());
async function loadTriangleShape(engine, refresh = true) {
await engine.addShape("triangle", new TriangleDrawer(), refresh);
}
async function loadPolygonShape(engine) {
await loadGenericPolygonShape(engine);
await loadTriangleShape(engine);
async function loadPolygonShape(engine, refresh = true) {
await loadGenericPolygonShape(engine, refresh);
await loadTriangleShape(engine, refresh);
}

@@ -187,0 +186,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){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})()));
!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,t=!0){await e.addShape("polygon",new n,t)}async function s(e,t=!0){await e.addShape("triangle",new a,t)}async function d(e,t=!0){await i(e,t),await s(e,t)}})(),r})()));

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

/*! tsParticles Polygon Shape v2.10.1 by Matteo Bruni */
/*! tsParticles Polygon Shape v2.11.0 by Matteo Bruni */
import type { Engine } from "tsparticles-engine";
export declare function loadGenericPolygonShape(engine: Engine): Promise<void>;
export declare function loadTriangleShape(engine: Engine): Promise<void>;
export declare function loadPolygonShape(engine: Engine): Promise<void>;
export declare function loadGenericPolygonShape(engine: Engine, refresh?: boolean): Promise<void>;
export declare function loadTriangleShape(engine: Engine, refresh?: boolean): Promise<void>;
export declare function loadPolygonShape(engine: Engine, refresh?: boolean): Promise<void>;

@@ -15,15 +15,15 @@ (function (factory) {

const TriangleDrawer_1 = require("./TriangleDrawer");
async function loadGenericPolygonShape(engine) {
await engine.addShape("polygon", new PolygonDrawer_1.PolygonDrawer());
async function loadGenericPolygonShape(engine, refresh = true) {
await engine.addShape("polygon", new PolygonDrawer_1.PolygonDrawer(), refresh);
}
exports.loadGenericPolygonShape = loadGenericPolygonShape;
async function loadTriangleShape(engine) {
await engine.addShape("triangle", new TriangleDrawer_1.TriangleDrawer());
async function loadTriangleShape(engine, refresh = true) {
await engine.addShape("triangle", new TriangleDrawer_1.TriangleDrawer(), refresh);
}
exports.loadTriangleShape = loadTriangleShape;
async function loadPolygonShape(engine) {
await loadGenericPolygonShape(engine);
await loadTriangleShape(engine);
async function loadPolygonShape(engine, refresh = true) {
await loadGenericPolygonShape(engine, refresh);
await loadTriangleShape(engine, refresh);
}
exports.loadPolygonShape = loadPolygonShape;
});

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

getSidesCount(particle) {
const polygon = particle.shapeData, sides = Math.round((0, tsparticles_engine_1.getRangeValue)(polygon?.sides ?? polygon?.nb_sides ?? 5));
return sides;
const polygon = particle.shapeData;
return Math.round((0, tsparticles_engine_1.getRangeValue)(polygon?.sides ?? polygon?.nb_sides ?? 5));
}

@@ -34,0 +34,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