@tsparticles/shape-polygon
Advanced tools
Comparing version 3.4.0 to 3.5.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.loadPolygonShape = exports.loadTriangleShape = exports.loadGenericPolygonShape = void 0; | ||
exports.loadGenericPolygonShape = loadGenericPolygonShape; | ||
exports.loadTriangleShape = loadTriangleShape; | ||
exports.loadPolygonShape = loadPolygonShape; | ||
const PolygonDrawer_js_1 = require("./PolygonDrawer.js"); | ||
@@ -9,7 +11,5 @@ const TriangleDrawer_js_1 = require("./TriangleDrawer.js"); | ||
} | ||
exports.loadGenericPolygonShape = loadGenericPolygonShape; | ||
async function loadTriangleShape(engine, refresh = true) { | ||
await engine.addShape(new TriangleDrawer_js_1.TriangleDrawer(), refresh); | ||
} | ||
exports.loadTriangleShape = loadTriangleShape; | ||
async function loadPolygonShape(engine, refresh = true) { | ||
@@ -19,2 +19,1 @@ await loadGenericPolygonShape(engine, refresh); | ||
} | ||
exports.loadPolygonShape = loadPolygonShape; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.drawPolygon = void 0; | ||
exports.drawPolygon = drawPolygon; | ||
const engine_1 = require("@tsparticles/engine"); | ||
@@ -20,2 +20,1 @@ const piDeg = 180, origin = { x: 0, y: 0 }, sidesOffset = 2; | ||
} | ||
exports.drawPolygon = drawPolygon; |
{ | ||
"name": "@tsparticles/shape-polygon", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "tsParticles polygon shape", | ||
@@ -62,3 +62,3 @@ "homepage": "https://particles.js.org", | ||
"dependencies": { | ||
"@tsparticles/engine": "^3.4.0" | ||
"@tsparticles/engine": "^3.5.0" | ||
}, | ||
@@ -65,0 +65,0 @@ "publishConfig": { |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v3.4.0 | ||
* v3.5.0 | ||
*/ | ||
@@ -10,0 +10,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=>(()=>{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})())); | ||
!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={};o.r(r),o.d(r,{loadGenericPolygonShape:()=>l,loadPolygonShape:()=>g,loadTriangleShape:()=>p});var a=o(303);const i=0,s=0;class d{draw(e){const{particle:t,radius:n}=e;!function(e,t,n){const{context:o}=e,r=n.count.numerator*n.count.denominator,d=n.count.numerator/n.count.denominator,u=180*(d-2)/d,c=Math.PI-(0,a.degToRad)(u);if(o){o.beginPath(),o.translate(t.x,t.y),o.moveTo(i,s);for(let e=0;e<r;e++)o.lineTo(n.length,s),o.translate(n.length,s),o.rotate(c)}}(e,this.getCenter(t,n),this.getSidesData(t,n))}getSidesCount(e){const t=e.shapeData;return Math.round((0,a.getRangeValue)(t?.sides??5))}}class u extends d{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 c extends d{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 l(e,t=!0){await e.addShape(new u,t)}async function p(e,t=!0){await e.addShape(new c,t)}async function g(e,t=!0){await l(e,t),await p(e,t)}return r})())); |
@@ -1,1 +0,1 @@ | ||
/*! tsParticles Polygon Shape v3.4.0 by Matteo Bruni */ | ||
/*! tsParticles Polygon Shape v3.5.0 by Matteo Bruni */ |
@@ -12,3 +12,5 @@ (function (factory) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.loadPolygonShape = exports.loadTriangleShape = exports.loadGenericPolygonShape = void 0; | ||
exports.loadGenericPolygonShape = loadGenericPolygonShape; | ||
exports.loadTriangleShape = loadTriangleShape; | ||
exports.loadPolygonShape = loadPolygonShape; | ||
const PolygonDrawer_js_1 = require("./PolygonDrawer.js"); | ||
@@ -19,7 +21,5 @@ const TriangleDrawer_js_1 = require("./TriangleDrawer.js"); | ||
} | ||
exports.loadGenericPolygonShape = loadGenericPolygonShape; | ||
async function loadTriangleShape(engine, refresh = true) { | ||
await engine.addShape(new TriangleDrawer_js_1.TriangleDrawer(), refresh); | ||
} | ||
exports.loadTriangleShape = loadTriangleShape; | ||
async function loadPolygonShape(engine, refresh = true) { | ||
@@ -29,3 +29,2 @@ await loadGenericPolygonShape(engine, refresh); | ||
} | ||
exports.loadPolygonShape = loadPolygonShape; | ||
}); |
@@ -12,3 +12,3 @@ (function (factory) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.drawPolygon = void 0; | ||
exports.drawPolygon = drawPolygon; | ||
const engine_1 = require("@tsparticles/engine"); | ||
@@ -30,3 +30,2 @@ const piDeg = 180, origin = { x: 0, y: 0 }, sidesOffset = 2; | ||
} | ||
exports.drawPolygon = drawPolygon; | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
315190
721
0
Updated@tsparticles/engine@^3.5.0