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

@tsparticles/updater-life

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-life - npm Package Compare versions

Comparing version 3.6.0-beta.1 to 3.6.0

3

browser/Options/Classes/Life.js

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

import { isNull } from "@tsparticles/engine";
import { LifeDelay } from "./LifeDelay.js";

@@ -10,3 +11,3 @@ import { LifeDuration } from "./LifeDuration.js";

load(data) {
if (!data) {
if (isNull(data)) {
return;

@@ -13,0 +14,0 @@ }

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

import { ValueWithRandom } from "@tsparticles/engine";
import { ValueWithRandom, isNull } from "@tsparticles/engine";
export class LifeDelay extends ValueWithRandom {

@@ -8,3 +8,3 @@ constructor() {

load(data) {
if (!data) {
if (isNull(data)) {
return;

@@ -11,0 +11,0 @@ }

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

import { ValueWithRandom } from "@tsparticles/engine";
import { ValueWithRandom, isNull } from "@tsparticles/engine";
export class LifeDuration extends ValueWithRandom {

@@ -8,3 +8,3 @@ constructor() {

load(data) {
if (!data) {
if (isNull(data)) {
return;

@@ -11,0 +11,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Life = void 0;
const engine_1 = require("@tsparticles/engine");
const LifeDelay_js_1 = require("./LifeDelay.js");

@@ -13,3 +14,3 @@ const LifeDuration_js_1 = require("./LifeDuration.js");

load(data) {
if (!data) {
if ((0, engine_1.isNull)(data)) {
return;

@@ -16,0 +17,0 @@ }

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

load(data) {
if (!data) {
if ((0, engine_1.isNull)(data)) {
return;

@@ -14,0 +14,0 @@ }

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

load(data) {
if (!data) {
if ((0, engine_1.isNull)(data)) {
return;

@@ -14,0 +14,0 @@ }

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

import { isNull } from "@tsparticles/engine";
import { LifeDelay } from "./LifeDelay.js";

@@ -10,3 +11,3 @@ import { LifeDuration } from "./LifeDuration.js";

load(data) {
if (!data) {
if (isNull(data)) {
return;

@@ -13,0 +14,0 @@ }

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

import { ValueWithRandom } from "@tsparticles/engine";
import { ValueWithRandom, isNull } from "@tsparticles/engine";
export class LifeDelay extends ValueWithRandom {

@@ -8,3 +8,3 @@ constructor() {

load(data) {
if (!data) {
if (isNull(data)) {
return;

@@ -11,0 +11,0 @@ }

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

import { ValueWithRandom } from "@tsparticles/engine";
import { ValueWithRandom, isNull } from "@tsparticles/engine";
export class LifeDuration extends ValueWithRandom {

@@ -8,3 +8,3 @@ constructor() {

load(data) {
if (!data) {
if (isNull(data)) {
return;

@@ -11,0 +11,0 @@ }

{
"name": "@tsparticles/updater-life",
"version": "3.6.0-beta.1",
"version": "3.6.0",
"description": "tsParticles particles life updater",

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

"dependencies": {
"@tsparticles/engine": "^3.6.0-beta.1"
"@tsparticles/engine": "^3.6.0"
},

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

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

* How to use? : Check the GitHub README
* v3.6.0-beta.1
* v3.6.0
*/

@@ -48,3 +48,3 @@ /*

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Life: () => (/* binding */ Life)\n/* harmony export */ });\n/* harmony import */ var _LifeDelay_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LifeDelay.js */ \"./dist/browser/Options/Classes/LifeDelay.js\");\n/* harmony import */ var _LifeDuration_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LifeDuration.js */ \"./dist/browser/Options/Classes/LifeDuration.js\");\n\n\nclass Life {\n constructor() {\n this.count = 0;\n this.delay = new _LifeDelay_js__WEBPACK_IMPORTED_MODULE_0__.LifeDelay();\n this.duration = new _LifeDuration_js__WEBPACK_IMPORTED_MODULE_1__.LifeDuration();\n }\n load(data) {\n if (!data) {\n return;\n }\n if (data.count !== undefined) {\n this.count = data.count;\n }\n this.delay.load(data.delay);\n this.duration.load(data.duration);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-life/./dist/browser/Options/Classes/Life.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Life: () => (/* binding */ Life)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _LifeDelay_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LifeDelay.js */ \"./dist/browser/Options/Classes/LifeDelay.js\");\n/* harmony import */ var _LifeDuration_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./LifeDuration.js */ \"./dist/browser/Options/Classes/LifeDuration.js\");\n\n\n\nclass Life {\n constructor() {\n this.count = 0;\n this.delay = new _LifeDelay_js__WEBPACK_IMPORTED_MODULE_1__.LifeDelay();\n this.duration = new _LifeDuration_js__WEBPACK_IMPORTED_MODULE_2__.LifeDuration();\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.count !== undefined) {\n this.count = data.count;\n }\n this.delay.load(data.delay);\n this.duration.load(data.duration);\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-life/./dist/browser/Options/Classes/Life.js?");

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

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LifeDelay: () => (/* binding */ LifeDelay)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass LifeDelay extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n constructor() {\n super();\n this.sync = false;\n }\n load(data) {\n if (!data) {\n return;\n }\n super.load(data);\n if (data.sync !== undefined) {\n this.sync = data.sync;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-life/./dist/browser/Options/Classes/LifeDelay.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LifeDelay: () => (/* binding */ LifeDelay)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass LifeDelay extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n constructor() {\n super();\n this.sync = false;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n super.load(data);\n if (data.sync !== undefined) {\n this.sync = data.sync;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-life/./dist/browser/Options/Classes/LifeDelay.js?");

@@ -70,3 +70,3 @@ /***/ }),

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LifeDuration: () => (/* binding */ LifeDuration)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass LifeDuration extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n constructor() {\n super();\n this.sync = false;\n }\n load(data) {\n if (!data) {\n return;\n }\n super.load(data);\n if (data.sync !== undefined) {\n this.sync = data.sync;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-life/./dist/browser/Options/Classes/LifeDuration.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LifeDuration: () => (/* binding */ LifeDuration)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__);\n\nclass LifeDuration extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n constructor() {\n super();\n this.sync = false;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n super.load(data);\n if (data.sync !== undefined) {\n this.sync = data.sync;\n }\n }\n}\n\n//# sourceURL=webpack://@tsparticles/updater-life/./dist/browser/Options/Classes/LifeDuration.js?");

@@ -73,0 +73,0 @@ /***/ }),

/*! For license information please see tsparticles.updater.life.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 n="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var i in n)("object"==typeof exports?exports:e)[i]=n[i]}}(this,(e=>(()=>{var t={303:t=>{t.exports=e}},n={};function i(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,i),a.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};i.r(o),i.d(o,{loadLifeUpdater:()=>c});var a=i(303);class r extends a.ValueWithRandom{constructor(){super(),this.sync=!1}load(e){e&&(super.load(e),void 0!==e.sync&&(this.sync=e.sync))}}class s extends a.ValueWithRandom{constructor(){super(),this.sync=!1}load(e){e&&(super.load(e),void 0!==e.sync&&(this.sync=e.sync))}}class l{constructor(){this.count=0,this.delay=new r,this.duration=new s}load(e){e&&(void 0!==e.count&&(this.count=e.count),this.delay.load(e.delay),this.duration.load(e.duration))}}class d{constructor(e){this.container=e}init(e){const t=this.container,n=e.options.life;n&&(e.life={delay:t.retina.reduceFactor?(0,a.getRangeValue)(n.delay.value)*(n.delay.sync?1:(0,a.getRandom)())/t.retina.reduceFactor*a.millisecondsToSeconds:0,delayTime:0,duration:t.retina.reduceFactor?(0,a.getRangeValue)(n.duration.value)*(n.duration.sync?1:(0,a.getRandom)())/t.retina.reduceFactor*a.millisecondsToSeconds:0,time:0,count:n.count},e.life.duration<=0&&(e.life.duration=-1),e.life.count<=0&&(e.life.count=-1),e.life&&(e.spawning=e.life.delay>0))}isEnabled(e){return!e.destroyed}loadOptions(e,...t){e.life||(e.life=new l);for(const n of t)e.life.load(n?.life)}update(e,t){this.isEnabled(e)&&e.life&&function(e,t,n){if(!e.life)return;const i=e.life;let o=!1;if(e.spawning){if(i.delayTime+=t.value,!(i.delayTime>=e.life.delay))return;o=!0,e.spawning=!1,i.delayTime=0,i.time=0}if(-1===i.duration)return;if(e.spawning)return;if(o?i.time=0:i.time+=t.value,i.time<i.duration)return;if(i.time=0,e.life.count>0&&e.life.count--,0===e.life.count)return void e.destroy();const r=(0,a.setRangeValue)(0,n.width),s=(0,a.setRangeValue)(0,n.width);e.position.x=(0,a.randomInRange)(r),e.position.y=(0,a.randomInRange)(s),e.spawning=!0,i.delayTime=0,i.time=0,e.reset();const l=e.options.life;l&&(i.delay=(0,a.getRangeValue)(l.delay.value)*a.millisecondsToSeconds,i.duration=(0,a.getRangeValue)(l.duration.value)*a.millisecondsToSeconds)}(e,t,this.container.canvas.size)}}async function c(e,t=!0){await e.addParticleUpdater("life",(async e=>Promise.resolve(new d(e))),t)}return 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 n="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var i in n)("object"==typeof exports?exports:e)[i]=n[i]}}(this,(e=>(()=>{var t={303:t=>{t.exports=e}},n={};function i(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,i),a.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};i.r(o),i.d(o,{loadLifeUpdater:()=>c});var a=i(303);class r extends a.ValueWithRandom{constructor(){super(),this.sync=!1}load(e){(0,a.isNull)(e)||(super.load(e),void 0!==e.sync&&(this.sync=e.sync))}}class s extends a.ValueWithRandom{constructor(){super(),this.sync=!1}load(e){(0,a.isNull)(e)||(super.load(e),void 0!==e.sync&&(this.sync=e.sync))}}class l{constructor(){this.count=0,this.delay=new r,this.duration=new s}load(e){(0,a.isNull)(e)||(void 0!==e.count&&(this.count=e.count),this.delay.load(e.delay),this.duration.load(e.duration))}}class d{constructor(e){this.container=e}init(e){const t=this.container,n=e.options.life;n&&(e.life={delay:t.retina.reduceFactor?(0,a.getRangeValue)(n.delay.value)*(n.delay.sync?1:(0,a.getRandom)())/t.retina.reduceFactor*a.millisecondsToSeconds:0,delayTime:0,duration:t.retina.reduceFactor?(0,a.getRangeValue)(n.duration.value)*(n.duration.sync?1:(0,a.getRandom)())/t.retina.reduceFactor*a.millisecondsToSeconds:0,time:0,count:n.count},e.life.duration<=0&&(e.life.duration=-1),e.life.count<=0&&(e.life.count=-1),e.life&&(e.spawning=e.life.delay>0))}isEnabled(e){return!e.destroyed}loadOptions(e,...t){e.life||(e.life=new l);for(const n of t)e.life.load(n?.life)}update(e,t){this.isEnabled(e)&&e.life&&function(e,t,n){if(!e.life)return;const i=e.life;let o=!1;if(e.spawning){if(i.delayTime+=t.value,!(i.delayTime>=e.life.delay))return;o=!0,e.spawning=!1,i.delayTime=0,i.time=0}if(-1===i.duration)return;if(e.spawning)return;if(o?i.time=0:i.time+=t.value,i.time<i.duration)return;if(i.time=0,e.life.count>0&&e.life.count--,0===e.life.count)return void e.destroy();const r=(0,a.setRangeValue)(0,n.width),s=(0,a.setRangeValue)(0,n.width);e.position.x=(0,a.randomInRange)(r),e.position.y=(0,a.randomInRange)(s),e.spawning=!0,i.delayTime=0,i.time=0,e.reset();const l=e.options.life;l&&(i.delay=(0,a.getRangeValue)(l.delay.value)*a.millisecondsToSeconds,i.duration=(0,a.getRangeValue)(l.duration.value)*a.millisecondsToSeconds)}(e,t,this.container.canvas.size)}}async function c(e,t=!0){await e.addParticleUpdater("life",(async e=>Promise.resolve(new d(e))),t)}return o})()));

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

/*! tsParticles Life Updater v3.6.0-beta.1 by Matteo Bruni */
/*! tsParticles Life Updater v3.6.0 by Matteo Bruni */

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

import type { IOptionLoader, RecursivePartial } from "@tsparticles/engine";
import { type IOptionLoader, type RecursivePartial } from "@tsparticles/engine";
import type { ILife } from "../Interfaces/ILife.js";

@@ -3,0 +3,0 @@ import { LifeDelay } from "./LifeDelay.js";

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

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "./LifeDelay.js", "./LifeDuration.js"], factory);
define(["require", "exports", "@tsparticles/engine", "./LifeDelay.js", "./LifeDuration.js"], factory);
}

@@ -14,2 +14,3 @@ })(function (require, exports) {

exports.Life = void 0;
const engine_1 = require("@tsparticles/engine");
const LifeDelay_js_1 = require("./LifeDelay.js");

@@ -24,3 +25,3 @@ const LifeDuration_js_1 = require("./LifeDuration.js");

load(data) {
if (!data) {
if ((0, engine_1.isNull)(data)) {
return;

@@ -27,0 +28,0 @@ }

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

load(data) {
if (!data) {
if ((0, engine_1.isNull)(data)) {
return;

@@ -23,0 +23,0 @@ }

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

load(data) {
if (!data) {
if ((0, engine_1.isNull)(data)) {
return;

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