@tsparticles/updater-tilt 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.
- package/308.min.js +1 -0
- package/browser/Options/Classes/Tilt.js +3 -0
- package/browser/Options/Classes/TiltAnimation.js +4 -0
- package/browser/TiltUpdater.js +6 -4
- package/browser/index.js +3 -3
- package/cjs/Options/Classes/Tilt.js +3 -0
- package/cjs/Options/Classes/TiltAnimation.js +4 -0
- package/cjs/TiltUpdater.js +6 -4
- package/cjs/index.js +3 -3
- package/dist_browser_TiltUpdater_js.js +5 -5
- package/esm/Options/Classes/Tilt.js +3 -0
- package/esm/Options/Classes/TiltAnimation.js +4 -0
- package/esm/TiltUpdater.js +6 -4
- package/esm/index.js +3 -3
- package/package.json +2 -2
- package/report.html +3 -3
- package/tsparticles.updater.tilt.js +11 -11
- package/tsparticles.updater.tilt.min.js +2 -2
- package/types/TiltUpdater.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/umd/Options/Classes/Tilt.js +3 -0
- package/umd/Options/Classes/TiltAnimation.js +4 -0
- package/umd/TiltUpdater.js +10 -8
- package/umd/index.js +3 -3
- package/233.min.js +0 -2
- package/233.min.js.LICENSE.txt +0 -1
- package/tsparticles.updater.tilt.min.js.LICENSE.txt +0 -1
|
@@ -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.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 */ loadTiltUpdater: () => (/* binding */ loadTiltUpdater)\n/* harmony export */ });\nfunction loadTiltUpdater(engine) {\n engine.checkVersion(\"4.0.0-alpha.2\");\n engine.register(e => {\n e.addParticleUpdater(\"tilt\", async container => {\n const {\n TiltUpdater\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_TiltUpdater_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./TiltUpdater.js */ \"./dist/browser/TiltUpdater.js\"));\n return new TiltUpdater(container);\n });\n });\n}\n\n//# sourceURL=webpack://@tsparticles/updater-tilt/./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 */ loadTiltUpdater: () => (/* binding */ loadTiltUpdater)\n/* harmony export */ });\nasync function loadTiltUpdater(engine) {\n engine.checkVersion(\"4.0.0-alpha.20\");\n await engine.register((e)=>{\n e.addParticleUpdater(\"tilt\", async (container)=>{\n const { TiltUpdater } = await __webpack_require__.e(/*! import() */ \"dist_browser_TiltUpdater_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./TiltUpdater.js */ \"./dist/browser/TiltUpdater.js\"));\n return new TiltUpdater(container);\n });\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-tilt/./dist/browser/index.js?\n}");
|
|
48
|
+
|
|
49
49
|
/***/ }
|
|
50
50
|
|
|
51
51
|
/******/ });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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,i={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 i[e](r,r.exports,a),r.exports}a.m=i,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||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s={},a.l=(e,t,r,o)=>{if(s[e])return void s[e].push(t);if(void 0!==r)for(var i,n,l=document.getElementsByTagName("script"),p=0;p<l.length;p++){var c=l[p];if(c.getAttribute("src")==e||c.getAttribute("data-webpack")=="@tsparticles/updater-tilt:"+r){i=c;break}}i||(n=!0,(i=document.createElement("script")).charset="utf-8",a.nc&&i.setAttribute("nonce",a.nc),i.setAttribute("data-webpack","@tsparticles/updater-tilt:"+r),i.src=e),s[e]=[t];var u=(t,r)=>{i.onerror=i.onload=null,clearTimeout(d);var o=s[e];if(delete s[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=u.bind(null,i.onerror),i.onload=u.bind(null,i.onload),n&&document.head.appendChild(i)},a.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.g.importScripts&&(l=a.g.location+"");var s,l,p=a.g.document;if(!l&&p&&(p.currentScript&&"SCRIPT"===p.currentScript.tagName.toUpperCase()&&(l=p.currentScript.src),!l)){var c=p.getElementsByTagName("script");if(c.length)for(var u=c.length-1;u>-1&&(!l||!/^http(s?):/.test(l));)l=c[u--].src}if(!l)throw Error("Automatic publicPath is not supported in this browser");a.p=l=l.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),t={865:0},a.f.j=(e,r)=>{var o=a.o(t,e)?t[e]:void 0;if(0!==o)if(o)r.push(o[2]);else{var i=new Promise((r,i)=>o=t[e]=[r,i]);r.push(o[2]=i);var n=a.p+a.u(e),s=Error();a.l(n,r=>{if(a.o(t,e)&&(0!==(o=t[e])&&(t[e]=void 0),o)){var i=r&&("load"===r.type?"missing":r.type),n=r&&r.target&&r.target.src;s.message="Loading chunk "+e+` failed.
|
|
2
|
+
(`+i+": "+n+")",s.name="ChunkLoadError",s.type=i,s.request=n,o[1](s)}},"chunk-"+e,e)}},r=(e,r)=>{var o,i,[n,s,l]=r,p=0;if(n.some(e=>0!==t[e])){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);l&&l(a)}for(e&&e(r);p<n.length;p++)i=n[p],a.o(t,i)&&t[i]&&t[i][0](),t[i]=0},(o=this.webpackChunk_tsparticles_updater_tilt=this.webpackChunk_tsparticles_updater_tilt||[]).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("tilt",async e=>{let{TiltUpdater:t}=await a.e(308).then(a.bind(a,308));return new t(e)})})}return a.r(d),a.d(d,{loadTiltUpdater:()=>f}),d})());
|
package/types/TiltUpdater.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ITiltParticlesOptions, TiltParticle, TiltParticlesOptions } from "
|
|
|
3
3
|
export declare class TiltUpdater implements IParticleUpdater {
|
|
4
4
|
private readonly container;
|
|
5
5
|
constructor(container: Container);
|
|
6
|
-
getTransformValues(particle: TiltParticle): IParticleTransformValues
|
|
6
|
+
getTransformValues(particle: TiltParticle): Partial<IParticleTransformValues>;
|
|
7
7
|
init(particle: TiltParticle): void;
|
|
8
8
|
isEnabled(particle: TiltParticle): boolean;
|
|
9
9
|
loadOptions(options: TiltParticlesOptions, ...sources: (RecursivePartial<ITiltParticlesOptions> | undefined)[]): void;
|
package/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type Engine } from "@tsparticles/engine";
|
|
2
|
-
export declare function loadTiltUpdater(engine: Engine): void
|
|
2
|
+
export declare function loadTiltUpdater(engine: Engine): Promise<void>;
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
const TiltDirection_js_1 = require("../../TiltDirection.js");
|
|
15
15
|
const TiltAnimation_js_1 = require("./TiltAnimation.js");
|
|
16
16
|
class Tilt extends engine_1.ValueWithRandom {
|
|
17
|
+
animation;
|
|
18
|
+
direction;
|
|
19
|
+
enable;
|
|
17
20
|
constructor() {
|
|
18
21
|
super();
|
|
19
22
|
this.animation = new TiltAnimation_js_1.TiltAnimation();
|
package/umd/TiltUpdater.js
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
const Tilt_js_1 = require("./Options/Classes/Tilt.js");
|
|
15
15
|
const TiltDirection_js_1 = require("./TiltDirection.js");
|
|
16
|
-
const
|
|
16
|
+
const maxAngle = 360;
|
|
17
17
|
class TiltUpdater {
|
|
18
|
+
container;
|
|
18
19
|
constructor(container) {
|
|
19
20
|
this.container = container;
|
|
20
21
|
}
|
|
@@ -33,14 +34,14 @@
|
|
|
33
34
|
particle.tilt = {
|
|
34
35
|
enable: tiltOptions.enable,
|
|
35
36
|
value: (0, engine_1.degToRad)((0, engine_1.getRangeValue)(tiltOptions.value)),
|
|
36
|
-
sinDirection: (0, engine_1.getRandom)() >= engine_1.half ? identity : -identity,
|
|
37
|
-
cosDirection: (0, engine_1.getRandom)() >= engine_1.half ? identity : -identity,
|
|
37
|
+
sinDirection: (0, engine_1.getRandom)() >= engine_1.half ? engine_1.identity : -engine_1.identity,
|
|
38
|
+
cosDirection: (0, engine_1.getRandom)() >= engine_1.half ? engine_1.identity : -engine_1.identity,
|
|
38
39
|
min: 0,
|
|
39
|
-
max: doublePI,
|
|
40
|
+
max: engine_1.doublePI,
|
|
40
41
|
};
|
|
41
42
|
let tiltDirection = tiltOptions.direction;
|
|
42
43
|
if (tiltDirection === TiltDirection_js_1.TiltDirection.random) {
|
|
43
|
-
const index = Math.floor((0, engine_1.getRandom)() * double), minIndex = 0;
|
|
44
|
+
const index = Math.floor((0, engine_1.getRandom)() * engine_1.double), minIndex = 0;
|
|
44
45
|
tiltDirection = index > minIndex ? TiltDirection_js_1.TiltDirection.counterClockwise : TiltDirection_js_1.TiltDirection.clockwise;
|
|
45
46
|
}
|
|
46
47
|
switch (tiltDirection) {
|
|
@@ -51,12 +52,13 @@
|
|
|
51
52
|
case TiltDirection_js_1.TiltDirection.clockwise:
|
|
52
53
|
particle.tilt.status = engine_1.AnimationStatus.increasing;
|
|
53
54
|
break;
|
|
55
|
+
default:
|
|
56
|
+
break;
|
|
54
57
|
}
|
|
55
58
|
const tiltAnimation = particle.options.tilt?.animation;
|
|
56
59
|
if (tiltAnimation?.enable) {
|
|
57
|
-
particle.tilt.decay = identity - (0, engine_1.getRangeValue)(tiltAnimation.decay);
|
|
58
|
-
particle.tilt.velocity =
|
|
59
|
-
((0, engine_1.getRangeValue)(tiltAnimation.speed) / maxAngle) * this.container.retina.reduceFactor;
|
|
60
|
+
particle.tilt.decay = engine_1.identity - (0, engine_1.getRangeValue)(tiltAnimation.decay);
|
|
61
|
+
particle.tilt.velocity = ((0, engine_1.getRangeValue)(tiltAnimation.speed) / maxAngle) * this.container.retina.reduceFactor;
|
|
60
62
|
if (!tiltAnimation.sync) {
|
|
61
63
|
particle.tilt.velocity *= (0, engine_1.getRandom)();
|
|
62
64
|
}
|
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.loadTiltUpdater = loadTiltUpdater;
|
|
47
|
-
function loadTiltUpdater(engine) {
|
|
48
|
-
engine.checkVersion("4.0.0-alpha.
|
|
49
|
-
engine.register(e => {
|
|
47
|
+
async function loadTiltUpdater(engine) {
|
|
48
|
+
engine.checkVersion("4.0.0-alpha.20");
|
|
49
|
+
await engine.register(e => {
|
|
50
50
|
e.addParticleUpdater("tilt", async (container) => {
|
|
51
51
|
const { TiltUpdater } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./TiltUpdater.js"))) : new Promise((resolve_1, reject_1) => { require(["./TiltUpdater.js"], resolve_1, reject_1); }).then(__importStar));
|
|
52
52
|
return new TiltUpdater(container);
|
package/233.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 233.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_updater_tilt=this.webpackChunk_tsparticles_updater_tilt||[]).push([[233],{233(t,e,i){i.d(e,{TiltUpdater:()=>l});var n,a=i(303);!function(t){t.clockwise="clockwise",t.counterClockwise="counter-clockwise",t.random="random"}(n||(n={}));class s{constructor(){this.enable=!1,this.speed=0,this.decay=0,this.sync=!1}load(t){(0,a.isNull)(t)||(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=(0,a.setRangeValue)(t.speed)),void 0!==t.decay&&(this.decay=(0,a.setRangeValue)(t.decay)),void 0!==t.sync&&(this.sync=t.sync))}}class o extends a.ValueWithRandom{constructor(){super(),this.animation=new s,this.direction=n.clockwise,this.enable=!1,this.value=0}load(t){super.load(t),(0,a.isNull)(t)||(this.animation.load(t.animation),void 0!==t.direction&&(this.direction=t.direction),void 0!==t.enable&&(this.enable=t.enable))}}const c=2*Math.PI;class l{constructor(t){this.container=t}getTransformValues(t){const e=t.tilt?.enable&&t.tilt;return{b:e?Math.cos(e.value)*e.cosDirection:void 0,c:e?Math.sin(e.value)*e.sinDirection:void 0}}init(t){const e=t.options.tilt;if(!e)return;t.tilt={enable:e.enable,value:(0,a.degToRad)((0,a.getRangeValue)(e.value)),sinDirection:(0,a.getRandom)()>=a.half?1:-1,cosDirection:(0,a.getRandom)()>=a.half?1:-1,min:0,max:c};let i=e.direction;if(i===n.random){i=Math.floor(2*(0,a.getRandom)())>0?n.counterClockwise:n.clockwise}switch(i){case n.counterClockwise:case"counterClockwise":t.tilt.status=a.AnimationStatus.decreasing;break;case n.clockwise:t.tilt.status=a.AnimationStatus.increasing}const s=t.options.tilt?.animation;s?.enable&&(t.tilt.decay=1-(0,a.getRangeValue)(s.decay),t.tilt.velocity=(0,a.getRangeValue)(s.speed)/360*this.container.retina.reduceFactor,s.sync||(t.tilt.velocity*=(0,a.getRandom)()))}isEnabled(t){const e=t.options.tilt?.animation;return!t.destroyed&&!t.spawning&&!!e?.enable}loadOptions(t,...e){t.tilt??=new o;for(const i of e)t.tilt.load(i?.tilt)}update(t,e){this.isEnabled(t)&&t.tilt&&(0,a.updateAnimation)(t,t.tilt,!1,a.DestroyType.none,e)}}}}]);
|
package/233.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Tilt Updater v4.0.0-alpha.2 by Matteo Bruni */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Tilt Updater v4.0.0-alpha.2 by Matteo Bruni */
|