@tsparticles/shape-circle 3.0.0-alpha.0

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.
@@ -0,0 +1,102 @@
1
+ /*!
2
+ * Author : Matteo Bruni
3
+ * MIT license: https://opensource.org/licenses/MIT
4
+ * Demo / Generator : https://particles.js.org/
5
+ * GitHub : https://www.github.com/matteobruni/tsparticles
6
+ * How to use? : Check the GitHub README
7
+ * v3.0.0-alpha.0
8
+ */
9
+ (function webpackUniversalModuleDefinition(root, factory) {
10
+ if(typeof exports === 'object' && typeof module === 'object')
11
+ module.exports = factory();
12
+ else if(typeof define === 'function' && define.amd)
13
+ define([], factory);
14
+ else {
15
+ var a = factory();
16
+ for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
17
+ }
18
+ })(this, () => {
19
+ return /******/ (() => { // webpackBootstrap
20
+ /******/ "use strict";
21
+ /******/ // The require scope
22
+ /******/ var __webpack_require__ = {};
23
+ /******/
24
+ /************************************************************************/
25
+ /******/ /* webpack/runtime/define property getters */
26
+ /******/ (() => {
27
+ /******/ // define getter functions for harmony exports
28
+ /******/ __webpack_require__.d = (exports, definition) => {
29
+ /******/ for(var key in definition) {
30
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
31
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
32
+ /******/ }
33
+ /******/ }
34
+ /******/ };
35
+ /******/ })();
36
+ /******/
37
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
38
+ /******/ (() => {
39
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
40
+ /******/ })();
41
+ /******/
42
+ /******/ /* webpack/runtime/make namespace object */
43
+ /******/ (() => {
44
+ /******/ // define __esModule on exports
45
+ /******/ __webpack_require__.r = (exports) => {
46
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
+ /******/ }
49
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
50
+ /******/ };
51
+ /******/ })();
52
+ /******/
53
+ /************************************************************************/
54
+ var __webpack_exports__ = {};
55
+ // ESM COMPAT FLAG
56
+ __webpack_require__.r(__webpack_exports__);
57
+
58
+ // EXPORTS
59
+ __webpack_require__.d(__webpack_exports__, {
60
+ "loadCircleShape": () => (/* binding */ loadCircleShape)
61
+ });
62
+
63
+ ;// CONCATENATED MODULE: ./dist/browser/CircleDrawer.js
64
+ class CircleDrawer {
65
+ draw(context, particle, radius) {
66
+ if (!particle.circleRange) {
67
+ particle.circleRange = {
68
+ min: 0,
69
+ max: Math.PI * 2
70
+ };
71
+ }
72
+ const circleRange = particle.circleRange;
73
+ context.arc(0, 0, radius, circleRange.min, circleRange.max, false);
74
+ }
75
+ getSidesCount() {
76
+ return 12;
77
+ }
78
+ particleInit(container, particle) {
79
+ var _a;
80
+ const shapeData = particle.shapeData,
81
+ angle = (_a = shapeData === null || shapeData === void 0 ? void 0 : shapeData.angle) !== null && _a !== void 0 ? _a : {
82
+ max: 360,
83
+ min: 0
84
+ };
85
+ particle.circleRange = typeof angle !== "object" ? {
86
+ min: 0,
87
+ max: angle * Math.PI / 180
88
+ } : {
89
+ min: angle.min * Math.PI / 180,
90
+ max: angle.max * Math.PI / 180
91
+ };
92
+ }
93
+ }
94
+ ;// CONCATENATED MODULE: ./dist/browser/index.js
95
+
96
+ async function loadCircleShape(engine) {
97
+ await engine.addShape("circle", new CircleDrawer());
98
+ }
99
+ /******/ return __webpack_exports__;
100
+ /******/ })()
101
+ ;
102
+ });
@@ -0,0 +1,2 @@
1
+ /*! For license information please see tsparticles.shape.circle.min.js.LICENSE.txt */
2
+ !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})()));
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Author : Matteo Bruni
3
+ * MIT license: https://opensource.org/licenses/MIT
4
+ * Demo / Generator : https://particles.js.org/
5
+ * GitHub : https://www.github.com/matteobruni/tsparticles
6
+ * How to use? : Check the GitHub README
7
+ * v3.0.0-alpha.0
8
+ */
@@ -0,0 +1,7 @@
1
+ import type { Container, IShapeDrawer } from "@tsparticles/engine";
2
+ import type { CircleParticle } from "./CircleParticle";
3
+ export declare class CircleDrawer implements IShapeDrawer {
4
+ draw(context: CanvasRenderingContext2D, particle: CircleParticle, radius: number): void;
5
+ getSidesCount(): number;
6
+ particleInit(container: Container, particle: CircleParticle): void;
7
+ }
@@ -0,0 +1,4 @@
1
+ import type { IRangeValue, Particle } from "@tsparticles/engine";
2
+ export type CircleParticle = Particle & {
3
+ circleRange?: IRangeValue;
4
+ };
@@ -0,0 +1,4 @@
1
+ import type { IShapeValues, RangeValue } from "@tsparticles/engine";
2
+ export interface ICircleShapeData extends IShapeValues {
3
+ angle: RangeValue;
4
+ }
@@ -0,0 +1,2 @@
1
+ import type { Engine } from "@tsparticles/engine";
2
+ export declare function loadCircleShape(engine: Engine): Promise<void>;
@@ -0,0 +1,40 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CircleDrawer = void 0;
13
+ class CircleDrawer {
14
+ draw(context, particle, radius) {
15
+ if (!particle.circleRange) {
16
+ particle.circleRange = { min: 0, max: Math.PI * 2 };
17
+ }
18
+ const circleRange = particle.circleRange;
19
+ context.arc(0, 0, radius, circleRange.min, circleRange.max, false);
20
+ }
21
+ getSidesCount() {
22
+ return 12;
23
+ }
24
+ particleInit(container, particle) {
25
+ var _a;
26
+ const shapeData = particle.shapeData, angle = (_a = shapeData === null || shapeData === void 0 ? void 0 : shapeData.angle) !== null && _a !== void 0 ? _a : {
27
+ max: 360,
28
+ min: 0,
29
+ };
30
+ particle.circleRange =
31
+ typeof angle !== "object"
32
+ ? {
33
+ min: 0,
34
+ max: (angle * Math.PI) / 180,
35
+ }
36
+ : { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 };
37
+ }
38
+ }
39
+ exports.CircleDrawer = CircleDrawer;
40
+ });
@@ -0,0 +1,12 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ });
@@ -0,0 +1,12 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ });
package/umd/index.js ADDED
@@ -0,0 +1,18 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports", "./CircleDrawer"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.loadCircleShape = void 0;
13
+ const CircleDrawer_1 = require("./CircleDrawer");
14
+ async function loadCircleShape(engine) {
15
+ await engine.addShape("circle", new CircleDrawer_1.CircleDrawer());
16
+ }
17
+ exports.loadCircleShape = loadCircleShape;
18
+ });