Socket
Socket
Sign inDemoInstall

tsparticles-updater-opacity

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

Comparing version 2.0.0-beta.2 to 2.0.0-beta.3

2

index.d.ts
import type { Main } from "tsparticles-engine";
export declare function loadOpacityUpdater(tsParticles: Main): void;
export declare function loadOpacityUpdater(tsParticles: Main): Promise<void>;

@@ -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 { OpacityUpdater } from "./OpacityUpdater";
export function loadOpacityUpdater(tsParticles) {
tsParticles.addParticleUpdater("opacity", (container) => new OpacityUpdater(container));
return __awaiter(this, void 0, void 0, function* () {
yield tsParticles.addParticleUpdater("opacity", (container) => new OpacityUpdater(container));
});
}
{
"name": "tsparticles-updater-opacity",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.3",
"description": "tsParticles particles opacity 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-opacity
# tsParticles Opacity Updater
tsParticles updater opacity
[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/tsparticles-updater-opacity/badge)](https://www.jsdelivr.com/package/npm/tsparticles-updater-opacity)
[![npmjs](https://badge.fury.io/js/tsparticles-updater-opacity.svg)](https://www.npmjs.com/package/tsparticles-updater-opacity)
[![npmjs](https://img.shields.io/npm/dt/tsparticles-updater-opacity)](https://www.npmjs.com/package/tsparticles-updater-opacity)
[tsParticles](https://github.com/matteobruni/tsparticles) updater plugin for opacity 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.opacity.min.js` file will export the function to load the updater plugin:
```javascript
loadOpacityUpdater;
```
### Usage
Once the scripts are loaded you can set up `tsParticles` and the updater plugin like this:
```javascript
loadOpacityUpdater(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-opacity
```
or
```shell
$ yarn add tsparticles-updater-opacity
```
Then you need to import it in the app, like this:
```javascript
const { tsParticles } = require("tsparticles-engine");
const { loadOpacityUpdater } = require("tsparticles-updater-opacity");
loadOpacityUpdater(tsParticles);
```
or
```javascript
import { tsParticles } from "tsparticles-engine";
import { loadOpacityUpdater } from "tsparticles-updater-opacity";
loadOpacityUpdater(tsParticles);
```
import { Main } from "tsparticles-engine";
export declare function loadOpacityUpdater(tsParticles: Main): void;
export declare function loadOpacityUpdater(tsParticles: Main): Promise<void>;
import type { Main } from "tsparticles-engine";
export declare function loadOpacityUpdater(tsParticles: Main): void;
export declare function loadOpacityUpdater(tsParticles: Main): Promise<void>;
import type { Main } from "tsparticles-engine";
export declare function loadOpacityUpdater(tsParticles: Main): void;
export declare function loadOpacityUpdater(tsParticles: Main): Promise<void>;

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

* How to use? : Check the GitHub README
* v2.0.0-beta.2
* v2.0.0-beta.3
*/

@@ -239,5 +239,39 @@ (function webpackUniversalModuleDefinition(root, factory) {

;// 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 loadOpacityUpdater(tsParticles) {
tsParticles.addParticleUpdater("opacity", container => new OpacityUpdater(container));
return __awaiter(this, void 0, void 0, function* () {
yield tsParticles.addParticleUpdater("opacity", container => new OpacityUpdater(container));
});
}

@@ -244,0 +278,0 @@ })();

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

/*! tsParticles Opacity Updater v2.0.0-beta.2 by Matteo Bruni */
!function(t,a){if("object"==typeof exports&&"object"==typeof module)module.exports=a(require("tsparticles-engine"));else if("function"==typeof define&&define.amd)define(["tsparticles-engine"],a);else{var o="object"==typeof exports?a(require("tsparticles-engine")):a(t.window);for(var e in o)("object"==typeof exports?exports:t)[e]=o[e]}}(this,(function(t){return(()=>{"use strict";var a={818:a=>{a.exports=t}},o={};function e(t){var i=o[t];if(void 0!==i)return i.exports;var n=o[t]={exports:{}};return a[t](n,n.exports,e),n.exports}e.d=(t,a)=>{for(var o in a)e.o(a,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:a[o]})},e.o=(t,a)=>Object.prototype.hasOwnProperty.call(t,a),e.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{e.r(i),e.d(i,{loadOpacityUpdater:()=>n});var t=e(818);function a(a,o){var e,i,n,c,s;if(!a.opacity)return;const p=a.opacity.min,r=a.opacity.max;if(!a.destroyed&&a.opacity.enable&&((null!==(e=a.opacity.maxLoops)&&void 0!==e?e:0)<=0||(null!==(i=a.opacity.loops)&&void 0!==i?i:0)<(null!==(n=a.opacity.maxLoops)&&void 0!==n?n:0))){switch(a.opacity.status){case t.AnimationStatus.increasing:a.opacity.value>=r?(a.opacity.status=t.AnimationStatus.decreasing,a.opacity.loops||(a.opacity.loops=0),a.opacity.loops++):a.opacity.value+=(null!==(c=a.opacity.velocity)&&void 0!==c?c:0)*o.factor;break;case t.AnimationStatus.decreasing:a.opacity.value<=p?(a.opacity.status=t.AnimationStatus.increasing,a.opacity.loops||(a.opacity.loops=0),a.opacity.loops++):a.opacity.value-=(null!==(s=a.opacity.velocity)&&void 0!==s?s:0)*o.factor}!function(a,o,e,i){switch(a.options.opacity.animation.destroy){case t.DestroyType.max:o>=i&&a.destroy();break;case t.DestroyType.min:o<=e&&a.destroy()}}(a,a.opacity.value,p,r),a.destroyed||(a.opacity.value=(0,t.clamp)(a.opacity.value,p,r))}}class o{constructor(t){this.container=t}init(a){const o=a.options.opacity;a.opacity={enable:o.animation.enable,max:(0,t.getRangeMax)(o.value),min:(0,t.getRangeMin)(o.value),value:(0,t.getRangeValue)(o.value),loops:0,maxLoops:o.animation.count};const e=o.animation;if(e.enable){a.opacity.status=t.AnimationStatus.increasing;const i=o.value;switch(a.opacity.min=(0,t.getRangeMin)(i),a.opacity.max=(0,t.getRangeMax)(i),e.startValue){case t.StartValueType.min:a.opacity.value=a.opacity.min,a.opacity.status=t.AnimationStatus.increasing;break;case t.StartValueType.random:a.opacity.value=(0,t.randomInRange)(a.opacity),a.opacity.status=Math.random()>=.5?t.AnimationStatus.increasing:t.AnimationStatus.decreasing;break;case t.StartValueType.max:default:a.opacity.value=a.opacity.max,a.opacity.status=t.AnimationStatus.decreasing}a.opacity.velocity=e.speed/100*this.container.retina.reduceFactor,e.sync||(a.opacity.velocity*=Math.random())}}isEnabled(t){var a,o,e;return!t.destroyed&&!t.spawning&&!!t.opacity&&t.opacity.enable&&((null!==(a=t.opacity.maxLoops)&&void 0!==a?a:0)<=0||(null!==(o=t.opacity.loops)&&void 0!==o?o:0)<(null!==(e=t.opacity.maxLoops)&&void 0!==e?e:0))}update(t,o){this.isEnabled(t)&&a(t,o)}}function n(t){t.addParticleUpdater("opacity",(t=>new o(t)))}})(),i})()}));
/*! tsParticles Opacity Updater v2.0.0-beta.3 by Matteo Bruni */
!function(t,a){if("object"==typeof exports&&"object"==typeof module)module.exports=a(require("tsparticles-engine"));else if("function"==typeof define&&define.amd)define(["tsparticles-engine"],a);else{var o="object"==typeof exports?a(require("tsparticles-engine")):a(t.window);for(var e in o)("object"==typeof exports?exports:t)[e]=o[e]}}(this,(function(t){return(()=>{"use strict";var a={818:a=>{a.exports=t}},o={};function e(t){var i=o[t];if(void 0!==i)return i.exports;var n=o[t]={exports:{}};return a[t](n,n.exports,e),n.exports}e.d=(t,a)=>{for(var o in a)e.o(a,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:a[o]})},e.o=(t,a)=>Object.prototype.hasOwnProperty.call(t,a),e.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{e.r(i),e.d(i,{loadOpacityUpdater:()=>c});var t=e(818);function a(a,o){var e,i,n,c,s;if(!a.opacity)return;const r=a.opacity.min,p=a.opacity.max;if(!a.destroyed&&a.opacity.enable&&((null!==(e=a.opacity.maxLoops)&&void 0!==e?e:0)<=0||(null!==(i=a.opacity.loops)&&void 0!==i?i:0)<(null!==(n=a.opacity.maxLoops)&&void 0!==n?n:0))){switch(a.opacity.status){case t.AnimationStatus.increasing:a.opacity.value>=p?(a.opacity.status=t.AnimationStatus.decreasing,a.opacity.loops||(a.opacity.loops=0),a.opacity.loops++):a.opacity.value+=(null!==(c=a.opacity.velocity)&&void 0!==c?c:0)*o.factor;break;case t.AnimationStatus.decreasing:a.opacity.value<=r?(a.opacity.status=t.AnimationStatus.increasing,a.opacity.loops||(a.opacity.loops=0),a.opacity.loops++):a.opacity.value-=(null!==(s=a.opacity.velocity)&&void 0!==s?s:0)*o.factor}!function(a,o,e,i){switch(a.options.opacity.animation.destroy){case t.DestroyType.max:o>=i&&a.destroy();break;case t.DestroyType.min:o<=e&&a.destroy()}}(a,a.opacity.value,r,p),a.destroyed||(a.opacity.value=(0,t.clamp)(a.opacity.value,r,p))}}class o{constructor(t){this.container=t}init(a){const o=a.options.opacity;a.opacity={enable:o.animation.enable,max:(0,t.getRangeMax)(o.value),min:(0,t.getRangeMin)(o.value),value:(0,t.getRangeValue)(o.value),loops:0,maxLoops:o.animation.count};const e=o.animation;if(e.enable){a.opacity.status=t.AnimationStatus.increasing;const i=o.value;switch(a.opacity.min=(0,t.getRangeMin)(i),a.opacity.max=(0,t.getRangeMax)(i),e.startValue){case t.StartValueType.min:a.opacity.value=a.opacity.min,a.opacity.status=t.AnimationStatus.increasing;break;case t.StartValueType.random:a.opacity.value=(0,t.randomInRange)(a.opacity),a.opacity.status=Math.random()>=.5?t.AnimationStatus.increasing:t.AnimationStatus.decreasing;break;case t.StartValueType.max:default:a.opacity.value=a.opacity.max,a.opacity.status=t.AnimationStatus.decreasing}a.opacity.velocity=e.speed/100*this.container.retina.reduceFactor,e.sync||(a.opacity.velocity*=Math.random())}}isEnabled(t){var a,o,e;return!t.destroyed&&!t.spawning&&!!t.opacity&&t.opacity.enable&&((null!==(a=t.opacity.maxLoops)&&void 0!==a?a:0)<=0||(null!==(o=t.opacity.loops)&&void 0!==o?o:0)<(null!==(e=t.opacity.maxLoops)&&void 0!==e?e:0))}update(t,o){this.isEnabled(t)&&a(t,o)}}var n=function(t,a,o,e){return new(o||(o=Promise))((function(i,n){function c(t){try{r(e.next(t))}catch(t){n(t)}}function s(t){try{r(e.throw(t))}catch(t){n(t)}}function r(t){var a;t.done?i(t.value):(a=t.value,a instanceof o?a:new o((function(t){t(a)}))).then(c,s)}r((e=e.apply(t,a||[])).next())}))};function c(t){return n(this,void 0,void 0,(function*(){yield t.addParticleUpdater("opacity",(t=>new o(t)))}))}})(),i})()}));

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