tsparticles-updater-out-modes
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0-beta.3
import type { Main } from "tsparticles-engine"; | ||
export declare function loadOutModesUpdater(tsParticles: Main): void; | ||
export declare function loadOutModesUpdater(tsParticles: Main): Promise<void>; |
13
index.js
@@ -0,4 +1,15 @@ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
import { OutOfCanvasUpdater } from "./OutOfCanvasUpdater"; | ||
export function loadOutModesUpdater(tsParticles) { | ||
tsParticles.addParticleUpdater("outModes", (container) => new OutOfCanvasUpdater(container)); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield tsParticles.addParticleUpdater("outModes", (container) => new OutOfCanvasUpdater(container)); | ||
}); | ||
} |
import type { Container, IDelta, IParticleUpdater, Particle } from "tsparticles-engine"; | ||
import type { IOutModeManager } from "./IOutModeManager"; | ||
export declare class OutOfCanvasUpdater implements IParticleUpdater { | ||
private readonly container; | ||
updaters: IOutModeManager[]; | ||
constructor(container: Container); | ||
@@ -9,6 +11,2 @@ init(): void; | ||
private updateOutMode; | ||
private destroy; | ||
private out; | ||
private bounce; | ||
private none; | ||
} |
@@ -1,6 +0,15 @@ | ||
import { calculateBounds, isPointInside, OutMode, OutModeDirection } from "tsparticles-engine"; | ||
import { bounceHorizontal, bounceVertical } from "./Utils"; | ||
import { OutModeDirection } from "tsparticles-engine"; | ||
import { BounceOutMode } from "./BounceOutMode"; | ||
import { DestroyOutMode } from "./DestroyOutMode"; | ||
import { OutOutMode } from "./OutOutMode"; | ||
import { NoneOutMode } from "./NoneOutMode"; | ||
export class OutOfCanvasUpdater { | ||
constructor(container) { | ||
this.container = container; | ||
this.updaters = [ | ||
new BounceOutMode(container), | ||
new DestroyOutMode(container), | ||
new OutOutMode(container), | ||
new NoneOutMode(container), | ||
]; | ||
} | ||
@@ -21,123 +30,6 @@ init() { | ||
updateOutMode(particle, delta, outMode, direction) { | ||
switch (outMode) { | ||
case OutMode.bounce: | ||
case OutMode.bounceVertical: | ||
case OutMode.bounceHorizontal: | ||
case "bounceVertical": | ||
case "bounceHorizontal": | ||
case OutMode.split: | ||
this.bounce(particle, delta, direction, outMode); | ||
break; | ||
case OutMode.destroy: | ||
this.destroy(particle, direction); | ||
break; | ||
case OutMode.out: | ||
this.out(particle, direction); | ||
break; | ||
case OutMode.none: | ||
default: | ||
this.none(particle, direction); | ||
break; | ||
for (const updater of this.updaters) { | ||
updater.update(particle, direction, delta, outMode); | ||
} | ||
} | ||
destroy(particle, direction) { | ||
const container = this.container; | ||
if (isPointInside(particle.position, container.canvas.size, particle.getRadius(), direction)) { | ||
return; | ||
} | ||
container.particles.remove(particle, undefined, true); | ||
} | ||
out(particle, direction) { | ||
const container = this.container; | ||
if (isPointInside(particle.position, container.canvas.size, particle.getRadius(), direction)) { | ||
return; | ||
} | ||
const wrap = particle.options.move.warp, canvasSize = container.canvas.size, newPos = { | ||
bottom: canvasSize.height + particle.getRadius() + particle.offset.y, | ||
left: -particle.getRadius() - particle.offset.x, | ||
right: canvasSize.width + particle.getRadius() + particle.offset.x, | ||
top: -particle.getRadius() - particle.offset.y, | ||
}, sizeValue = particle.getRadius(), nextBounds = calculateBounds(particle.position, sizeValue); | ||
if (direction === OutModeDirection.right && nextBounds.left > canvasSize.width + particle.offset.x) { | ||
particle.position.x = newPos.left; | ||
particle.initialPosition.x = particle.position.x; | ||
if (!wrap) { | ||
particle.position.y = Math.random() * canvasSize.height; | ||
particle.initialPosition.y = particle.position.y; | ||
} | ||
} | ||
else if (direction === OutModeDirection.left && nextBounds.right < -particle.offset.x) { | ||
particle.position.x = newPos.right; | ||
particle.initialPosition.x = particle.position.x; | ||
if (!wrap) { | ||
particle.position.y = Math.random() * canvasSize.height; | ||
particle.initialPosition.y = particle.position.y; | ||
} | ||
} | ||
if (direction === OutModeDirection.bottom && nextBounds.top > canvasSize.height + particle.offset.y) { | ||
if (!wrap) { | ||
particle.position.x = Math.random() * canvasSize.width; | ||
particle.initialPosition.x = particle.position.x; | ||
} | ||
particle.position.y = newPos.top; | ||
particle.initialPosition.y = particle.position.y; | ||
} | ||
else if (direction === OutModeDirection.top && nextBounds.bottom < -particle.offset.y) { | ||
if (!wrap) { | ||
particle.position.x = Math.random() * canvasSize.width; | ||
particle.initialPosition.x = particle.position.x; | ||
} | ||
particle.position.y = newPos.bottom; | ||
particle.initialPosition.y = particle.position.y; | ||
} | ||
} | ||
bounce(particle, delta, direction, outMode) { | ||
const container = this.container; | ||
let handled = false; | ||
for (const [, plugin] of container.plugins) { | ||
if (plugin.particleBounce !== undefined) { | ||
handled = plugin.particleBounce(particle, delta, direction); | ||
} | ||
if (handled) { | ||
break; | ||
} | ||
} | ||
if (handled) { | ||
return; | ||
} | ||
const pos = particle.getPosition(), offset = particle.offset, size = particle.getRadius(), bounds = calculateBounds(pos, size), canvasSize = container.canvas.size; | ||
bounceHorizontal({ particle, outMode, direction, bounds, canvasSize, offset, size }); | ||
bounceVertical({ particle, outMode, direction, bounds, canvasSize, offset, size }); | ||
} | ||
none(particle, direction) { | ||
if ((particle.options.move.distance.horizontal && | ||
(direction === OutModeDirection.left || direction === OutModeDirection.right)) || | ||
(particle.options.move.distance.vertical && | ||
(direction === OutModeDirection.top || direction === OutModeDirection.bottom))) { | ||
return; | ||
} | ||
const gravityOptions = particle.options.move.gravity, container = this.container; | ||
const canvasSize = container.canvas.size; | ||
const pRadius = particle.getRadius(); | ||
if (!gravityOptions.enable) { | ||
if ((particle.velocity.y > 0 && particle.position.y <= canvasSize.height + pRadius) || | ||
(particle.velocity.y < 0 && particle.position.y >= -pRadius) || | ||
(particle.velocity.x > 0 && particle.position.x <= canvasSize.width + pRadius) || | ||
(particle.velocity.x < 0 && particle.position.x >= -pRadius)) { | ||
return; | ||
} | ||
if (!isPointInside(particle.position, container.canvas.size, pRadius, direction)) { | ||
container.particles.remove(particle); | ||
} | ||
} | ||
else { | ||
const position = particle.position; | ||
if ((!gravityOptions.inverse && | ||
position.y > canvasSize.height + pRadius && | ||
direction === OutModeDirection.bottom) || | ||
(gravityOptions.inverse && position.y < -pRadius && direction === OutModeDirection.top)) { | ||
container.particles.remove(particle); | ||
} | ||
} | ||
} | ||
} |
{ | ||
"name": "tsparticles-updater-out-modes", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0-beta.3", | ||
"description": "tsParticles particles out modes updater", | ||
@@ -48,4 +48,4 @@ "homepage": "https://particles.js.org/", | ||
"dependencies": { | ||
"tsparticles-engine": "^2.0.0-beta.1" | ||
"tsparticles-engine": "^2.0.0-beta.2" | ||
} | ||
} |
[![banner](https://particles.js.org/images/banner2.png)](https://particles.js.org) | ||
# tsparticles-updater-outModes | ||
# tsParticles Out Modes Updater | ||
tsParticles updater outModes | ||
[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/tsparticles-updater-out-modes/badge)](https://www.jsdelivr.com/package/npm/tsparticles-updater-out-modes) | ||
[![npmjs](https://badge.fury.io/js/tsparticles-updater-out-modes.svg)](https://www.npmjs.com/package/tsparticles-updater-out-modes) | ||
[![npmjs](https://img.shields.io/npm/dt/tsparticles-updater-out-modes)](https://www.npmjs.com/package/tsparticles-updater-out-modes) | ||
[tsParticles](https://github.com/matteobruni/tsparticles) updater plugin for out modes animations. | ||
## How to use it | ||
### CDN / Vanilla JS / jQuery | ||
The CDN/Vanilla version JS has one required file in vanilla configuration: | ||
Including the `tsparticles.updater.out-modes.min.js` file will export the function to load the updater plugin: | ||
```javascript | ||
loadOutModesUpdater; | ||
``` | ||
### Usage | ||
Once the scripts are loaded you can set up `tsParticles` and the updater plugin like this: | ||
```javascript | ||
loadOutModesUpdater(tsParticles); | ||
tsParticles.load("tsparticles", { | ||
/* options */ | ||
}); | ||
``` | ||
### ESM / CommonJS | ||
This package is compatible also with ES or CommonJS modules, firstly this needs to be installed, like this: | ||
```shell | ||
$ npm install tsparticles-updater-out-modes | ||
``` | ||
or | ||
```shell | ||
$ yarn add tsparticles-updater-out-modes | ||
``` | ||
Then you need to import it in the app, like this: | ||
```javascript | ||
const { tsParticles } = require("tsparticles-engine"); | ||
const { loadOutModesUpdater } = require("tsparticles-updater-out-modes"); | ||
loadOutModesUpdater(tsParticles); | ||
``` | ||
or | ||
```javascript | ||
import { tsParticles } from "tsparticles-engine"; | ||
import { loadOutModesUpdater } from "tsparticles-updater-out-modes"; | ||
loadOutModesUpdater(tsParticles); | ||
``` |
import { Main } from "tsparticles-engine"; | ||
export declare function loadOutModesUpdater(tsParticles: Main): void; | ||
export declare function loadOutModesUpdater(tsParticles: Main): Promise<void>; |
import { Container, IDelta, IParticleUpdater, Particle } from "tsparticles-engine"; | ||
import { IOutModeManager } from "./IOutModeManager"; | ||
export declare class OutOfCanvasUpdater implements IParticleUpdater { | ||
private readonly container; | ||
updaters: IOutModeManager[]; | ||
constructor(container: Container); | ||
@@ -9,6 +11,2 @@ init(): void; | ||
private updateOutMode; | ||
private destroy; | ||
private out; | ||
private bounce; | ||
private none; | ||
} |
import type { Main } from "tsparticles-engine"; | ||
export declare function loadOutModesUpdater(tsParticles: Main): void; | ||
export declare function loadOutModesUpdater(tsParticles: Main): Promise<void>; |
import type { Container, IDelta, IParticleUpdater, Particle } from "tsparticles-engine"; | ||
import type { IOutModeManager } from "./IOutModeManager"; | ||
export declare class OutOfCanvasUpdater implements IParticleUpdater { | ||
private readonly container; | ||
updaters: IOutModeManager[]; | ||
constructor(container: Container); | ||
@@ -9,6 +11,2 @@ init(): void; | ||
private updateOutMode; | ||
private destroy; | ||
private out; | ||
private bounce; | ||
private none; | ||
} |
import type { Main } from "tsparticles-engine"; | ||
export declare function loadOutModesUpdater(tsParticles: Main): void; | ||
export declare function loadOutModesUpdater(tsParticles: Main): Promise<void>; |
import type { Container, IDelta, IParticleUpdater, Particle } from "tsparticles-engine"; | ||
import type { IOutModeManager } from "./IOutModeManager"; | ||
export declare class OutOfCanvasUpdater implements IParticleUpdater { | ||
private readonly container; | ||
updaters: IOutModeManager[]; | ||
constructor(container: Container); | ||
@@ -9,6 +11,2 @@ init(): void; | ||
private updateOutMode; | ||
private destroy; | ||
private out; | ||
private bounce; | ||
private none; | ||
} |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v2.0.0-beta.2 | ||
* v2.0.0-beta.3 | ||
*/ | ||
@@ -160,119 +160,17 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
} | ||
;// CONCATENATED MODULE: ./dist/OutOfCanvasUpdater.js | ||
;// CONCATENATED MODULE: ./dist/BounceOutMode.js | ||
class OutOfCanvasUpdater { | ||
class BounceOutMode { | ||
constructor(container) { | ||
this.container = container; | ||
this.modes = [external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.bounce, external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.bounceVertical, external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.bounceHorizontal, "bounceVertical", "bounceHorizontal", external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.split]; | ||
} | ||
init() {} | ||
isEnabled(particle) { | ||
return !particle.destroyed && !particle.spawning; | ||
} | ||
update(particle, delta) { | ||
var _a, _b, _c, _d; | ||
const outModes = particle.options.move.outModes; | ||
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); | ||
} | ||
updateOutMode(particle, delta, outMode, direction) { | ||
switch (outMode) { | ||
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 external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.split: | ||
this.bounce(particle, delta, direction, outMode); | ||
break; | ||
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.destroy: | ||
this.destroy(particle, direction); | ||
break; | ||
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.out: | ||
this.out(particle, direction); | ||
break; | ||
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.none: | ||
default: | ||
this.none(particle, direction); | ||
break; | ||
} | ||
} | ||
destroy(particle, direction) { | ||
const container = this.container; | ||
if ((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isPointInside)(particle.position, container.canvas.size, particle.getRadius(), direction)) { | ||
update(particle, direction, delta, outMode) { | ||
if (!this.modes.includes(outMode)) { | ||
return; | ||
} | ||
container.particles.remove(particle, undefined, true); | ||
} | ||
out(particle, direction) { | ||
const container = this.container; | ||
if ((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isPointInside)(particle.position, container.canvas.size, particle.getRadius(), direction)) { | ||
return; | ||
} | ||
const wrap = particle.options.move.warp, | ||
canvasSize = container.canvas.size, | ||
newPos = { | ||
bottom: canvasSize.height + particle.getRadius() + particle.offset.y, | ||
left: -particle.getRadius() - particle.offset.x, | ||
right: canvasSize.width + particle.getRadius() + particle.offset.x, | ||
top: -particle.getRadius() - particle.offset.y | ||
}, | ||
sizeValue = particle.getRadius(), | ||
nextBounds = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.calculateBounds)(particle.position, sizeValue); | ||
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; | ||
particle.initialPosition.x = particle.position.x; | ||
if (!wrap) { | ||
particle.position.y = Math.random() * canvasSize.height; | ||
particle.initialPosition.y = particle.position.y; | ||
} | ||
} 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; | ||
particle.initialPosition.x = particle.position.x; | ||
if (!wrap) { | ||
particle.position.y = Math.random() * canvasSize.height; | ||
particle.initialPosition.y = particle.position.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) { | ||
particle.position.x = Math.random() * canvasSize.width; | ||
particle.initialPosition.x = particle.position.x; | ||
} | ||
particle.position.y = newPos.top; | ||
particle.initialPosition.y = particle.position.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) { | ||
particle.position.x = Math.random() * canvasSize.width; | ||
particle.initialPosition.x = particle.position.x; | ||
} | ||
particle.position.y = newPos.bottom; | ||
particle.initialPosition.y = particle.position.y; | ||
} | ||
} | ||
bounce(particle, delta, direction, outMode) { | ||
const container = this.container; | ||
let handled = false; | ||
@@ -319,3 +217,204 @@ | ||
none(particle, direction) { | ||
} | ||
;// CONCATENATED MODULE: ./dist/DestroyOutMode.js | ||
class DestroyOutMode { | ||
constructor(container) { | ||
this.container = container; | ||
this.modes = [external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.destroy]; | ||
} | ||
update(particle, direction, delta, outMode) { | ||
if (!this.modes.includes(outMode)) { | ||
return; | ||
} | ||
const container = this.container; | ||
switch (particle.outType) { | ||
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.ParticleOutType.normal: | ||
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.ParticleOutType.outside: | ||
if ((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isPointInside)(particle.position, container.canvas.size, external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.Vector.origin, particle.getRadius(), direction)) { | ||
return; | ||
} | ||
break; | ||
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.ParticleOutType.inside: | ||
{ | ||
const { | ||
dx, | ||
dy | ||
} = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getDistances)(particle.position, particle.moveCenter); | ||
const { | ||
x: vx, | ||
y: vy | ||
} = particle.velocity; | ||
if (vx < 0 && dx > particle.moveCenter.radius || vy < 0 && dy > particle.moveCenter.radius || vx >= 0 && dx < -particle.moveCenter.radius || vy >= 0 && dy < -particle.moveCenter.radius) { | ||
return; | ||
} | ||
break; | ||
} | ||
} | ||
container.particles.remove(particle, undefined, true); | ||
} | ||
} | ||
;// CONCATENATED MODULE: ./dist/OutOutMode.js | ||
class OutOutMode { | ||
constructor(container) { | ||
this.container = container; | ||
this.modes = [external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.out]; | ||
} | ||
update(particle, direction, delta, outMode) { | ||
if (!this.modes.includes(outMode)) { | ||
return; | ||
} | ||
const container = this.container; | ||
switch (particle.outType) { | ||
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.ParticleOutType.inside: | ||
{ | ||
const { | ||
x: vx, | ||
y: vy | ||
} = particle.velocity; | ||
const circVec = external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.Vector.origin; | ||
circVec.length = particle.moveCenter.radius; | ||
circVec.angle = particle.velocity.angle + Math.PI; | ||
circVec.addTo(external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.Vector.create(particle.moveCenter)); | ||
const { | ||
dx, | ||
dy | ||
} = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getDistances)(particle.position, circVec); | ||
if (vx <= 0 && dx >= 0 || vy <= 0 && dy >= 0 || vx >= 0 && dx <= 0 || vy >= 0 && dy <= 0) { | ||
return; | ||
} | ||
particle.position.x = Math.floor((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.randomInRange)({ | ||
min: 0, | ||
max: container.canvas.size.width | ||
})); | ||
particle.position.y = Math.floor((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.randomInRange)({ | ||
min: 0, | ||
max: container.canvas.size.height | ||
})); | ||
const { | ||
dx: newDx, | ||
dy: newDy | ||
} = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getDistances)(particle.position, particle.moveCenter); | ||
particle.direction = Math.atan2(-newDy, -newDx); | ||
particle.velocity.angle = particle.direction; | ||
break; | ||
} | ||
default: | ||
{ | ||
if ((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isPointInside)(particle.position, container.canvas.size, external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.Vector.origin, particle.getRadius(), direction)) { | ||
return; | ||
} | ||
switch (particle.outType) { | ||
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.ParticleOutType.outside: | ||
{ | ||
particle.position.x = Math.floor((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.randomInRange)({ | ||
min: -particle.moveCenter.radius, | ||
max: particle.moveCenter.radius | ||
})) + particle.moveCenter.x; | ||
particle.position.y = Math.floor((0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.randomInRange)({ | ||
min: -particle.moveCenter.radius, | ||
max: particle.moveCenter.radius | ||
})) + particle.moveCenter.y; | ||
const { | ||
dx, | ||
dy | ||
} = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.getDistances)(particle.position, particle.moveCenter); | ||
if (particle.moveCenter.radius) { | ||
particle.direction = Math.atan2(dy, dx); | ||
particle.velocity.angle = particle.direction; | ||
} | ||
break; | ||
} | ||
case external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.ParticleOutType.normal: | ||
{ | ||
const wrap = particle.options.move.warp, | ||
canvasSize = container.canvas.size, | ||
newPos = { | ||
bottom: canvasSize.height + particle.getRadius() + particle.offset.y, | ||
left: -particle.getRadius() - particle.offset.x, | ||
right: canvasSize.width + particle.getRadius() + particle.offset.x, | ||
top: -particle.getRadius() - particle.offset.y | ||
}, | ||
sizeValue = particle.getRadius(), | ||
nextBounds = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.calculateBounds)(particle.position, sizeValue); | ||
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; | ||
particle.initialPosition.x = particle.position.x; | ||
if (!wrap) { | ||
particle.position.y = Math.random() * canvasSize.height; | ||
particle.initialPosition.y = particle.position.y; | ||
} | ||
} 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; | ||
particle.initialPosition.x = particle.position.x; | ||
if (!wrap) { | ||
particle.position.y = Math.random() * canvasSize.height; | ||
particle.initialPosition.y = particle.position.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) { | ||
particle.position.x = Math.random() * canvasSize.width; | ||
particle.initialPosition.x = particle.position.x; | ||
} | ||
particle.position.y = newPos.top; | ||
particle.initialPosition.y = particle.position.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) { | ||
particle.position.x = Math.random() * canvasSize.width; | ||
particle.initialPosition.x = particle.position.x; | ||
} | ||
particle.position.y = newPos.bottom; | ||
particle.initialPosition.y = particle.position.y; | ||
} | ||
break; | ||
} | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
;// CONCATENATED MODULE: ./dist/NoneOutMode.js | ||
class NoneOutMode { | ||
constructor(container) { | ||
this.container = container; | ||
this.modes = [external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutMode.none]; | ||
} | ||
update(particle, direction, delta, outMode) { | ||
if (!this.modes.includes(outMode)) { | ||
return; | ||
} | ||
if (particle.options.move.distance.horizontal && (direction === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.left || direction === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.right) || particle.options.move.distance.vertical && (direction === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.top || direction === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.OutModeDirection.bottom)) { | ||
@@ -335,3 +434,3 @@ return; | ||
if (!(0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isPointInside)(particle.position, container.canvas.size, pRadius, direction)) { | ||
if (!(0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.isPointInside)(particle.position, container.canvas.size, external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.Vector.origin, pRadius, direction)) { | ||
container.particles.remove(particle); | ||
@@ -349,6 +448,75 @@ } | ||
} | ||
;// CONCATENATED MODULE: ./dist/OutOfCanvasUpdater.js | ||
class OutOfCanvasUpdater { | ||
constructor(container) { | ||
this.container = container; | ||
this.updaters = [new BounceOutMode(container), new DestroyOutMode(container), new OutOutMode(container), new NoneOutMode(container)]; | ||
} | ||
init() {} | ||
isEnabled(particle) { | ||
return !particle.destroyed && !particle.spawning; | ||
} | ||
update(particle, delta) { | ||
var _a, _b, _c, _d; | ||
const outModes = particle.options.move.outModes; | ||
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); | ||
} | ||
updateOutMode(particle, delta, outMode, direction) { | ||
for (const updater of this.updaters) { | ||
updater.update(particle, direction, delta, outMode); | ||
} | ||
} | ||
} | ||
;// CONCATENATED MODULE: ./dist/index.js | ||
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { | ||
return value instanceof P ? value : new P(function (resolve) { | ||
resolve(value); | ||
}); | ||
} | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { | ||
try { | ||
step(generator.next(value)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} | ||
function rejected(value) { | ||
try { | ||
step(generator["throw"](value)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} | ||
function step(result) { | ||
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); | ||
} | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
function loadOutModesUpdater(tsParticles) { | ||
tsParticles.addParticleUpdater("outModes", container => new OutOfCanvasUpdater(container)); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield tsParticles.addParticleUpdater("outModes", container => new OutOfCanvasUpdater(container)); | ||
}); | ||
} | ||
@@ -355,0 +523,0 @@ })(); |
@@ -1,2 +0,2 @@ | ||
/*! tsParticles Out Modes Updater v2.0.0-beta.2 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={818:o=>{o.exports=t}},e={};function i(t){var n=e[t];if(void 0!==n)return n.exports;var s=e[t]={exports:{}};return o[t](s,s.exports,i),s.exports}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})};var n={};return(()=>{i.r(n),i.d(n,{loadOutModesUpdater:()=>e});var t=i(818);class o{constructor(t){this.container=t}init(){}isEnabled(t){return!t.destroyed&&!t.spawning}update(o,e){var i,n,s,r;const a=o.options.move.outModes;this.updateOutMode(o,e,null!==(i=a.bottom)&&void 0!==i?i:a.default,t.OutModeDirection.bottom),this.updateOutMode(o,e,null!==(n=a.left)&&void 0!==n?n:a.default,t.OutModeDirection.left),this.updateOutMode(o,e,null!==(s=a.right)&&void 0!==s?s:a.default,t.OutModeDirection.right),this.updateOutMode(o,e,null!==(r=a.top)&&void 0!==r?r:a.default,t.OutModeDirection.top)}updateOutMode(o,e,i,n){switch(i){case t.OutMode.bounce:case t.OutMode.bounceVertical:case t.OutMode.bounceHorizontal:case"bounceVertical":case"bounceHorizontal":case t.OutMode.split:this.bounce(o,e,n,i);break;case t.OutMode.destroy:this.destroy(o,n);break;case t.OutMode.out:this.out(o,n);break;case t.OutMode.none:default:this.none(o,n)}}destroy(o,e){const i=this.container;(0,t.isPointInside)(o.position,i.canvas.size,o.getRadius(),e)||i.particles.remove(o,void 0,!0)}out(o,e){const i=this.container;if((0,t.isPointInside)(o.position,i.canvas.size,o.getRadius(),e))return;const n=o.options.move.warp,s=i.canvas.size,r={bottom:s.height+o.getRadius()+o.offset.y,left:-o.getRadius()-o.offset.x,right:s.width+o.getRadius()+o.offset.x,top:-o.getRadius()-o.offset.y},a=o.getRadius(),c=(0,t.calculateBounds)(o.position,a);e===t.OutModeDirection.right&&c.left>s.width+o.offset.x?(o.position.x=r.left,o.initialPosition.x=o.position.x,n||(o.position.y=Math.random()*s.height,o.initialPosition.y=o.position.y)):e===t.OutModeDirection.left&&c.right<-o.offset.x&&(o.position.x=r.right,o.initialPosition.x=o.position.x,n||(o.position.y=Math.random()*s.height,o.initialPosition.y=o.position.y)),e===t.OutModeDirection.bottom&&c.top>s.height+o.offset.y?(n||(o.position.x=Math.random()*s.width,o.initialPosition.x=o.position.x),o.position.y=r.top,o.initialPosition.y=o.position.y):e===t.OutModeDirection.top&&c.bottom<-o.offset.y&&(n||(o.position.x=Math.random()*s.width,o.initialPosition.x=o.position.x),o.position.y=r.bottom,o.initialPosition.y=o.position.y)}bounce(o,e,i,n){const s=this.container;let r=!1;for(const[,t]of s.plugins)if(void 0!==t.particleBounce&&(r=t.particleBounce(o,e,i)),r)break;if(r)return;const a=o.getPosition(),c=o.offset,u=o.getRadius(),d=(0,t.calculateBounds)(a,u),l=s.canvas.size;!function(o){if(o.outMode!==t.OutMode.bounce&&o.outMode!==t.OutMode.bounceHorizontal&&"bounceHorizontal"!==o.outMode&&o.outMode!==t.OutMode.split)return;const e=o.particle.velocity.x;let i=!1;if(o.direction===t.OutModeDirection.right&&o.bounds.right>=o.canvasSize.width&&e>0||o.direction===t.OutModeDirection.left&&o.bounds.left<=0&&e<0){const e=(0,t.getRangeValue)(o.particle.options.bounce.horizontal.value);o.particle.velocity.x*=-e,i=!0}if(!i)return;const n=o.offset.x+o.size;o.bounds.right>=o.canvasSize.width?o.particle.position.x=o.canvasSize.width-n:o.bounds.left<=0&&(o.particle.position.x=n),o.outMode===t.OutMode.split&&o.particle.destroy()}({particle:o,outMode:n,direction:i,bounds:d,canvasSize:l,offset:c,size:u}),function(o){if(o.outMode===t.OutMode.bounce||o.outMode===t.OutMode.bounceVertical||"bounceVertical"===o.outMode||o.outMode===t.OutMode.split){const e=o.particle.velocity.y;let i=!1;if(o.direction===t.OutModeDirection.bottom&&o.bounds.bottom>=o.canvasSize.height&&e>0||o.direction===t.OutModeDirection.top&&o.bounds.top<=0&&e<0){const e=(0,t.getRangeValue)(o.particle.options.bounce.vertical.value);o.particle.velocity.y*=-e,i=!0}if(!i)return;const n=o.offset.y+o.size;o.bounds.bottom>=o.canvasSize.height?o.particle.position.y=o.canvasSize.height-n:o.bounds.top<=0&&(o.particle.position.y=n),o.outMode===t.OutMode.split&&o.particle.destroy()}}({particle:o,outMode:n,direction:i,bounds:d,canvasSize:l,offset:c,size:u})}none(o,e){if(o.options.move.distance.horizontal&&(e===t.OutModeDirection.left||e===t.OutModeDirection.right)||o.options.move.distance.vertical&&(e===t.OutModeDirection.top||e===t.OutModeDirection.bottom))return;const i=o.options.move.gravity,n=this.container,s=n.canvas.size,r=o.getRadius();if(i.enable){const a=o.position;(!i.inverse&&a.y>s.height+r&&e===t.OutModeDirection.bottom||i.inverse&&a.y<-r&&e===t.OutModeDirection.top)&&n.particles.remove(o)}else{if(o.velocity.y>0&&o.position.y<=s.height+r||o.velocity.y<0&&o.position.y>=-r||o.velocity.x>0&&o.position.x<=s.width+r||o.velocity.x<0&&o.position.x>=-r)return;(0,t.isPointInside)(o.position,n.canvas.size,r,e)||n.particles.remove(o)}}}function e(t){t.addParticleUpdater("outModes",(t=>new o(t)))}})(),n})()})); | ||
/*! tsParticles Out Modes Updater v2.0.0-beta.3 by Matteo Bruni */ | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("tsparticles-engine"));else if("function"==typeof define&&define.amd)define(["tsparticles-engine"],e);else{var o="object"==typeof exports?e(require("tsparticles-engine")):e(t.window);for(var i in o)("object"==typeof exports?exports:t)[i]=o[i]}}(this,(function(t){return(()=>{"use strict";var e={818:e=>{e.exports=t}},o={};function i(t){var n=o[t];if(void 0!==n)return n.exports;var s=o[t]={exports:{}};return e[t](s,s.exports,i),s.exports}i.d=(t,e)=>{for(var o in e)i.o(e,o)&&!i.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{i.r(n),i.d(n,{loadOutModesUpdater:()=>d});var t=i(818);class e{constructor(e){this.container=e,this.modes=[t.OutMode.bounce,t.OutMode.bounceVertical,t.OutMode.bounceHorizontal,"bounceVertical","bounceHorizontal",t.OutMode.split]}update(e,o,i,n){if(!this.modes.includes(n))return;const s=this.container;let r=!1;for(const[,t]of s.plugins)if(void 0!==t.particleBounce&&(r=t.particleBounce(e,i,o)),r)break;if(r)return;const a=e.getPosition(),c=e.offset,d=e.getRadius(),u=(0,t.calculateBounds)(a,d),l=s.canvas.size;!function(e){if(e.outMode!==t.OutMode.bounce&&e.outMode!==t.OutMode.bounceHorizontal&&"bounceHorizontal"!==e.outMode&&e.outMode!==t.OutMode.split)return;const o=e.particle.velocity.x;let i=!1;if(e.direction===t.OutModeDirection.right&&e.bounds.right>=e.canvasSize.width&&o>0||e.direction===t.OutModeDirection.left&&e.bounds.left<=0&&o<0){const o=(0,t.getRangeValue)(e.particle.options.bounce.horizontal.value);e.particle.velocity.x*=-o,i=!0}if(!i)return;const n=e.offset.x+e.size;e.bounds.right>=e.canvasSize.width?e.particle.position.x=e.canvasSize.width-n:e.bounds.left<=0&&(e.particle.position.x=n),e.outMode===t.OutMode.split&&e.particle.destroy()}({particle:e,outMode:n,direction:o,bounds:u,canvasSize:l,offset:c,size:d}),function(e){if(e.outMode===t.OutMode.bounce||e.outMode===t.OutMode.bounceVertical||"bounceVertical"===e.outMode||e.outMode===t.OutMode.split){const o=e.particle.velocity.y;let i=!1;if(e.direction===t.OutModeDirection.bottom&&e.bounds.bottom>=e.canvasSize.height&&o>0||e.direction===t.OutModeDirection.top&&e.bounds.top<=0&&o<0){const o=(0,t.getRangeValue)(e.particle.options.bounce.vertical.value);e.particle.velocity.y*=-o,i=!0}if(!i)return;const n=e.offset.y+e.size;e.bounds.bottom>=e.canvasSize.height?e.particle.position.y=e.canvasSize.height-n:e.bounds.top<=0&&(e.particle.position.y=n),e.outMode===t.OutMode.split&&e.particle.destroy()}}({particle:e,outMode:n,direction:o,bounds:u,canvasSize:l,offset:c,size:d})}}class o{constructor(e){this.container=e,this.modes=[t.OutMode.destroy]}update(e,o,i,n){if(!this.modes.includes(n))return;const s=this.container;switch(e.outType){case t.ParticleOutType.normal:case t.ParticleOutType.outside:if((0,t.isPointInside)(e.position,s.canvas.size,t.Vector.origin,e.getRadius(),o))return;break;case t.ParticleOutType.inside:{const{dx:o,dy:i}=(0,t.getDistances)(e.position,e.moveCenter),{x:n,y:s}=e.velocity;if(n<0&&o>e.moveCenter.radius||s<0&&i>e.moveCenter.radius||n>=0&&o<-e.moveCenter.radius||s>=0&&i<-e.moveCenter.radius)return;break}}s.particles.remove(e,void 0,!0)}}class s{constructor(e){this.container=e,this.modes=[t.OutMode.out]}update(e,o,i,n){if(!this.modes.includes(n))return;const s=this.container;switch(e.outType){case t.ParticleOutType.inside:{const{x:o,y:i}=e.velocity,n=t.Vector.origin;n.length=e.moveCenter.radius,n.angle=e.velocity.angle+Math.PI,n.addTo(t.Vector.create(e.moveCenter));const{dx:r,dy:a}=(0,t.getDistances)(e.position,n);if(o<=0&&r>=0||i<=0&&a>=0||o>=0&&r<=0||i>=0&&a<=0)return;e.position.x=Math.floor((0,t.randomInRange)({min:0,max:s.canvas.size.width})),e.position.y=Math.floor((0,t.randomInRange)({min:0,max:s.canvas.size.height}));const{dx:c,dy:d}=(0,t.getDistances)(e.position,e.moveCenter);e.direction=Math.atan2(-d,-c),e.velocity.angle=e.direction;break}default:if((0,t.isPointInside)(e.position,s.canvas.size,t.Vector.origin,e.getRadius(),o))return;switch(e.outType){case t.ParticleOutType.outside:{e.position.x=Math.floor((0,t.randomInRange)({min:-e.moveCenter.radius,max:e.moveCenter.radius}))+e.moveCenter.x,e.position.y=Math.floor((0,t.randomInRange)({min:-e.moveCenter.radius,max:e.moveCenter.radius}))+e.moveCenter.y;const{dx:o,dy:i}=(0,t.getDistances)(e.position,e.moveCenter);e.moveCenter.radius&&(e.direction=Math.atan2(i,o),e.velocity.angle=e.direction);break}case t.ParticleOutType.normal:{const i=e.options.move.warp,n=s.canvas.size,r={bottom:n.height+e.getRadius()+e.offset.y,left:-e.getRadius()-e.offset.x,right:n.width+e.getRadius()+e.offset.x,top:-e.getRadius()-e.offset.y},a=e.getRadius(),c=(0,t.calculateBounds)(e.position,a);o===t.OutModeDirection.right&&c.left>n.width+e.offset.x?(e.position.x=r.left,e.initialPosition.x=e.position.x,i||(e.position.y=Math.random()*n.height,e.initialPosition.y=e.position.y)):o===t.OutModeDirection.left&&c.right<-e.offset.x&&(e.position.x=r.right,e.initialPosition.x=e.position.x,i||(e.position.y=Math.random()*n.height,e.initialPosition.y=e.position.y)),o===t.OutModeDirection.bottom&&c.top>n.height+e.offset.y?(i||(e.position.x=Math.random()*n.width,e.initialPosition.x=e.position.x),e.position.y=r.top,e.initialPosition.y=e.position.y):o===t.OutModeDirection.top&&c.bottom<-e.offset.y&&(i||(e.position.x=Math.random()*n.width,e.initialPosition.x=e.position.x),e.position.y=r.bottom,e.initialPosition.y=e.position.y);break}}}}}class r{constructor(e){this.container=e,this.modes=[t.OutMode.none]}update(e,o,i,n){if(!this.modes.includes(n))return;if(e.options.move.distance.horizontal&&(o===t.OutModeDirection.left||o===t.OutModeDirection.right)||e.options.move.distance.vertical&&(o===t.OutModeDirection.top||o===t.OutModeDirection.bottom))return;const s=e.options.move.gravity,r=this.container,a=r.canvas.size,c=e.getRadius();if(s.enable){const i=e.position;(!s.inverse&&i.y>a.height+c&&o===t.OutModeDirection.bottom||s.inverse&&i.y<-c&&o===t.OutModeDirection.top)&&r.particles.remove(e)}else{if(e.velocity.y>0&&e.position.y<=a.height+c||e.velocity.y<0&&e.position.y>=-c||e.velocity.x>0&&e.position.x<=a.width+c||e.velocity.x<0&&e.position.x>=-c)return;(0,t.isPointInside)(e.position,r.canvas.size,t.Vector.origin,c,o)||r.particles.remove(e)}}}class a{constructor(t){this.container=t,this.updaters=[new e(t),new o(t),new s(t),new r(t)]}init(){}isEnabled(t){return!t.destroyed&&!t.spawning}update(e,o){var i,n,s,r;const a=e.options.move.outModes;this.updateOutMode(e,o,null!==(i=a.bottom)&&void 0!==i?i:a.default,t.OutModeDirection.bottom),this.updateOutMode(e,o,null!==(n=a.left)&&void 0!==n?n:a.default,t.OutModeDirection.left),this.updateOutMode(e,o,null!==(s=a.right)&&void 0!==s?s:a.default,t.OutModeDirection.right),this.updateOutMode(e,o,null!==(r=a.top)&&void 0!==r?r:a.default,t.OutModeDirection.top)}updateOutMode(t,e,o,i){for(const n of this.updaters)n.update(t,i,e,o)}}var c=function(t,e,o,i){return new(o||(o=Promise))((function(n,s){function r(t){try{c(i.next(t))}catch(t){s(t)}}function a(t){try{c(i.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(r,a)}c((i=i.apply(t,e||[])).next())}))};function d(t){return c(this,void 0,void 0,(function*(){yield t.addParticleUpdater("outModes",(t=>new a(t)))}))}})(),n})()})); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
342806
50
1056
66
1