@tsparticles/updater-rotate 4.0.0-alpha.5 → 4.0.0-beta.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/558.min.js +1 -0
- package/browser/Options/Classes/Rotate.js +3 -0
- package/browser/Options/Classes/RotateAnimation.js +4 -0
- package/browser/RotateUpdater.js +3 -0
- package/browser/index.js +1 -1
- package/cjs/Options/Classes/Rotate.js +3 -0
- package/cjs/Options/Classes/RotateAnimation.js +4 -0
- package/cjs/RotateUpdater.js +3 -0
- package/cjs/index.js +1 -1
- package/dist_browser_RotateUpdater_js.js +4 -4
- package/esm/Options/Classes/Rotate.js +3 -0
- package/esm/Options/Classes/RotateAnimation.js +4 -0
- package/esm/RotateUpdater.js +3 -0
- package/esm/index.js +1 -1
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.updater.rotate.js +31 -19
- package/tsparticles.updater.rotate.min.js +2 -2
- package/umd/Options/Classes/Rotate.js +3 -0
- package/umd/Options/Classes/RotateAnimation.js +4 -0
- package/umd/RotateUpdater.js +3 -0
- package/umd/index.js +1 -1
- package/321.min.js +0 -2
- package/321.min.js.LICENSE.txt +0 -1
- package/tsparticles.updater.rotate.min.js.LICENSE.txt +0 -1
package/558.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_updater_rotate=this.webpackChunk_tsparticles_updater_rotate||[]).push([[558],{558(t,e,a){a.d(e,{RotateUpdater:()=>s});var i=a(303);class o{decay;enable;speed;sync;constructor(){this.enable=!1,this.speed=0,this.decay=0,this.sync=!1}load(t){(0,i.isNull)(t)||(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=(0,i.setRangeValue)(t.speed)),void 0!==t.decay&&(this.decay=(0,i.setRangeValue)(t.decay)),void 0!==t.sync&&(this.sync=t.sync))}}class n extends i.ValueWithRandom{animation;direction;path;constructor(){super(),this.animation=new o,this.direction=i.RotateDirection.clockwise,this.path=!1,this.value=0}load(t){(0,i.isNull)(t)||(super.load(t),void 0!==t.direction&&(this.direction=t.direction),this.animation.load(t.animation),void 0!==t.path&&(this.path=t.path))}}class s{container;constructor(t){this.container=t}init(t){let e=t.options.rotate;if(!e)return;t.rotate={enable:e.animation.enable,value:(0,i.degToRad)((0,i.getRangeValue)(e.value)),min:0,max:i.doublePI},t.pathRotation=e.path;let a=e.direction;switch(a===i.RotateDirection.random&&(a=Math.floor((0,i.getRandom)()*i.double)>0?i.RotateDirection.counterClockwise:i.RotateDirection.clockwise),a){case i.RotateDirection.counterClockwise:case"counterClockwise":t.rotate.status=i.AnimationStatus.decreasing;break;case i.RotateDirection.clockwise:t.rotate.status=i.AnimationStatus.increasing}let o=e.animation;o.enable&&(t.rotate.decay=i.identity-(0,i.getRangeValue)(o.decay),t.rotate.velocity=(0,i.getRangeValue)(o.speed)/360*this.container.retina.reduceFactor,o.sync||(t.rotate.velocity*=(0,i.getRandom)())),t.rotation=t.rotate.value}isEnabled(t){let e=t.options.rotate;return!!e&&!t.destroyed&&!t.spawning&&(!!e.value||e.animation.enable||e.path)}loadOptions(t,...e){for(let a of(t.rotate??=new n,e))t.rotate.load(a?.rotate)}update(t,e){!this.isEnabled(t)||(t.isRotating=!!t.rotate,t.rotate&&((0,i.updateAnimation)(t,t.rotate,!1,i.DestroyType.none,e),t.rotation=t.rotate.value))}}}}]);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { RotateDirection, ValueWithRandom, isNull, } from "@tsparticles/engine";
|
|
2
2
|
import { RotateAnimation } from "./RotateAnimation.js";
|
|
3
3
|
export class Rotate extends ValueWithRandom {
|
|
4
|
+
animation;
|
|
5
|
+
direction;
|
|
6
|
+
path;
|
|
4
7
|
constructor() {
|
|
5
8
|
super();
|
|
6
9
|
this.animation = new RotateAnimation();
|
package/browser/RotateUpdater.js
CHANGED
|
@@ -2,6 +2,7 @@ import { AnimationStatus, DestroyType, RotateDirection, degToRad, double, double
|
|
|
2
2
|
import { Rotate } from "./Options/Classes/Rotate.js";
|
|
3
3
|
const doublePIDeg = 360;
|
|
4
4
|
export class RotateUpdater {
|
|
5
|
+
container;
|
|
5
6
|
constructor(container) {
|
|
6
7
|
this.container = container;
|
|
7
8
|
}
|
|
@@ -30,6 +31,8 @@ export class RotateUpdater {
|
|
|
30
31
|
case RotateDirection.clockwise:
|
|
31
32
|
particle.rotate.status = AnimationStatus.increasing;
|
|
32
33
|
break;
|
|
34
|
+
default:
|
|
35
|
+
break;
|
|
33
36
|
}
|
|
34
37
|
const rotateAnimation = rotateOptions.animation;
|
|
35
38
|
if (rotateAnimation.enable) {
|
package/browser/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadRotateUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-
|
|
2
|
+
engine.checkVersion("4.0.0-beta.0");
|
|
3
3
|
await engine.register(e => {
|
|
4
4
|
e.addParticleUpdater("rotate", async (container) => {
|
|
5
5
|
const { RotateUpdater } = await import("./RotateUpdater.js");
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { RotateDirection, ValueWithRandom, isNull, } from "@tsparticles/engine";
|
|
2
2
|
import { RotateAnimation } from "./RotateAnimation.js";
|
|
3
3
|
export class Rotate extends ValueWithRandom {
|
|
4
|
+
animation;
|
|
5
|
+
direction;
|
|
6
|
+
path;
|
|
4
7
|
constructor() {
|
|
5
8
|
super();
|
|
6
9
|
this.animation = new RotateAnimation();
|
package/cjs/RotateUpdater.js
CHANGED
|
@@ -2,6 +2,7 @@ import { AnimationStatus, DestroyType, RotateDirection, degToRad, double, double
|
|
|
2
2
|
import { Rotate } from "./Options/Classes/Rotate.js";
|
|
3
3
|
const doublePIDeg = 360;
|
|
4
4
|
export class RotateUpdater {
|
|
5
|
+
container;
|
|
5
6
|
constructor(container) {
|
|
6
7
|
this.container = container;
|
|
7
8
|
}
|
|
@@ -30,6 +31,8 @@ export class RotateUpdater {
|
|
|
30
31
|
case RotateDirection.clockwise:
|
|
31
32
|
particle.rotate.status = AnimationStatus.increasing;
|
|
32
33
|
break;
|
|
34
|
+
default:
|
|
35
|
+
break;
|
|
33
36
|
}
|
|
34
37
|
const rotateAnimation = rotateOptions.animation;
|
|
35
38
|
if (rotateAnimation.enable) {
|
package/cjs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadRotateUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-
|
|
2
|
+
engine.checkVersion("4.0.0-beta.0");
|
|
3
3
|
await engine.register(e => {
|
|
4
4
|
e.addParticleUpdater("rotate", async (container) => {
|
|
5
5
|
const { RotateUpdater } = await import("./RotateUpdater.js");
|
|
@@ -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-
|
|
7
|
+
* v4.0.0-beta.0
|
|
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 */ Rotate: () => (/* binding */ Rotate)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _RotateAnimation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RotateAnimation.js */ \"./dist/browser/Options/Classes/RotateAnimation.js\");\n\n\nclass Rotate extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Rotate: () => (/* binding */ Rotate)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _RotateAnimation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./RotateAnimation.js */ \"./dist/browser/Options/Classes/RotateAnimation.js\");\n\n\nclass Rotate extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n animation;\n direction;\n path;\n constructor(){\n super();\n this.animation = new _RotateAnimation_js__WEBPACK_IMPORTED_MODULE_1__.RotateAnimation();\n this.direction = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.clockwise;\n this.path = false;\n this.value = 0;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n super.load(data);\n if (data.direction !== undefined) {\n this.direction = data.direction;\n }\n this.animation.load(data.animation);\n if (data.path !== undefined) {\n this.path = data.path;\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-rotate/./dist/browser/Options/Classes/Rotate.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 */ RotateAnimation: () => (/* binding */ RotateAnimation)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass RotateAnimation {\n
|
|
36
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RotateAnimation: () => (/* binding */ RotateAnimation)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass RotateAnimation {\n decay;\n enable;\n speed;\n sync;\n constructor(){\n this.enable = false;\n this.speed = 0;\n this.decay = 0;\n this.sync = false;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.enable !== undefined) {\n this.enable = data.enable;\n }\n if (data.speed !== undefined) {\n this.speed = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.speed);\n }\n if (data.decay !== undefined) {\n this.decay = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.decay);\n }\n if (data.sync !== undefined) {\n this.sync = data.sync;\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-rotate/./dist/browser/Options/Classes/RotateAnimation.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 */ RotateUpdater: () => (/* binding */ RotateUpdater)\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_Rotate_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Rotate.js */ \"./dist/browser/Options/Classes/Rotate.js\");\n\n\nconst doublePIDeg = 360;\nclass RotateUpdater {\n
|
|
46
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ RotateUpdater: () => (/* binding */ RotateUpdater)\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_Rotate_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Rotate.js */ \"./dist/browser/Options/Classes/Rotate.js\");\n\n\nconst doublePIDeg = 360;\nclass RotateUpdater {\n container;\n constructor(container){\n this.container = container;\n }\n init(particle) {\n const rotateOptions = particle.options.rotate;\n if (!rotateOptions) {\n return;\n }\n particle.rotate = {\n enable: rotateOptions.animation.enable,\n value: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.degToRad)((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(rotateOptions.value)),\n min: 0,\n max: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.doublePI\n };\n particle.pathRotation = rotateOptions.path;\n let rotateDirection = rotateOptions.direction;\n if (rotateDirection === _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.random) {\n const index = Math.floor((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.double), minIndex = 0;\n rotateDirection = index > minIndex ? _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.counterClockwise : _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.clockwise;\n }\n switch(rotateDirection){\n case _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.counterClockwise:\n case \"counterClockwise\":\n particle.rotate.status = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.decreasing;\n break;\n case _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.RotateDirection.clockwise:\n particle.rotate.status = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimationStatus.increasing;\n break;\n default:\n break;\n }\n const rotateAnimation = rotateOptions.animation;\n if (rotateAnimation.enable) {\n particle.rotate.decay = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.identity - (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(rotateAnimation.decay);\n particle.rotate.velocity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(rotateAnimation.speed) / doublePIDeg * this.container.retina.reduceFactor;\n if (!rotateAnimation.sync) {\n particle.rotate.velocity *= (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)();\n }\n }\n particle.rotation = particle.rotate.value;\n }\n isEnabled(particle) {\n const rotate = particle.options.rotate;\n if (!rotate) {\n return false;\n }\n return !particle.destroyed && !particle.spawning && (!!rotate.value || rotate.animation.enable || rotate.path);\n }\n loadOptions(options, ...sources) {\n options.rotate ??= new _Options_Classes_Rotate_js__WEBPACK_IMPORTED_MODULE_1__.Rotate();\n for (const source of sources){\n options.rotate.load(source?.rotate);\n }\n }\n update(particle, delta) {\n if (!this.isEnabled(particle)) {\n return;\n }\n particle.isRotating = !!particle.rotate;\n if (!particle.rotate) {\n return;\n }\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.updateAnimation)(particle, particle.rotate, false, _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.DestroyType.none, delta);\n particle.rotation = particle.rotate.value;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-rotate/./dist/browser/RotateUpdater.js?\n}");
|
|
47
47
|
|
|
48
48
|
/***/ }
|
|
49
49
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { RotateDirection, ValueWithRandom, isNull, } from "@tsparticles/engine";
|
|
2
2
|
import { RotateAnimation } from "./RotateAnimation.js";
|
|
3
3
|
export class Rotate extends ValueWithRandom {
|
|
4
|
+
animation;
|
|
5
|
+
direction;
|
|
6
|
+
path;
|
|
4
7
|
constructor() {
|
|
5
8
|
super();
|
|
6
9
|
this.animation = new RotateAnimation();
|
package/esm/RotateUpdater.js
CHANGED
|
@@ -2,6 +2,7 @@ import { AnimationStatus, DestroyType, RotateDirection, degToRad, double, double
|
|
|
2
2
|
import { Rotate } from "./Options/Classes/Rotate.js";
|
|
3
3
|
const doublePIDeg = 360;
|
|
4
4
|
export class RotateUpdater {
|
|
5
|
+
container;
|
|
5
6
|
constructor(container) {
|
|
6
7
|
this.container = container;
|
|
7
8
|
}
|
|
@@ -30,6 +31,8 @@ export class RotateUpdater {
|
|
|
30
31
|
case RotateDirection.clockwise:
|
|
31
32
|
particle.rotate.status = AnimationStatus.increasing;
|
|
32
33
|
break;
|
|
34
|
+
default:
|
|
35
|
+
break;
|
|
33
36
|
}
|
|
34
37
|
const rotateAnimation = rotateOptions.animation;
|
|
35
38
|
if (rotateAnimation.enable) {
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadRotateUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-
|
|
2
|
+
engine.checkVersion("4.0.0-beta.0");
|
|
3
3
|
await engine.register(e => {
|
|
4
4
|
e.addParticleUpdater("rotate", async (container) => {
|
|
5
5
|
const { RotateUpdater } = await import("./RotateUpdater.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-rotate",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-beta.0",
|
|
4
4
|
"description": "tsParticles particles rotate updater",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"./package.json": "./package.json"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@tsparticles/engine": "4.0.0-
|
|
90
|
+
"@tsparticles/engine": "4.0.0-beta.0"
|
|
91
91
|
},
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|