@tsparticles/updater-rotate 4.0.0-alpha.2 → 4.0.0-alpha.20

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.
@@ -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.2
7
+ * v4.0.0-alpha.20
8
8
  */
9
9
  /*
10
10
  * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
@@ -28,16 +28,6 @@ return /******/ (() => { // webpackBootstrap
28
28
  /******/ "use strict";
29
29
  /******/ var __webpack_modules__ = ({
30
30
 
31
- /***/ "./dist/browser/index.js"
32
- /*!*******************************!*\
33
- !*** ./dist/browser/index.js ***!
34
- \*******************************/
35
- (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
36
-
37
- eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadRotateUpdater: () => (/* binding */ loadRotateUpdater)\n/* harmony export */ });\nfunction loadRotateUpdater(engine) {\n engine.checkVersion(\"4.0.0-alpha.2\");\n engine.register(e => {\n e.addParticleUpdater(\"rotate\", async container => {\n const {\n RotateUpdater\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_RotateUpdater_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./RotateUpdater.js */ \"./dist/browser/RotateUpdater.js\"));\n return new RotateUpdater(container);\n });\n });\n}\n\n//# sourceURL=webpack://@tsparticles/updater-rotate/./dist/browser/index.js?\n}");
38
-
39
- /***/ },
40
-
41
31
  /***/ "@tsparticles/engine"
42
32
  /*!*********************************************************************************************************************************!*\
43
33
  !*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
@@ -46,6 +36,16 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
46
36
 
47
37
  module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
48
38
 
39
+ /***/ },
40
+
41
+ /***/ "./dist/browser/index.js"
42
+ /*!*******************************!*\
43
+ !*** ./dist/browser/index.js ***!
44
+ \*******************************/
45
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
46
+
47
+ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadRotateUpdater: () => (/* binding */ loadRotateUpdater)\n/* harmony export */ });\nasync function loadRotateUpdater(engine) {\n engine.checkVersion(\"4.0.0-alpha.20\");\n await engine.register((e)=>{\n e.addParticleUpdater(\"rotate\", async (container)=>{\n const { RotateUpdater } = await __webpack_require__.e(/*! import() */ \"dist_browser_RotateUpdater_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./RotateUpdater.js */ \"./dist/browser/RotateUpdater.js\"));\n return new RotateUpdater(container);\n });\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-rotate/./dist/browser/index.js?\n}");
48
+
49
49
  /***/ }
50
50
 
51
51
  /******/ });
@@ -1,2 +1,2 @@
1
- /*! For license information please see tsparticles.updater.rotate.min.js.LICENSE.txt */
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e=>(()=>{var t,r,o={303(t){t.exports=e}},n={};function a(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,a),r.exports}a.m=o,a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((t,r)=>(a.f[r](e,t),t)),[])),a.u=e=>e+".min.js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/updater-rotate:",a.l=(e,o,n,i)=>{if(t[e])t[e].push(o);else{var s,p;if(void 0!==n)for(var c=document.getElementsByTagName("script"),l=0;l<c.length;l++){var u=c[l];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+n){s=u;break}}s||(p=!0,(s=document.createElement("script")).charset="utf-8",a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",r+n),s.src=e),t[e]=[o];var d=(r,o)=>{s.onerror=s.onload=null,clearTimeout(f);var n=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),n&&n.forEach((e=>e(o))),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),p&&document.head.appendChild(s)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={145:0};a.f.j=(t,r)=>{var o=a.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var n=new Promise(((r,n)=>o=e[t]=[r,n]));r.push(o[2]=n);var i=a.p+a.u(t),s=new Error;a.l(i,(r=>{if(a.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var n=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+n+": "+i+")",s.name="ChunkLoadError",s.type=n,s.request=i,o[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,n,[i,s,p]=r,c=0;if(i.some((t=>0!==e[t]))){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);if(p)p(a)}for(t&&t(r);c<i.length;c++)n=i[c],a.o(e,n)&&e[n]&&e[n][0](),e[n]=0},r=this.webpackChunk_tsparticles_updater_rotate=this.webpackChunk_tsparticles_updater_rotate||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var i={};function s(e){e.checkVersion("4.0.0-alpha.2"),e.register((e=>{e.addParticleUpdater("rotate",(async e=>{const{RotateUpdater:t}=await a.e(8).then(a.bind(a,8));return new t(e)}))}))}return a.r(i),a.d(i,{loadRotateUpdater:()=>s}),i})()));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,e=>(()=>{"use strict";var t,r,o,a={303(t){t.exports=e}},i={};function n(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return a[e](r,r.exports,n),r.exports}n.m=a,n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((t,r)=>(n.f[r](e,t),t),[])),n.u=e=>""+e+".min.js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s={},n.l=(e,t,r,o)=>{if(s[e])return void s[e].push(t);if(void 0!==r)for(var a,i,p=document.getElementsByTagName("script"),c=0;c<p.length;c++){var l=p[c];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="@tsparticles/updater-rotate:"+r){a=l;break}}a||(i=!0,(a=document.createElement("script")).charset="utf-8",n.nc&&a.setAttribute("nonce",n.nc),a.setAttribute("data-webpack","@tsparticles/updater-rotate:"+r),a.src=e),s[e]=[t];var u=(t,r)=>{a.onerror=a.onload=null,clearTimeout(d);var o=s[e];if(delete s[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=u.bind(null,a.onerror),a.onload=u.bind(null,a.onload),i&&document.head.appendChild(a)},n.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.g.importScripts&&(p=n.g.location+"");var s,p,c=n.g.document;if(!p&&c&&(c.currentScript&&"SCRIPT"===c.currentScript.tagName.toUpperCase()&&(p=c.currentScript.src),!p)){var l=c.getElementsByTagName("script");if(l.length)for(var u=l.length-1;u>-1&&(!p||!/^http(s?):/.test(p));)p=l[u--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");n.p=p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={145:0},n.f.j=(e,r)=>{var o=n.o(t,e)?t[e]:void 0;if(0!==o)if(o)r.push(o[2]);else{var a=new Promise((r,a)=>o=t[e]=[r,a]);r.push(o[2]=a);var i=n.p+n.u(e),s=Error();n.l(i,r=>{if(n.o(t,e)&&(0!==(o=t[e])&&(t[e]=void 0),o)){var a=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;s.message="Loading chunk "+e+` failed.
2
+ (`+a+": "+i+")",s.name="ChunkLoadError",s.type=a,s.request=i,o[1](s)}},"chunk-"+e,e)}},r=(e,r)=>{var o,a,[i,s,p]=r,c=0;if(i.some(e=>0!==t[e])){for(o in s)n.o(s,o)&&(n.m[o]=s[o]);p&&p(n)}for(e&&e(r);c<i.length;c++)a=i[c],n.o(t,a)&&t[a]&&t[a][0](),t[a]=0},(o=this.webpackChunk_tsparticles_updater_rotate=this.webpackChunk_tsparticles_updater_rotate||[]).forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o));var d={};async function f(e){e.checkVersion("4.0.0-alpha.20"),await e.register(e=>{e.addParticleUpdater("rotate",async e=>{let{RotateUpdater:t}=await n.e(655).then(n.bind(n,655));return new t(e)})})}return n.r(d),n.d(d,{loadRotateUpdater:()=>f}),d})());
package/types/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import { type Engine } from "@tsparticles/engine";
2
- export declare function loadRotateUpdater(engine: Engine): void;
2
+ export declare function loadRotateUpdater(engine: Engine): Promise<void>;
@@ -13,6 +13,9 @@
13
13
  const engine_1 = require("@tsparticles/engine");
14
14
  const RotateAnimation_js_1 = require("./RotateAnimation.js");
15
15
  class Rotate extends engine_1.ValueWithRandom {
16
+ animation;
17
+ direction;
18
+ path;
16
19
  constructor() {
17
20
  super();
18
21
  this.animation = new RotateAnimation_js_1.RotateAnimation();
@@ -12,6 +12,10 @@
12
12
  exports.RotateAnimation = void 0;
13
13
  const engine_1 = require("@tsparticles/engine");
14
14
  class RotateAnimation {
15
+ decay;
16
+ enable;
17
+ speed;
18
+ sync;
15
19
  constructor() {
16
20
  this.enable = false;
17
21
  this.speed = 0;
@@ -12,8 +12,9 @@
12
12
  exports.RotateUpdater = void 0;
13
13
  const engine_1 = require("@tsparticles/engine");
14
14
  const Rotate_js_1 = require("./Options/Classes/Rotate.js");
15
- const double = 2, doublePI = Math.PI * double, identity = 1, doublePIDeg = 360;
15
+ const doublePIDeg = 360;
16
16
  class RotateUpdater {
17
+ container;
17
18
  constructor(container) {
18
19
  this.container = container;
19
20
  }
@@ -26,12 +27,12 @@
26
27
  enable: rotateOptions.animation.enable,
27
28
  value: (0, engine_1.degToRad)((0, engine_1.getRangeValue)(rotateOptions.value)),
28
29
  min: 0,
29
- max: doublePI,
30
+ max: engine_1.doublePI,
30
31
  };
31
32
  particle.pathRotation = rotateOptions.path;
32
33
  let rotateDirection = rotateOptions.direction;
33
34
  if (rotateDirection === engine_1.RotateDirection.random) {
34
- const index = Math.floor((0, engine_1.getRandom)() * double), minIndex = 0;
35
+ const index = Math.floor((0, engine_1.getRandom)() * engine_1.double), minIndex = 0;
35
36
  rotateDirection = index > minIndex ? engine_1.RotateDirection.counterClockwise : engine_1.RotateDirection.clockwise;
36
37
  }
37
38
  switch (rotateDirection) {
@@ -42,10 +43,12 @@
42
43
  case engine_1.RotateDirection.clockwise:
43
44
  particle.rotate.status = engine_1.AnimationStatus.increasing;
44
45
  break;
46
+ default:
47
+ break;
45
48
  }
46
49
  const rotateAnimation = rotateOptions.animation;
47
50
  if (rotateAnimation.enable) {
48
- particle.rotate.decay = identity - (0, engine_1.getRangeValue)(rotateAnimation.decay);
51
+ particle.rotate.decay = engine_1.identity - (0, engine_1.getRangeValue)(rotateAnimation.decay);
49
52
  particle.rotate.velocity =
50
53
  ((0, engine_1.getRangeValue)(rotateAnimation.speed) / doublePIDeg) * this.container.retina.reduceFactor;
51
54
  if (!rotateAnimation.sync) {
package/umd/index.js CHANGED
@@ -44,9 +44,9 @@ var __importStar = (this && this.__importStar) || (function () {
44
44
  var __syncRequire = typeof module === "object" && typeof module.exports === "object";
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.loadRotateUpdater = loadRotateUpdater;
47
- function loadRotateUpdater(engine) {
48
- engine.checkVersion("4.0.0-alpha.2");
49
- engine.register(e => {
47
+ async function loadRotateUpdater(engine) {
48
+ engine.checkVersion("4.0.0-alpha.20");
49
+ await engine.register(e => {
50
50
  e.addParticleUpdater("rotate", async (container) => {
51
51
  const { RotateUpdater } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./RotateUpdater.js"))) : new Promise((resolve_1, reject_1) => { require(["./RotateUpdater.js"], resolve_1, reject_1); }).then(__importStar));
52
52
  return new RotateUpdater(container);
package/8.min.js DELETED
@@ -1,2 +0,0 @@
1
- /*! For license information please see 8.min.js.LICENSE.txt */
2
- (this.webpackChunk_tsparticles_updater_rotate=this.webpackChunk_tsparticles_updater_rotate||[]).push([[8],{8(t,e,a){a.d(e,{RotateUpdater:()=>r});var o=a(303);class i{constructor(){this.enable=!1,this.speed=0,this.decay=0,this.sync=!1}load(t){(0,o.isNull)(t)||(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=(0,o.setRangeValue)(t.speed)),void 0!==t.decay&&(this.decay=(0,o.setRangeValue)(t.decay)),void 0!==t.sync&&(this.sync=t.sync))}}class n extends o.ValueWithRandom{constructor(){super(),this.animation=new i,this.direction=o.RotateDirection.clockwise,this.path=!1,this.value=0}load(t){(0,o.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))}}const s=2*Math.PI;class r{constructor(t){this.container=t}init(t){const e=t.options.rotate;if(!e)return;t.rotate={enable:e.animation.enable,value:(0,o.degToRad)((0,o.getRangeValue)(e.value)),min:0,max:s},t.pathRotation=e.path;let a=e.direction;if(a===o.RotateDirection.random){a=Math.floor(2*(0,o.getRandom)())>0?o.RotateDirection.counterClockwise:o.RotateDirection.clockwise}switch(a){case o.RotateDirection.counterClockwise:case"counterClockwise":t.rotate.status=o.AnimationStatus.decreasing;break;case o.RotateDirection.clockwise:t.rotate.status=o.AnimationStatus.increasing}const i=e.animation;i.enable&&(t.rotate.decay=1-(0,o.getRangeValue)(i.decay),t.rotate.velocity=(0,o.getRangeValue)(i.speed)/360*this.container.retina.reduceFactor,i.sync||(t.rotate.velocity*=(0,o.getRandom)())),t.rotation=t.rotate.value}isEnabled(t){const e=t.options.rotate;return!!e&&(!t.destroyed&&!t.spawning&&(!!e.value||e.animation.enable||e.path))}loadOptions(t,...e){t.rotate??=new n;for(const a of e)t.rotate.load(a?.rotate)}update(t,e){this.isEnabled(t)&&(t.isRotating=!!t.rotate,t.rotate&&((0,o.updateAnimation)(t,t.rotate,!1,o.DestroyType.none,e),t.rotation=t.rotate.value))}}}}]);
@@ -1 +0,0 @@
1
- /*! tsParticles Rotate Updater v4.0.0-alpha.2 by Matteo Bruni */
@@ -1 +0,0 @@
1
- /*! tsParticles Rotate Updater v4.0.0-alpha.2 by Matteo Bruni */