@tsparticles/updater-gradient 4.0.0-beta.15 → 4.0.0-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/index.js +1 -1
- package/browser/index.lazy.js +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.lazy.js +1 -1
- package/esm/index.js +1 -1
- package/esm/index.lazy.js +1 -1
- package/package.json +2 -2
- package/tsparticles.updater.gradient.js +2 -2
- package/tsparticles.updater.gradient.min.js +1 -1
package/browser/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GradientUpdater } from "./GradientUpdater.js";
|
|
2
2
|
export async function loadGradientUpdater(engine) {
|
|
3
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
+
engine.checkVersion("4.0.0-beta.16");
|
|
4
4
|
await engine.pluginManager.register(e => {
|
|
5
5
|
e.pluginManager.addParticleUpdater("gradient", container => {
|
|
6
6
|
return Promise.resolve(new GradientUpdater(e.pluginManager, container));
|
package/browser/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadGradientUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
2
|
+
engine.checkVersion("4.0.0-beta.16");
|
|
3
3
|
await engine.pluginManager.register(e => {
|
|
4
4
|
e.pluginManager.addParticleUpdater("gradient", async (container) => {
|
|
5
5
|
const { GradientUpdater } = await import("./GradientUpdater.js");
|
package/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GradientUpdater } from "./GradientUpdater.js";
|
|
2
2
|
export async function loadGradientUpdater(engine) {
|
|
3
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
+
engine.checkVersion("4.0.0-beta.16");
|
|
4
4
|
await engine.pluginManager.register(e => {
|
|
5
5
|
e.pluginManager.addParticleUpdater("gradient", container => {
|
|
6
6
|
return Promise.resolve(new GradientUpdater(e.pluginManager, container));
|
package/cjs/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadGradientUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
2
|
+
engine.checkVersion("4.0.0-beta.16");
|
|
3
3
|
await engine.pluginManager.register(e => {
|
|
4
4
|
e.pluginManager.addParticleUpdater("gradient", async (container) => {
|
|
5
5
|
const { GradientUpdater } = await import("./GradientUpdater.js");
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GradientUpdater } from "./GradientUpdater.js";
|
|
2
2
|
export async function loadGradientUpdater(engine) {
|
|
3
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
+
engine.checkVersion("4.0.0-beta.16");
|
|
4
4
|
await engine.pluginManager.register(e => {
|
|
5
5
|
e.pluginManager.addParticleUpdater("gradient", container => {
|
|
6
6
|
return Promise.resolve(new GradientUpdater(e.pluginManager, container));
|
package/esm/index.lazy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export async function loadGradientUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
2
|
+
engine.checkVersion("4.0.0-beta.16");
|
|
3
3
|
await engine.pluginManager.register(e => {
|
|
4
4
|
e.pluginManager.addParticleUpdater("gradient", async (container) => {
|
|
5
5
|
const { GradientUpdater } = await import("./GradientUpdater.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-gradient",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.16",
|
|
4
4
|
"description": "tsParticles particles gradient updater",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"./package.json": "./package.json"
|
|
108
108
|
},
|
|
109
109
|
"peerDependencies": {
|
|
110
|
-
"@tsparticles/engine": "4.0.0-beta.
|
|
110
|
+
"@tsparticles/engine": "4.0.0-beta.16"
|
|
111
111
|
},
|
|
112
112
|
"publishConfig": {
|
|
113
113
|
"access": "public"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(g){g.__tsParticlesInternals=g.__tsParticlesInternals||{};g.__tsParticlesInternals.bundles=g.__tsParticlesInternals.bundles||{};g.__tsParticlesInternals.effects=g.__tsParticlesInternals.effects||{};g.__tsParticlesInternals.engine=g.__tsParticlesInternals.engine||{};g.__tsParticlesInternals.interactions=g.__tsParticlesInternals.interactions||{};g.__tsParticlesInternals.palettes=g.__tsParticlesInternals.palettes||{};g.__tsParticlesInternals.paths=g.__tsParticlesInternals.paths||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins=g.__tsParticlesInternals.plugins||{};g.__tsParticlesInternals.plugins.emittersShapes=g.__tsParticlesInternals.plugins.emittersShapes||{};g.__tsParticlesInternals.presets=g.__tsParticlesInternals.presets||{};g.__tsParticlesInternals.shapes=g.__tsParticlesInternals.shapes||{};g.__tsParticlesInternals.updaters=g.__tsParticlesInternals.updaters||{};g.__tsParticlesInternals.utils=g.__tsParticlesInternals.utils||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas=g.__tsParticlesInternals.canvas||{};g.__tsParticlesInternals.canvas.utils=g.__tsParticlesInternals.canvas.utils||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path=g.__tsParticlesInternals.path||{};g.__tsParticlesInternals.path.utils=g.__tsParticlesInternals.path.utils||{};var __tsProxyFactory=typeof Proxy!=="undefined"?function(obj){return new Proxy(obj,{get:function(target,key){if(!(key in target)){target[key]={};}return target[key];}});}:function(obj){return obj;};g.__tsParticlesInternals.bundles=__tsProxyFactory(g.__tsParticlesInternals.bundles);g.__tsParticlesInternals.effects=__tsProxyFactory(g.__tsParticlesInternals.effects);g.__tsParticlesInternals.interactions=__tsProxyFactory(g.__tsParticlesInternals.interactions);g.__tsParticlesInternals.palettes=__tsProxyFactory(g.__tsParticlesInternals.palettes);g.__tsParticlesInternals.paths=__tsProxyFactory(g.__tsParticlesInternals.paths);g.__tsParticlesInternals.plugins=__tsProxyFactory(g.__tsParticlesInternals.plugins);g.__tsParticlesInternals.plugins.emittersShapes=__tsProxyFactory(g.__tsParticlesInternals.plugins.emittersShapes);g.__tsParticlesInternals.presets=__tsProxyFactory(g.__tsParticlesInternals.presets);g.__tsParticlesInternals.shapes=__tsProxyFactory(g.__tsParticlesInternals.shapes);g.__tsParticlesInternals.updaters=__tsProxyFactory(g.__tsParticlesInternals.updaters);g.__tsParticlesInternals.utils=__tsProxyFactory(g.__tsParticlesInternals.utils);g.__tsParticlesInternals.canvas=__tsProxyFactory(g.__tsParticlesInternals.canvas);g.__tsParticlesInternals.path=__tsProxyFactory(g.__tsParticlesInternals.path);g.tsparticlesInternalExports=g.tsparticlesInternalExports||{};})(typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:this);
|
|
2
|
-
/* Updater v4.0.0-beta.
|
|
2
|
+
/* Updater v4.0.0-beta.16 */
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tsparticles/engine')) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define(['exports', '@tsparticles/engine'], factory) :
|
|
@@ -331,7 +331,7 @@
|
|
|
331
331
|
}
|
|
332
332
|
|
|
333
333
|
async function loadGradientUpdater(engine) {
|
|
334
|
-
engine.checkVersion("4.0.0-beta.
|
|
334
|
+
engine.checkVersion("4.0.0-beta.16");
|
|
335
335
|
await engine.pluginManager.register(e => {
|
|
336
336
|
e.pluginManager.addParticleUpdater("gradient", container => {
|
|
337
337
|
return Promise.resolve(new GradientUpdater(e.pluginManager, container));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.updaters.gradient=t.__tsParticlesInternals.updaters.gradient||{}),t.__tsParticlesInternals.engine)}(this,function(t,e){"use strict";class a{count;decay;delay;enable;speed;startValue;sync;constructor(){this.count=0,this.enable=!1,this.speed=0,this.decay=0,this.delay=0,this.sync=!1,this.startValue=e.StartValueType.random}load(t){e.isNull(t)||(void 0!==t.count&&(this.count=e.setRangeValue(t.count)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=e.setRangeValue(t.speed)),void 0!==t.sync&&(this.sync=t.sync),void 0!==t.startValue&&(this.startValue=t.startValue),void 0!==t.decay&&(this.decay=e.setRangeValue(t.decay)),void 0!==t.delay&&(this.delay=e.setRangeValue(t.delay)))}}class s{animation;value;constructor(){this.value=0,this.animation=new a}load(t){e.isNull(t)||(this.animation.load(t.animation),void 0!==t.value&&(this.value=e.setRangeValue(t.value)))}}class n{opacity;stop;value;constructor(){this.stop=0,this.value=new e.AnimatableColor}load(t){e.isNull(t)||(void 0!==t.stop&&(this.stop=t.stop),this.value=e.AnimatableColor.create(this.value,t.value),void 0!==t.opacity&&(this.opacity=new s,e.isNumber(t.opacity)?this.opacity.value=t.opacity:this.opacity.load(t.opacity)))}}class i{count;decay;delay;enable;speed;sync;constructor(){this.count=0,this.enable=!1,this.speed=0,this.decay=0,this.delay=0,this.sync=!1}load(t){e.isNull(t)||(void 0!==t.count&&(this.count=e.setRangeValue(t.count)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=e.setRangeValue(t.speed)),void 0!==t.decay&&(this.decay=e.setRangeValue(t.decay)),void 0!==t.delay&&(this.delay=e.setRangeValue(t.delay)),void 0!==t.sync&&(this.sync=t.sync))}}class l{animation;direction;value;constructor(){this.value=0,this.animation=new i,this.direction=e.RotateDirection.clockwise}load(t){e.isNull(t)||(this.animation.load(t.animation),void 0!==t.value&&(this.value=e.setRangeValue(t.value)),void 0!==t.direction&&(this.direction=t.direction))}}class r{angle;colors;type;constructor(){this.angle=new l,this.colors=[],this.type=e.GradientType.random}load(t){e.isNull(t)||(this.angle.load(t.angle),void 0!==t.colors&&(this.colors=t.colors.map(t=>{const e=new n;return e.load(t),e})),void 0!==t.type&&(this.type=t.type))}}class o{_container;_pluginManager;constructor(t,e){this._pluginManager=t,this._container=e}getColorStyles(t,a,s,n){const i=t.gradient;if(!i)return{};const{_container:l}=this,r=i.angle.value,o=0,c=0,u=i.type===e.GradientType.radial?a.createRadialGradient(o,c,0,o,c,s):a.createLinearGradient(Math.cos(r)*-s,Math.sin(r)*-s,Math.cos(r)*s,Math.sin(r)*s);for(const{stop:t,value:a,opacity:s}of i.colors){const i={h:a.h.value,s:a.s.value,l:a.l.value};u.addColorStop(t,e.getStyleFromHsl(i,l.hdr,s?.value??n))}return{fill:u}}init(t){const a=e.itemFromSingleOrMultiple(t.options.gradient);if(!a)return;const s=this._container,{angle:n}=a;t.gradient={angle:{value:e.getRangeValue(n.value),enable:n.animation.enable,velocity:e.getRangeValue(n.animation.speed)/360*s.retina.reduceFactor,decay:1-e.getRangeValue(n.animation.decay),delayTime:e.getRangeValue(n.animation.delay)*e.millisecondsToSeconds,max:e.doublePI,min:0,time:0},type:a.type,colors:[]};let i=a.angle.direction;switch(i===e.RotateDirection.random&&(i=e.getRandom()>e.half?e.RotateDirection.counterClockwise:e.RotateDirection.clockwise),i){case e.RotateDirection.counterClockwise:case"counterClockwise":t.gradient.angle.status=e.AnimationStatus.decreasing;break;case e.RotateDirection.clockwise:t.gradient.angle.status=e.AnimationStatus.increasing}const l=t.options.reduceDuplicates;for(const n of a.colors){const a=e.rangeColorToHsl(this._pluginManager,n.value,t.id,l);if(!a)continue;const i=e.getHslAnimationFromHsl(a,n.value.animation,s.retina.reduceFactor),r={stop:n.stop,value:i,opacity:n.opacity?{enable:n.opacity.animation.enable,max:e.getRangeMax(n.opacity.value),min:e.getRangeMin(n.opacity.value),status:e.AnimationStatus.increasing,value:e.getRangeValue(n.opacity.value),velocity:e.getRangeValue(n.opacity.animation.speed)/e.percentDenominator*s.retina.reduceFactor,decay:1-e.getRangeValue(n.opacity.animation.decay),delayTime:e.getRangeValue(n.opacity.animation.delay)*e.millisecondsToSeconds,time:0}:void 0},{opacity:o}=r;if(n.opacity&&o){const t=n.opacity.value;o.min=e.getRangeMin(t),o.max=e.getRangeMax(t);switch(n.opacity.animation.startValue){case e.StartValueType.min:o.value=o.min,o.status=e.AnimationStatus.increasing;break;case e.StartValueType.max:o.value=o.max,o.status=e.AnimationStatus.decreasing;break;case e.StartValueType.random:default:o.value=e.randomInRangeValue(o),o.status=e.getRandom()>=e.half?e.AnimationStatus.increasing:e.AnimationStatus.decreasing}}t.gradient.colors.push(r)}}isEnabled(t){return!t.destroyed&&!t.spawning&&(!!t.gradient?.angle.enable||(t.gradient?.colors.some(t=>t.value.h.enable||t.value.s.enable||t.value.l.enable)??!1))}loadOptions(t,...a){for(const s of a){if(!s?.gradient)continue;const a=s.gradient;t.gradient=e.executeOnSingleOrMultiple(a,t=>{const e=new r;return e.load(t),e})}}update(t,a){!function(t,a){const{gradient:s}=t;if(s){e.updateAnimation(t,s.angle,!1,e.DestroyType.none,a);for(const n of s.colors)e.updateColor(n.value,a),n.opacity&&e.updateAnimation(t,n.opacity,!0,e.DestroyType.none,a)}}(t,a)}}async function c(t){t.checkVersion("4.0.0-beta.
|
|
1
|
+
!function(t){t.__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.bundles=t.__tsParticlesInternals.bundles||{},t.__tsParticlesInternals.effects=t.__tsParticlesInternals.effects||{},t.__tsParticlesInternals.engine=t.__tsParticlesInternals.engine||{},t.__tsParticlesInternals.interactions=t.__tsParticlesInternals.interactions||{},t.__tsParticlesInternals.palettes=t.__tsParticlesInternals.palettes||{},t.__tsParticlesInternals.paths=t.__tsParticlesInternals.paths||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins=t.__tsParticlesInternals.plugins||{},t.__tsParticlesInternals.plugins.emittersShapes=t.__tsParticlesInternals.plugins.emittersShapes||{},t.__tsParticlesInternals.presets=t.__tsParticlesInternals.presets||{},t.__tsParticlesInternals.shapes=t.__tsParticlesInternals.shapes||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.utils=t.__tsParticlesInternals.utils||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas=t.__tsParticlesInternals.canvas||{},t.__tsParticlesInternals.canvas.utils=t.__tsParticlesInternals.canvas.utils||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path=t.__tsParticlesInternals.path||{},t.__tsParticlesInternals.path.utils=t.__tsParticlesInternals.path.utils||{};var e="undefined"!=typeof Proxy?function(t){return new Proxy(t,{get:function(t,e){return e in t||(t[e]={}),t[e]}})}:function(t){return t};t.__tsParticlesInternals.bundles=e(t.__tsParticlesInternals.bundles),t.__tsParticlesInternals.effects=e(t.__tsParticlesInternals.effects),t.__tsParticlesInternals.interactions=e(t.__tsParticlesInternals.interactions),t.__tsParticlesInternals.palettes=e(t.__tsParticlesInternals.palettes),t.__tsParticlesInternals.paths=e(t.__tsParticlesInternals.paths),t.__tsParticlesInternals.plugins=e(t.__tsParticlesInternals.plugins),t.__tsParticlesInternals.plugins.emittersShapes=e(t.__tsParticlesInternals.plugins.emittersShapes),t.__tsParticlesInternals.presets=e(t.__tsParticlesInternals.presets),t.__tsParticlesInternals.shapes=e(t.__tsParticlesInternals.shapes),t.__tsParticlesInternals.updaters=e(t.__tsParticlesInternals.updaters),t.__tsParticlesInternals.utils=e(t.__tsParticlesInternals.utils),t.__tsParticlesInternals.canvas=e(t.__tsParticlesInternals.canvas),t.__tsParticlesInternals.path=e(t.__tsParticlesInternals.path),t.tsparticlesInternalExports=t.tsparticlesInternalExports||{}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:this),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@tsparticles/engine")):"function"==typeof define&&define.amd?define(["exports","@tsparticles/engine"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).__tsParticlesInternals=t.__tsParticlesInternals||{},t.__tsParticlesInternals.updaters=t.__tsParticlesInternals.updaters||{},t.__tsParticlesInternals.updaters.gradient=t.__tsParticlesInternals.updaters.gradient||{}),t.__tsParticlesInternals.engine)}(this,function(t,e){"use strict";class a{count;decay;delay;enable;speed;startValue;sync;constructor(){this.count=0,this.enable=!1,this.speed=0,this.decay=0,this.delay=0,this.sync=!1,this.startValue=e.StartValueType.random}load(t){e.isNull(t)||(void 0!==t.count&&(this.count=e.setRangeValue(t.count)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=e.setRangeValue(t.speed)),void 0!==t.sync&&(this.sync=t.sync),void 0!==t.startValue&&(this.startValue=t.startValue),void 0!==t.decay&&(this.decay=e.setRangeValue(t.decay)),void 0!==t.delay&&(this.delay=e.setRangeValue(t.delay)))}}class s{animation;value;constructor(){this.value=0,this.animation=new a}load(t){e.isNull(t)||(this.animation.load(t.animation),void 0!==t.value&&(this.value=e.setRangeValue(t.value)))}}class n{opacity;stop;value;constructor(){this.stop=0,this.value=new e.AnimatableColor}load(t){e.isNull(t)||(void 0!==t.stop&&(this.stop=t.stop),this.value=e.AnimatableColor.create(this.value,t.value),void 0!==t.opacity&&(this.opacity=new s,e.isNumber(t.opacity)?this.opacity.value=t.opacity:this.opacity.load(t.opacity)))}}class i{count;decay;delay;enable;speed;sync;constructor(){this.count=0,this.enable=!1,this.speed=0,this.decay=0,this.delay=0,this.sync=!1}load(t){e.isNull(t)||(void 0!==t.count&&(this.count=e.setRangeValue(t.count)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.speed&&(this.speed=e.setRangeValue(t.speed)),void 0!==t.decay&&(this.decay=e.setRangeValue(t.decay)),void 0!==t.delay&&(this.delay=e.setRangeValue(t.delay)),void 0!==t.sync&&(this.sync=t.sync))}}class l{animation;direction;value;constructor(){this.value=0,this.animation=new i,this.direction=e.RotateDirection.clockwise}load(t){e.isNull(t)||(this.animation.load(t.animation),void 0!==t.value&&(this.value=e.setRangeValue(t.value)),void 0!==t.direction&&(this.direction=t.direction))}}class r{angle;colors;type;constructor(){this.angle=new l,this.colors=[],this.type=e.GradientType.random}load(t){e.isNull(t)||(this.angle.load(t.angle),void 0!==t.colors&&(this.colors=t.colors.map(t=>{const e=new n;return e.load(t),e})),void 0!==t.type&&(this.type=t.type))}}class o{_container;_pluginManager;constructor(t,e){this._pluginManager=t,this._container=e}getColorStyles(t,a,s,n){const i=t.gradient;if(!i)return{};const{_container:l}=this,r=i.angle.value,o=0,c=0,u=i.type===e.GradientType.radial?a.createRadialGradient(o,c,0,o,c,s):a.createLinearGradient(Math.cos(r)*-s,Math.sin(r)*-s,Math.cos(r)*s,Math.sin(r)*s);for(const{stop:t,value:a,opacity:s}of i.colors){const i={h:a.h.value,s:a.s.value,l:a.l.value};u.addColorStop(t,e.getStyleFromHsl(i,l.hdr,s?.value??n))}return{fill:u}}init(t){const a=e.itemFromSingleOrMultiple(t.options.gradient);if(!a)return;const s=this._container,{angle:n}=a;t.gradient={angle:{value:e.getRangeValue(n.value),enable:n.animation.enable,velocity:e.getRangeValue(n.animation.speed)/360*s.retina.reduceFactor,decay:1-e.getRangeValue(n.animation.decay),delayTime:e.getRangeValue(n.animation.delay)*e.millisecondsToSeconds,max:e.doublePI,min:0,time:0},type:a.type,colors:[]};let i=a.angle.direction;switch(i===e.RotateDirection.random&&(i=e.getRandom()>e.half?e.RotateDirection.counterClockwise:e.RotateDirection.clockwise),i){case e.RotateDirection.counterClockwise:case"counterClockwise":t.gradient.angle.status=e.AnimationStatus.decreasing;break;case e.RotateDirection.clockwise:t.gradient.angle.status=e.AnimationStatus.increasing}const l=t.options.reduceDuplicates;for(const n of a.colors){const a=e.rangeColorToHsl(this._pluginManager,n.value,t.id,l);if(!a)continue;const i=e.getHslAnimationFromHsl(a,n.value.animation,s.retina.reduceFactor),r={stop:n.stop,value:i,opacity:n.opacity?{enable:n.opacity.animation.enable,max:e.getRangeMax(n.opacity.value),min:e.getRangeMin(n.opacity.value),status:e.AnimationStatus.increasing,value:e.getRangeValue(n.opacity.value),velocity:e.getRangeValue(n.opacity.animation.speed)/e.percentDenominator*s.retina.reduceFactor,decay:1-e.getRangeValue(n.opacity.animation.decay),delayTime:e.getRangeValue(n.opacity.animation.delay)*e.millisecondsToSeconds,time:0}:void 0},{opacity:o}=r;if(n.opacity&&o){const t=n.opacity.value;o.min=e.getRangeMin(t),o.max=e.getRangeMax(t);switch(n.opacity.animation.startValue){case e.StartValueType.min:o.value=o.min,o.status=e.AnimationStatus.increasing;break;case e.StartValueType.max:o.value=o.max,o.status=e.AnimationStatus.decreasing;break;case e.StartValueType.random:default:o.value=e.randomInRangeValue(o),o.status=e.getRandom()>=e.half?e.AnimationStatus.increasing:e.AnimationStatus.decreasing}}t.gradient.colors.push(r)}}isEnabled(t){return!t.destroyed&&!t.spawning&&(!!t.gradient?.angle.enable||(t.gradient?.colors.some(t=>t.value.h.enable||t.value.s.enable||t.value.l.enable)??!1))}loadOptions(t,...a){for(const s of a){if(!s?.gradient)continue;const a=s.gradient;t.gradient=e.executeOnSingleOrMultiple(a,t=>{const e=new r;return e.load(t),e})}}update(t,a){!function(t,a){const{gradient:s}=t;if(s){e.updateAnimation(t,s.angle,!1,e.DestroyType.none,a);for(const n of s.colors)e.updateColor(n.value,a),n.opacity&&e.updateAnimation(t,n.opacity,!0,e.DestroyType.none,a)}}(t,a)}}async function c(t){t.checkVersion("4.0.0-beta.16"),await t.pluginManager.register(t=>{t.pluginManager.addParticleUpdater("gradient",e=>Promise.resolve(new o(t.pluginManager,e)))})}const u=globalThis;u.__tsParticlesInternals=u.__tsParticlesInternals??{},u.loadGradientUpdater=c,t.loadGradientUpdater=c}),Object.assign(globalThis.window||globalThis,{loadGradientUpdater:(globalThis.__tsParticlesInternals.updaters.gradient||{}).loadGradientUpdater}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|