@tsparticles/shape-circle
Advanced tools
Comparing version 3.0.0-alpha.1 to 3.0.0-beta.0
@@ -0,1 +1,2 @@ | ||
import { isObject } from "@tsparticles/engine"; | ||
export class CircleDrawer { | ||
@@ -13,15 +14,13 @@ draw(context, particle, radius) { | ||
particleInit(container, particle) { | ||
var _a; | ||
const shapeData = particle.shapeData, angle = (_a = shapeData === null || shapeData === void 0 ? void 0 : shapeData.angle) !== null && _a !== void 0 ? _a : { | ||
const shapeData = particle.shapeData, angle = shapeData?.angle ?? { | ||
max: 360, | ||
min: 0, | ||
}; | ||
particle.circleRange = | ||
typeof angle !== "object" | ||
? { | ||
min: 0, | ||
max: (angle * Math.PI) / 180, | ||
} | ||
: { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 }; | ||
particle.circleRange = !isObject(angle) | ||
? { | ||
min: 0, | ||
max: (angle * Math.PI) / 180, | ||
} | ||
: { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 }; | ||
} | ||
} |
import { CircleDrawer } from "./CircleDrawer"; | ||
export async function loadCircleShape(engine) { | ||
await engine.addShape("circle", new CircleDrawer()); | ||
export async function loadCircleShape(engine, refresh = true) { | ||
await engine.addShape("circle", new CircleDrawer(), refresh); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CircleDrawer = void 0; | ||
const engine_1 = require("@tsparticles/engine"); | ||
class CircleDrawer { | ||
@@ -16,16 +17,14 @@ draw(context, particle, radius) { | ||
particleInit(container, particle) { | ||
var _a; | ||
const shapeData = particle.shapeData, angle = (_a = shapeData === null || shapeData === void 0 ? void 0 : shapeData.angle) !== null && _a !== void 0 ? _a : { | ||
const shapeData = particle.shapeData, angle = shapeData?.angle ?? { | ||
max: 360, | ||
min: 0, | ||
}; | ||
particle.circleRange = | ||
typeof angle !== "object" | ||
? { | ||
min: 0, | ||
max: (angle * Math.PI) / 180, | ||
} | ||
: { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 }; | ||
particle.circleRange = !(0, engine_1.isObject)(angle) | ||
? { | ||
min: 0, | ||
max: (angle * Math.PI) / 180, | ||
} | ||
: { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 }; | ||
} | ||
} | ||
exports.CircleDrawer = CircleDrawer; |
"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.loadCircleShape = void 0; | ||
const CircleDrawer_1 = require("./CircleDrawer"); | ||
function loadCircleShape(engine) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield engine.addShape("circle", new CircleDrawer_1.CircleDrawer()); | ||
}); | ||
async function loadCircleShape(engine, refresh = true) { | ||
await engine.addShape("circle", new CircleDrawer_1.CircleDrawer(), refresh); | ||
} | ||
exports.loadCircleShape = loadCircleShape; |
@@ -0,1 +1,2 @@ | ||
import { isObject } from "@tsparticles/engine"; | ||
export class CircleDrawer { | ||
@@ -13,15 +14,13 @@ draw(context, particle, radius) { | ||
particleInit(container, particle) { | ||
var _a; | ||
const shapeData = particle.shapeData, angle = (_a = shapeData === null || shapeData === void 0 ? void 0 : shapeData.angle) !== null && _a !== void 0 ? _a : { | ||
const shapeData = particle.shapeData, angle = shapeData?.angle ?? { | ||
max: 360, | ||
min: 0, | ||
}; | ||
particle.circleRange = | ||
typeof angle !== "object" | ||
? { | ||
min: 0, | ||
max: (angle * Math.PI) / 180, | ||
} | ||
: { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 }; | ||
particle.circleRange = !isObject(angle) | ||
? { | ||
min: 0, | ||
max: (angle * Math.PI) / 180, | ||
} | ||
: { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 }; | ||
} | ||
} |
import { CircleDrawer } from "./CircleDrawer"; | ||
export async function loadCircleShape(engine) { | ||
await engine.addShape("circle", new CircleDrawer()); | ||
export async function loadCircleShape(engine, refresh = true) { | ||
await engine.addShape("circle", new CircleDrawer(), refresh); | ||
} |
{ | ||
"name": "@tsparticles/shape-circle", | ||
"version": "3.0.0-alpha.1", | ||
"version": "3.0.0-beta.0", | ||
"description": "tsParticles circle 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-circle/badge)](https://www.jsdelivr.com/package/npm/tsparticles-shape-circle) | ||
[![npmjs](https://badge.fury.io/js/tsparticles-shape-circle.svg)](https://www.npmjs.com/package/tsparticles-shape-circle) | ||
[![npmjs](https://img.shields.io/npm/dt/tsparticles-shape-circle)](https://www.npmjs.com/package/tsparticles-shape-circle) [![GitHub Sponsors](https://img.shields.io/github/sponsors/matteobruni)](https://github.com/sponsors/matteobruni) | ||
[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/@tsparticles/shape-circle/badge)](https://www.jsdelivr.com/package/npm/@tsparticles/shape-circle) | ||
[![npmjs](https://badge.fury.io/js/@tsparticles/shape-circle.svg)](https://www.npmjs.com/package/@tsparticles/shape-circle) | ||
[![npmjs](https://img.shields.io/npm/dt/@tsparticles/shape-circle)](https://www.npmjs.com/package/@tsparticles/shape-circle) [![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 circle shape. | ||
(async () => { | ||
await loadCircleShape(); | ||
await loadCircleShape(tsParticles); | ||
@@ -48,3 +48,3 @@ await tsParticles.load({ | ||
```shell | ||
$ npm install tsparticles-shape-circle | ||
$ npm install @tsparticles/shape-circle | ||
``` | ||
@@ -55,3 +55,3 @@ | ||
```shell | ||
$ yarn add tsparticles-shape-circle | ||
$ yarn add @tsparticles/shape-circle | ||
``` | ||
@@ -62,6 +62,8 @@ | ||
```javascript | ||
const { tsParticles } = require("tsparticles-engine"); | ||
const { loadCircleShape } = require("tsparticles-shape-circle"); | ||
const { tsParticles } = require("@tsparticles/engine"); | ||
const { loadCircleShape } = require("@tsparticles/shape-circle"); | ||
loadCircleShape(tsParticles); | ||
(async () => { | ||
await loadCircleShape(tsParticles); | ||
})(); | ||
``` | ||
@@ -72,6 +74,8 @@ | ||
```javascript | ||
import { tsParticles } from "tsparticles-engine"; | ||
import { loadCircleShape } from "tsparticles-shape-circle"; | ||
import { tsParticles } from "@tsparticles/engine"; | ||
import { loadCircleShape } from "@tsparticles/shape-circle"; | ||
loadCircleShape(tsParticles); | ||
(async () => { | ||
await loadCircleShape(tsParticles); | ||
})(); | ||
``` |
@@ -7,19 +7,51 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v3.0.0-alpha.1 | ||
* v3.0.0-beta.0 | ||
*/ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(); | ||
module.exports = factory(require("@tsparticles/engine")); | ||
else if(typeof define === 'function' && define.amd) | ||
define([], factory); | ||
define(["@tsparticles/engine"], factory); | ||
else { | ||
var a = factory(); | ||
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]); | ||
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; | ||
} | ||
})(this, () => { | ||
})(this, (__WEBPACK_EXTERNAL_MODULE__533__) => { | ||
return /******/ (() => { // webpackBootstrap | ||
/******/ "use strict"; | ||
/******/ // The require scope | ||
/******/ var __webpack_require__ = {}; | ||
/******/ var __webpack_modules__ = ({ | ||
/***/ 533: | ||
/***/ ((module) => { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE__533__; | ||
/***/ }) | ||
/******/ }); | ||
/************************************************************************/ | ||
/******/ // The module cache | ||
/******/ var __webpack_module_cache__ = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ // Check if module is in cache | ||
/******/ var cachedModule = __webpack_module_cache__[moduleId]; | ||
/******/ if (cachedModule !== undefined) { | ||
/******/ return cachedModule.exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = __webpack_module_cache__[moduleId] = { | ||
/******/ // no module.id needed | ||
/******/ // no module.loaded needed | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/************************************************************************/ | ||
@@ -56,2 +88,4 @@ /******/ /* webpack/runtime/define property getters */ | ||
var __webpack_exports__ = {}; | ||
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. | ||
(() => { | ||
// ESM COMPAT FLAG | ||
@@ -62,6 +96,9 @@ __webpack_require__.r(__webpack_exports__); | ||
__webpack_require__.d(__webpack_exports__, { | ||
"loadCircleShape": () => (/* binding */ loadCircleShape) | ||
loadCircleShape: () => (/* binding */ loadCircleShape) | ||
}); | ||
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} | ||
var engine_root_window_ = __webpack_require__(533); | ||
;// CONCATENATED MODULE: ./dist/browser/CircleDrawer.js | ||
class CircleDrawer { | ||
@@ -82,9 +119,8 @@ draw(context, particle, radius) { | ||
particleInit(container, particle) { | ||
var _a; | ||
const shapeData = particle.shapeData, | ||
angle = (_a = shapeData === null || shapeData === void 0 ? void 0 : shapeData.angle) !== null && _a !== void 0 ? _a : { | ||
angle = shapeData?.angle ?? { | ||
max: 360, | ||
min: 0 | ||
}; | ||
particle.circleRange = typeof angle !== "object" ? { | ||
particle.circleRange = !(0,engine_root_window_.isObject)(angle) ? { | ||
min: 0, | ||
@@ -100,5 +136,7 @@ max: angle * Math.PI / 180 | ||
async function loadCircleShape(engine) { | ||
await engine.addShape("circle", new CircleDrawer()); | ||
async function loadCircleShape(engine, refresh = true) { | ||
await engine.addShape("circle", new CircleDrawer(), refresh); | ||
} | ||
})(); | ||
/******/ return __webpack_exports__; | ||
@@ -105,0 +143,0 @@ /******/ })() |
/*! For license information please see tsparticles.shape.circle.min.js.LICENSE.txt */ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var o=t();for(var a in o)("object"==typeof exports?exports:e)[a]=o[a]}}(this,(()=>(()=>{"use strict";var e={d:(t,o)=>{for(var a in o)e.o(o,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:o[a]})},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,{loadCircleShape:()=>a});class o{draw(e,t,o){t.circleRange||(t.circleRange={min:0,max:2*Math.PI});const a=t.circleRange;e.arc(0,0,o,a.min,a.max,!1)}getSidesCount(){return 12}particleInit(e,t){var o;const a=t.shapeData,n=null!==(o=null==a?void 0:a.angle)&&void 0!==o?o:{max:360,min:0};t.circleRange="object"!=typeof n?{min:0,max:n*Math.PI/180}:{min:n.min*Math.PI/180,max:n.max*Math.PI/180}}}async function a(e){await e.addShape("circle",new o)}return t})())); | ||
!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 n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{loadCircleShape:()=>r});var e=n(533);class t{draw(e,t,r){t.circleRange||(t.circleRange={min:0,max:2*Math.PI});const n=t.circleRange;e.arc(0,0,r,n.min,n.max,!1)}getSidesCount(){return 12}particleInit(t,r){const n=r.shapeData,o=n?.angle??{max:360,min:0};r.circleRange=(0,e.isObject)(o)?{min:o.min*Math.PI/180,max:o.max*Math.PI/180}:{min:0,max:o*Math.PI/180}}}async function r(e,r=!0){await e.addShape("circle",new t,r)}})(),o})())); |
@@ -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 Circle Shape v3.0.0-beta.0 by Matteo Bruni */ |
@@ -1,2 +0,2 @@ | ||
import type { Container, IShapeDrawer } from "@tsparticles/engine"; | ||
import { type Container, type IShapeDrawer } from "@tsparticles/engine"; | ||
import type { CircleParticle } from "./CircleParticle"; | ||
@@ -3,0 +3,0 @@ export declare class CircleDrawer implements IShapeDrawer { |
import type { Engine } from "@tsparticles/engine"; | ||
export declare function loadCircleShape(engine: Engine): Promise<void>; | ||
export declare function loadCircleShape(engine: Engine, refresh?: boolean): Promise<void>; |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports"], factory); | ||
define(["require", "exports", "@tsparticles/engine"], factory); | ||
} | ||
@@ -14,2 +14,3 @@ })(function (require, exports) { | ||
exports.CircleDrawer = void 0; | ||
const engine_1 = require("@tsparticles/engine"); | ||
class CircleDrawer { | ||
@@ -27,14 +28,12 @@ draw(context, particle, radius) { | ||
particleInit(container, particle) { | ||
var _a; | ||
const shapeData = particle.shapeData, angle = (_a = shapeData === null || shapeData === void 0 ? void 0 : shapeData.angle) !== null && _a !== void 0 ? _a : { | ||
const shapeData = particle.shapeData, angle = shapeData?.angle ?? { | ||
max: 360, | ||
min: 0, | ||
}; | ||
particle.circleRange = | ||
typeof angle !== "object" | ||
? { | ||
min: 0, | ||
max: (angle * Math.PI) / 180, | ||
} | ||
: { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 }; | ||
particle.circleRange = !(0, engine_1.isObject)(angle) | ||
? { | ||
min: 0, | ||
max: (angle * Math.PI) / 180, | ||
} | ||
: { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 }; | ||
} | ||
@@ -41,0 +40,0 @@ } |
@@ -14,6 +14,6 @@ (function (factory) { | ||
const CircleDrawer_1 = require("./CircleDrawer"); | ||
async function loadCircleShape(engine) { | ||
await engine.addShape("circle", new CircleDrawer_1.CircleDrawer()); | ||
async function loadCircleShape(engine, refresh = true) { | ||
await engine.addShape("circle", new CircleDrawer_1.CircleDrawer(), refresh); | ||
} | ||
exports.loadCircleShape = loadCircleShape; | ||
}); |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
297228
332
76
2