@tsparticles/updater-tilt
Advanced tools
Comparing version 3.2.2 to 3.3.0
@@ -15,3 +15,3 @@ import { degToRad, getRandom, getRangeValue, halfRandom, updateAnimation, } from "@tsparticles/engine"; | ||
} | ||
async init(particle) { | ||
init(particle) { | ||
const tiltOptions = particle.options.tilt; | ||
@@ -52,3 +52,2 @@ if (!tiltOptions) { | ||
} | ||
await Promise.resolve(); | ||
} | ||
@@ -55,0 +54,0 @@ isEnabled(particle) { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -29,3 +6,3 @@ exports.loadTiltUpdater = void 0; | ||
await engine.addParticleUpdater("tilt", async (container) => { | ||
const { TiltUpdater } = await Promise.resolve().then(() => __importStar(require("./TiltUpdater.js"))); | ||
const { TiltUpdater } = await import("./TiltUpdater.js"); | ||
return new TiltUpdater(container); | ||
@@ -32,0 +9,0 @@ }, refresh); |
@@ -18,3 +18,3 @@ "use strict"; | ||
} | ||
async init(particle) { | ||
init(particle) { | ||
const tiltOptions = particle.options.tilt; | ||
@@ -55,3 +55,2 @@ if (!tiltOptions) { | ||
} | ||
await Promise.resolve(); | ||
} | ||
@@ -58,0 +57,0 @@ isEnabled(particle) { |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v3.2.2 | ||
* v3.3.0 | ||
*/ | ||
@@ -47,3 +47,3 @@ "use strict"; | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TiltUpdater: () => (/* binding */ TiltUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Tilt_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Tilt.js */ \"./dist/browser/Options/Classes/Tilt.js\");\n\n\nconst identity = 1,\n double = 2,\n doublePI = Math.PI * double,\n maxAngle = 360;\nclass TiltUpdater {\n constructor(container) {\n this.container = container;\n }\n getTransformValues(particle) {\n const tilt = particle.tilt?.enable && particle.tilt;\n return {\n b: tilt ? Math.cos(tilt.value) * tilt.cosDirection : undefined,\n c: tilt ? Math.sin(tilt.value) * tilt.sinDirection : undefined\n };\n }\n async init(particle) {\n const tiltOptions = particle.options.tilt;\n if (!tiltOptions) {\n return;\n }\n particle.tilt = {\n enable: tiltOptions.enable,\n value: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.degToRad)((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(tiltOptions.value)),\n sinDirection: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() >= _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.halfRandom ? identity : -identity,\n cosDirection: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() >= _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.halfRandom ? identity : -identity,\n min: 0,\n max: doublePI\n };\n let tiltDirection = tiltOptions.direction;\n if (tiltDirection === \"random\") {\n const index = Math.floor((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * double),\n minIndex = 0;\n tiltDirection = index > minIndex ? \"counter-clockwise\" : \"clockwise\";\n }\n switch (tiltDirection) {\n case \"counter-clockwise\":\n case \"counterClockwise\":\n particle.tilt.status = \"decreasing\";\n break;\n case \"clockwise\":\n particle.tilt.status = \"increasing\";\n break;\n }\n const tiltAnimation = particle.options.tilt?.animation;\n if (tiltAnimation?.enable) {\n particle.tilt.decay = identity - (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(tiltAnimation.decay);\n particle.tilt.velocity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(tiltAnimation.speed) / maxAngle * this.container.retina.reduceFactor;\n if (!tiltAnimation.sync) {\n particle.tilt.velocity *= (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)();\n }\n }\n await Promise.resolve();\n }\n isEnabled(particle) {\n const tiltAnimation = particle.options.tilt?.animation;\n return !particle.destroyed && !particle.spawning && !!tiltAnimation?.enable;\n }\n loadOptions(options, ...sources) {\n if (!options.tilt) {\n options.tilt = new _Options_Classes_Tilt_js__WEBPACK_IMPORTED_MODULE_1__.Tilt();\n }\n for (const source of sources) {\n options.tilt.load(source?.tilt);\n }\n }\n async update(particle, delta) {\n if (!this.isEnabled(particle) || !particle.tilt) {\n return;\n }\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.updateAnimation)(particle, particle.tilt, false, \"none\", delta);\n await Promise.resolve();\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-tilt/./dist/browser/TiltUpdater.js?"); | ||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TiltUpdater: () => (/* binding */ TiltUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Options_Classes_Tilt_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Tilt.js */ \"./dist/browser/Options/Classes/Tilt.js\");\n\n\nconst identity = 1,\n double = 2,\n doublePI = Math.PI * double,\n maxAngle = 360;\nclass TiltUpdater {\n constructor(container) {\n this.container = container;\n }\n getTransformValues(particle) {\n const tilt = particle.tilt?.enable && particle.tilt;\n return {\n b: tilt ? Math.cos(tilt.value) * tilt.cosDirection : undefined,\n c: tilt ? Math.sin(tilt.value) * tilt.sinDirection : undefined\n };\n }\n init(particle) {\n const tiltOptions = particle.options.tilt;\n if (!tiltOptions) {\n return;\n }\n particle.tilt = {\n enable: tiltOptions.enable,\n value: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.degToRad)((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(tiltOptions.value)),\n sinDirection: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() >= _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.halfRandom ? identity : -identity,\n cosDirection: (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() >= _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.halfRandom ? identity : -identity,\n min: 0,\n max: doublePI\n };\n let tiltDirection = tiltOptions.direction;\n if (tiltDirection === \"random\") {\n const index = Math.floor((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() * double),\n minIndex = 0;\n tiltDirection = index > minIndex ? \"counter-clockwise\" : \"clockwise\";\n }\n switch (tiltDirection) {\n case \"counter-clockwise\":\n case \"counterClockwise\":\n particle.tilt.status = \"decreasing\";\n break;\n case \"clockwise\":\n particle.tilt.status = \"increasing\";\n break;\n }\n const tiltAnimation = particle.options.tilt?.animation;\n if (tiltAnimation?.enable) {\n particle.tilt.decay = identity - (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(tiltAnimation.decay);\n particle.tilt.velocity = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(tiltAnimation.speed) / maxAngle * this.container.retina.reduceFactor;\n if (!tiltAnimation.sync) {\n particle.tilt.velocity *= (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)();\n }\n }\n }\n isEnabled(particle) {\n const tiltAnimation = particle.options.tilt?.animation;\n return !particle.destroyed && !particle.spawning && !!tiltAnimation?.enable;\n }\n loadOptions(options, ...sources) {\n if (!options.tilt) {\n options.tilt = new _Options_Classes_Tilt_js__WEBPACK_IMPORTED_MODULE_1__.Tilt();\n }\n for (const source of sources) {\n options.tilt.load(source?.tilt);\n }\n }\n async update(particle, delta) {\n if (!this.isEnabled(particle) || !particle.tilt) {\n return;\n }\n (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.updateAnimation)(particle, particle.tilt, false, \"none\", delta);\n await Promise.resolve();\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-tilt/./dist/browser/TiltUpdater.js?"); | ||
@@ -50,0 +50,0 @@ /***/ }) |
@@ -15,3 +15,3 @@ import { degToRad, getRandom, getRangeValue, halfRandom, updateAnimation, } from "@tsparticles/engine"; | ||
} | ||
async init(particle) { | ||
init(particle) { | ||
const tiltOptions = particle.options.tilt; | ||
@@ -52,3 +52,2 @@ if (!tiltOptions) { | ||
} | ||
await Promise.resolve(); | ||
} | ||
@@ -55,0 +54,0 @@ isEnabled(particle) { |
{ | ||
"name": "@tsparticles/updater-tilt", | ||
"version": "3.2.2", | ||
"version": "3.3.0", | ||
"description": "tsParticles particles tilt updater", | ||
@@ -90,3 +90,3 @@ "homepage": "https://particles.js.org", | ||
"dependencies": { | ||
"@tsparticles/engine": "^3.2.2" | ||
"@tsparticles/engine": "^3.3.0" | ||
}, | ||
@@ -93,0 +93,0 @@ "publishConfig": { |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v3.2.2 | ||
* v3.3.0 | ||
*/ | ||
@@ -214,3 +214,3 @@ /* | ||
/******/ var i = scripts.length - 1; | ||
/******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src; | ||
/******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src; | ||
/******/ } | ||
@@ -217,0 +217,0 @@ /******/ } |
/*! For license information please see tsparticles.updater.tilt.min.js.LICENSE.txt */ | ||
!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={533: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 o[e](r,r.exports,n),r.exports}n.m=o,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||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/updater-tilt:",n.l=(e,o,i,a)=>{if(t[e])t[e].push(o);else{var s,l;if(void 0!==i)for(var c=document.getElementsByTagName("script"),p=0;p<c.length;p++){var u=c[p];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+i){s=u;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,n.nc&&s.setAttribute("nonce",n.nc),s.setAttribute("data-webpack",r+i),s.src=e),t[e]=[o];var d=(r,o)=>{s.onerror=s.onload=null,clearTimeout(f);var i=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),i&&i.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),l&&document.head.appendChild(s)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var o=r.length-1;o>-1&&!e;)e=r[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={778:0};n.f.j=(t,r)=>{var o=n.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var i=new Promise(((r,i)=>o=e[t]=[r,i]));r.push(o[2]=i);var a=n.p+n.u(t),s=new Error;n.l(a,(r=>{if(n.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",s.name="ChunkLoadError",s.type=i,s.request=a,o[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,i,a=r[0],s=r[1],l=r[2],c=0;if(a.some((t=>0!==e[t]))){for(o in s)n.o(s,o)&&(n.m[o]=s[o]);if(l)l(n)}for(t&&t(r);c<a.length;c++)i=a[c],n.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunk_tsparticles_updater_tilt=this.webpackChunk_tsparticles_updater_tilt||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};return(()=>{async function e(e,t=!0){await e.addParticleUpdater("tilt",(async e=>{const{TiltUpdater:t}=await n.e(942).then(n.bind(n,942));return new t(e)}),t)}n.r(a),n.d(a,{loadTiltUpdater:()=>e})})(),a})())); | ||
!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}},i={};function n(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,n),r.exports}n.m=o,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||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},r="@tsparticles/updater-tilt:",n.l=(e,o,i,a)=>{if(t[e])t[e].push(o);else{var s,l;if(void 0!==i)for(var p=document.getElementsByTagName("script"),c=0;c<p.length;c++){var u=p[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==r+i){s=u;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,n.nc&&s.setAttribute("nonce",n.nc),s.setAttribute("data-webpack",r+i),s.src=e),t[e]=[o];var d=(r,o)=>{s.onerror=s.onload=null,clearTimeout(f);var i=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),i&&i.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),l&&document.head.appendChild(s)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;n.g.importScripts&&(e=n.g.location+"");var t=n.g.document;if(!e&&t&&(t.currentScript&&(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(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=e})(),(()=>{var e={865:0};n.f.j=(t,r)=>{var o=n.o(e,t)?e[t]:void 0;if(0!==o)if(o)r.push(o[2]);else{var i=new Promise(((r,i)=>o=e[t]=[r,i]));r.push(o[2]=i);var a=n.p+n.u(t),s=new Error;n.l(a,(r=>{if(n.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var i=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+i+": "+a+")",s.name="ChunkLoadError",s.type=i,s.request=a,o[1](s)}}),"chunk-"+t,t)}};var t=(t,r)=>{var o,i,a=r[0],s=r[1],l=r[2],p=0;if(a.some((t=>0!==e[t]))){for(o in s)n.o(s,o)&&(n.m[o]=s[o]);if(l)l(n)}for(t&&t(r);p<a.length;p++)i=a[p],n.o(e,i)&&e[i]&&e[i][0](),e[i]=0},r=this.webpackChunk_tsparticles_updater_tilt=this.webpackChunk_tsparticles_updater_tilt||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var a={};return(()=>{async function e(e,t=!0){await e.addParticleUpdater("tilt",(async e=>{const{TiltUpdater:t}=await n.e(174).then(n.bind(n,174));return new t(e)}),t)}n.r(a),n.d(a,{loadTiltUpdater:()=>e})})(),a})())); |
@@ -1,1 +0,1 @@ | ||
/*! tsParticles Tilt Updater v3.2.2 by Matteo Bruni */ | ||
/*! tsParticles Tilt Updater v3.3.0 by Matteo Bruni */ |
@@ -7,3 +7,3 @@ import { type Container, type IDelta, type IParticleTransformValues, type IParticleUpdater, type RecursivePartial } from "@tsparticles/engine"; | ||
getTransformValues(particle: TiltParticle): IParticleTransformValues; | ||
init(particle: TiltParticle): Promise<void>; | ||
init(particle: TiltParticle): void; | ||
isEnabled(particle: TiltParticle): boolean; | ||
@@ -10,0 +10,0 @@ loadOptions(options: TiltParticlesOptions, ...sources: (RecursivePartial<ITiltParticlesOptions> | undefined)[]): void; |
@@ -27,3 +27,3 @@ (function (factory) { | ||
} | ||
async init(particle) { | ||
init(particle) { | ||
const tiltOptions = particle.options.tilt; | ||
@@ -64,3 +64,2 @@ if (!tiltOptions) { | ||
} | ||
await Promise.resolve(); | ||
} | ||
@@ -67,0 +66,0 @@ isEnabled(particle) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
336019
1121
Updated@tsparticles/engine@^3.3.0