tsparticles-updater-color
Advanced tools
Comparing version 2.0.0-beta.4 to 2.0.0-beta.5
@@ -1,2 +0,2 @@ | ||
import { AnimationStatus, colorToHsl, getHslAnimationFromHsl, randomInRange } from "tsparticles-engine"; | ||
import { colorToHsl, getHslAnimationFromHsl, randomInRange } from "tsparticles-engine"; | ||
function updateColorValue(delta, value, valueAnimation, max, decrease) { | ||
@@ -10,6 +10,6 @@ var _a; | ||
const velocity = ((_a = value.velocity) !== null && _a !== void 0 ? _a : 0) * delta.factor + offset * 3.6; | ||
if (!decrease || colorValue.status === AnimationStatus.increasing) { | ||
if (!decrease || colorValue.status === 0) { | ||
colorValue.value += velocity; | ||
if (decrease && colorValue.value > max) { | ||
colorValue.status = AnimationStatus.decreasing; | ||
colorValue.status = 1; | ||
colorValue.value -= colorValue.value % max; | ||
@@ -21,3 +21,3 @@ } | ||
if (colorValue.value < 0) { | ||
colorValue.status = AnimationStatus.increasing; | ||
colorValue.status = 0; | ||
colorValue.value += colorValue.value; | ||
@@ -24,0 +24,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { Main } from "tsparticles-engine"; | ||
export declare function loadColorUpdater(tsParticles: Main): Promise<void>; | ||
import type { Engine } from "tsparticles-engine"; | ||
export declare function loadColorUpdater(engine: Engine): Promise<void>; |
@@ -11,6 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { ColorUpdater } from "./ColorUpdater"; | ||
export function loadColorUpdater(tsParticles) { | ||
export function loadColorUpdater(engine) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield tsParticles.addParticleUpdater("color", (container) => new ColorUpdater(container)); | ||
yield engine.addParticleUpdater("color", (container) => new ColorUpdater(container)); | ||
}); | ||
} |
{ | ||
"name": "tsparticles-updater-color", | ||
"version": "2.0.0-beta.4", | ||
"version": "2.0.0-beta.5", | ||
"description": "tsParticles particles color updater", | ||
@@ -48,4 +48,4 @@ "homepage": "https://particles.js.org/", | ||
"dependencies": { | ||
"tsparticles-engine": "^2.0.0-beta.3" | ||
"tsparticles-engine": "^2.0.0-beta.4" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Main } from "tsparticles-engine"; | ||
export declare function loadColorUpdater(tsParticles: Main): Promise<void>; | ||
import { Engine } from "tsparticles-engine"; | ||
export declare function loadColorUpdater(engine: Engine): Promise<void>; |
@@ -1,2 +0,2 @@ | ||
import type { Main } from "tsparticles-engine"; | ||
export declare function loadColorUpdater(tsParticles: Main): Promise<void>; | ||
import type { Engine } from "tsparticles-engine"; | ||
export declare function loadColorUpdater(engine: Engine): Promise<void>; |
@@ -1,2 +0,2 @@ | ||
import type { Main } from "tsparticles-engine"; | ||
export declare function loadColorUpdater(tsParticles: Main): Promise<void>; | ||
import type { Engine } from "tsparticles-engine"; | ||
export declare function loadColorUpdater(engine: Engine): Promise<void>; |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v2.0.0-beta.4 | ||
* v2.0.0-beta.5 | ||
*/ | ||
@@ -115,7 +115,7 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
if (!decrease || colorValue.status === external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.AnimationStatus.increasing) { | ||
if (!decrease || colorValue.status === 0) { | ||
colorValue.value += velocity; | ||
if (decrease && colorValue.value > max) { | ||
colorValue.status = external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.AnimationStatus.decreasing; | ||
colorValue.status = 1; | ||
colorValue.value -= colorValue.value % max; | ||
@@ -127,3 +127,3 @@ } | ||
if (colorValue.value < 0) { | ||
colorValue.status = external_commonjs_tsparticles_engine_commonjs2_tsparticles_engine_amd_tsparticles_engine_root_window_.AnimationStatus.increasing; | ||
colorValue.status = 0; | ||
colorValue.value += colorValue.value; | ||
@@ -215,5 +215,5 @@ } | ||
function loadColorUpdater(tsParticles) { | ||
function loadColorUpdater(engine) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield tsParticles.addParticleUpdater("color", container => new ColorUpdater(container)); | ||
yield engine.addParticleUpdater("color", container => new ColorUpdater(container)); | ||
}); | ||
@@ -220,0 +220,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/*! tsParticles Color Updater v2.0.0-beta.4 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 n in t)("object"==typeof exports?exports:o)[n]=t[n]}}(this,(function(o){return(()=>{"use strict";var e={818:e=>{e.exports=o}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.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 i={};return(()=>{n.r(i),n.d(i,{loadColorUpdater:()=>a});var o=n(818);function e(e,t,n,i,r){var a;const l=t;if(!l||!n.enable)return;const c=(0,o.randomInRange)(n.offset),s=(null!==(a=t.velocity)&&void 0!==a?a:0)*e.factor+3.6*c;r&&l.status!==o.AnimationStatus.increasing?(l.value-=s,l.value<0&&(l.status=o.AnimationStatus.increasing,l.value+=l.value)):(l.value+=s,r&&l.value>i&&(l.status=o.AnimationStatus.decreasing,l.value-=l.value%i)),l.value>i&&(l.value%=i)}class t{constructor(o){this.container=o}init(e){const t=(0,o.colorToHsl)(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 i=o.options.color.animation;return!o.destroyed&&!o.spawning&&(void 0!==(null===(e=o.color)||void 0===e?void 0:e.h.value)&&i.h.enable||void 0!==(null===(t=o.color)||void 0===t?void 0:t.s.value)&&i.s.enable||void 0!==(null===(n=o.color)||void 0===n?void 0:n.l.value)&&i.l.enable)}update(o,t){!function(o,t){var n,i,r;const a=o.options.color.animation;void 0!==(null===(n=o.color)||void 0===n?void 0:n.h)&&e(t,o.color.h,a.h,360,!1),void 0!==(null===(i=o.color)||void 0===i?void 0:i.s)&&e(t,o.color.s,a.s,100,!0),void 0!==(null===(r=o.color)||void 0===r?void 0:r.l)&&e(t,o.color.l,a.l,100,!0)}(o,t)}}var r=function(o,e,t,n){return new(t||(t=Promise))((function(i,r){function a(o){try{c(n.next(o))}catch(o){r(o)}}function l(o){try{c(n.throw(o))}catch(o){r(o)}}function c(o){var e;o.done?i(o.value):(e=o.value,e instanceof t?e:new t((function(o){o(e)}))).then(a,l)}c((n=n.apply(o,e||[])).next())}))};function a(o){return r(this,void 0,void 0,(function*(){yield o.addParticleUpdater("color",(o=>new t(o)))}))}})(),i})()})); | ||
/*! tsParticles Color Updater v2.0.0-beta.5 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 n in t)("object"==typeof exports?exports:o)[n]=t[n]}}(this,(function(o){return(()=>{"use strict";var e={818:e=>{e.exports=o}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.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(818);function e(e,t,n,r,i){var l;const a=t;if(!a||!n.enable)return;const c=(0,o.randomInRange)(n.offset),u=(null!==(l=t.velocity)&&void 0!==l?l:0)*e.factor+3.6*c;i&&0!==a.status?(a.value-=u,a.value<0&&(a.status=0,a.value+=a.value)):(a.value+=u,i&&a.value>r&&(a.status=1,a.value-=a.value%r)),a.value>r&&(a.value%=r)}class t{constructor(o){this.container=o}init(e){const t=(0,o.colorToHsl)(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,i;const l=o.options.color.animation;void 0!==(null===(n=o.color)||void 0===n?void 0:n.h)&&e(t,o.color.h,l.h,360,!1),void 0!==(null===(r=o.color)||void 0===r?void 0:r.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)}}var i=function(o,e,t,n){return new(t||(t=Promise))((function(r,i){function l(o){try{c(n.next(o))}catch(o){i(o)}}function a(o){try{c(n.throw(o))}catch(o){i(o)}}function c(o){var e;o.done?r(o.value):(e=o.value,e instanceof t?e:new t((function(o){o(e)}))).then(l,a)}c((n=n.apply(o,e||[])).next())}))};function l(o){return i(this,void 0,void 0,(function*(){yield o.addParticleUpdater("color",(o=>new t(o)))}))}})(),r})()})); |
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
295486