@tsparticles/updater-orbit 4.0.0-beta.0 → 4.0.0-beta.10
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/183.min.js +1 -0
- package/README.md +29 -0
- package/browser/OrbitUpdater.js +6 -6
- package/browser/Utils.js +3 -3
- package/browser/index.js +4 -4
- package/cjs/OrbitUpdater.js +6 -6
- package/cjs/Utils.js +3 -3
- package/cjs/index.js +4 -4
- package/dist_browser_OrbitUpdater_js.js +3 -3
- package/esm/OrbitUpdater.js +6 -6
- package/esm/Utils.js +3 -3
- package/esm/index.js +4 -4
- package/package.json +4 -5
- package/report.html +84 -29
- package/tsparticles.updater.orbit.js +2 -2
- package/tsparticles.updater.orbit.min.js +2 -2
- package/types/OrbitUpdater.d.ts +3 -3
- package/types/Utils.d.ts +3 -2
- package/319.min.js +0 -1
- package/umd/Enums.js +0 -18
- package/umd/Options/Classes/Orbit.js +0 -54
- package/umd/Options/Classes/OrbitRotation.js +0 -27
- package/umd/Options/Interfaces/IOrbit.js +0 -12
- package/umd/OrbitUpdater.js +0 -92
- package/umd/Types.js +0 -12
- package/umd/Utils.js +0 -29
- package/umd/index.js +0 -56
package/183.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_updater_orbit=this.webpackChunk_tsparticles_updater_orbit||[]).push([[183],{183(t,i,a){a.d(i,{OrbitUpdater:()=>b});var o,e,r=a(303);class n extends r.ValueWithRandom{constructor(){super(),this.value=45}load(t){(0,r.isNull)(t)||super.load(t)}}class s{animation;color;enable;opacity;radius;rotation;width;constructor(){this.animation=new r.AnimationOptions,this.enable=!1,this.opacity=1,this.rotation=new n,this.width=1}load(t){(0,r.isNull)(t)||(this.animation.load(t.animation),this.rotation.load(t.rotation),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.opacity&&(this.opacity=(0,r.setRangeValue)(t.opacity)),void 0!==t.width&&(this.width=(0,r.setRangeValue)(t.width)),void 0!==t.radius&&(this.radius=(0,r.setRangeValue)(t.radius)),void 0!==t.color&&(this.color=r.OptionsColor.create(this.color,t.color)))}}(o=e||(e={})).front="front",o.back="back";let l=Math.PI*r.half,d=Math.PI+l;class b{_container;_pluginManager;constructor(t,i){this._pluginManager=t,this._container=i}afterDraw(t){let i=t.options.orbit;i?.enable&&this.drawOrbit(t,e.front)}beforeDraw(t){let i=t.options.orbit;i?.enable&&this.drawOrbit(t,e.back)}drawOrbit(t,i){let a,o,n=this._container;switch(i){case e.back:a=l,o=d;break;case e.front:a=d,o=l;break;default:a=0,o=r.doublePI}n.canvas.render.draw(i=>{!function(t,i,a,o,e,n,s,l,d,b){if(s<=0)return;let u=a.getPosition();o&&(i.strokeStyle=(0,r.getStyleFromHsl)(o,t.hdr,n)),i.lineWidth=s;let c=(0,r.degToRad)(l);i.beginPath(),i.ellipse(u.x,u.y,e*r.half,e*r.double,c,d,b),i.stroke()}(n,i,t,t.orbitColor??t.getFillColor(),t.retina.orbitRadius??n.retina.orbitRadius??t.getRadius(),t.orbitOpacity??r.defaultOpacity,t.orbitWidth??1,(t.orbitRotation??0)*n.retina.pixelRatio,a,o)})}init(t){let i=this._container,a=t.options.orbit;a?.enable&&(t.orbitRotation=(0,r.getRangeValue)(a.rotation.value),t.orbitColor=(0,r.rangeColorToHsl)(this._pluginManager,a.color),t.retina.orbitRadius=void 0!==a.radius?(0,r.getRangeValue)(a.radius)*i.retina.pixelRatio:void 0,i.retina.orbitRadius=t.retina.orbitRadius,t.orbitAnimationSpeed=a.animation.enable?(0,r.getRangeValue)(a.animation.speed):0,t.orbitWidth=(0,r.getRangeValue)(a.width),t.orbitOpacity=(0,r.getRangeValue)(a.opacity))}isEnabled(t){let i=t.options.orbit?.animation;return!t.destroyed&&!t.spawning&&!!i?.enable}loadOptions(t,...i){for(let a of(t.orbit??=new s,i))t.orbit.load(a?.orbit)}update(t,i){this.isEnabled(t)&&(t.orbitRotation??=0,t.orbitRotation+=(t.orbitAnimationSpeed??0/r.doublePI)*i.factor)}}}}]);
|
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
[tsParticles](https://github.com/tsparticles/tsparticles) updater plugin for orbit animations.
|
|
10
10
|
|
|
11
|
+
## Quick checklist
|
|
12
|
+
|
|
13
|
+
1. Install `@tsparticles/engine` (or use the CDN bundle below)
|
|
14
|
+
2. Call the package loader function(s) before `tsParticles.load(...)`
|
|
15
|
+
3. Apply the package options in your `tsParticles.load(...)` config
|
|
16
|
+
|
|
11
17
|
## How to use it
|
|
12
18
|
|
|
13
19
|
### CDN / Vanilla JS / jQuery
|
|
@@ -72,3 +78,26 @@ import { loadOrbitUpdater } from "@tsparticles/updater-orbit";
|
|
|
72
78
|
await loadOrbitUpdater(tsParticles);
|
|
73
79
|
})();
|
|
74
80
|
```
|
|
81
|
+
|
|
82
|
+
## Option mapping
|
|
83
|
+
|
|
84
|
+
- Primary options key: `particles.orbit`
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"particles": {
|
|
89
|
+
"orbit": {}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Common pitfalls
|
|
95
|
+
|
|
96
|
+
- Calling `tsParticles.load(...)` before `loadOrbitUpdater(...)`
|
|
97
|
+
- Verify required peer packages before enabling advanced options
|
|
98
|
+
- Change one option group at a time to isolate regressions quickly
|
|
99
|
+
|
|
100
|
+
## Related docs
|
|
101
|
+
|
|
102
|
+
- All packages catalog: <https://github.com/tsparticles/tsparticles>
|
|
103
|
+
- Main docs: <https://particles.js.org/docs/>
|
package/browser/OrbitUpdater.js
CHANGED
|
@@ -5,9 +5,9 @@ import { drawEllipse } from "./Utils.js";
|
|
|
5
5
|
const defaultOrbitSpeed = 0, halfPI = Math.PI * half, piAndAHalf = Math.PI + halfPI, startAngle = 0, defaultWidth = 1, defaultRotation = 0;
|
|
6
6
|
export class OrbitUpdater {
|
|
7
7
|
_container;
|
|
8
|
-
|
|
9
|
-
constructor(
|
|
10
|
-
this.
|
|
8
|
+
_pluginManager;
|
|
9
|
+
constructor(pluginManager, container) {
|
|
10
|
+
this._pluginManager = pluginManager;
|
|
11
11
|
this._container = container;
|
|
12
12
|
}
|
|
13
13
|
afterDraw(particle) {
|
|
@@ -38,8 +38,8 @@ export class OrbitUpdater {
|
|
|
38
38
|
start = startAngle;
|
|
39
39
|
end = doublePI;
|
|
40
40
|
}
|
|
41
|
-
container.canvas.draw(ctx => {
|
|
42
|
-
drawEllipse(ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ?? defaultOpacity, particle.orbitWidth ?? defaultWidth, (particle.orbitRotation ?? defaultRotation) * container.retina.pixelRatio, start, end);
|
|
41
|
+
container.canvas.render.draw(ctx => {
|
|
42
|
+
drawEllipse(container, ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ?? defaultOpacity, particle.orbitWidth ?? defaultWidth, (particle.orbitRotation ?? defaultRotation) * container.retina.pixelRatio, start, end);
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
init(particle) {
|
|
@@ -48,7 +48,7 @@ export class OrbitUpdater {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
particle.orbitRotation = getRangeValue(orbitOptions.rotation.value);
|
|
51
|
-
particle.orbitColor = rangeColorToHsl(this.
|
|
51
|
+
particle.orbitColor = rangeColorToHsl(this._pluginManager, orbitOptions.color);
|
|
52
52
|
particle.retina.orbitRadius =
|
|
53
53
|
orbitOptions.radius !== undefined ? getRangeValue(orbitOptions.radius) * container.retina.pixelRatio : undefined;
|
|
54
54
|
container.retina.orbitRadius = particle.retina.orbitRadius;
|
package/browser/Utils.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { degToRad, double, getStyleFromHsl, half } from "@tsparticles/engine";
|
|
1
|
+
import { degToRad, double, getStyleFromHsl, half, } from "@tsparticles/engine";
|
|
2
2
|
const minWidth = 0;
|
|
3
|
-
export function drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
3
|
+
export function drawEllipse(container, context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
4
4
|
if (width <= minWidth) {
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
|
-
const pos = particle.getPosition()
|
|
7
|
+
const pos = particle.getPosition();
|
|
8
8
|
if (fillColorValue) {
|
|
9
9
|
context.strokeStyle = getStyleFromHsl(fillColorValue, container.hdr, opacity);
|
|
10
10
|
}
|
package/browser/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export async function loadOrbitUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("orbit", async (container) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("orbit", async (container) => {
|
|
5
5
|
const { OrbitUpdater } = await import("./OrbitUpdater.js");
|
|
6
|
-
return new OrbitUpdater(e, container);
|
|
6
|
+
return new OrbitUpdater(e.pluginManager, container);
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
}
|
package/cjs/OrbitUpdater.js
CHANGED
|
@@ -5,9 +5,9 @@ import { drawEllipse } from "./Utils.js";
|
|
|
5
5
|
const defaultOrbitSpeed = 0, halfPI = Math.PI * half, piAndAHalf = Math.PI + halfPI, startAngle = 0, defaultWidth = 1, defaultRotation = 0;
|
|
6
6
|
export class OrbitUpdater {
|
|
7
7
|
_container;
|
|
8
|
-
|
|
9
|
-
constructor(
|
|
10
|
-
this.
|
|
8
|
+
_pluginManager;
|
|
9
|
+
constructor(pluginManager, container) {
|
|
10
|
+
this._pluginManager = pluginManager;
|
|
11
11
|
this._container = container;
|
|
12
12
|
}
|
|
13
13
|
afterDraw(particle) {
|
|
@@ -38,8 +38,8 @@ export class OrbitUpdater {
|
|
|
38
38
|
start = startAngle;
|
|
39
39
|
end = doublePI;
|
|
40
40
|
}
|
|
41
|
-
container.canvas.draw(ctx => {
|
|
42
|
-
drawEllipse(ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ?? defaultOpacity, particle.orbitWidth ?? defaultWidth, (particle.orbitRotation ?? defaultRotation) * container.retina.pixelRatio, start, end);
|
|
41
|
+
container.canvas.render.draw(ctx => {
|
|
42
|
+
drawEllipse(container, ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ?? defaultOpacity, particle.orbitWidth ?? defaultWidth, (particle.orbitRotation ?? defaultRotation) * container.retina.pixelRatio, start, end);
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
init(particle) {
|
|
@@ -48,7 +48,7 @@ export class OrbitUpdater {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
particle.orbitRotation = getRangeValue(orbitOptions.rotation.value);
|
|
51
|
-
particle.orbitColor = rangeColorToHsl(this.
|
|
51
|
+
particle.orbitColor = rangeColorToHsl(this._pluginManager, orbitOptions.color);
|
|
52
52
|
particle.retina.orbitRadius =
|
|
53
53
|
orbitOptions.radius !== undefined ? getRangeValue(orbitOptions.radius) * container.retina.pixelRatio : undefined;
|
|
54
54
|
container.retina.orbitRadius = particle.retina.orbitRadius;
|
package/cjs/Utils.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { degToRad, double, getStyleFromHsl, half } from "@tsparticles/engine";
|
|
1
|
+
import { degToRad, double, getStyleFromHsl, half, } from "@tsparticles/engine";
|
|
2
2
|
const minWidth = 0;
|
|
3
|
-
export function drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
3
|
+
export function drawEllipse(container, context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
4
4
|
if (width <= minWidth) {
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
|
-
const pos = particle.getPosition()
|
|
7
|
+
const pos = particle.getPosition();
|
|
8
8
|
if (fillColorValue) {
|
|
9
9
|
context.strokeStyle = getStyleFromHsl(fillColorValue, container.hdr, opacity);
|
|
10
10
|
}
|
package/cjs/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export async function loadOrbitUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("orbit", async (container) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("orbit", async (container) => {
|
|
5
5
|
const { OrbitUpdater } = await import("./OrbitUpdater.js");
|
|
6
|
-
return new OrbitUpdater(e, container);
|
|
6
|
+
return new OrbitUpdater(e.pluginManager, container);
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v4.0.0-beta.
|
|
7
|
+
* v4.0.0-beta.10
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -53,7 +53,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
53
53
|
\**************************************/
|
|
54
54
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
55
55
|
|
|
56
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OrbitUpdater: () => (/* binding */ OrbitUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Options_Classes_Orbit_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Orbit.js */ \"./dist/browser/Options/Classes/Orbit.js\");\n/* harmony import */ var _Enums_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Enums.js */ \"./dist/browser/Enums.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\n\nconst defaultOrbitSpeed = 0, halfPI = Math.PI * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, piAndAHalf = Math.PI + halfPI, startAngle = 0, defaultWidth = 1, defaultRotation = 0;\nclass OrbitUpdater {\n _container;\n
|
|
56
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OrbitUpdater: () => (/* binding */ OrbitUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Options_Classes_Orbit_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Orbit.js */ \"./dist/browser/Options/Classes/Orbit.js\");\n/* harmony import */ var _Enums_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Enums.js */ \"./dist/browser/Enums.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\n\nconst defaultOrbitSpeed = 0, halfPI = Math.PI * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, piAndAHalf = Math.PI + halfPI, startAngle = 0, defaultWidth = 1, defaultRotation = 0;\nclass OrbitUpdater {\n _container;\n _pluginManager;\n constructor(pluginManager, container){\n this._pluginManager = pluginManager;\n this._container = container;\n }\n afterDraw(particle) {\n const orbitOptions = particle.options.orbit;\n if (orbitOptions?.enable) {\n this.drawOrbit(particle, _Enums_js__WEBPACK_IMPORTED_MODULE_2__.OrbitType.front);\n }\n }\n beforeDraw(particle) {\n const orbitOptions = particle.options.orbit;\n if (orbitOptions?.enable) {\n this.drawOrbit(particle, _Enums_js__WEBPACK_IMPORTED_MODULE_2__.OrbitType.back);\n }\n }\n drawOrbit(particle, type) {\n const container = this._container;\n let start, end;\n switch(type){\n case _Enums_js__WEBPACK_IMPORTED_MODULE_2__.OrbitType.back:\n start = halfPI;\n end = piAndAHalf;\n break;\n case _Enums_js__WEBPACK_IMPORTED_MODULE_2__.OrbitType.front:\n start = piAndAHalf;\n end = halfPI;\n break;\n default:\n start = startAngle;\n end = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.doublePI;\n }\n container.canvas.render.draw((ctx)=>{\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__.drawEllipse)(container, ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ?? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.defaultOpacity, particle.orbitWidth ?? defaultWidth, (particle.orbitRotation ?? defaultRotation) * container.retina.pixelRatio, start, end);\n });\n }\n init(particle) {\n const container = this._container, particlesOptions = particle.options, orbitOptions = particlesOptions.orbit;\n if (!orbitOptions?.enable) {\n return;\n }\n particle.orbitRotation = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(orbitOptions.rotation.value);\n particle.orbitColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToHsl)(this._pluginManager, orbitOptions.color);\n particle.retina.orbitRadius = orbitOptions.radius !== undefined ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(orbitOptions.radius) * container.retina.pixelRatio : undefined;\n container.retina.orbitRadius = particle.retina.orbitRadius;\n particle.orbitAnimationSpeed = orbitOptions.animation.enable ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(orbitOptions.animation.speed) : defaultOrbitSpeed;\n particle.orbitWidth = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(orbitOptions.width);\n particle.orbitOpacity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(orbitOptions.opacity);\n }\n isEnabled(particle) {\n const orbitAnimations = particle.options.orbit?.animation;\n return !particle.destroyed && !particle.spawning && !!orbitAnimations?.enable;\n }\n loadOptions(options, ...sources) {\n options.orbit ??= new _Options_Classes_Orbit_js__WEBPACK_IMPORTED_MODULE_1__.Orbit();\n for (const source of sources){\n options.orbit.load(source?.orbit);\n }\n }\n update(particle, delta) {\n if (!this.isEnabled(particle)) {\n return;\n }\n particle.orbitRotation ??= defaultRotation;\n particle.orbitRotation += (particle.orbitAnimationSpeed ?? defaultOrbitSpeed / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.doublePI) * delta.factor;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-orbit/./dist/browser/OrbitUpdater.js?\n}");
|
|
57
57
|
|
|
58
58
|
/***/ },
|
|
59
59
|
|
|
@@ -63,7 +63,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
63
63
|
\*******************************/
|
|
64
64
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
65
65
|
|
|
66
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawEllipse: () => (/* binding */ drawEllipse)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst minWidth = 0;\nfunction drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {\n if (width <= minWidth) {\n return;\n }\n const pos = particle.getPosition()
|
|
66
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ drawEllipse: () => (/* binding */ drawEllipse)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst minWidth = 0;\nfunction drawEllipse(container, context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {\n if (width <= minWidth) {\n return;\n }\n const pos = particle.getPosition();\n if (fillColorValue) {\n context.strokeStyle = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromHsl)(fillColorValue, container.hdr, opacity);\n }\n context.lineWidth = width;\n const rotationRadian = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.degToRad)(rotation);\n context.beginPath();\n context.ellipse(pos.x, pos.y, radius * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.half, radius * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.double, rotationRadian, start, end);\n context.stroke();\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-orbit/./dist/browser/Utils.js?\n}");
|
|
67
67
|
|
|
68
68
|
/***/ }
|
|
69
69
|
|
package/esm/OrbitUpdater.js
CHANGED
|
@@ -5,9 +5,9 @@ import { drawEllipse } from "./Utils.js";
|
|
|
5
5
|
const defaultOrbitSpeed = 0, halfPI = Math.PI * half, piAndAHalf = Math.PI + halfPI, startAngle = 0, defaultWidth = 1, defaultRotation = 0;
|
|
6
6
|
export class OrbitUpdater {
|
|
7
7
|
_container;
|
|
8
|
-
|
|
9
|
-
constructor(
|
|
10
|
-
this.
|
|
8
|
+
_pluginManager;
|
|
9
|
+
constructor(pluginManager, container) {
|
|
10
|
+
this._pluginManager = pluginManager;
|
|
11
11
|
this._container = container;
|
|
12
12
|
}
|
|
13
13
|
afterDraw(particle) {
|
|
@@ -38,8 +38,8 @@ export class OrbitUpdater {
|
|
|
38
38
|
start = startAngle;
|
|
39
39
|
end = doublePI;
|
|
40
40
|
}
|
|
41
|
-
container.canvas.draw(ctx => {
|
|
42
|
-
drawEllipse(ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ?? defaultOpacity, particle.orbitWidth ?? defaultWidth, (particle.orbitRotation ?? defaultRotation) * container.retina.pixelRatio, start, end);
|
|
41
|
+
container.canvas.render.draw(ctx => {
|
|
42
|
+
drawEllipse(container, ctx, particle, particle.orbitColor ?? particle.getFillColor(), particle.retina.orbitRadius ?? container.retina.orbitRadius ?? particle.getRadius(), particle.orbitOpacity ?? defaultOpacity, particle.orbitWidth ?? defaultWidth, (particle.orbitRotation ?? defaultRotation) * container.retina.pixelRatio, start, end);
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
init(particle) {
|
|
@@ -48,7 +48,7 @@ export class OrbitUpdater {
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
particle.orbitRotation = getRangeValue(orbitOptions.rotation.value);
|
|
51
|
-
particle.orbitColor = rangeColorToHsl(this.
|
|
51
|
+
particle.orbitColor = rangeColorToHsl(this._pluginManager, orbitOptions.color);
|
|
52
52
|
particle.retina.orbitRadius =
|
|
53
53
|
orbitOptions.radius !== undefined ? getRangeValue(orbitOptions.radius) * container.retina.pixelRatio : undefined;
|
|
54
54
|
container.retina.orbitRadius = particle.retina.orbitRadius;
|
package/esm/Utils.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { degToRad, double, getStyleFromHsl, half } from "@tsparticles/engine";
|
|
1
|
+
import { degToRad, double, getStyleFromHsl, half, } from "@tsparticles/engine";
|
|
2
2
|
const minWidth = 0;
|
|
3
|
-
export function drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
3
|
+
export function drawEllipse(container, context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
4
4
|
if (width <= minWidth) {
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
|
-
const pos = particle.getPosition()
|
|
7
|
+
const pos = particle.getPosition();
|
|
8
8
|
if (fillColorValue) {
|
|
9
9
|
context.strokeStyle = getStyleFromHsl(fillColorValue, container.hdr, opacity);
|
|
10
10
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export async function loadOrbitUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("orbit", async (container) => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.10");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("orbit", async (container) => {
|
|
5
5
|
const { OrbitUpdater } = await import("./OrbitUpdater.js");
|
|
6
|
-
return new OrbitUpdater(e, container);
|
|
6
|
+
return new OrbitUpdater(e.pluginManager, container);
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-orbit",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.10",
|
|
4
4
|
"description": "tsParticles particles orbit updater",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -95,13 +95,12 @@
|
|
|
95
95
|
"browser": "./browser/index.js",
|
|
96
96
|
"import": "./esm/index.js",
|
|
97
97
|
"require": "./cjs/index.js",
|
|
98
|
-
"
|
|
99
|
-
"default": "./cjs/index.js"
|
|
98
|
+
"default": "./esm/index.js"
|
|
100
99
|
},
|
|
101
100
|
"./package.json": "./package.json"
|
|
102
101
|
},
|
|
103
|
-
"
|
|
104
|
-
"@tsparticles/engine": "4.0.0-beta.
|
|
102
|
+
"peerDependencies": {
|
|
103
|
+
"@tsparticles/engine": "4.0.0-beta.10"
|
|
105
104
|
},
|
|
106
105
|
"publishConfig": {
|
|
107
106
|
"access": "public"
|