@tsparticles/shape-polygon 3.0.0-beta.1 → 3.0.0-beta.3
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/README.md +1 -1
- package/browser/PolygonDrawerBase.js +3 -3
- package/cjs/PolygonDrawerBase.js +2 -2
- package/esm/PolygonDrawerBase.js +3 -3
- package/package.json +4 -4
- package/report.html +23 -5
- package/tsparticles.shape.polygon.js +8 -3
- package/tsparticles.shape.polygon.min.js +1 -1
- package/tsparticles.shape.polygon.min.js.LICENSE.txt +1 -1
- package/types/PolygonDrawerBase.d.ts +2 -2
- package/umd/PolygonDrawerBase.js +2 -2
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v3.0.0-beta.
|
|
7
|
+
* v3.0.0-beta.3
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -101,8 +101,13 @@ var engine_root_window_ = __webpack_require__(533);
|
|
|
101
101
|
;// CONCATENATED MODULE: ./dist/browser/PolygonDrawerBase.js
|
|
102
102
|
|
|
103
103
|
class PolygonDrawerBase {
|
|
104
|
-
draw(
|
|
105
|
-
const
|
|
104
|
+
draw(data) {
|
|
105
|
+
const {
|
|
106
|
+
context,
|
|
107
|
+
particle,
|
|
108
|
+
radius
|
|
109
|
+
} = data,
|
|
110
|
+
start = this.getCenter(particle, radius),
|
|
106
111
|
side = this.getSidesData(particle, radius),
|
|
107
112
|
sideCount = side.count.numerator * side.count.denominator,
|
|
108
113
|
decimalSides = side.count.numerator / side.count.denominator,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.shape.polygon.min.js.LICENSE.txt */
|
|
2
|
-
!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={533: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(533);class t{draw(e
|
|
2
|
+
!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={533: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(533);class t{draw(e){const{context:t,particle:n,radius:o}=e,r=this.getCenter(n,o),a=this.getSidesData(n,o),i=a.count.numerator*a.count.denominator,s=a.count.numerator/a.count.denominator,d=180*(s-2)/s,u=Math.PI-Math.PI*d/180;if(t){t.beginPath(),t.translate(r.x,r.y),t.moveTo(0,0);for(let e=0;e<i;e++)t.lineTo(a.length,0),t.translate(a.length,0),t.rotate(u)}}getSidesCount(t){const n=t.shapeData;return Math.round((0,e.getRangeValue)(n?.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 @@
|
|
|
1
|
-
/*! tsParticles Polygon Shape v3.0.0-beta.
|
|
1
|
+
/*! tsParticles Polygon Shape v3.0.0-beta.3 by Matteo Bruni */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type ICoordinates, type IShapeDrawer, type Particle } from "@tsparticles/engine";
|
|
1
|
+
import { type ICoordinates, type IShapeDrawData, type IShapeDrawer, type Particle } from "@tsparticles/engine";
|
|
2
2
|
import type { ISide } from "./ISide.js";
|
|
3
3
|
export declare abstract class PolygonDrawerBase implements IShapeDrawer {
|
|
4
|
-
draw(
|
|
4
|
+
draw(data: IShapeDrawData): void;
|
|
5
5
|
getSidesCount(particle: Particle): number;
|
|
6
6
|
abstract getCenter(particle: Particle, radius: number): ICoordinates;
|
|
7
7
|
abstract getSidesData(particle: Particle, radius: number): ISide;
|
package/umd/PolygonDrawerBase.js
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
exports.PolygonDrawerBase = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
class PolygonDrawerBase {
|
|
15
|
-
draw(
|
|
16
|
-
const start = this.getCenter(particle, radius), side = this.getSidesData(particle, radius), sideCount = side.count.numerator * side.count.denominator, decimalSides = side.count.numerator / side.count.denominator, interiorAngleDegrees = (180 * (decimalSides - 2)) / decimalSides, interiorAngle = Math.PI - (Math.PI * interiorAngleDegrees) / 180;
|
|
15
|
+
draw(data) {
|
|
16
|
+
const { context, particle, radius } = data, start = this.getCenter(particle, radius), side = this.getSidesData(particle, radius), sideCount = side.count.numerator * side.count.denominator, decimalSides = side.count.numerator / side.count.denominator, interiorAngleDegrees = (180 * (decimalSides - 2)) / decimalSides, interiorAngle = Math.PI - (Math.PI * interiorAngleDegrees) / 180;
|
|
17
17
|
if (!context) {
|
|
18
18
|
return;
|
|
19
19
|
}
|