Socket
Socket
Sign inDemoInstall

tsparticles-updater-stroke-color

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

Comparing version 2.0.6 to 2.1.0

21

browser/StrokeColorUpdater.js

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

import { colorToHsl, getHslAnimationFromHsl, itemFromArray, randomInRange } from "tsparticles-engine";
import { getHslAnimationFromHsl, itemFromArray, randomInRange, rangeColorToHsl, } from "tsparticles-engine";
function updateColorValue(delta, value, valueAnimation, max, decrease) {
var _a;
var _a, _b;
const colorValue = value;

@@ -8,8 +8,7 @@ if (!colorValue || !colorValue.enable) {

}
const offset = randomInRange(valueAnimation.offset);
const velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6;
if (!decrease || colorValue.status === 0 /* increasing */) {
const offset = randomInRange(valueAnimation.offset), velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6, decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
if (!decrease || colorValue.status === 0 /* AnimationStatus.increasing */) {
colorValue.value += velocity;
if (decrease && colorValue.value > max) {
colorValue.status = 1 /* decreasing */;
colorValue.status = 1 /* AnimationStatus.decreasing */;
colorValue.value -= colorValue.value % max;

@@ -21,6 +20,9 @@ }

if (colorValue.value < 0) {
colorValue.status = 0 /* increasing */;
colorValue.status = 0 /* AnimationStatus.increasing */;
colorValue.value += colorValue.value;
}
}
if (colorValue.velocity && decay !== 1) {
colorValue.velocity *= decay;
}
if (colorValue.value > max) {

@@ -35,4 +37,3 @@ colorValue.value %= max;

}
const animationOptions = particle.stroke.color.animation;
const h = (_c = (_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h) !== null && _c !== void 0 ? _c : (_d = particle.color) === null || _d === void 0 ? void 0 : _d.h;
const animationOptions = particle.stroke.color.animation, h = (_c = (_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h) !== null && _c !== void 0 ? _c : (_d = particle.color) === null || _d === void 0 ? void 0 : _d.h;
if (h) {

@@ -63,3 +64,3 @@ updateColorValue(delta, h, animationOptions.h, 360, false);

particle.strokeWidth = particle.stroke.width * container.retina.pixelRatio;
const strokeHslColor = (_a = colorToHsl(particle.stroke.color)) !== null && _a !== void 0 ? _a : particle.getFillColor();
const strokeHslColor = (_a = rangeColorToHsl(particle.stroke.color)) !== null && _a !== void 0 ? _a : particle.getFillColor();
if (strokeHslColor) {

@@ -66,0 +67,0 @@ particle.strokeColor = getHslAnimationFromHsl(strokeHslColor, (_b = particle.stroke.color) === null || _b === void 0 ? void 0 : _b.animation, container.retina.reduceFactor);

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

function updateColorValue(delta, value, valueAnimation, max, decrease) {
var _a;
var _a, _b;
const colorValue = value;

@@ -12,4 +12,3 @@ if (!colorValue || !colorValue.enable) {

}
const offset = (0, tsparticles_engine_1.randomInRange)(valueAnimation.offset);
const velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6;
const offset = (0, tsparticles_engine_1.randomInRange)(valueAnimation.offset), velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6, decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
if (!decrease || colorValue.status === 0) {

@@ -29,2 +28,5 @@ colorValue.value += velocity;

}
if (colorValue.velocity && decay !== 1) {
colorValue.velocity *= decay;
}
if (colorValue.value > max) {

@@ -39,4 +41,3 @@ colorValue.value %= max;

}
const animationOptions = particle.stroke.color.animation;
const h = (_c = (_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h) !== null && _c !== void 0 ? _c : (_d = particle.color) === null || _d === void 0 ? void 0 : _d.h;
const animationOptions = particle.stroke.color.animation, h = (_c = (_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h) !== null && _c !== void 0 ? _c : (_d = particle.color) === null || _d === void 0 ? void 0 : _d.h;
if (h) {

@@ -66,3 +67,3 @@ updateColorValue(delta, h, animationOptions.h, 360, false);

particle.strokeWidth = particle.stroke.width * container.retina.pixelRatio;
const strokeHslColor = (_a = (0, tsparticles_engine_1.colorToHsl)(particle.stroke.color)) !== null && _a !== void 0 ? _a : particle.getFillColor();
const strokeHslColor = (_a = (0, tsparticles_engine_1.rangeColorToHsl)(particle.stroke.color)) !== null && _a !== void 0 ? _a : particle.getFillColor();
if (strokeHslColor) {

@@ -69,0 +70,0 @@ particle.strokeColor = (0, tsparticles_engine_1.getHslAnimationFromHsl)(strokeHslColor, (_b = particle.stroke.color) === null || _b === void 0 ? void 0 : _b.animation, container.retina.reduceFactor);

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

import { colorToHsl, getHslAnimationFromHsl, itemFromArray, randomInRange } from "tsparticles-engine";
import { getHslAnimationFromHsl, itemFromArray, randomInRange, rangeColorToHsl, } from "tsparticles-engine";
function updateColorValue(delta, value, valueAnimation, max, decrease) {
var _a;
var _a, _b;
const colorValue = value;

@@ -8,4 +8,3 @@ if (!colorValue || !colorValue.enable) {

}
const offset = randomInRange(valueAnimation.offset);
const velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6;
const offset = randomInRange(valueAnimation.offset), velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6, decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
if (!decrease || colorValue.status === 0) {

@@ -25,2 +24,5 @@ colorValue.value += velocity;

}
if (colorValue.velocity && decay !== 1) {
colorValue.velocity *= decay;
}
if (colorValue.value > max) {

@@ -35,4 +37,3 @@ colorValue.value %= max;

}
const animationOptions = particle.stroke.color.animation;
const h = (_c = (_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h) !== null && _c !== void 0 ? _c : (_d = particle.color) === null || _d === void 0 ? void 0 : _d.h;
const animationOptions = particle.stroke.color.animation, h = (_c = (_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h) !== null && _c !== void 0 ? _c : (_d = particle.color) === null || _d === void 0 ? void 0 : _d.h;
if (h) {

@@ -62,3 +63,3 @@ updateColorValue(delta, h, animationOptions.h, 360, false);

particle.strokeWidth = particle.stroke.width * container.retina.pixelRatio;
const strokeHslColor = (_a = colorToHsl(particle.stroke.color)) !== null && _a !== void 0 ? _a : particle.getFillColor();
const strokeHslColor = (_a = rangeColorToHsl(particle.stroke.color)) !== null && _a !== void 0 ? _a : particle.getFillColor();
if (strokeHslColor) {

@@ -65,0 +66,0 @@ particle.strokeColor = getHslAnimationFromHsl(strokeHslColor, (_b = particle.stroke.color) === null || _b === void 0 ? void 0 : _b.animation, container.retina.reduceFactor);

{
"name": "tsparticles-updater-stroke-color",
"version": "2.0.6",
"version": "2.1.0",
"description": "tsParticles particles stroke color updater",

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

"dependencies": {
"tsparticles-engine": "^2.0.6"
"tsparticles-engine": "^2.1.0"
}
}

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

* How to use? : Check the GitHub README
* v2.0.6
* v2.1.0
*/

@@ -104,3 +104,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

function updateColorValue(delta, value, valueAnimation, max, decrease) {
var _a;
var _a, _b;

@@ -113,7 +113,8 @@ const colorValue = value;

const offset = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.randomInRange)(valueAnimation.offset);
const velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6;
const offset = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.randomInRange)(valueAnimation.offset),
velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6,
decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
if (!decrease || colorValue.status === 0
/* increasing */
/* AnimationStatus.increasing */
) {

@@ -124,3 +125,3 @@ colorValue.value += velocity;

colorValue.status = 1
/* decreasing */
/* AnimationStatus.decreasing */
;

@@ -134,3 +135,3 @@ colorValue.value -= colorValue.value % max;

colorValue.status = 0
/* increasing */
/* AnimationStatus.increasing */
;

@@ -141,2 +142,6 @@ colorValue.value += colorValue.value;

if (colorValue.velocity && decay !== 1) {
colorValue.velocity *= decay;
}
if (colorValue.value > max) {

@@ -154,4 +159,4 @@ colorValue.value %= max;

const animationOptions = particle.stroke.color.animation;
const h = (_c = (_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h) !== null && _c !== void 0 ? _c : (_d = particle.color) === null || _d === void 0 ? void 0 : _d.h;
const animationOptions = particle.stroke.color.animation,
h = (_c = (_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h) !== null && _c !== void 0 ? _c : (_d = particle.color) === null || _d === void 0 ? void 0 : _d.h;

@@ -188,3 +193,3 @@ if (h) {

particle.strokeWidth = particle.stroke.width * container.retina.pixelRatio;
const strokeHslColor = (_a = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.colorToHsl)(particle.stroke.color)) !== null && _a !== void 0 ? _a : particle.getFillColor();
const strokeHslColor = (_a = (0,external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.rangeColorToHsl)(particle.stroke.color)) !== null && _a !== void 0 ? _a : particle.getFillColor();

@@ -191,0 +196,0 @@ if (strokeHslColor) {

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

/*! tsParticles Stroke Color Updater v2.0.6 by Matteo Bruni */
!function(o,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 t="object"==typeof exports?e(require("tsparticles-engine")):e(o.window);for(var r in t)("object"==typeof exports?exports:o)[r]=t[r]}}(this,(o=>(()=>{"use strict";var e={818:e=>{e.exports=o}},t={};function r(o){var i=t[o];if(void 0!==i)return i.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,r),l.exports}r.d=(o,e)=>{for(var t in e)r.o(e,t)&&!r.o(o,t)&&Object.defineProperty(o,t,{enumerable:!0,get:e[t]})},r.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),r.r=o=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})};var i={};return(()=>{r.r(i),r.d(i,{loadStrokeColorUpdater:()=>l});var o=r(818);function e(e,t,r,i,l){var n;const s=t;if(!s||!s.enable)return;const a=(0,o.randomInRange)(r.offset),d=(null!==(n=t.velocity)&&void 0!==n?n:0)*e.factor+3.6*a;l&&0!==s.status?(s.value-=d,s.value<0&&(s.status=0,s.value+=s.value)):(s.value+=d,l&&s.value>i&&(s.status=1,s.value-=s.value%i)),s.value>i&&(s.value%=i)}class t{constructor(o){this.container=o}init(e){var t,r;const i=this.container;e.stroke=e.options.stroke instanceof Array?(0,o.itemFromArray)(e.options.stroke,e.id,e.options.reduceDuplicates):e.options.stroke,e.strokeWidth=e.stroke.width*i.retina.pixelRatio;const l=null!==(t=(0,o.colorToHsl)(e.stroke.color))&&void 0!==t?t:e.getFillColor();l&&(e.strokeColor=(0,o.getHslAnimationFromHsl)(l,null===(r=e.stroke.color)||void 0===r?void 0:r.animation,i.retina.reduceFactor))}isEnabled(o){var e,t,r,i;const l=null===(e=o.stroke)||void 0===e?void 0:e.color;return!o.destroyed&&!o.spawning&&!!l&&(void 0!==(null===(t=o.strokeColor)||void 0===t?void 0:t.h.value)&&l.animation.h.enable||void 0!==(null===(r=o.strokeColor)||void 0===r?void 0:r.s.value)&&l.animation.s.enable||void 0!==(null===(i=o.strokeColor)||void 0===i?void 0:i.l.value)&&l.animation.l.enable)}update(o,t){this.isEnabled(o)&&function(o,t){var r,i,l,n,s,a,d,u,v,c;if(!(null===(r=o.stroke)||void 0===r?void 0:r.color))return;const p=o.stroke.color.animation,f=null!==(l=null===(i=o.strokeColor)||void 0===i?void 0:i.h)&&void 0!==l?l:null===(n=o.color)||void 0===n?void 0:n.h;f&&e(t,f,p.h,360,!1);const k=null!==(a=null===(s=o.strokeColor)||void 0===s?void 0:s.s)&&void 0!==a?a:null===(d=o.color)||void 0===d?void 0:d.s;k&&e(t,k,p.s,100,!0);const y=null!==(v=null===(u=o.strokeColor)||void 0===u?void 0:u.l)&&void 0!==v?v:null===(c=o.color)||void 0===c?void 0:c.l;y&&e(t,y,p.l,100,!0)}(o,t)}}async function l(o){await o.addParticleUpdater("strokeColor",(o=>new t(o)))}})(),i})()));
/*! tsParticles Stroke Color Updater v2.1.0 by Matteo Bruni */
!function(o,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 t="object"==typeof exports?e(require("tsparticles-engine")):e(o.window);for(var r in t)("object"==typeof exports?exports:o)[r]=t[r]}}(this,(o=>(()=>{"use strict";var e={818:e=>{e.exports=o}},t={};function r(o){var i=t[o];if(void 0!==i)return i.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,r),l.exports}r.d=(o,e)=>{for(var t in e)r.o(e,t)&&!r.o(o,t)&&Object.defineProperty(o,t,{enumerable:!0,get:e[t]})},r.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),r.r=o=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})};var i={};return(()=>{r.r(i),r.d(i,{loadStrokeColorUpdater:()=>l});var o=r(818);function e(e,t,r,i,l){var n,a;const s=t;if(!s||!s.enable)return;const d=(0,o.randomInRange)(r.offset),v=(null!==(n=t.velocity)&&void 0!==n?n:0)*e.factor+3.6*d,u=null!==(a=t.decay)&&void 0!==a?a:1;l&&0!==s.status?(s.value-=v,s.value<0&&(s.status=0,s.value+=s.value)):(s.value+=v,l&&s.value>i&&(s.status=1,s.value-=s.value%i)),s.velocity&&1!==u&&(s.velocity*=u),s.value>i&&(s.value%=i)}class t{constructor(o){this.container=o}init(e){var t,r;const i=this.container;e.stroke=e.options.stroke instanceof Array?(0,o.itemFromArray)(e.options.stroke,e.id,e.options.reduceDuplicates):e.options.stroke,e.strokeWidth=e.stroke.width*i.retina.pixelRatio;const l=null!==(t=(0,o.rangeColorToHsl)(e.stroke.color))&&void 0!==t?t:e.getFillColor();l&&(e.strokeColor=(0,o.getHslAnimationFromHsl)(l,null===(r=e.stroke.color)||void 0===r?void 0:r.animation,i.retina.reduceFactor))}isEnabled(o){var e,t,r,i;const l=null===(e=o.stroke)||void 0===e?void 0:e.color;return!o.destroyed&&!o.spawning&&!!l&&(void 0!==(null===(t=o.strokeColor)||void 0===t?void 0:t.h.value)&&l.animation.h.enable||void 0!==(null===(r=o.strokeColor)||void 0===r?void 0:r.s.value)&&l.animation.s.enable||void 0!==(null===(i=o.strokeColor)||void 0===i?void 0:i.l.value)&&l.animation.l.enable)}update(o,t){this.isEnabled(o)&&function(o,t){var r,i,l,n,a,s,d,v,u,c;if(!(null===(r=o.stroke)||void 0===r?void 0:r.color))return;const p=o.stroke.color.animation,f=null!==(l=null===(i=o.strokeColor)||void 0===i?void 0:i.h)&&void 0!==l?l:null===(n=o.color)||void 0===n?void 0:n.h;f&&e(t,f,p.h,360,!1);const y=null!==(s=null===(a=o.strokeColor)||void 0===a?void 0:a.s)&&void 0!==s?s:null===(d=o.color)||void 0===d?void 0:d.s;y&&e(t,y,p.s,100,!0);const k=null!==(u=null===(v=o.strokeColor)||void 0===v?void 0:v.l)&&void 0!==u?u:null===(c=o.color)||void 0===c?void 0:c.l;k&&e(t,k,p.l,100,!0)}(o,t)}}async function l(o){await o.addParticleUpdater("strokeColor",(o=>new t(o)))}})(),i})()));

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

function updateColorValue(delta, value, valueAnimation, max, decrease) {
var _a;
var _a, _b;
const colorValue = value;

@@ -21,4 +21,3 @@ if (!colorValue || !colorValue.enable) {

}
const offset = (0, tsparticles_engine_1.randomInRange)(valueAnimation.offset);
const velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6;
const offset = (0, tsparticles_engine_1.randomInRange)(valueAnimation.offset), velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6, decay = (_b = value.decay) !== null && _b !== void 0 ? _b : 1;
if (!decrease || colorValue.status === 0) {

@@ -38,2 +37,5 @@ colorValue.value += velocity;

}
if (colorValue.velocity && decay !== 1) {
colorValue.velocity *= decay;
}
if (colorValue.value > max) {

@@ -48,4 +50,3 @@ colorValue.value %= max;

}
const animationOptions = particle.stroke.color.animation;
const h = (_c = (_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h) !== null && _c !== void 0 ? _c : (_d = particle.color) === null || _d === void 0 ? void 0 : _d.h;
const animationOptions = particle.stroke.color.animation, h = (_c = (_b = particle.strokeColor) === null || _b === void 0 ? void 0 : _b.h) !== null && _c !== void 0 ? _c : (_d = particle.color) === null || _d === void 0 ? void 0 : _d.h;
if (h) {

@@ -75,3 +76,3 @@ updateColorValue(delta, h, animationOptions.h, 360, false);

particle.strokeWidth = particle.stroke.width * container.retina.pixelRatio;
const strokeHslColor = (_a = (0, tsparticles_engine_1.colorToHsl)(particle.stroke.color)) !== null && _a !== void 0 ? _a : particle.getFillColor();
const strokeHslColor = (_a = (0, tsparticles_engine_1.rangeColorToHsl)(particle.stroke.color)) !== null && _a !== void 0 ? _a : particle.getFillColor();
if (strokeHslColor) {

@@ -78,0 +79,0 @@ particle.strokeColor = (0, tsparticles_engine_1.getHslAnimationFromHsl)(strokeHslColor, (_b = particle.stroke.color) === null || _b === void 0 ? void 0 : _b.animation, container.retina.reduceFactor);

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