@tsparticles/plugin-emitters-shape-circle 3.9.0 → 4.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.
- package/430.min.js +2 -0
- package/430.min.js.LICENSE.txt +1 -0
- package/browser/index.js +6 -6
- package/cjs/EmittersCircleShape.js +5 -9
- package/cjs/EmittersCircleShapeGenerator.js +3 -7
- package/cjs/index.js +6 -9
- package/dist_browser_EmittersCircleShapeGenerator_js.js +40 -0
- package/esm/index.js +6 -6
- package/package.json +5 -4
- package/report.html +5 -4
- package/tsparticles.plugin.emitters.shape.circle.js +212 -43
- package/tsparticles.plugin.emitters.shape.circle.min.js +1 -1
- package/tsparticles.plugin.emitters.shape.circle.min.js.LICENSE.txt +1 -1
- package/types/index.d.ts +2 -2
- package/umd/index.js +41 -7
package/430.min.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see 430.min.js.LICENSE.txt */
|
|
2
|
+
(this.webpackChunk_tsparticles_plugin_emitters_shape_circle=this.webpackChunk_tsparticles_plugin_emitters_shape_circle||[]).push([[430],{430(t,s,e){e.d(s,{EmittersCircleShapeGenerator:()=>c});var a=e(526),i=e(303);const n=.25,h=2*Math.PI;class r extends a.EmitterShapeBase{constructor(t,s,e,a){super(t,s,e,a)}async init(){}randomPosition(){const t=this.size,s=this.fill,e=this.position,[a,r]=[.5*t.width,.5*t.height],c=((t,s)=>{const e=(0,i.getRandom)()*n,a=Math.atan(s/t*Math.tan(h*e)),r=(0,i.getRandom)();return r<n?a:r<.5?Math.PI-a:r<.75?Math.PI+a:-a})(a,r),o=(u=c,(l=a)*(M=r)/Math.sqrt((M*Math.cos(u))**2+(l*Math.sin(u))**2)),p=s?o*Math.sqrt((0,i.getRandom)()):o;var l,M,u;return{position:{x:e.x+p*Math.cos(c),y:e.y+p*Math.sin(c)}}}}class c{generate(t,s,e,a){return new r(t,s,e,a)}}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! tsParticles Emitters Shape Circle Plugin v4.0.0-alpha.0 by Matteo Bruni */
|
package/browser/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export function loadEmittersShapeCircle(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.0");
|
|
3
|
+
engine.register(async (emittersEngine) => {
|
|
4
|
+
const { EmittersCircleShapeGenerator } = await import("./EmittersCircleShapeGenerator.js");
|
|
5
|
+
emittersEngine.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator());
|
|
6
|
+
});
|
|
7
7
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.EmittersCircleShape = void 0;
|
|
4
|
-
const plugin_emitters_1 = require("@tsparticles/plugin-emitters");
|
|
5
|
-
const engine_1 = require("@tsparticles/engine");
|
|
1
|
+
import { EmitterShapeBase } from "@tsparticles/plugin-emitters";
|
|
2
|
+
import { getRandom } from "@tsparticles/engine";
|
|
6
3
|
const quarter = 0.25, double = 2, doublePI = Math.PI * double, squareExp = 2, half = 0.5;
|
|
7
|
-
class EmittersCircleShape extends
|
|
4
|
+
export class EmittersCircleShape extends EmitterShapeBase {
|
|
8
5
|
constructor(position, size, fill, options) {
|
|
9
6
|
super(position, size, fill, options);
|
|
10
7
|
}
|
|
@@ -12,7 +9,7 @@ class EmittersCircleShape extends plugin_emitters_1.EmitterShapeBase {
|
|
|
12
9
|
}
|
|
13
10
|
randomPosition() {
|
|
14
11
|
const size = this.size, fill = this.fill, position = this.position, generateTheta = (x, y) => {
|
|
15
|
-
const u =
|
|
12
|
+
const u = getRandom() * quarter, theta = Math.atan((y / x) * Math.tan(doublePI * u)), v = getRandom();
|
|
16
13
|
if (v < quarter) {
|
|
17
14
|
return theta;
|
|
18
15
|
}
|
|
@@ -25,7 +22,7 @@ class EmittersCircleShape extends plugin_emitters_1.EmitterShapeBase {
|
|
|
25
22
|
else {
|
|
26
23
|
return -theta;
|
|
27
24
|
}
|
|
28
|
-
}, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** squareExp + (x * Math.sin(theta)) ** squareExp), [a, b] = [size.width * half, size.height * half], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt(
|
|
25
|
+
}, radius = (x, y, theta) => (x * y) / Math.sqrt((y * Math.cos(theta)) ** squareExp + (x * Math.sin(theta)) ** squareExp), [a, b] = [size.width * half, size.height * half], randomTheta = generateTheta(a, b), maxRadius = radius(a, b, randomTheta), randomRadius = fill ? maxRadius * Math.sqrt(getRandom()) : maxRadius;
|
|
29
26
|
return {
|
|
30
27
|
position: {
|
|
31
28
|
x: position.x + randomRadius * Math.cos(randomTheta),
|
|
@@ -34,4 +31,3 @@ class EmittersCircleShape extends plugin_emitters_1.EmitterShapeBase {
|
|
|
34
31
|
};
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
|
-
exports.EmittersCircleShape = EmittersCircleShape;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.EmittersCircleShapeGenerator = void 0;
|
|
4
|
-
const EmittersCircleShape_js_1 = require("./EmittersCircleShape.js");
|
|
5
|
-
class EmittersCircleShapeGenerator {
|
|
1
|
+
import { EmittersCircleShape } from "./EmittersCircleShape.js";
|
|
2
|
+
export class EmittersCircleShapeGenerator {
|
|
6
3
|
generate(position, size, fill, options) {
|
|
7
|
-
return new
|
|
4
|
+
return new EmittersCircleShape(position, size, fill, options);
|
|
8
5
|
}
|
|
9
6
|
}
|
|
10
|
-
exports.EmittersCircleShapeGenerator = EmittersCircleShapeGenerator;
|
package/cjs/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
emittersEngine.checkVersion("3.9.0");
|
|
8
|
-
emittersEngine.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator_js_1.EmittersCircleShapeGenerator());
|
|
9
|
-
await emittersEngine.refresh(refresh);
|
|
1
|
+
export function loadEmittersShapeCircle(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.0");
|
|
3
|
+
engine.register(async (emittersEngine) => {
|
|
4
|
+
const { EmittersCircleShapeGenerator } = await import("./EmittersCircleShapeGenerator.js");
|
|
5
|
+
emittersEngine.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator());
|
|
6
|
+
});
|
|
10
7
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
* v4.0.0-alpha.0
|
|
8
|
+
*/
|
|
9
|
+
"use strict";
|
|
10
|
+
/*
|
|
11
|
+
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
+
* This devtool is neither made for production nor for readable output files.
|
|
13
|
+
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
+
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
+
* or disable the default devtool with "devtool: false".
|
|
16
|
+
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
+
*/
|
|
18
|
+
(this["webpackChunk_tsparticles_plugin_emitters_shape_circle"] = this["webpackChunk_tsparticles_plugin_emitters_shape_circle"] || []).push([["dist_browser_EmittersCircleShapeGenerator_js"],{
|
|
19
|
+
|
|
20
|
+
/***/ "./dist/browser/EmittersCircleShape.js"
|
|
21
|
+
/*!*********************************************!*\
|
|
22
|
+
!*** ./dist/browser/EmittersCircleShape.js ***!
|
|
23
|
+
\*********************************************/
|
|
24
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
|
+
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmittersCircleShape: () => (/* binding */ EmittersCircleShape)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/plugin-emitters */ \"@tsparticles/plugin-emitters\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\n\nconst quarter = 0.25,\n double = 2,\n doublePI = Math.PI * double,\n squareExp = 2,\n half = 0.5;\nclass EmittersCircleShape extends _tsparticles_plugin_emitters__WEBPACK_IMPORTED_MODULE_0__.EmitterShapeBase {\n constructor(position, size, fill, options) {\n super(position, size, fill, options);\n }\n async init() {}\n randomPosition() {\n const size = this.size,\n fill = this.fill,\n position = this.position,\n generateTheta = (x, y) => {\n const u = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.getRandom)() * quarter,\n theta = Math.atan(y / x * Math.tan(doublePI * u)),\n v = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.getRandom)();\n if (v < quarter) {\n return theta;\n } else if (v < double * quarter) {\n return Math.PI - theta;\n } else if (v < double * quarter + quarter) {\n return Math.PI + theta;\n } else {\n return -theta;\n }\n },\n radius = (x, y, theta) => x * y / Math.sqrt((y * Math.cos(theta)) ** squareExp + (x * Math.sin(theta)) ** squareExp),\n [a, b] = [size.width * half, size.height * half],\n randomTheta = generateTheta(a, b),\n maxRadius = radius(a, b, randomTheta),\n randomRadius = fill ? maxRadius * Math.sqrt((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_1__.getRandom)()) : maxRadius;\n return {\n position: {\n x: position.x + randomRadius * Math.cos(randomTheta),\n y: position.y + randomRadius * Math.sin(randomTheta)\n }\n };\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-circle/./dist/browser/EmittersCircleShape.js?\n}");
|
|
27
|
+
|
|
28
|
+
/***/ },
|
|
29
|
+
|
|
30
|
+
/***/ "./dist/browser/EmittersCircleShapeGenerator.js"
|
|
31
|
+
/*!******************************************************!*\
|
|
32
|
+
!*** ./dist/browser/EmittersCircleShapeGenerator.js ***!
|
|
33
|
+
\******************************************************/
|
|
34
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
35
|
+
|
|
36
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EmittersCircleShapeGenerator: () => (/* binding */ EmittersCircleShapeGenerator)\n/* harmony export */ });\n/* harmony import */ var _EmittersCircleShape_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./EmittersCircleShape.js */ \"./dist/browser/EmittersCircleShape.js\");\n\nclass EmittersCircleShapeGenerator {\n generate(position, size, fill, options) {\n return new _EmittersCircleShape_js__WEBPACK_IMPORTED_MODULE_0__.EmittersCircleShape(position, size, fill, options);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/plugin-emitters-shape-circle/./dist/browser/EmittersCircleShapeGenerator.js?\n}");
|
|
37
|
+
|
|
38
|
+
/***/ }
|
|
39
|
+
|
|
40
|
+
}]);
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export function loadEmittersShapeCircle(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.0");
|
|
3
|
+
engine.register(async (emittersEngine) => {
|
|
4
|
+
const { EmittersCircleShapeGenerator } = await import("./EmittersCircleShapeGenerator.js");
|
|
5
|
+
emittersEngine.addEmitterShapeGenerator?.("circle", new EmittersCircleShapeGenerator());
|
|
6
|
+
});
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/plugin-emitters-shape-circle",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.0",
|
|
4
4
|
"description": "tsParticles emitters shape circle plugin",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -100,10 +100,11 @@
|
|
|
100
100
|
"./package.json": "./package.json"
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
|
-
"@tsparticles/engine": "
|
|
104
|
-
"@tsparticles/plugin-emitters": "
|
|
103
|
+
"@tsparticles/engine": "4.0.0-alpha.0",
|
|
104
|
+
"@tsparticles/plugin-emitters": "4.0.0-alpha.0"
|
|
105
105
|
},
|
|
106
106
|
"publishConfig": {
|
|
107
107
|
"access": "public"
|
|
108
|
-
}
|
|
108
|
+
},
|
|
109
|
+
"type": "module"
|
|
109
110
|
}
|