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

@tsparticles/shape-star

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsparticles/shape-star - npm Package Compare versions

Comparing version 3.0.0-alpha.1 to 3.0.0-beta.0

4

browser/index.js
import { StarDrawer } from "./StarDrawer";
export async function loadStarShape(engine) {
await engine.addShape("star", new StarDrawer());
export async function loadStarShape(engine, refresh = true) {
await engine.addShape("star", new StarDrawer(), refresh);
}
import { getRangeValue } from "@tsparticles/engine";
export class StarDrawer {
draw(context, particle, radius) {
var _a;
const sides = particle.sides, inset = (_a = particle.starInset) !== null && _a !== void 0 ? _a : 2;
const sides = particle.sides, inset = particle.starInset ?? 2;
context.moveTo(0, 0 - radius);

@@ -15,11 +14,9 @@ for (let i = 0; i < sides; i++) {

getSidesCount(particle) {
var _a, _b;
const star = particle.shapeData;
return Math.round(getRangeValue((_b = (_a = star === null || star === void 0 ? void 0 : star.sides) !== null && _a !== void 0 ? _a : star === null || star === void 0 ? void 0 : star.nb_sides) !== null && _b !== void 0 ? _b : 5));
return Math.round(getRangeValue(star?.sides ?? 5));
}
particleInit(container, particle) {
var _a;
const star = particle.shapeData, inset = getRangeValue((_a = star === null || star === void 0 ? void 0 : star.inset) !== null && _a !== void 0 ? _a : 2);
particle.starInset = inset;
const star = particle.shapeData;
particle.starInset = getRangeValue(star?.inset ?? 2);
}
}
"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 });
exports.loadStarShape = void 0;
const StarDrawer_1 = require("./StarDrawer");
function loadStarShape(engine) {
return __awaiter(this, void 0, void 0, function* () {
yield engine.addShape("star", new StarDrawer_1.StarDrawer());
});
async function loadStarShape(engine, refresh = true) {
await engine.addShape("star", new StarDrawer_1.StarDrawer(), refresh);
}
exports.loadStarShape = loadStarShape;

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

draw(context, particle, radius) {
var _a;
const sides = particle.sides, inset = (_a = particle.starInset) !== null && _a !== void 0 ? _a : 2;
const sides = particle.sides, inset = particle.starInset ?? 2;
context.moveTo(0, 0 - radius);

@@ -19,12 +18,10 @@ for (let i = 0; i < sides; i++) {

getSidesCount(particle) {
var _a, _b;
const star = particle.shapeData;
return Math.round((0, engine_1.getRangeValue)((_b = (_a = star === null || star === void 0 ? void 0 : star.sides) !== null && _a !== void 0 ? _a : star === null || star === void 0 ? void 0 : star.nb_sides) !== null && _b !== void 0 ? _b : 5));
return Math.round((0, engine_1.getRangeValue)(star?.sides ?? 5));
}
particleInit(container, particle) {
var _a;
const star = particle.shapeData, inset = (0, engine_1.getRangeValue)((_a = star === null || star === void 0 ? void 0 : star.inset) !== null && _a !== void 0 ? _a : 2);
particle.starInset = inset;
const star = particle.shapeData;
particle.starInset = (0, engine_1.getRangeValue)(star?.inset ?? 2);
}
}
exports.StarDrawer = StarDrawer;
import { StarDrawer } from "./StarDrawer";
export async function loadStarShape(engine) {
await engine.addShape("star", new StarDrawer());
export async function loadStarShape(engine, refresh = true) {
await engine.addShape("star", new StarDrawer(), refresh);
}
import { getRangeValue } from "@tsparticles/engine";
export class StarDrawer {
draw(context, particle, radius) {
var _a;
const sides = particle.sides, inset = (_a = particle.starInset) !== null && _a !== void 0 ? _a : 2;
const sides = particle.sides, inset = particle.starInset ?? 2;
context.moveTo(0, 0 - radius);

@@ -15,11 +14,9 @@ for (let i = 0; i < sides; i++) {

getSidesCount(particle) {
var _a, _b;
const star = particle.shapeData;
return Math.round(getRangeValue((_b = (_a = star === null || star === void 0 ? void 0 : star.sides) !== null && _a !== void 0 ? _a : star === null || star === void 0 ? void 0 : star.nb_sides) !== null && _b !== void 0 ? _b : 5));
return Math.round(getRangeValue(star?.sides ?? 5));
}
particleInit(container, particle) {
var _a;
const star = particle.shapeData, inset = getRangeValue((_a = star === null || star === void 0 ? void 0 : star.inset) !== null && _a !== void 0 ? _a : 2);
particle.starInset = inset;
const star = particle.shapeData;
particle.starInset = getRangeValue(star?.inset ?? 2);
}
}
{
"name": "@tsparticles/shape-star",
"version": "3.0.0-alpha.1",
"version": "3.0.0-beta.0",
"description": "tsParticles star shape",

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

"types": "types/index.d.ts",
"sideEffects": false,
"dependencies": {
"@tsparticles/engine": "^3.0.0-beta.0"
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@tsparticles/engine": "^3.0.0-alpha.1"
}
}
}

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

[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/tsparticles-shape-star/badge)](https://www.jsdelivr.com/package/npm/tsparticles-shape-star)
[![npmjs](https://badge.fury.io/js/tsparticles-shape-star.svg)](https://www.npmjs.com/package/tsparticles-shape-star)
[![npmjs](https://img.shields.io/npm/dt/tsparticles-shape-star)](https://www.npmjs.com/package/tsparticles-shape-star) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)
[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/@tsparticles/shape-star/badge)](https://www.jsdelivr.com/package/npm/@tsparticles/shape-star)
[![npmjs](https://badge.fury.io/js/@tsparticles/shape-star.svg)](https://www.npmjs.com/package/@tsparticles/shape-star)
[![npmjs](https://img.shields.io/npm/dt/@tsparticles/shape-star)](https://www.npmjs.com/package/@tsparticles/shape-star) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni)

@@ -30,3 +30,3 @@ [tsParticles](https://github.com/matteobruni/tsparticles) additional star shape.

(async () => {
await loadStarShape();
await loadStarShape(tsParticles);

@@ -48,3 +48,3 @@ await tsParticles.load({

```shell
$ npm install tsparticles-shape-star
$ npm install @tsparticles/shape-star
```

@@ -55,3 +55,3 @@

```shell
$ yarn add tsparticles-shape-star
$ yarn add @tsparticles/shape-star
```

@@ -62,6 +62,8 @@

```javascript
const { tsParticles } = require("tsparticles-engine");
const { loadStarShape } = require("tsparticles-shape-star");
const { tsParticles } = require("@tsparticles/engine");
const { loadStarShape } = require("@tsparticles/shape-star");
loadStarShape(tsParticles);
(async () => {
await loadStarShape(tsParticles);
})();
```

@@ -72,6 +74,8 @@

```javascript
import { tsParticles } from "tsparticles-engine";
import { loadStarShape } from "tsparticles-shape-star";
import { tsParticles } from "@tsparticles/engine";
import { loadStarShape } from "@tsparticles/shape-star";
loadStarShape(tsParticles);
(async () => {
await loadStarShape(tsParticles);
})();
```

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

* How to use? : Check the GitHub README
* v3.0.0-alpha.1
* v3.0.0-beta.0
*/

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

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

@@ -105,5 +105,4 @@

draw(context, particle, radius) {
var _a;
const sides = particle.sides,
inset = (_a = particle.starInset) !== null && _a !== void 0 ? _a : 2;
inset = particle.starInset ?? 2;
context.moveTo(0, 0 - radius);

@@ -118,11 +117,8 @@ for (let i = 0; i < sides; i++) {

getSidesCount(particle) {
var _a, _b;
const star = particle.shapeData;
return Math.round((0,engine_root_window_.getRangeValue)((_b = (_a = star === null || star === void 0 ? void 0 : star.sides) !== null && _a !== void 0 ? _a : star === null || star === void 0 ? void 0 : star.nb_sides) !== null && _b !== void 0 ? _b : 5));
return Math.round((0,engine_root_window_.getRangeValue)(star?.sides ?? 5));
}
particleInit(container, particle) {
var _a;
const star = particle.shapeData,
inset = (0,engine_root_window_.getRangeValue)((_a = star === null || star === void 0 ? void 0 : star.inset) !== null && _a !== void 0 ? _a : 2);
particle.starInset = inset;
const star = particle.shapeData;
particle.starInset = (0,engine_root_window_.getRangeValue)(star?.inset ?? 2);
}

@@ -132,4 +128,4 @@ }

async function loadStarShape(engine) {
await engine.addShape("star", new StarDrawer());
async function loadStarShape(engine, refresh = true) {
await engine.addShape("star", new StarDrawer(), refresh);
}

@@ -136,0 +132,0 @@ })();

/*! For license information please see tsparticles.shape.star.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 o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function r(e){var n=o[e];if(void 0!==n)return n.exports;var a=o[e]={exports:{}};return t[e](a,a.exports,r),a.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{r.r(n),r.d(n,{loadStarShape:()=>o});var e=r(533);class t{draw(e,t,o){var r;const n=t.sides,a=null!==(r=t.starInset)&&void 0!==r?r:2;e.moveTo(0,0-o);for(let t=0;t<n;t++)e.rotate(Math.PI/n),e.lineTo(0,0-o*a),e.rotate(Math.PI/n),e.lineTo(0,0-o)}getSidesCount(t){var o,r;const n=t.shapeData;return Math.round((0,e.getRangeValue)(null!==(r=null!==(o=null==n?void 0:n.sides)&&void 0!==o?o:null==n?void 0:n.nb_sides)&&void 0!==r?r:5))}particleInit(t,o){var r;const n=o.shapeData,a=(0,e.getRangeValue)(null!==(r=null==n?void 0:n.inset)&&void 0!==r?r:2);o.starInset=a}}async function o(e){await e.addShape("star",new t)}})(),n})()));
!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 r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},r={};function o(e){var a=r[e];if(void 0!==a)return a.exports;var n=r[e]={exports:{}};return t[e](n,n.exports,o),n.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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 a={};return(()=>{o.r(a),o.d(a,{loadStarShape:()=>r});var e=o(533);class t{draw(e,t,r){const o=t.sides,a=t.starInset??2;e.moveTo(0,0-r);for(let t=0;t<o;t++)e.rotate(Math.PI/o),e.lineTo(0,0-r*a),e.rotate(Math.PI/o),e.lineTo(0,0-r)}getSidesCount(t){const r=t.shapeData;return Math.round((0,e.getRangeValue)(r?.sides??5))}particleInit(t,r){const o=r.shapeData;r.starInset=(0,e.getRangeValue)(o?.inset??2)}}async function r(e,r=!0){await e.addShape("star",new t,r)}})(),a})()));

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

/*!
* Author : Matteo Bruni
* MIT license: https://opensource.org/licenses/MIT
* Demo / Generator : https://particles.js.org/
* GitHub : https://www.github.com/matteobruni/tsparticles
* How to use? : Check the GitHub README
* v3.0.0-alpha.1
*/
/*! tsParticles Star Shape v3.0.0-beta.0 by Matteo Bruni */
import type { Engine } from "@tsparticles/engine";
export declare function loadStarShape(engine: Engine): Promise<void>;
export declare function loadStarShape(engine: Engine, refresh?: boolean): Promise<void>;

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

import type { Container, IShapeDrawer, Particle } from "@tsparticles/engine";
import { type Container, type IShapeDrawer, type Particle } from "@tsparticles/engine";
import type { StarParticle } from "./StarParticle";

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

@@ -14,6 +14,6 @@ (function (factory) {

const StarDrawer_1 = require("./StarDrawer");
async function loadStarShape(engine) {
await engine.addShape("star", new StarDrawer_1.StarDrawer());
async function loadStarShape(engine, refresh = true) {
await engine.addShape("star", new StarDrawer_1.StarDrawer(), refresh);
}
exports.loadStarShape = loadStarShape;
});

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

draw(context, particle, radius) {
var _a;
const sides = particle.sides, inset = (_a = particle.starInset) !== null && _a !== void 0 ? _a : 2;
const sides = particle.sides, inset = particle.starInset ?? 2;
context.moveTo(0, 0 - radius);

@@ -28,10 +27,8 @@ for (let i = 0; i < sides; i++) {

getSidesCount(particle) {
var _a, _b;
const star = particle.shapeData;
return Math.round((0, engine_1.getRangeValue)((_b = (_a = star === null || star === void 0 ? void 0 : star.sides) !== null && _a !== void 0 ? _a : star === null || star === void 0 ? void 0 : star.nb_sides) !== null && _b !== void 0 ? _b : 5));
return Math.round((0, engine_1.getRangeValue)(star?.sides ?? 5));
}
particleInit(container, particle) {
var _a;
const star = particle.shapeData, inset = (0, engine_1.getRangeValue)((_a = star === null || star === void 0 ? void 0 : star.inset) !== null && _a !== void 0 ? _a : 2);
particle.starInset = inset;
const star = particle.shapeData;
particle.starInset = (0, engine_1.getRangeValue)(star?.inset ?? 2);
}

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