@tsparticles/updater-orbit 4.0.0-alpha.2 → 4.0.0-alpha.21
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/443.min.js +1 -0
- package/browser/Options/Classes/Orbit.js +7 -0
- package/browser/OrbitUpdater.js +3 -3
- package/browser/Utils.js +2 -2
- package/browser/index.js +3 -3
- package/cjs/Options/Classes/Orbit.js +7 -0
- package/cjs/OrbitUpdater.js +3 -3
- package/cjs/Utils.js +2 -2
- package/cjs/index.js +3 -3
- package/dist_browser_OrbitUpdater_js.js +6 -6
- package/esm/Options/Classes/Orbit.js +7 -0
- package/esm/OrbitUpdater.js +3 -3
- package/esm/Utils.js +2 -2
- package/esm/index.js +3 -3
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.updater.orbit.js +11 -11
- package/tsparticles.updater.orbit.min.js +2 -2
- package/types/index.d.ts +1 -1
- package/umd/Options/Classes/Orbit.js +7 -0
- package/umd/OrbitUpdater.js +3 -3
- package/umd/Utils.js +2 -2
- package/umd/index.js +3 -3
- package/604.min.js +0 -2
- package/604.min.js.LICENSE.txt +0 -1
- package/tsparticles.updater.orbit.min.js.LICENSE.txt +0 -1
package/443.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_updater_orbit=this.webpackChunk_tsparticles_updater_orbit||[]).push([[443],{443(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;_engine;constructor(t,i){this._engine=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.draw(i=>{!function(t,i,a,o,e,n,s,l,d){if(n<=0)return;let b=i.getPosition(),{container:u}=i;a&&(t.strokeStyle=(0,r.getStyleFromHsl)(a,u.hdr,e)),t.lineWidth=n;let c=(0,r.degToRad)(s);t.beginPath(),t.ellipse(b.x,b.y,o*r.half,o*r.double,c,l,d),t.stroke()}(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._engine,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)}}}}]);
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { AnimationOptions, OptionsColor, isNull, setRangeValue, } from "@tsparticles/engine";
|
|
2
2
|
import { OrbitRotation } from "./OrbitRotation.js";
|
|
3
3
|
export class Orbit {
|
|
4
|
+
animation;
|
|
5
|
+
color;
|
|
6
|
+
enable;
|
|
7
|
+
opacity;
|
|
8
|
+
radius;
|
|
9
|
+
rotation;
|
|
10
|
+
width;
|
|
4
11
|
constructor() {
|
|
5
12
|
this.animation = new AnimationOptions();
|
|
6
13
|
this.enable = false;
|
package/browser/OrbitUpdater.js
CHANGED
|
@@ -4,6 +4,8 @@ import { OrbitType } from "./Enums.js";
|
|
|
4
4
|
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
|
+
_container;
|
|
8
|
+
_engine;
|
|
7
9
|
constructor(engine, container) {
|
|
8
10
|
this._engine = engine;
|
|
9
11
|
this._container = container;
|
|
@@ -48,9 +50,7 @@ export class OrbitUpdater {
|
|
|
48
50
|
particle.orbitRotation = getRangeValue(orbitOptions.rotation.value);
|
|
49
51
|
particle.orbitColor = rangeColorToHsl(this._engine, orbitOptions.color);
|
|
50
52
|
particle.retina.orbitRadius =
|
|
51
|
-
orbitOptions.radius !== undefined
|
|
52
|
-
? getRangeValue(orbitOptions.radius) * container.retina.pixelRatio
|
|
53
|
-
: undefined;
|
|
53
|
+
orbitOptions.radius !== undefined ? getRangeValue(orbitOptions.radius) * container.retina.pixelRatio : undefined;
|
|
54
54
|
container.retina.orbitRadius = particle.retina.orbitRadius;
|
|
55
55
|
particle.orbitAnimationSpeed = orbitOptions.animation.enable
|
|
56
56
|
? getRangeValue(orbitOptions.animation.speed)
|
package/browser/Utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { degToRad, getStyleFromHsl } from "@tsparticles/engine";
|
|
2
|
-
const minWidth = 0
|
|
1
|
+
import { degToRad, double, getStyleFromHsl, half } from "@tsparticles/engine";
|
|
2
|
+
const minWidth = 0;
|
|
3
3
|
export function drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
4
4
|
if (width <= minWidth) {
|
|
5
5
|
return;
|
package/browser/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export function loadOrbitUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(e => {
|
|
1
|
+
export async function loadOrbitUpdater(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.21");
|
|
3
|
+
await engine.register(e => {
|
|
4
4
|
e.addParticleUpdater("orbit", async (container) => {
|
|
5
5
|
const { OrbitUpdater } = await import("./OrbitUpdater.js");
|
|
6
6
|
return new OrbitUpdater(e, container);
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { AnimationOptions, OptionsColor, isNull, setRangeValue, } from "@tsparticles/engine";
|
|
2
2
|
import { OrbitRotation } from "./OrbitRotation.js";
|
|
3
3
|
export class Orbit {
|
|
4
|
+
animation;
|
|
5
|
+
color;
|
|
6
|
+
enable;
|
|
7
|
+
opacity;
|
|
8
|
+
radius;
|
|
9
|
+
rotation;
|
|
10
|
+
width;
|
|
4
11
|
constructor() {
|
|
5
12
|
this.animation = new AnimationOptions();
|
|
6
13
|
this.enable = false;
|
package/cjs/OrbitUpdater.js
CHANGED
|
@@ -4,6 +4,8 @@ import { OrbitType } from "./Enums.js";
|
|
|
4
4
|
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
|
+
_container;
|
|
8
|
+
_engine;
|
|
7
9
|
constructor(engine, container) {
|
|
8
10
|
this._engine = engine;
|
|
9
11
|
this._container = container;
|
|
@@ -48,9 +50,7 @@ export class OrbitUpdater {
|
|
|
48
50
|
particle.orbitRotation = getRangeValue(orbitOptions.rotation.value);
|
|
49
51
|
particle.orbitColor = rangeColorToHsl(this._engine, orbitOptions.color);
|
|
50
52
|
particle.retina.orbitRadius =
|
|
51
|
-
orbitOptions.radius !== undefined
|
|
52
|
-
? getRangeValue(orbitOptions.radius) * container.retina.pixelRatio
|
|
53
|
-
: undefined;
|
|
53
|
+
orbitOptions.radius !== undefined ? getRangeValue(orbitOptions.radius) * container.retina.pixelRatio : undefined;
|
|
54
54
|
container.retina.orbitRadius = particle.retina.orbitRadius;
|
|
55
55
|
particle.orbitAnimationSpeed = orbitOptions.animation.enable
|
|
56
56
|
? getRangeValue(orbitOptions.animation.speed)
|
package/cjs/Utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { degToRad, getStyleFromHsl } from "@tsparticles/engine";
|
|
2
|
-
const minWidth = 0
|
|
1
|
+
import { degToRad, double, getStyleFromHsl, half } from "@tsparticles/engine";
|
|
2
|
+
const minWidth = 0;
|
|
3
3
|
export function drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
4
4
|
if (width <= minWidth) {
|
|
5
5
|
return;
|
package/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export function loadOrbitUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(e => {
|
|
1
|
+
export async function loadOrbitUpdater(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.21");
|
|
3
|
+
await engine.register(e => {
|
|
4
4
|
e.addParticleUpdater("orbit", async (container) => {
|
|
5
5
|
const { OrbitUpdater } = await import("./OrbitUpdater.js");
|
|
6
6
|
return new OrbitUpdater(e, container);
|
|
@@ -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-alpha.
|
|
7
|
+
* v4.0.0-alpha.21
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
\*******************************/
|
|
24
24
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
25
|
|
|
26
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OrbitType: () => (/* binding */ OrbitType)\n/* harmony export */ });\nvar OrbitType;\n(function
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OrbitType: () => (/* binding */ OrbitType)\n/* harmony export */ });\nvar OrbitType;\n(function(OrbitType) {\n OrbitType[\"front\"] = \"front\";\n OrbitType[\"back\"] = \"back\";\n})(OrbitType || (OrbitType = {}));\n\n\n//# sourceURL=webpack://@tsparticles/updater-orbit/./dist/browser/Enums.js?\n}");
|
|
27
27
|
|
|
28
28
|
/***/ },
|
|
29
29
|
|
|
@@ -33,7 +33,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
33
33
|
\***********************************************/
|
|
34
34
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
35
35
|
|
|
36
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Orbit: () => (/* binding */ Orbit)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _OrbitRotation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./OrbitRotation.js */ \"./dist/browser/Options/Classes/OrbitRotation.js\");\n\n\nclass Orbit {\n
|
|
36
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Orbit: () => (/* binding */ Orbit)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _OrbitRotation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./OrbitRotation.js */ \"./dist/browser/Options/Classes/OrbitRotation.js\");\n\n\nclass Orbit {\n animation;\n color;\n enable;\n opacity;\n radius;\n rotation;\n width;\n constructor(){\n this.animation = new _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationOptions();\n this.enable = false;\n this.opacity = 1;\n this.rotation = new _OrbitRotation_js__WEBPACK_IMPORTED_MODULE_1__.OrbitRotation();\n this.width = 1;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n this.animation.load(data.animation);\n this.rotation.load(data.rotation);\n if (data.enable !== undefined) {\n this.enable = data.enable;\n }\n if (data.opacity !== undefined) {\n this.opacity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.opacity);\n }\n if (data.width !== undefined) {\n this.width = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.width);\n }\n if (data.radius !== undefined) {\n this.radius = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.radius);\n }\n if (data.color !== undefined) {\n this.color = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OptionsColor.create(this.color, data.color);\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-orbit/./dist/browser/Options/Classes/Orbit.js?\n}");
|
|
37
37
|
|
|
38
38
|
/***/ },
|
|
39
39
|
|
|
@@ -43,7 +43,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
43
43
|
\*******************************************************/
|
|
44
44
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
45
45
|
|
|
46
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OrbitRotation: () => (/* binding */ OrbitRotation)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass OrbitRotation extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n
|
|
46
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OrbitRotation: () => (/* binding */ OrbitRotation)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass OrbitRotation extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n constructor(){\n super();\n this.value = 45;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n super.load(data);\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-orbit/./dist/browser/Options/Classes/OrbitRotation.js?\n}");
|
|
47
47
|
|
|
48
48
|
/***/ },
|
|
49
49
|
|
|
@@ -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
|
|
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 _engine;\n constructor(engine, container){\n this._engine = engine;\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.draw((ctx)=>{\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__.drawEllipse)(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._engine, 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
|
|
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(), { container } = particle;\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
|
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { AnimationOptions, OptionsColor, isNull, setRangeValue, } from "@tsparticles/engine";
|
|
2
2
|
import { OrbitRotation } from "./OrbitRotation.js";
|
|
3
3
|
export class Orbit {
|
|
4
|
+
animation;
|
|
5
|
+
color;
|
|
6
|
+
enable;
|
|
7
|
+
opacity;
|
|
8
|
+
radius;
|
|
9
|
+
rotation;
|
|
10
|
+
width;
|
|
4
11
|
constructor() {
|
|
5
12
|
this.animation = new AnimationOptions();
|
|
6
13
|
this.enable = false;
|
package/esm/OrbitUpdater.js
CHANGED
|
@@ -4,6 +4,8 @@ import { OrbitType } from "./Enums.js";
|
|
|
4
4
|
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
|
+
_container;
|
|
8
|
+
_engine;
|
|
7
9
|
constructor(engine, container) {
|
|
8
10
|
this._engine = engine;
|
|
9
11
|
this._container = container;
|
|
@@ -48,9 +50,7 @@ export class OrbitUpdater {
|
|
|
48
50
|
particle.orbitRotation = getRangeValue(orbitOptions.rotation.value);
|
|
49
51
|
particle.orbitColor = rangeColorToHsl(this._engine, orbitOptions.color);
|
|
50
52
|
particle.retina.orbitRadius =
|
|
51
|
-
orbitOptions.radius !== undefined
|
|
52
|
-
? getRangeValue(orbitOptions.radius) * container.retina.pixelRatio
|
|
53
|
-
: undefined;
|
|
53
|
+
orbitOptions.radius !== undefined ? getRangeValue(orbitOptions.radius) * container.retina.pixelRatio : undefined;
|
|
54
54
|
container.retina.orbitRadius = particle.retina.orbitRadius;
|
|
55
55
|
particle.orbitAnimationSpeed = orbitOptions.animation.enable
|
|
56
56
|
? getRangeValue(orbitOptions.animation.speed)
|
package/esm/Utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { degToRad, getStyleFromHsl } from "@tsparticles/engine";
|
|
2
|
-
const minWidth = 0
|
|
1
|
+
import { degToRad, double, getStyleFromHsl, half } from "@tsparticles/engine";
|
|
2
|
+
const minWidth = 0;
|
|
3
3
|
export function drawEllipse(context, particle, fillColorValue, radius, opacity, width, rotation, start, end) {
|
|
4
4
|
if (width <= minWidth) {
|
|
5
5
|
return;
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export function loadOrbitUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
3
|
-
engine.register(e => {
|
|
1
|
+
export async function loadOrbitUpdater(engine) {
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.21");
|
|
3
|
+
await engine.register(e => {
|
|
4
4
|
e.addParticleUpdater("orbit", async (container) => {
|
|
5
5
|
const { OrbitUpdater } = await import("./OrbitUpdater.js");
|
|
6
6
|
return new OrbitUpdater(e, container);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-orbit",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.21",
|
|
4
4
|
"description": "tsParticles particles orbit updater",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"./package.json": "./package.json"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@tsparticles/engine": "4.0.0-alpha.
|
|
104
|
+
"@tsparticles/engine": "4.0.0-alpha.21"
|
|
105
105
|
},
|
|
106
106
|
"publishConfig": {
|
|
107
107
|
"access": "public"
|