tsparticles-updater-color
Advanced tools
Comparing version 2.6.0 to 2.7.0
@@ -5,3 +5,8 @@ import { getHslAnimationFromHsl, randomInRange, rangeColorToHsl } from "tsparticles-engine"; | ||
const colorValue = value; | ||
if (!colorValue || !valueAnimation.enable) { | ||
if (!colorValue || | ||
!valueAnimation.enable || | ||
(colorValue.loops !== undefined && | ||
colorValue.maxLoops !== undefined && | ||
colorValue.maxLoops > 0 && | ||
colorValue.loops >= colorValue.maxLoops)) { | ||
return; | ||
@@ -12,5 +17,11 @@ } | ||
colorValue.value += velocity; | ||
if (decrease && colorValue.value > max) { | ||
colorValue.status = "decreasing"; | ||
colorValue.value -= colorValue.value % max; | ||
if (colorValue.value > max) { | ||
if (!colorValue.loops) { | ||
colorValue.loops = 0; | ||
} | ||
colorValue.loops++; | ||
if (decrease) { | ||
colorValue.status = "decreasing"; | ||
colorValue.value -= colorValue.value % max; | ||
} | ||
} | ||
@@ -21,2 +32,6 @@ } | ||
if (colorValue.value < 0) { | ||
if (!colorValue.loops) { | ||
colorValue.loops = 0; | ||
} | ||
colorValue.loops++; | ||
colorValue.status = "increasing"; | ||
@@ -36,10 +51,11 @@ colorValue.value += colorValue.value; | ||
const animationOptions = particle.options.color.animation; | ||
if (((_a = particle.color) === null || _a === void 0 ? void 0 : _a.h) !== undefined) { | ||
updateColorValue(delta, particle.color.h, animationOptions.h, 360, false); | ||
const h = (_a = particle.color) === null || _a === void 0 ? void 0 : _a.h, s = (_b = particle.color) === null || _b === void 0 ? void 0 : _b.s, l = (_c = particle.color) === null || _c === void 0 ? void 0 : _c.l; | ||
if (h) { | ||
updateColorValue(delta, h, animationOptions.h, 360, false); | ||
} | ||
if (((_b = particle.color) === null || _b === void 0 ? void 0 : _b.s) !== undefined) { | ||
updateColorValue(delta, particle.color.s, animationOptions.s, 100, true); | ||
if (s) { | ||
updateColorValue(delta, s, animationOptions.s, 100, true); | ||
} | ||
if (((_c = particle.color) === null || _c === void 0 ? void 0 : _c.l) !== undefined) { | ||
updateColorValue(delta, particle.color.l, animationOptions.l, 100, true); | ||
if (l) { | ||
updateColorValue(delta, l, animationOptions.l, 100, true); | ||
} | ||
@@ -46,0 +62,0 @@ } |
@@ -8,3 +8,8 @@ "use strict"; | ||
const colorValue = value; | ||
if (!colorValue || !valueAnimation.enable) { | ||
if (!colorValue || | ||
!valueAnimation.enable || | ||
(colorValue.loops !== undefined && | ||
colorValue.maxLoops !== undefined && | ||
colorValue.maxLoops > 0 && | ||
colorValue.loops >= colorValue.maxLoops)) { | ||
return; | ||
@@ -15,5 +20,11 @@ } | ||
colorValue.value += velocity; | ||
if (decrease && colorValue.value > max) { | ||
colorValue.status = "decreasing"; | ||
colorValue.value -= colorValue.value % max; | ||
if (colorValue.value > max) { | ||
if (!colorValue.loops) { | ||
colorValue.loops = 0; | ||
} | ||
colorValue.loops++; | ||
if (decrease) { | ||
colorValue.status = "decreasing"; | ||
colorValue.value -= colorValue.value % max; | ||
} | ||
} | ||
@@ -24,2 +35,6 @@ } | ||
if (colorValue.value < 0) { | ||
if (!colorValue.loops) { | ||
colorValue.loops = 0; | ||
} | ||
colorValue.loops++; | ||
colorValue.status = "increasing"; | ||
@@ -39,10 +54,11 @@ colorValue.value += colorValue.value; | ||
const animationOptions = particle.options.color.animation; | ||
if (((_a = particle.color) === null || _a === void 0 ? void 0 : _a.h) !== undefined) { | ||
updateColorValue(delta, particle.color.h, animationOptions.h, 360, false); | ||
const h = (_a = particle.color) === null || _a === void 0 ? void 0 : _a.h, s = (_b = particle.color) === null || _b === void 0 ? void 0 : _b.s, l = (_c = particle.color) === null || _c === void 0 ? void 0 : _c.l; | ||
if (h) { | ||
updateColorValue(delta, h, animationOptions.h, 360, false); | ||
} | ||
if (((_b = particle.color) === null || _b === void 0 ? void 0 : _b.s) !== undefined) { | ||
updateColorValue(delta, particle.color.s, animationOptions.s, 100, true); | ||
if (s) { | ||
updateColorValue(delta, s, animationOptions.s, 100, true); | ||
} | ||
if (((_c = particle.color) === null || _c === void 0 ? void 0 : _c.l) !== undefined) { | ||
updateColorValue(delta, particle.color.l, animationOptions.l, 100, true); | ||
if (l) { | ||
updateColorValue(delta, l, animationOptions.l, 100, true); | ||
} | ||
@@ -49,0 +65,0 @@ } |
@@ -5,3 +5,8 @@ import { getHslAnimationFromHsl, randomInRange, rangeColorToHsl } from "tsparticles-engine"; | ||
const colorValue = value; | ||
if (!colorValue || !valueAnimation.enable) { | ||
if (!colorValue || | ||
!valueAnimation.enable || | ||
(colorValue.loops !== undefined && | ||
colorValue.maxLoops !== undefined && | ||
colorValue.maxLoops > 0 && | ||
colorValue.loops >= colorValue.maxLoops)) { | ||
return; | ||
@@ -12,5 +17,11 @@ } | ||
colorValue.value += velocity; | ||
if (decrease && colorValue.value > max) { | ||
colorValue.status = "decreasing"; | ||
colorValue.value -= colorValue.value % max; | ||
if (colorValue.value > max) { | ||
if (!colorValue.loops) { | ||
colorValue.loops = 0; | ||
} | ||
colorValue.loops++; | ||
if (decrease) { | ||
colorValue.status = "decreasing"; | ||
colorValue.value -= colorValue.value % max; | ||
} | ||
} | ||
@@ -21,2 +32,6 @@ } | ||
if (colorValue.value < 0) { | ||
if (!colorValue.loops) { | ||
colorValue.loops = 0; | ||
} | ||
colorValue.loops++; | ||
colorValue.status = "increasing"; | ||
@@ -36,10 +51,11 @@ colorValue.value += colorValue.value; | ||
const animationOptions = particle.options.color.animation; | ||
if (((_a = particle.color) === null || _a === void 0 ? void 0 : _a.h) !== undefined) { | ||
updateColorValue(delta, particle.color.h, animationOptions.h, 360, false); | ||
const h = (_a = particle.color) === null || _a === void 0 ? void 0 : _a.h, s = (_b = particle.color) === null || _b === void 0 ? void 0 : _b.s, l = (_c = particle.color) === null || _c === void 0 ? void 0 : _c.l; | ||
if (h) { | ||
updateColorValue(delta, h, animationOptions.h, 360, false); | ||
} | ||
if (((_b = particle.color) === null || _b === void 0 ? void 0 : _b.s) !== undefined) { | ||
updateColorValue(delta, particle.color.s, animationOptions.s, 100, true); | ||
if (s) { | ||
updateColorValue(delta, s, animationOptions.s, 100, true); | ||
} | ||
if (((_c = particle.color) === null || _c === void 0 ? void 0 : _c.l) !== undefined) { | ||
updateColorValue(delta, particle.color.l, animationOptions.l, 100, true); | ||
if (l) { | ||
updateColorValue(delta, l, animationOptions.l, 100, true); | ||
} | ||
@@ -46,0 +62,0 @@ } |
{ | ||
"name": "tsparticles-updater-color", | ||
"version": "2.6.0", | ||
"version": "2.7.0", | ||
"description": "tsParticles particles color updater", | ||
@@ -77,4 +77,4 @@ "homepage": "https://particles.js.org", | ||
"dependencies": { | ||
"tsparticles-engine": "^2.6.0" | ||
"tsparticles-engine": "^2.7.0" | ||
} | ||
} |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v2.6.0 | ||
* v2.7.0 | ||
*/ | ||
@@ -105,3 +105,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
const colorValue = value; | ||
if (!colorValue || !valueAnimation.enable) { | ||
if (!colorValue || !valueAnimation.enable || colorValue.loops !== undefined && colorValue.maxLoops !== undefined && colorValue.maxLoops > 0 && colorValue.loops >= colorValue.maxLoops) { | ||
return; | ||
@@ -114,5 +114,11 @@ } | ||
colorValue.value += velocity; | ||
if (decrease && colorValue.value > max) { | ||
colorValue.status = "decreasing"; | ||
colorValue.value -= colorValue.value % max; | ||
if (colorValue.value > max) { | ||
if (!colorValue.loops) { | ||
colorValue.loops = 0; | ||
} | ||
colorValue.loops++; | ||
if (decrease) { | ||
colorValue.status = "decreasing"; | ||
colorValue.value -= colorValue.value % max; | ||
} | ||
} | ||
@@ -122,2 +128,6 @@ } else { | ||
if (colorValue.value < 0) { | ||
if (!colorValue.loops) { | ||
colorValue.loops = 0; | ||
} | ||
colorValue.loops++; | ||
colorValue.status = "increasing"; | ||
@@ -137,10 +147,13 @@ colorValue.value += colorValue.value; | ||
const animationOptions = particle.options.color.animation; | ||
if (((_a = particle.color) === null || _a === void 0 ? void 0 : _a.h) !== undefined) { | ||
updateColorValue(delta, particle.color.h, animationOptions.h, 360, false); | ||
const h = (_a = particle.color) === null || _a === void 0 ? void 0 : _a.h, | ||
s = (_b = particle.color) === null || _b === void 0 ? void 0 : _b.s, | ||
l = (_c = particle.color) === null || _c === void 0 ? void 0 : _c.l; | ||
if (h) { | ||
updateColorValue(delta, h, animationOptions.h, 360, false); | ||
} | ||
if (((_b = particle.color) === null || _b === void 0 ? void 0 : _b.s) !== undefined) { | ||
updateColorValue(delta, particle.color.s, animationOptions.s, 100, true); | ||
if (s) { | ||
updateColorValue(delta, s, animationOptions.s, 100, true); | ||
} | ||
if (((_c = particle.color) === null || _c === void 0 ? void 0 : _c.l) !== undefined) { | ||
updateColorValue(delta, particle.color.l, animationOptions.l, 100, true); | ||
if (l) { | ||
updateColorValue(delta, l, animationOptions.l, 100, true); | ||
} | ||
@@ -147,0 +160,0 @@ } |
/*! For license information please see tsparticles.updater.color.min.js.LICENSE.txt */ | ||
!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={961:e=>{e.exports=o}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,r),i.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 n={};return(()=>{r.r(n),r.d(n,{loadColorUpdater:()=>i});var o=r(961);function e(e,t,r,n,i){var l,a;const s=t;if(!s||!r.enable)return;const c=(0,o.randomInRange)(r.offset),d=(null!==(l=t.velocity)&&void 0!==l?l:0)*e.factor+3.6*c,u=null!==(a=t.decay)&&void 0!==a?a:1;i&&"increasing"!==s.status?(s.value-=d,s.value<0&&(s.status="increasing",s.value+=s.value)):(s.value+=d,i&&s.value>n&&(s.status="decreasing",s.value-=s.value%n)),s.velocity&&1!==u&&(s.velocity*=u),s.value>n&&(s.value%=n)}class t{constructor(o){this.container=o}init(e){const t=(0,o.rangeColorToHsl)(e.options.color,e.id,e.options.reduceDuplicates);t&&(e.color=(0,o.getHslAnimationFromHsl)(t,e.options.color.animation,this.container.retina.reduceFactor))}isEnabled(o){var e,t,r;const n=o.options.color.animation;return!o.destroyed&&!o.spawning&&(void 0!==(null===(e=o.color)||void 0===e?void 0:e.h.value)&&n.h.enable||void 0!==(null===(t=o.color)||void 0===t?void 0:t.s.value)&&n.s.enable||void 0!==(null===(r=o.color)||void 0===r?void 0:r.l.value)&&n.l.enable)}update(o,t){!function(o,t){var r,n,i;const l=o.options.color.animation;void 0!==(null===(r=o.color)||void 0===r?void 0:r.h)&&e(t,o.color.h,l.h,360,!1),void 0!==(null===(n=o.color)||void 0===n?void 0:n.s)&&e(t,o.color.s,l.s,100,!0),void 0!==(null===(i=o.color)||void 0===i?void 0:i.l)&&e(t,o.color.l,l.l,100,!0)}(o,t)}}async function i(o){await o.addParticleUpdater("color",(o=>new t(o)))}})(),n})())); | ||
!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 n in t)("object"==typeof exports?exports:o)[n]=t[n]}}(this,(o=>(()=>{"use strict";var e={961:e=>{e.exports=o}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,n),l.exports}n.d=(o,e)=>{for(var t in e)n.o(e,t)&&!n.o(o,t)&&Object.defineProperty(o,t,{enumerable:!0,get:e[t]})},n.o=(o,e)=>Object.prototype.hasOwnProperty.call(o,e),n.r=o=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})};var r={};return(()=>{n.r(r),n.d(r,{loadColorUpdater:()=>l});var o=n(961);function e(e,t,n,r,l){var i,a;const s=t;if(!s||!n.enable||void 0!==s.loops&&void 0!==s.maxLoops&&s.maxLoops>0&&s.loops>=s.maxLoops)return;const c=(0,o.randomInRange)(n.offset),d=(null!==(i=t.velocity)&&void 0!==i?i:0)*e.factor+3.6*c,u=null!==(a=t.decay)&&void 0!==a?a:1;l&&"increasing"!==s.status?(s.value-=d,s.value<0&&(s.loops||(s.loops=0),s.loops++,s.status="increasing",s.value+=s.value)):(s.value+=d,s.value>r&&(s.loops||(s.loops=0),s.loops++,l&&(s.status="decreasing",s.value-=s.value%r))),s.velocity&&1!==u&&(s.velocity*=u),s.value>r&&(s.value%=r)}class t{constructor(o){this.container=o}init(e){const t=(0,o.rangeColorToHsl)(e.options.color,e.id,e.options.reduceDuplicates);t&&(e.color=(0,o.getHslAnimationFromHsl)(t,e.options.color.animation,this.container.retina.reduceFactor))}isEnabled(o){var e,t,n;const r=o.options.color.animation;return!o.destroyed&&!o.spawning&&(void 0!==(null===(e=o.color)||void 0===e?void 0:e.h.value)&&r.h.enable||void 0!==(null===(t=o.color)||void 0===t?void 0:t.s.value)&&r.s.enable||void 0!==(null===(n=o.color)||void 0===n?void 0:n.l.value)&&r.l.enable)}update(o,t){!function(o,t){var n,r,l;const i=o.options.color.animation,a=null===(n=o.color)||void 0===n?void 0:n.h,s=null===(r=o.color)||void 0===r?void 0:r.s,c=null===(l=o.color)||void 0===l?void 0:l.l;a&&e(t,a,i.h,360,!1),s&&e(t,s,i.s,100,!0),c&&e(t,c,i.l,100,!0)}(o,t)}}async function l(o){await o.addParticleUpdater("color",(o=>new t(o)))}})(),r})())); |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v2.6.0 | ||
* v2.7.0 | ||
*/ |
@@ -17,3 +17,8 @@ (function (factory) { | ||
const colorValue = value; | ||
if (!colorValue || !valueAnimation.enable) { | ||
if (!colorValue || | ||
!valueAnimation.enable || | ||
(colorValue.loops !== undefined && | ||
colorValue.maxLoops !== undefined && | ||
colorValue.maxLoops > 0 && | ||
colorValue.loops >= colorValue.maxLoops)) { | ||
return; | ||
@@ -24,5 +29,11 @@ } | ||
colorValue.value += velocity; | ||
if (decrease && colorValue.value > max) { | ||
colorValue.status = "decreasing"; | ||
colorValue.value -= colorValue.value % max; | ||
if (colorValue.value > max) { | ||
if (!colorValue.loops) { | ||
colorValue.loops = 0; | ||
} | ||
colorValue.loops++; | ||
if (decrease) { | ||
colorValue.status = "decreasing"; | ||
colorValue.value -= colorValue.value % max; | ||
} | ||
} | ||
@@ -33,2 +44,6 @@ } | ||
if (colorValue.value < 0) { | ||
if (!colorValue.loops) { | ||
colorValue.loops = 0; | ||
} | ||
colorValue.loops++; | ||
colorValue.status = "increasing"; | ||
@@ -48,10 +63,11 @@ colorValue.value += colorValue.value; | ||
const animationOptions = particle.options.color.animation; | ||
if (((_a = particle.color) === null || _a === void 0 ? void 0 : _a.h) !== undefined) { | ||
updateColorValue(delta, particle.color.h, animationOptions.h, 360, false); | ||
const h = (_a = particle.color) === null || _a === void 0 ? void 0 : _a.h, s = (_b = particle.color) === null || _b === void 0 ? void 0 : _b.s, l = (_c = particle.color) === null || _c === void 0 ? void 0 : _c.l; | ||
if (h) { | ||
updateColorValue(delta, h, animationOptions.h, 360, false); | ||
} | ||
if (((_b = particle.color) === null || _b === void 0 ? void 0 : _b.s) !== undefined) { | ||
updateColorValue(delta, particle.color.s, animationOptions.s, 100, true); | ||
if (s) { | ||
updateColorValue(delta, s, animationOptions.s, 100, true); | ||
} | ||
if (((_c = particle.color) === null || _c === void 0 ? void 0 : _c.l) !== undefined) { | ||
updateColorValue(delta, particle.color.l, animationOptions.l, 100, true); | ||
if (l) { | ||
updateColorValue(delta, l, animationOptions.l, 100, true); | ||
} | ||
@@ -58,0 +74,0 @@ } |
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
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
310530
574
Updatedtsparticles-engine@^2.7.0