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

tsparticles-shape-polygon

Package Overview
Dependencies
Maintainers
1
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.0.0-beta.4 to 2.0.0-beta.5

IPolygonShape.d.ts

8

index.d.ts

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

import type { Main } from "tsparticles-engine";
export declare function loadGenericPolygonShape(tsParticles: Main): Promise<void>;
export declare function loadTriangleShape(tsParticles: Main): Promise<void>;
export declare function loadPolygonShape(tsParticles: Main): Promise<void>;
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>;

@@ -12,17 +12,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import { TriangleDrawer } from "./TriangleDrawer";
export function loadGenericPolygonShape(tsParticles) {
export function loadGenericPolygonShape(engine) {
return __awaiter(this, void 0, void 0, function* () {
yield tsParticles.addShape("polygon", new PolygonDrawer());
yield engine.addShape("polygon", new PolygonDrawer());
});
}
export function loadTriangleShape(tsParticles) {
export function loadTriangleShape(engine) {
return __awaiter(this, void 0, void 0, function* () {
yield tsParticles.addShape("triangle", new TriangleDrawer());
yield engine.addShape("triangle", new TriangleDrawer());
});
}
export function loadPolygonShape(tsParticles) {
export function loadPolygonShape(engine) {
return __awaiter(this, void 0, void 0, function* () {
yield loadGenericPolygonShape(tsParticles);
yield loadTriangleShape(tsParticles);
yield loadGenericPolygonShape(engine);
yield loadTriangleShape(engine);
});
}
{
"name": "tsparticles-shape-polygon",
"version": "2.0.0-beta.4",
"version": "2.0.0-beta.5",
"description": "tsParticles polygon shape",

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

"dependencies": {
"tsparticles-engine": "^2.0.0-beta.3"
"tsparticles-engine": "^2.0.0-beta.4"
}
}

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

import type { ICoordinates, IParticle } from "tsparticles-engine";
import type { ISide } from "./PolygonDrawerBase";
import { PolygonDrawerBase } from "./PolygonDrawerBase";
import type { ICoordinates, IParticle } from "tsparticles-engine";
export declare class PolygonDrawer extends PolygonDrawerBase {

@@ -5,0 +5,0 @@ getSidesData(particle: IParticle, radius: number): ISide;

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

import type { ICoordinates, IParticle } from "tsparticles-engine";
import type { ISide } from "./PolygonDrawerBase";
import type { ICoordinates, IParticle } from "tsparticles-engine";
import { PolygonDrawerBase } from "./PolygonDrawerBase";

@@ -4,0 +4,0 @@ export declare class TriangleDrawer extends PolygonDrawerBase {

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

* How to use? : Check the GitHub README
* v2.0.0-beta.4
* v2.0.0-beta.5
*/

@@ -185,16 +185,16 @@ (function webpackUniversalModuleDefinition(root, factory) {

function loadGenericPolygonShape(tsParticles) {
function loadGenericPolygonShape(engine) {
return __awaiter(this, void 0, void 0, function* () {
yield tsParticles.addShape("polygon", new PolygonDrawer());
yield engine.addShape("polygon", new PolygonDrawer());
});
}
function loadTriangleShape(tsParticles) {
function loadTriangleShape(engine) {
return __awaiter(this, void 0, void 0, function* () {
yield tsParticles.addShape("triangle", new TriangleDrawer());
yield engine.addShape("triangle", new TriangleDrawer());
});
}
function loadPolygonShape(tsParticles) {
function loadPolygonShape(engine) {
return __awaiter(this, void 0, void 0, function* () {
yield loadGenericPolygonShape(tsParticles);
yield loadTriangleShape(tsParticles);
yield loadGenericPolygonShape(engine);
yield loadTriangleShape(engine);
});

@@ -201,0 +201,0 @@ }

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

/*! tsParticles Polygon Shape v2.0.0-beta.4 by Matteo Bruni */
/*! tsParticles Polygon Shape v2.0.0-beta.5 by Matteo Bruni */
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,(function(){return(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{loadGenericPolygonShape:()=>a,loadPolygonShape:()=>d,loadTriangleShape:()=>u});class n{getSidesCount(e){var t,n;const o=e.shapeData;return null!==(n=null!==(t=null==o?void 0:o.sides)&&void 0!==t?t:null==o?void 0:o.nb_sides)&&void 0!==n?n:5}draw(e,t,n){const o=this.getCenter(t,n),r=this.getSidesData(t,n),i=r.count.numerator*r.count.denominator,a=r.count.numerator/r.count.denominator,u=180*(a-2)/a,d=Math.PI-Math.PI*u/180;if(e){e.beginPath(),e.translate(o.x,o.y),e.moveTo(0,0);for(let t=0;t<i;t++)e.lineTo(r.length,0),e.translate(r.length,0),e.rotate(d)}}}class o extends n{getSidesData(e,t){var n,o;const r=e.shapeData,i=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;return{count:{denominator:1,numerator:i},length:2.66*t/(i/3)}}getCenter(e,t){return{x:-t/(this.getSidesCount(e)/3.5),y:-t/.76}}}class r extends n{getSidesCount(){return 3}getSidesData(e,t){return{count:{denominator:2,numerator:3},length:2*t}}getCenter(e,t){return{x:-t,y:t/1.66}}}var i=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{d(o.next(e))}catch(e){i(e)}}function u(e){try{d(o.throw(e))}catch(e){i(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}d((o=o.apply(e,t||[])).next())}))};function a(e){return i(this,void 0,void 0,(function*(){yield e.addShape("polygon",new o)}))}function u(e){return i(this,void 0,void 0,(function*(){yield e.addShape("triangle",new r)}))}function d(e){return i(this,void 0,void 0,(function*(){yield a(e),yield u(e)}))}return t})()}));

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