Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tsparticles/updater-tilt

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tsparticles/updater-tilt - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

942.min.js

6

browser/index.js

@@ -1,4 +0,6 @@

import { TiltUpdater } from "./TiltUpdater.js";
export async function loadTiltUpdater(engine, refresh = true) {
await engine.addParticleUpdater("tilt", (container) => new TiltUpdater(container), refresh);
await engine.addParticleUpdater("tilt", async (container) => {
const { TiltUpdater } = await import("./TiltUpdater.js");
return new TiltUpdater(container);
}, refresh);
}

@@ -15,3 +15,3 @@ import { degToRad, getRandom, getRangeValue, halfRandom, updateAnimation, } from "@tsparticles/engine";

}
init(particle) {
async init(particle) {
const tiltOptions = particle.options.tilt;

@@ -52,2 +52,3 @@ if (!tiltOptions) {

}
await Promise.resolve();
}

@@ -66,3 +67,3 @@ isEnabled(particle) {

}
update(particle, delta) {
async update(particle, delta) {
if (!this.isEnabled(particle) || !particle.tilt) {

@@ -72,3 +73,4 @@ return;

updateAnimation(particle, particle.tilt, false, "none", delta);
await Promise.resolve();
}
}
"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 });
exports.loadTiltUpdater = void 0;
const TiltUpdater_js_1 = require("./TiltUpdater.js");
async function loadTiltUpdater(engine, refresh = true) {
await engine.addParticleUpdater("tilt", (container) => new TiltUpdater_js_1.TiltUpdater(container), refresh);
await engine.addParticleUpdater("tilt", async (container) => {
const { TiltUpdater } = await Promise.resolve().then(() => __importStar(require("./TiltUpdater.js")));
return new TiltUpdater(container);
}, refresh);
}
exports.loadTiltUpdater = loadTiltUpdater;

@@ -18,3 +18,3 @@ "use strict";

}
init(particle) {
async init(particle) {
const tiltOptions = particle.options.tilt;

@@ -55,2 +55,3 @@ if (!tiltOptions) {

}
await Promise.resolve();
}

@@ -69,3 +70,3 @@ isEnabled(particle) {

}
update(particle, delta) {
async update(particle, delta) {
if (!this.isEnabled(particle) || !particle.tilt) {

@@ -75,4 +76,5 @@ return;

(0, engine_1.updateAnimation)(particle, particle.tilt, false, "none", delta);
await Promise.resolve();
}
}
exports.TiltUpdater = TiltUpdater;

@@ -1,4 +0,6 @@

import { TiltUpdater } from "./TiltUpdater.js";
export async function loadTiltUpdater(engine, refresh = true) {
await engine.addParticleUpdater("tilt", (container) => new TiltUpdater(container), refresh);
await engine.addParticleUpdater("tilt", async (container) => {
const { TiltUpdater } = await import("./TiltUpdater.js");
return new TiltUpdater(container);
}, refresh);
}

@@ -15,3 +15,3 @@ import { degToRad, getRandom, getRangeValue, halfRandom, updateAnimation, } from "@tsparticles/engine";

}
init(particle) {
async init(particle) {
const tiltOptions = particle.options.tilt;

@@ -52,2 +52,3 @@ if (!tiltOptions) {

}
await Promise.resolve();
}

@@ -66,3 +67,3 @@ isEnabled(particle) {

}
update(particle, delta) {
async update(particle, delta) {
if (!this.isEnabled(particle) || !particle.tilt) {

@@ -72,3 +73,4 @@ return;

updateAnimation(particle, particle.tilt, false, "none", delta);
await Promise.resolve();
}
}
{
"name": "@tsparticles/updater-tilt",
"version": "3.1.0",
"version": "3.2.0",
"description": "tsParticles particles tilt updater",

@@ -90,3 +90,3 @@ "homepage": "https://particles.js.org",

"dependencies": {
"@tsparticles/engine": "^3.1.0"
"@tsparticles/engine": "^3.2.0"
},

@@ -93,0 +93,0 @@ "publishConfig": {

@@ -7,4 +7,12 @@ /*!

* How to use? : Check the GitHub README
* v3.1.0
* v3.2.0
*/
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
(function webpackUniversalModuleDefinition(root, factory) {

@@ -19,3 +27,3 @@ if(typeof exports === 'object' && typeof module === 'object')

}
})(this, (__WEBPACK_EXTERNAL_MODULE__533__) => {
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
return /******/ (() => { // webpackBootstrap

@@ -25,6 +33,19 @@ /******/ "use strict";

/***/ 533:
/***/ "./dist/browser/index.js":
/*!*******************************!*\
!*** ./dist/browser/index.js ***!
\*******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
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, refresh = true) {\n await engine.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 }, refresh);\n}\n\n//# sourceURL=webpack://@tsparticles/updater-tilt/./dist/browser/index.js?");
/***/ }),
/***/ "@tsparticles/engine":
/*!*********************************************************************************************************************************!*\
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
\*********************************************************************************************************************************/
/***/ ((module) => {
module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;

@@ -59,3 +80,18 @@ /***/ })

/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */

@@ -73,2 +109,36 @@ /******/ (() => {

/******/
/******/ /* webpack/runtime/ensure chunk */
/******/ (() => {
/******/ __webpack_require__.f = {};
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ __webpack_require__.e = (chunkId) => {
/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
/******/ __webpack_require__.f[key](chunkId, promises);
/******/ return promises;
/******/ }, []));
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/get javascript chunk filename */
/******/ (() => {
/******/ // This function allow to reference async chunks
/******/ __webpack_require__.u = (chunkId) => {
/******/ // return url for filenames based on template
/******/ return "" + chunkId + ".js";
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/global */
/******/ (() => {
/******/ __webpack_require__.g = (function() {
/******/ if (typeof globalThis === 'object') return globalThis;
/******/ try {
/******/ return this || new Function('return this')();
/******/ } catch (e) {
/******/ if (typeof window === 'object') return window;
/******/ }
/******/ })();
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */

@@ -79,2 +149,48 @@ /******/ (() => {

/******/
/******/ /* webpack/runtime/load script */
/******/ (() => {
/******/ var inProgress = {};
/******/ var dataWebpackPrefix = "@tsparticles/updater-tilt:";
/******/ // loadScript function to load a script via script tag
/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
/******/ var scripts = document.getElementsByTagName("script");
/******/ for(var i = 0; i < scripts.length; i++) {
/******/ var s = scripts[i];
/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
/******/ }
/******/ }
/******/ if(!script) {
/******/ needAttach = true;
/******/ script = document.createElement('script');
/******/
/******/ script.charset = 'utf-8';
/******/ script.timeout = 120;
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
/******/
/******/ script.src = url;
/******/ }
/******/ inProgress[url] = [done];
/******/ var onScriptComplete = (prev, event) => {
/******/ // avoid mem leaks in IE.
/******/ script.onerror = script.onload = null;
/******/ clearTimeout(timeout);
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
/******/ needAttach && document.head.appendChild(script);
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */

@@ -91,149 +207,124 @@ /******/ (() => {

/******/
/******/ /* webpack/runtime/publicPath */
/******/ (() => {
/******/ var scriptUrl;
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
/******/ var document = __webpack_require__.g.document;
/******/ if (!scriptUrl && document) {
/******/ if (document.currentScript)
/******/ scriptUrl = document.currentScript.src;
/******/ if (!scriptUrl) {
/******/ var scripts = document.getElementsByTagName("script");
/******/ if(scripts.length) {
/******/ var i = scripts.length - 1;
/******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
/******/ }
/******/ }
/******/ }
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
/******/ __webpack_require__.p = scriptUrl;
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
/******/ (() => {
/******/ // no baseURI
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "tsparticles.updater.tilt": 0
/******/ };
/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
/******/ if(installedChunkData !== 0) { // 0 means "already installed".
/******/
/******/ // a Promise means "currently loading".
/******/ if(installedChunkData) {
/******/ promises.push(installedChunkData[2]);
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
/******/ // create error before stack unwound to get useful stacktrace later
/******/ var error = new Error();
/******/ var loadingEnded = (event) => {
/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
/******/ installedChunkData = installedChunks[chunkId];
/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
/******/ if(installedChunkData) {
/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
/******/ var realSrc = event && event.target && event.target.src;
/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
/******/ error.name = 'ChunkLoadError';
/******/ error.type = errorType;
/******/ error.request = realSrc;
/******/ installedChunkData[1](error);
/******/ }
/******/ }
/******/ };
/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ }
/******/ }
/******/ }
/******/ };
/******/
/******/ // no prefetching
/******/
/******/ // no preloaded
/******/
/******/ // no HMR
/******/
/******/ // no HMR manifest
/******/
/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var chunkIds = data[0];
/******/ var moreModules = data[1];
/******/ var runtime = data[2];
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0;
/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
/******/ for(moduleId in moreModules) {
/******/ if(__webpack_require__.o(moreModules, moduleId)) {
/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(runtime) var result = runtime(__webpack_require__);
/******/ }
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = this["webpackChunk_tsparticles_updater_tilt"] = this["webpackChunk_tsparticles_updater_tilt"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
loadTiltUpdater: () => (/* binding */ loadTiltUpdater)
});
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
var engine_root_window_ = __webpack_require__(533);
;// CONCATENATED MODULE: ./dist/browser/Options/Classes/TiltAnimation.js
class TiltAnimation {
constructor() {
this.enable = false;
this.speed = 0;
this.decay = 0;
this.sync = false;
}
load(data) {
if (!data) {
return;
}
if (data.enable !== undefined) {
this.enable = data.enable;
}
if (data.speed !== undefined) {
this.speed = (0,engine_root_window_.setRangeValue)(data.speed);
}
if (data.decay !== undefined) {
this.decay = (0,engine_root_window_.setRangeValue)(data.decay);
}
if (data.sync !== undefined) {
this.sync = data.sync;
}
}
}
;// CONCATENATED MODULE: ./dist/browser/Options/Classes/Tilt.js
class Tilt extends engine_root_window_.ValueWithRandom {
constructor() {
super();
this.animation = new TiltAnimation();
this.direction = "clockwise";
this.enable = false;
this.value = 0;
}
load(data) {
super.load(data);
if (!data) {
return;
}
this.animation.load(data.animation);
if (data.direction !== undefined) {
this.direction = data.direction;
}
if (data.enable !== undefined) {
this.enable = data.enable;
}
}
}
;// CONCATENATED MODULE: ./dist/browser/TiltUpdater.js
const identity = 1,
TiltUpdater_double = 2,
doublePI = Math.PI * TiltUpdater_double,
maxAngle = 360;
class TiltUpdater {
constructor(container) {
this.container = container;
}
getTransformValues(particle) {
const tilt = particle.tilt?.enable && particle.tilt;
return {
b: tilt ? Math.cos(tilt.value) * tilt.cosDirection : undefined,
c: tilt ? Math.sin(tilt.value) * tilt.sinDirection : undefined
};
}
init(particle) {
const tiltOptions = particle.options.tilt;
if (!tiltOptions) {
return;
}
particle.tilt = {
enable: tiltOptions.enable,
value: (0,engine_root_window_.degToRad)((0,engine_root_window_.getRangeValue)(tiltOptions.value)),
sinDirection: (0,engine_root_window_.getRandom)() >= engine_root_window_.halfRandom ? identity : -identity,
cosDirection: (0,engine_root_window_.getRandom)() >= engine_root_window_.halfRandom ? identity : -identity,
min: 0,
max: doublePI
};
let tiltDirection = tiltOptions.direction;
if (tiltDirection === "random") {
const index = Math.floor((0,engine_root_window_.getRandom)() * TiltUpdater_double),
minIndex = 0;
tiltDirection = index > minIndex ? "counter-clockwise" : "clockwise";
}
switch (tiltDirection) {
case "counter-clockwise":
case "counterClockwise":
particle.tilt.status = "decreasing";
break;
case "clockwise":
particle.tilt.status = "increasing";
break;
}
const tiltAnimation = particle.options.tilt?.animation;
if (tiltAnimation?.enable) {
particle.tilt.decay = identity - (0,engine_root_window_.getRangeValue)(tiltAnimation.decay);
particle.tilt.velocity = (0,engine_root_window_.getRangeValue)(tiltAnimation.speed) / maxAngle * this.container.retina.reduceFactor;
if (!tiltAnimation.sync) {
particle.tilt.velocity *= (0,engine_root_window_.getRandom)();
}
}
}
isEnabled(particle) {
const tiltAnimation = particle.options.tilt?.animation;
return !particle.destroyed && !particle.spawning && !!tiltAnimation?.enable;
}
loadOptions(options, ...sources) {
if (!options.tilt) {
options.tilt = new Tilt();
}
for (const source of sources) {
options.tilt.load(source?.tilt);
}
}
update(particle, delta) {
if (!this.isEnabled(particle) || !particle.tilt) {
return;
}
(0,engine_root_window_.updateAnimation)(particle, particle.tilt, false, "none", delta);
}
}
;// CONCATENATED MODULE: ./dist/browser/index.js
async function loadTiltUpdater(engine, refresh = true) {
await engine.addParticleUpdater("tilt", container => new TiltUpdater(container), refresh);
}
})();
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval devtool is used.
/******/ var __webpack_exports__ = __webpack_require__("./dist/browser/index.js");
/******/
/******/ return __webpack_exports__;

@@ -240,0 +331,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 i="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var n in i)("object"==typeof exports?exports:e)[n]=i[n]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},i={};function n(e){var o=i[e];if(void 0!==o)return o.exports;var a=i[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{loadTiltUpdater:()=>r});var e=n(533);class t{constructor(){this.enable=!1,this.speed=0,this.decay=0,this.sync=!1}load(t){t&&(void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=(0,e.setRangeValue)(t.speed)),void 0!==t.decay&&(this.decay=(0,e.setRangeValue)(t.decay)),void 0!==t.sync&&(this.sync=t.sync))}}class i extends e.ValueWithRandom{constructor(){super(),this.animation=new t,this.direction="clockwise",this.enable=!1,this.value=0}load(e){super.load(e),e&&(this.animation.load(e.animation),void 0!==e.direction&&(this.direction=e.direction),void 0!==e.enable&&(this.enable=e.enable))}}const a=2*Math.PI;class s{constructor(e){this.container=e}getTransformValues(e){const t=e.tilt?.enable&&e.tilt;return{b:t?Math.cos(t.value)*t.cosDirection:void 0,c:t?Math.sin(t.value)*t.sinDirection:void 0}}init(t){const i=t.options.tilt;if(!i)return;t.tilt={enable:i.enable,value:(0,e.degToRad)((0,e.getRangeValue)(i.value)),sinDirection:(0,e.getRandom)()>=e.halfRandom?1:-1,cosDirection:(0,e.getRandom)()>=e.halfRandom?1:-1,min:0,max:a};let n=i.direction;if("random"===n){n=Math.floor(2*(0,e.getRandom)())>0?"counter-clockwise":"clockwise"}switch(n){case"counter-clockwise":case"counterClockwise":t.tilt.status="decreasing";break;case"clockwise":t.tilt.status="increasing"}const o=t.options.tilt?.animation;o?.enable&&(t.tilt.decay=1-(0,e.getRangeValue)(o.decay),t.tilt.velocity=(0,e.getRangeValue)(o.speed)/360*this.container.retina.reduceFactor,o.sync||(t.tilt.velocity*=(0,e.getRandom)()))}isEnabled(e){const t=e.options.tilt?.animation;return!e.destroyed&&!e.spawning&&!!t?.enable}loadOptions(e,...t){e.tilt||(e.tilt=new i);for(const i of t)e.tilt.load(i?.tilt)}update(t,i){this.isEnabled(t)&&t.tilt&&(0,e.updateAnimation)(t,t.tilt,!1,"none",i)}}async function r(e,t=!0){await e.addParticleUpdater("tilt",(e=>new s(e)),t)}})(),o})()));
!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})()));

@@ -1,1 +0,1 @@

/*! tsParticles Tilt Updater v3.1.0 by Matteo Bruni */
/*! tsParticles Tilt Updater v3.2.0 by Matteo Bruni */

@@ -7,6 +7,6 @@ import { type Container, type IDelta, type IParticleTransformValues, type IParticleUpdater, type RecursivePartial } from "@tsparticles/engine";

getTransformValues(particle: TiltParticle): IParticleTransformValues;
init(particle: TiltParticle): void;
init(particle: TiltParticle): Promise<void>;
isEnabled(particle: TiltParticle): boolean;
loadOptions(options: TiltParticlesOptions, ...sources: (RecursivePartial<ITiltParticlesOptions> | undefined)[]): void;
update(particle: TiltParticle, delta: IDelta): void;
update(particle: TiltParticle, delta: IDelta): Promise<void>;
}

@@ -0,1 +1,24 @@

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;
};
(function (factory) {

@@ -7,13 +30,16 @@ if (typeof module === "object" && typeof module.exports === "object") {

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./TiltUpdater.js"], factory);
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadTiltUpdater = void 0;
const TiltUpdater_js_1 = require("./TiltUpdater.js");
async function loadTiltUpdater(engine, refresh = true) {
await engine.addParticleUpdater("tilt", (container) => new TiltUpdater_js_1.TiltUpdater(container), refresh);
await engine.addParticleUpdater("tilt", async (container) => {
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));
return new TiltUpdater(container);
}, refresh);
}
exports.loadTiltUpdater = loadTiltUpdater;
});

@@ -27,3 +27,3 @@ (function (factory) {

}
init(particle) {
async init(particle) {
const tiltOptions = particle.options.tilt;

@@ -64,2 +64,3 @@ if (!tiltOptions) {

}
await Promise.resolve();
}

@@ -78,3 +79,3 @@ isEnabled(particle) {

}
update(particle, delta) {
async update(particle, delta) {
if (!this.isEnabled(particle) || !particle.tilt) {

@@ -84,2 +85,3 @@ return;

(0, engine_1.updateAnimation)(particle, particle.tilt, false, "none", delta);
await Promise.resolve();
}

@@ -86,0 +88,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc