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

tsparticles-updater-out-modes

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsparticles-updater-out-modes - npm Package Compare versions

Comparing version 2.0.0-alpha.3 to 2.0.0-alpha.4

4

IBounceData.d.ts

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

import type { IBounds, ICoordinates, IDimension, Particle } from "tsparticles-core";
import type { OutMode, OutModeAlt, OutModeDirection } from "tsparticles-core";
import type { IBounds, ICoordinates, IDimension, Particle } from "tsparticles-engine";
import type { OutMode, OutModeAlt, OutModeDirection } from "tsparticles-engine";
export interface IBounceData {

@@ -4,0 +4,0 @@ particle: Particle;

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

import { loadUpdater } from "./updater";
export { loadUpdater };
import type { Main } from "tsparticles-engine";
export declare function loadOutModesUpdater(tsParticles: Main): void;

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

import { loadUpdater } from "./updater";
import { tsParticles } from "tsparticles-core";
loadUpdater(tsParticles);
export { loadUpdater };
import { OutOfCanvasUpdater } from "./OutOfCanvasUpdater";
export function loadOutModesUpdater(tsParticles) {
tsParticles.addParticleUpdater("outModes", (container) => new OutOfCanvasUpdater(container));
}

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

import type { Container, IDelta, IParticleUpdater, Particle } from "tsparticles-core";
import type { Container, IDelta, IParticleUpdater, Particle } from "tsparticles-engine";
export declare class OutOfCanvasUpdater implements IParticleUpdater {

@@ -3,0 +3,0 @@ private readonly container;

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

import { calculateBounds, isPointInside } from "tsparticles-core";
import { calculateBounds, isPointInside, OutMode, OutModeDirection } from "tsparticles-engine";
import { bounceHorizontal, bounceVertical } from "./Utils";

@@ -13,24 +13,24 @@ export class OutOfCanvasUpdater {

const outModes = particle.options.move.outModes;
this.updateOutMode(particle, delta, (_a = outModes.bottom) !== null && _a !== void 0 ? _a : outModes.default, "bottom");
this.updateOutMode(particle, delta, (_b = outModes.left) !== null && _b !== void 0 ? _b : outModes.default, "left");
this.updateOutMode(particle, delta, (_c = outModes.right) !== null && _c !== void 0 ? _c : outModes.default, "right");
this.updateOutMode(particle, delta, (_d = outModes.top) !== null && _d !== void 0 ? _d : outModes.default, "top");
this.updateOutMode(particle, delta, (_a = outModes.bottom) !== null && _a !== void 0 ? _a : outModes.default, OutModeDirection.bottom);
this.updateOutMode(particle, delta, (_b = outModes.left) !== null && _b !== void 0 ? _b : outModes.default, OutModeDirection.left);
this.updateOutMode(particle, delta, (_c = outModes.right) !== null && _c !== void 0 ? _c : outModes.default, OutModeDirection.right);
this.updateOutMode(particle, delta, (_d = outModes.top) !== null && _d !== void 0 ? _d : outModes.default, OutModeDirection.top);
}
updateOutMode(particle, delta, outMode, direction) {
switch (outMode) {
case "bounce":
case "bounce-vertical":
case "bounce-horizontal":
case OutMode.bounce:
case OutMode.bounceVertical:
case OutMode.bounceHorizontal:
case "bounceVertical":
case "bounceHorizontal":
case "split":
case OutMode.split:
this.bounce(particle, delta, direction, outMode);
break;
case "destroy":
case OutMode.destroy:
this.destroy(particle, direction);
break;
case "out":
case OutMode.out:
this.out(particle, direction);
break;
case "none":
case OutMode.none:
this.none(particle, direction);

@@ -58,3 +58,3 @@ break;

}, sizeValue = particle.getRadius(), nextBounds = calculateBounds(particle.position, sizeValue);
if (direction === "right" && nextBounds.left > canvasSize.width - particle.offset.x) {
if (direction === OutModeDirection.right && nextBounds.left > canvasSize.width - particle.offset.x) {
particle.position.x = newPos.left;

@@ -67,3 +67,3 @@ particle.initialPosition.x = particle.position.x;

}
else if (direction === "left" && nextBounds.right < -particle.offset.x) {
else if (direction === OutModeDirection.left && nextBounds.right < -particle.offset.x) {
particle.position.x = newPos.right;

@@ -76,3 +76,3 @@ particle.initialPosition.x = particle.position.x;

}
if (direction === "bottom" && nextBounds.top > canvasSize.height - particle.offset.y) {
if (direction === OutModeDirection.bottom && nextBounds.top > canvasSize.height - particle.offset.y) {
if (!wrap) {

@@ -85,3 +85,3 @@ particle.position.x = Math.random() * canvasSize.width;

}
else if (direction === "top" && nextBounds.bottom < -particle.offset.y) {
else if (direction === OutModeDirection.top && nextBounds.bottom < -particle.offset.y) {
if (!wrap) {

@@ -127,4 +127,4 @@ particle.position.x = Math.random() * canvasSize.width;

position.y > container.canvas.size.height &&
direction === "bottom") ||
(gravityOptions.acceleration < 0 && position.y < 0 && direction === "top")) {
direction === OutModeDirection.bottom) ||
(gravityOptions.acceleration < 0 && position.y < 0 && direction === OutModeDirection.top)) {
container.particles.remove(particle);

@@ -131,0 +131,0 @@ }

{
"name": "tsparticles-updater-out-modes",
"version": "2.0.0-alpha.3",
"version": "2.0.0-alpha.4",
"description": "tsParticles particles out modes updater",

@@ -48,4 +48,4 @@ "homepage": "https://particles.js.org/",

"dependencies": {
"tsparticles-core": "^2.0.0-alpha.0"
"tsparticles-engine": "^2.0.0-alpha.4"
}
}

@@ -7,14 +7,14 @@ /*!

* How to use? : Check the GitHub README
* v2.0.0-alpha.3
* v2.0.0-alpha.4
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("tsparticles-core"));
module.exports = factory(require("tsparticles-engine"));
else if(typeof define === 'function' && define.amd)
define(["tsparticles-core"], factory);
define(["tsparticles-engine"], factory);
else {
var a = typeof exports === 'object' ? factory(require("tsparticles-core")) : factory(root["window"]);
var a = typeof exports === 'object' ? factory(require("tsparticles-engine")) : factory(root["window"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(this, function(__WEBPACK_EXTERNAL_MODULE__646__) {
})(this, function(__WEBPACK_EXTERNAL_MODULE__414__) {
return /******/ (() => { // webpackBootstrap

@@ -24,3 +24,3 @@ /******/ "use strict";

/***/ 373:
/***/ 825:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

@@ -33,11 +33,11 @@

__webpack_require__.d(__webpack_exports__, {
"loadUpdater": () => /* reexport */ loadUpdater
"loadOutModesUpdater": () => /* binding */ loadOutModesUpdater
});
// EXTERNAL MODULE: external {"commonjs":"tsparticles-core","commonjs2":"tsparticles-core","amd":"tsparticles-core","root":"window"}
var external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_ = __webpack_require__(646);
// EXTERNAL MODULE: external {"commonjs":"tsparticles-engine","commonjs2":"tsparticles-engine","amd":"tsparticles-engine","root":"window"}
var external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_ = __webpack_require__(414);
;// CONCATENATED MODULE: ./dist/Utils.js
function bounceHorizontal(data) {
if (!(data.outMode === "bounce" || data.outMode === "bounce-horizontal" || data.outMode === "bounceHorizontal" || data.outMode === "split")) {
if (!(data.outMode === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.bounce || data.outMode === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.bounceHorizontal || data.outMode === "bounceHorizontal" || data.outMode === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.split)) {
return;

@@ -49,4 +49,4 @@ }

if (data.direction === "right" && data.bounds.right >= data.canvasSize.width && velocity > 0 || data.direction === "left" && data.bounds.left <= 0 && velocity < 0) {
const newVelocity = (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.getRangeValue)(data.particle.options.bounce.horizontal.value);
if (data.direction === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.right && data.bounds.right >= data.canvasSize.width && velocity > 0 || data.direction === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.left && data.bounds.left <= 0 && velocity < 0) {
const newVelocity = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getRangeValue)(data.particle.options.bounce.horizontal.value);
data.particle.velocity.x *= -newVelocity;

@@ -68,3 +68,3 @@ bounced = true;

if (data.outMode === "split") {
if (data.outMode === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.split) {
data.particle.destroy();

@@ -74,8 +74,8 @@ }

function bounceVertical(data) {
if (data.outMode === "bounce" || data.outMode === "bounce-vertical" || data.outMode === "bounceVertical" || data.outMode === "split") {
if (data.outMode === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.bounce || data.outMode === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.bounceVertical || data.outMode === "bounceVertical" || data.outMode === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.split) {
const velocity = data.particle.velocity.y;
let bounced = false;
if (data.direction === "bottom" && data.bounds.bottom >= data.canvasSize.height && velocity > 0 || data.direction === "top" && data.bounds.top <= 0 && velocity < 0) {
const newVelocity = (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.getRangeValue)(data.particle.options.bounce.vertical.value);
if (data.direction === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.bottom && data.bounds.bottom >= data.canvasSize.height && velocity > 0 || data.direction === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.top && data.bounds.top <= 0 && velocity < 0) {
const newVelocity = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getRangeValue)(data.particle.options.bounce.vertical.value);
data.particle.velocity.y *= -newVelocity;

@@ -97,3 +97,3 @@ bounced = true;

if (data.outMode === "split") {
if (data.outMode === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.split) {
data.particle.destroy();

@@ -119,6 +119,6 @@ }

const outModes = particle.options.move.outModes;
this.updateOutMode(particle, delta, (_a = outModes.bottom) !== null && _a !== void 0 ? _a : outModes.default, "bottom");
this.updateOutMode(particle, delta, (_b = outModes.left) !== null && _b !== void 0 ? _b : outModes.default, "left");
this.updateOutMode(particle, delta, (_c = outModes.right) !== null && _c !== void 0 ? _c : outModes.default, "right");
this.updateOutMode(particle, delta, (_d = outModes.top) !== null && _d !== void 0 ? _d : outModes.default, "top");
this.updateOutMode(particle, delta, (_a = outModes.bottom) !== null && _a !== void 0 ? _a : outModes.default, external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.bottom);
this.updateOutMode(particle, delta, (_b = outModes.left) !== null && _b !== void 0 ? _b : outModes.default, external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.left);
this.updateOutMode(particle, delta, (_c = outModes.right) !== null && _c !== void 0 ? _c : outModes.default, external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.right);
this.updateOutMode(particle, delta, (_d = outModes.top) !== null && _d !== void 0 ? _d : outModes.default, external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.top);
}

@@ -128,20 +128,20 @@

switch (outMode) {
case "bounce":
case "bounce-vertical":
case "bounce-horizontal":
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.bounce:
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.bounceVertical:
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.bounceHorizontal:
case "bounceVertical":
case "bounceHorizontal":
case "split":
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.split:
this.bounce(particle, delta, direction, outMode);
break;
case "destroy":
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.destroy:
this.destroy(particle, direction);
break;
case "out":
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.out:
this.out(particle, direction);
break;
case "none":
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.none:
this.none(particle, direction);

@@ -155,3 +155,3 @@ break;

if ((0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.isPointInside)(particle.position, container.canvas.size, particle.getRadius(), direction)) {
if ((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isPointInside)(particle.position, container.canvas.size, particle.getRadius(), direction)) {
return;

@@ -166,3 +166,3 @@ }

if ((0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.isPointInside)(particle.position, container.canvas.size, particle.getRadius(), direction)) {
if ((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isPointInside)(particle.position, container.canvas.size, particle.getRadius(), direction)) {
return;

@@ -180,5 +180,5 @@ }

sizeValue = particle.getRadius(),
nextBounds = (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.calculateBounds)(particle.position, sizeValue);
nextBounds = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.calculateBounds)(particle.position, sizeValue);
if (direction === "right" && nextBounds.left > canvasSize.width - particle.offset.x) {
if (direction === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.right && nextBounds.left > canvasSize.width - particle.offset.x) {
particle.position.x = newPos.left;

@@ -191,3 +191,3 @@ particle.initialPosition.x = particle.position.x;

}
} else if (direction === "left" && nextBounds.right < -particle.offset.x) {
} else if (direction === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.left && nextBounds.right < -particle.offset.x) {
particle.position.x = newPos.right;

@@ -202,3 +202,3 @@ particle.initialPosition.x = particle.position.x;

if (direction === "bottom" && nextBounds.top > canvasSize.height - particle.offset.y) {
if (direction === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.bottom && nextBounds.top > canvasSize.height - particle.offset.y) {
if (!wrap) {

@@ -211,3 +211,3 @@ particle.position.x = Math.random() * canvasSize.width;

particle.initialPosition.y = particle.position.y;
} else if (direction === "top" && nextBounds.bottom < -particle.offset.y) {
} else if (direction === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.top && nextBounds.bottom < -particle.offset.y) {
if (!wrap) {

@@ -244,3 +244,3 @@ particle.position.x = Math.random() * canvasSize.width;

size = particle.getRadius(),
bounds = (0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.calculateBounds)(pos, size),
bounds = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.calculateBounds)(pos, size),
canvasSize = container.canvas.size;

@@ -276,3 +276,3 @@ bounceHorizontal({

if (!gravityOptions.enable) {
if (!(0,external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.isPointInside)(particle.position, container.canvas.size, particle.getRadius(), direction)) {
if (!(0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isPointInside)(particle.position, container.canvas.size, particle.getRadius(), direction)) {
container.particles.remove(particle);

@@ -283,3 +283,3 @@ }

if (gravityOptions.acceleration >= 0 && position.y > container.canvas.size.height && direction === "bottom" || gravityOptions.acceleration < 0 && position.y < 0 && direction === "top") {
if (gravityOptions.acceleration >= 0 && position.y > container.canvas.size.height && direction === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.bottom || gravityOptions.acceleration < 0 && position.y < 0 && direction === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.top) {
container.particles.remove(particle);

@@ -291,19 +291,14 @@ }

}
;// CONCATENATED MODULE: ./dist/updater.js
;// CONCATENATED MODULE: ./dist/index.js
function loadUpdater(tsParticles) {
tsParticles.addParticleUpdater(container => new OutOfCanvasUpdater(container));
function loadOutModesUpdater(tsParticles) {
tsParticles.addParticleUpdater("outModes", container => new OutOfCanvasUpdater(container));
}
;// CONCATENATED MODULE: ./dist/index.js
loadUpdater(external_commonjs_tsparticles_core_commonjs2_tsparticles_core_amd_tsparticles_core_root_window_.tsParticles);
/***/ }),
/***/ 646:
/***/ 414:
/***/ ((module) => {
module.exports = __WEBPACK_EXTERNAL_MODULE__646__;
module.exports = __WEBPACK_EXTERNAL_MODULE__414__;

@@ -370,5 +365,5 @@ /***/ })

/******/ // Load entry module and return exports
/******/ return __webpack_require__(373);
/******/ return __webpack_require__(825);
/******/ })()
;
});

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

/*! tsParticles Out Modes Updater v2.0.0-alpha.3 by Matteo Bruni */
!function(t,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o(require("tsparticles-core"));else if("function"==typeof define&&define.amd)define(["tsparticles-core"],o);else{var e="object"==typeof exports?o(require("tsparticles-core")):o(t.window);for(var i in e)("object"==typeof exports?exports:t)[i]=e[i]}}(this,(function(t){return(()=>{"use strict";var o={373:(t,o,e)=>{e.r(o),e.d(o,{loadUpdater:()=>s});var i=e(646);class n{constructor(t){this.container=t}isEnabled(t){return!t.destroyed&&!t.spawning}update(t,o){var e,i,n,s;const a=t.options.move.outModes;this.updateOutMode(t,o,null!==(e=a.bottom)&&void 0!==e?e:a.default,"bottom"),this.updateOutMode(t,o,null!==(i=a.left)&&void 0!==i?i:a.default,"left"),this.updateOutMode(t,o,null!==(n=a.right)&&void 0!==n?n:a.default,"right"),this.updateOutMode(t,o,null!==(s=a.top)&&void 0!==s?s:a.default,"top")}updateOutMode(t,o,e,i){switch(e){case"bounce":case"bounce-vertical":case"bounce-horizontal":case"bounceVertical":case"bounceHorizontal":case"split":this.bounce(t,o,i,e);break;case"destroy":this.destroy(t,i);break;case"out":this.out(t,i);break;case"none":this.none(t,i)}}destroy(t,o){const e=this.container;(0,i.isPointInside)(t.position,e.canvas.size,t.getRadius(),o)||e.particles.remove(t,void 0,!0)}out(t,o){const e=this.container;if((0,i.isPointInside)(t.position,e.canvas.size,t.getRadius(),o))return;const n=t.options.move.warp,s=e.canvas.size,a={bottom:s.height+t.getRadius()-t.offset.y,left:-t.getRadius()-t.offset.x,right:s.width+t.getRadius()+t.offset.x,top:-t.getRadius()-t.offset.y},r=t.getRadius(),c=(0,i.calculateBounds)(t.position,r);"right"===o&&c.left>s.width-t.offset.x?(t.position.x=a.left,t.initialPosition.x=t.position.x,n||(t.position.y=Math.random()*s.height,t.initialPosition.y=t.position.y)):"left"===o&&c.right<-t.offset.x&&(t.position.x=a.right,t.initialPosition.x=t.position.x,n||(t.position.y=Math.random()*s.height,t.initialPosition.y=t.position.y)),"bottom"===o&&c.top>s.height-t.offset.y?(n||(t.position.x=Math.random()*s.width,t.initialPosition.x=t.position.x),t.position.y=a.top,t.initialPosition.y=t.position.y):"top"===o&&c.bottom<-t.offset.y&&(n||(t.position.x=Math.random()*s.width,t.initialPosition.x=t.position.x),t.position.y=a.bottom,t.initialPosition.y=t.position.y)}bounce(t,o,e,n){const s=this.container;let a=!1;for(const[,i]of s.plugins)if(void 0!==i.particleBounce&&(a=i.particleBounce(t,o,e)),a)break;if(a)return;const r=t.getPosition(),c=t.offset,u=t.getRadius(),d=(0,i.calculateBounds)(r,u),l=s.canvas.size;!function(t){if("bounce"!==t.outMode&&"bounce-horizontal"!==t.outMode&&"bounceHorizontal"!==t.outMode&&"split"!==t.outMode)return;const o=t.particle.velocity.x;let e=!1;if("right"===t.direction&&t.bounds.right>=t.canvasSize.width&&o>0||"left"===t.direction&&t.bounds.left<=0&&o<0){const o=(0,i.getRangeValue)(t.particle.options.bounce.horizontal.value);t.particle.velocity.x*=-o,e=!0}if(!e)return;const n=t.offset.x+t.size;t.bounds.right>=t.canvasSize.width?t.particle.position.x=t.canvasSize.width-n:t.bounds.left<=0&&(t.particle.position.x=n),"split"===t.outMode&&t.particle.destroy()}({particle:t,outMode:n,direction:e,bounds:d,canvasSize:l,offset:c,size:u}),function(t){if("bounce"===t.outMode||"bounce-vertical"===t.outMode||"bounceVertical"===t.outMode||"split"===t.outMode){const o=t.particle.velocity.y;let e=!1;if("bottom"===t.direction&&t.bounds.bottom>=t.canvasSize.height&&o>0||"top"===t.direction&&t.bounds.top<=0&&o<0){const o=(0,i.getRangeValue)(t.particle.options.bounce.vertical.value);t.particle.velocity.y*=-o,e=!0}if(!e)return;const n=t.offset.y+t.size;t.bounds.bottom>=t.canvasSize.height?t.particle.position.y=t.canvasSize.height-n:t.bounds.top<=0&&(t.particle.position.y=n),"split"===t.outMode&&t.particle.destroy()}}({particle:t,outMode:n,direction:e,bounds:d,canvasSize:l,offset:c,size:u})}none(t,o){if(t.options.move.distance)return;const e=t.options.move.gravity,n=this.container;if(e.enable){const i=t.position;(e.acceleration>=0&&i.y>n.canvas.size.height&&"bottom"===o||e.acceleration<0&&i.y<0&&"top"===o)&&n.particles.remove(t)}else(0,i.isPointInside)(t.position,n.canvas.size,t.getRadius(),o)||n.particles.remove(t)}}function s(t){t.addParticleUpdater((t=>new n(t)))}s(i.tsParticles)},646:o=>{o.exports=t}},e={};function i(t){if(e[t])return e[t].exports;var n=e[t]={exports:{}};return o[t](n,n.exports,i),n.exports}return i.d=(t,o)=>{for(var e in o)i.o(o,e)&&!i.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:o[e]})},i.o=(t,o)=>Object.prototype.hasOwnProperty.call(t,o),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i(373)})()}));
/*! tsParticles Out Modes Updater v2.0.0-alpha.4 by Matteo Bruni */
!function(t,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o(require("tsparticles-engine"));else if("function"==typeof define&&define.amd)define(["tsparticles-engine"],o);else{var e="object"==typeof exports?o(require("tsparticles-engine")):o(t.window);for(var i in e)("object"==typeof exports?exports:t)[i]=e[i]}}(this,(function(t){return(()=>{"use strict";var o={825:(t,o,e)=>{e.r(o),e.d(o,{loadOutModesUpdater:()=>s});var i=e(414);class n{constructor(t){this.container=t}isEnabled(t){return!t.destroyed&&!t.spawning}update(t,o){var e,n,s,a;const r=t.options.move.outModes;this.updateOutMode(t,o,null!==(e=r.bottom)&&void 0!==e?e:r.default,i.OutModeDirection.bottom),this.updateOutMode(t,o,null!==(n=r.left)&&void 0!==n?n:r.default,i.OutModeDirection.left),this.updateOutMode(t,o,null!==(s=r.right)&&void 0!==s?s:r.default,i.OutModeDirection.right),this.updateOutMode(t,o,null!==(a=r.top)&&void 0!==a?a:r.default,i.OutModeDirection.top)}updateOutMode(t,o,e,n){switch(e){case i.OutMode.bounce:case i.OutMode.bounceVertical:case i.OutMode.bounceHorizontal:case"bounceVertical":case"bounceHorizontal":case i.OutMode.split:this.bounce(t,o,n,e);break;case i.OutMode.destroy:this.destroy(t,n);break;case i.OutMode.out:this.out(t,n);break;case i.OutMode.none:this.none(t,n)}}destroy(t,o){const e=this.container;(0,i.isPointInside)(t.position,e.canvas.size,t.getRadius(),o)||e.particles.remove(t,void 0,!0)}out(t,o){const e=this.container;if((0,i.isPointInside)(t.position,e.canvas.size,t.getRadius(),o))return;const n=t.options.move.warp,s=e.canvas.size,a={bottom:s.height+t.getRadius()-t.offset.y,left:-t.getRadius()-t.offset.x,right:s.width+t.getRadius()+t.offset.x,top:-t.getRadius()-t.offset.y},r=t.getRadius(),c=(0,i.calculateBounds)(t.position,r);o===i.OutModeDirection.right&&c.left>s.width-t.offset.x?(t.position.x=a.left,t.initialPosition.x=t.position.x,n||(t.position.y=Math.random()*s.height,t.initialPosition.y=t.position.y)):o===i.OutModeDirection.left&&c.right<-t.offset.x&&(t.position.x=a.right,t.initialPosition.x=t.position.x,n||(t.position.y=Math.random()*s.height,t.initialPosition.y=t.position.y)),o===i.OutModeDirection.bottom&&c.top>s.height-t.offset.y?(n||(t.position.x=Math.random()*s.width,t.initialPosition.x=t.position.x),t.position.y=a.top,t.initialPosition.y=t.position.y):o===i.OutModeDirection.top&&c.bottom<-t.offset.y&&(n||(t.position.x=Math.random()*s.width,t.initialPosition.x=t.position.x),t.position.y=a.bottom,t.initialPosition.y=t.position.y)}bounce(t,o,e,n){const s=this.container;let a=!1;for(const[,i]of s.plugins)if(void 0!==i.particleBounce&&(a=i.particleBounce(t,o,e)),a)break;if(a)return;const r=t.getPosition(),c=t.offset,u=t.getRadius(),d=(0,i.calculateBounds)(r,u),l=s.canvas.size;!function(t){if(t.outMode!==i.OutMode.bounce&&t.outMode!==i.OutMode.bounceHorizontal&&"bounceHorizontal"!==t.outMode&&t.outMode!==i.OutMode.split)return;const o=t.particle.velocity.x;let e=!1;if(t.direction===i.OutModeDirection.right&&t.bounds.right>=t.canvasSize.width&&o>0||t.direction===i.OutModeDirection.left&&t.bounds.left<=0&&o<0){const o=(0,i.getRangeValue)(t.particle.options.bounce.horizontal.value);t.particle.velocity.x*=-o,e=!0}if(!e)return;const n=t.offset.x+t.size;t.bounds.right>=t.canvasSize.width?t.particle.position.x=t.canvasSize.width-n:t.bounds.left<=0&&(t.particle.position.x=n),t.outMode===i.OutMode.split&&t.particle.destroy()}({particle:t,outMode:n,direction:e,bounds:d,canvasSize:l,offset:c,size:u}),function(t){if(t.outMode===i.OutMode.bounce||t.outMode===i.OutMode.bounceVertical||"bounceVertical"===t.outMode||t.outMode===i.OutMode.split){const o=t.particle.velocity.y;let e=!1;if(t.direction===i.OutModeDirection.bottom&&t.bounds.bottom>=t.canvasSize.height&&o>0||t.direction===i.OutModeDirection.top&&t.bounds.top<=0&&o<0){const o=(0,i.getRangeValue)(t.particle.options.bounce.vertical.value);t.particle.velocity.y*=-o,e=!0}if(!e)return;const n=t.offset.y+t.size;t.bounds.bottom>=t.canvasSize.height?t.particle.position.y=t.canvasSize.height-n:t.bounds.top<=0&&(t.particle.position.y=n),t.outMode===i.OutMode.split&&t.particle.destroy()}}({particle:t,outMode:n,direction:e,bounds:d,canvasSize:l,offset:c,size:u})}none(t,o){if(t.options.move.distance)return;const e=t.options.move.gravity,n=this.container;if(e.enable){const s=t.position;(e.acceleration>=0&&s.y>n.canvas.size.height&&o===i.OutModeDirection.bottom||e.acceleration<0&&s.y<0&&o===i.OutModeDirection.top)&&n.particles.remove(t)}else(0,i.isPointInside)(t.position,n.canvas.size,t.getRadius(),o)||n.particles.remove(t)}}function s(t){t.addParticleUpdater("outModes",(t=>new n(t)))}},414:o=>{o.exports=t}},e={};function i(t){if(e[t])return e[t].exports;var n=e[t]={exports:{}};return o[t](n,n.exports,i),n.exports}return i.d=(t,o)=>{for(var e in o)i.o(o,e)&&!i.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:o[e]})},i.o=(t,o)=>Object.prototype.hasOwnProperty.call(t,o),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i(825)})()}));

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

import { getRangeValue } from "tsparticles-core";
import { getRangeValue, OutMode, OutModeDirection } from "tsparticles-engine";
export function bounceHorizontal(data) {
if (!(data.outMode === "bounce" ||
data.outMode === "bounce-horizontal" ||
if (!(data.outMode === OutMode.bounce ||
data.outMode === OutMode.bounceHorizontal ||
data.outMode === "bounceHorizontal" ||
data.outMode === "split")) {
data.outMode === OutMode.split)) {
return;

@@ -11,4 +11,4 @@ }

let bounced = false;
if ((data.direction === "right" && data.bounds.right >= data.canvasSize.width && velocity > 0) ||
(data.direction === "left" && data.bounds.left <= 0 && velocity < 0)) {
if ((data.direction === OutModeDirection.right && data.bounds.right >= data.canvasSize.width && velocity > 0) ||
(data.direction === OutModeDirection.left && data.bounds.left <= 0 && velocity < 0)) {
const newVelocity = getRangeValue(data.particle.options.bounce.horizontal.value);

@@ -28,3 +28,3 @@ data.particle.velocity.x *= -newVelocity;

}
if (data.outMode === "split") {
if (data.outMode === OutMode.split) {
data.particle.destroy();

@@ -34,12 +34,12 @@ }

export function bounceVertical(data) {
if (data.outMode === "bounce" ||
data.outMode === "bounce-vertical" ||
if (data.outMode === OutMode.bounce ||
data.outMode === OutMode.bounceVertical ||
data.outMode === "bounceVertical" ||
data.outMode === "split") {
data.outMode === OutMode.split) {
const velocity = data.particle.velocity.y;
let bounced = false;
if ((data.direction === "bottom" &&
if ((data.direction === OutModeDirection.bottom &&
data.bounds.bottom >= data.canvasSize.height &&
velocity > 0) ||
(data.direction === "top" && data.bounds.top <= 0 && velocity < 0)) {
(data.direction === OutModeDirection.top && data.bounds.top <= 0 && velocity < 0)) {
const newVelocity = getRangeValue(data.particle.options.bounce.vertical.value);

@@ -59,3 +59,3 @@ data.particle.velocity.y *= -newVelocity;

}
if (data.outMode === "split") {
if (data.outMode === OutMode.split) {
data.particle.destroy();

@@ -62,0 +62,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