@tsparticles/updater-destroy 4.0.0-beta.9 → 4.0.1
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/DestroyUpdater.js +44 -4
- package/browser/Enums/DestroyMode.js +1 -0
- package/browser/Options/Classes/Destroy.js +4 -0
- package/browser/Options/Classes/Explode.js +20 -0
- package/browser/Options/Interfaces/IExplode.js +1 -0
- package/browser/Utils.js +1 -1
- package/browser/browser.js +5 -0
- package/browser/index.js +4 -4
- package/browser/index.lazy.js +9 -0
- package/cjs/DestroyUpdater.js +44 -4
- package/cjs/Enums/DestroyMode.js +1 -0
- package/cjs/Options/Classes/Destroy.js +4 -0
- package/cjs/Options/Classes/Explode.js +20 -0
- package/cjs/Options/Interfaces/IExplode.js +1 -0
- package/cjs/Utils.js +1 -1
- package/cjs/browser.js +5 -0
- package/cjs/index.js +4 -4
- package/cjs/index.lazy.js +9 -0
- package/esm/DestroyUpdater.js +44 -4
- package/esm/Enums/DestroyMode.js +1 -0
- package/esm/Options/Classes/Destroy.js +4 -0
- package/esm/Options/Classes/Explode.js +20 -0
- package/esm/Options/Interfaces/IExplode.js +1 -0
- package/esm/Utils.js +1 -1
- package/esm/browser.js +5 -0
- package/esm/index.js +4 -4
- package/esm/index.lazy.js +9 -0
- package/package.json +9 -2
- package/report.html +4949 -94
- package/tsparticles.updater.destroy.js +371 -310
- package/tsparticles.updater.destroy.min.js +1 -2
- package/types/DestroyUpdater.d.ts +2 -2
- package/types/Enums/DestroyMode.d.ts +1 -0
- package/types/Options/Classes/Destroy.d.ts +2 -0
- package/types/Options/Classes/Explode.d.ts +8 -0
- package/types/Options/Interfaces/IDestroy.d.ts +2 -0
- package/types/Options/Interfaces/IExplode.d.ts +4 -0
- package/types/Types.d.ts +8 -0
- package/types/browser.d.ts +1 -0
- package/types/index.lazy.d.ts +2 -0
- package/960.min.js +0 -1
- package/dist_browser_DestroyUpdater_js.js +0 -100
|
@@ -1,2 +1 @@
|
|
|
1
|
-
!function(e,t){
|
|
2
|
-
(`+n+": "+i+")",s.name="ChunkLoadError",s.type=n,s.request=i,o[1](s)}},"chunk-"+e,e)}},r=(e,r)=>{var o,n,[i,s,p]=r,c=0;if(i.some(e=>0!==t[e])){for(o in s)a.o(s,o)&&(a.m[o]=s[o]);p&&p(a)}for(e&&e(r);c<i.length;c++)n=i[c],a.o(t,n)&&t[n]&&t[n][0](),t[n]=0},(o=this.webpackChunk_tsparticles_updater_destroy=this.webpackChunk_tsparticles_updater_destroy||[]).forEach(r.bind(null,0)),o.push=r.bind(null,o.push.bind(o));var d={};async function f(e){e.checkVersion("4.0.0-beta.9"),await e.pluginManager.register(e=>{e.pluginManager.addParticleUpdater("destroy",async t=>{let{DestroyUpdater:r}=await a.e(960).then(a.bind(a,960));return new r(e.pluginManager,t)})})}return a.r(d),a.d(d,{loadDestroyUpdater:()=>f}),d})());
|
|
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.destroy=t.__tsParticlesInternals.updaters.destroy||{}),t.__tsParticlesInternals.engine)}(this,function(t,e){"use strict";class s{bottom;left;right;top;load(t){e.isNull(t)||(void 0!==t.bottom&&(this.bottom=e.setRangeValue(t.bottom)),void 0!==t.left&&(this.left=e.setRangeValue(t.left)),void 0!==t.right&&(this.right=e.setRangeValue(t.right)),void 0!==t.top&&(this.top=e.setRangeValue(t.top)))}}var l;!function(t){t.explode="explode",t.none="none",t.split="split"}(l||(l={}));class i{maxSizeFactor;speed;constructor(){this.maxSizeFactor=3,this.speed=2}load(t){e.isNull(t)||(void 0!==t.maxSizeFactor&&(this.maxSizeFactor=t.maxSizeFactor),void 0!==t.speed&&(this.speed=t.speed))}}class n extends e.ValueWithRandom{constructor(){super(),this.value=3}}class r extends e.ValueWithRandom{constructor(){super(),this.value={min:4,max:9}}}class a{count;factor;fillColor;fillColorOffset;particles;rate;sizeOffset;strokeColor;strokeColorOffset;constructor(){this.count=1,this.factor=new n,this.rate=new r,this.sizeOffset=!0}load(t){e.isNull(t)||(void 0!==t.fillColor&&(this.fillColor=e.OptionsColor.create(this.fillColor,t.fillColor)),void 0!==t.strokeColor&&(this.strokeColor=e.OptionsColor.create(this.strokeColor,t.strokeColor)),void 0!==t.count&&(this.count=t.count),this.factor.load(t.factor),this.rate.load(t.rate),this.particles=e.executeOnSingleOrMultiple(t.particles,t=>e.deepExtend({},t)),void 0!==t.sizeOffset&&(this.sizeOffset=t.sizeOffset),t.fillColorOffset&&(this.fillColorOffset=this.fillColorOffset??{},void 0!==t.fillColorOffset.h&&(this.fillColorOffset.h=t.fillColorOffset.h),void 0!==t.fillColorOffset.s&&(this.fillColorOffset.s=t.fillColorOffset.s),void 0!==t.fillColorOffset.l&&(this.fillColorOffset.l=t.fillColorOffset.l)),t.strokeColorOffset&&(this.strokeColorOffset=this.strokeColorOffset??{},void 0!==t.strokeColorOffset.h&&(this.strokeColorOffset.h=t.strokeColorOffset.h),void 0!==t.strokeColorOffset.s&&(this.strokeColorOffset.s=t.strokeColorOffset.s),void 0!==t.strokeColorOffset.l&&(this.strokeColorOffset.l=t.strokeColorOffset.l)))}}class o{bounds;explode;mode;split;constructor(){this.bounds=new s,this.explode=new i,this.mode=l.none,this.split=new a}load(t){e.isNull(t)||(t.mode&&(this.mode=t.mode),t.bounds&&this.bounds.load(t.bounds),this.explode.load(t.explode),this.split.load(t.split))}}function c(t,s,l,i){return t&&i?function(t,s){const l=e.getRangeValue(s.h??0),i=e.getRangeValue(s.s??0),n=e.getRangeValue(s.l??0),r=(t.h+l)%360,a=Math.max(0,Math.min(100,t.s+i)),o=Math.max(0,Math.min(100,t.l+n));return e.AnimatableColor.create(void 0,{value:{hsl:{h:r<0?r+360:r,s:a,l:o}}})}(i,t):s?e.AnimatableColor.create(void 0,s):l?e.AnimatableColor.create(void 0,l):i?function(t){return e.AnimatableColor.create(void 0,{value:{hsl:t}})}(i):void 0}function p(t,s,l,i){const n=l.options.destroy;if(!n)return;const r=n.split,a=e.loadParticlesOptions(t,s,l.options),o=e.itemFromSingleOrMultiple(r.fillColor),p=e.itemFromSingleOrMultiple(r.strokeColor),d=l.getFillColor(),_=l.getStrokeColor();a.move.load({center:{x:l.position.x,y:l.position.y,mode:e.PixelMode.precise}});const f=e.identity/e.getRangeValue(r.factor.value);e.isNumber(a.size.value)?a.size.value*=f:(a.size.value.min*=f,a.size.value.max*=f),a.load(i);const u=e.itemFromSingleOrMultiple(a.paint),h=u?.fill,g=u?.stroke,P=c(r.fillColorOffset,o,h?.color,d),I=c(r.strokeColorOffset,p,g?.color,_);P&&h&&(h.color=P),I&&g&&(g.color=I);const m=r.sizeOffset?e.setRangeValue(-l.size.value,l.size.value):0,v={x:l.position.x+e.randomInRangeValue(m),y:l.position.y+e.randomInRangeValue(m)};return s.particles.addParticle(v,a,l.group,t=>!(t.size.value<.5)&&(t.velocity.length=e.randomInRangeValue(e.setRangeValue(l.velocity.length,t.velocity.length)),t.splitCount=(l.splitCount??0)+1,t.unbreakable=!0,t.unbreakableUntil=performance.now()+500,!0))}class d{_container;_pluginManager;constructor(t,e){this._container=e,this._pluginManager=t}init(t){const s=this._container,l=t.options.destroy;if(!l)return;t.exploding=void 0,t.splitCount=0;const i=l.bounds;t.destroyBounds??={};const{bottom:n,left:r,right:a,top:o}=i,{destroyBounds:c}=t,p=s.canvas.size;n&&(c.bottom=e.getRangeValue(n)*p.height/e.percentDenominator),r&&(c.left=e.getRangeValue(r)*p.width/e.percentDenominator),a&&(c.right=e.getRangeValue(a)*p.width/e.percentDenominator),o&&(c.top=e.getRangeValue(o)*p.height/e.percentDenominator)}isEnabled(t){const e=t;return!e.destroyed||!!e.exploding}loadOptions(t,...e){t.destroy??=new o;for(const s of e)t.destroy.load(s?.destroy)}particleDestroyed(t,s){if(s)return;const i=t.options.destroy;switch(i?.mode){case l.split:!function(t,s,l){const i=l.options.destroy;if(!i)return;const n=i.split;if(n.count>=0){if(void 0===l.splitCount||l.splitCount>n.count)return;l.splitCount++}const r=e.getRangeValue(n.rate.value),a=e.itemFromSingleOrMultiple(n.particles);for(let e=0;e<r;e++)p(t,s,l,a)}(this._pluginManager,this._container,t);break;case l.explode:{if(t.exploding){t.destroyed=!1;break}const{explode:e}=i,s=t.size.value,l=s*e.maxSizeFactor,n=t.getOpacity();t.exploding={initialFillOpacity:n.fillOpacity,initialSize:s,initialStrokeOpacity:n.strokeOpacity,maxSize:l,progress:0,speed:Math.max(e.speed,.01)},t.fillOpacity=n.fillOpacity,t.strokeOpacity=n.strokeOpacity,t.destroyed=!1;break}}}update(t,e){if(t.exploding){const s=t.exploding,l=e.factor||1;s.progress=Math.min(1,s.progress+s.speed*l/60);const i=s.progress;return t.size.value=s.initialSize+(s.maxSize-s.initialSize)*i,t.fillOpacity=s.initialFillOpacity*(1-i),t.strokeOpacity=s.initialStrokeOpacity*(1-i),void(i>=1&&(t.exploding=void 0,t.destroy(!0)))}void 0!==t.unbreakableUntil&&performance.now()>=t.unbreakableUntil&&(t.unbreakable=!1,t.unbreakableUntil=void 0);const s=t.getPosition(),l=t.destroyBounds;l&&(void 0!==l.bottom&&s.y>=l.bottom||void 0!==l.left&&s.x<=l.left||void 0!==l.right&&s.x>=l.right||void 0!==l.top&&s.y<=l.top)&&t.destroy()}}async function _(t){t.checkVersion("4.0.1"),await t.pluginManager.register(t=>{t.pluginManager.addParticleUpdater("destroy",e=>Promise.resolve(new d(t.pluginManager,e)))})}const f=globalThis;f.__tsParticlesInternals=f.__tsParticlesInternals??{},f.loadDestroyUpdater=_,t.loadDestroyUpdater=_}),Object.assign(globalThis.window||globalThis,{loadDestroyUpdater:(globalThis.__tsParticlesInternals.updaters.destroy||{}).loadDestroyUpdater}),delete(globalThis.window||globalThis).tsparticlesInternalExports;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Container, type IParticleUpdater, type Particle, type PluginManager, type RecursivePartial } from "@tsparticles/engine";
|
|
1
|
+
import { type Container, type IDelta, type IParticleUpdater, type Particle, type PluginManager, type RecursivePartial } from "@tsparticles/engine";
|
|
2
2
|
import type { DestroyParticle, DestroyParticlesOptions, IDestroyParticlesOptions } from "./Types.js";
|
|
3
3
|
export declare class DestroyUpdater implements IParticleUpdater {
|
|
4
4
|
private readonly _container;
|
|
@@ -8,5 +8,5 @@ export declare class DestroyUpdater implements IParticleUpdater {
|
|
|
8
8
|
isEnabled(particle: Particle): boolean;
|
|
9
9
|
loadOptions(options: DestroyParticlesOptions, ...sources: (RecursivePartial<IDestroyParticlesOptions> | undefined)[]): void;
|
|
10
10
|
particleDestroyed(particle: DestroyParticle, override?: boolean): void;
|
|
11
|
-
update(particle: DestroyParticle): void;
|
|
11
|
+
update(particle: DestroyParticle, delta: IDelta): void;
|
|
12
12
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type IOptionLoader, type RecursivePartial } from "@tsparticles/engine";
|
|
2
2
|
import { DestroyBounds } from "./DestroyBounds.js";
|
|
3
3
|
import { DestroyMode } from "../../Enums/DestroyMode.js";
|
|
4
|
+
import { Explode } from "./Explode.js";
|
|
4
5
|
import type { IDestroy } from "../Interfaces/IDestroy.js";
|
|
5
6
|
import { Split } from "./Split.js";
|
|
6
7
|
export declare class Destroy implements IDestroy, IOptionLoader<IDestroy> {
|
|
7
8
|
bounds: DestroyBounds;
|
|
9
|
+
explode: Explode;
|
|
8
10
|
mode: DestroyMode | keyof typeof DestroyMode;
|
|
9
11
|
split: Split;
|
|
10
12
|
constructor();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type IOptionLoader, type RecursivePartial } from "@tsparticles/engine";
|
|
2
|
+
import type { IExplode } from "../Interfaces/IExplode.js";
|
|
3
|
+
export declare class Explode implements IExplode, IOptionLoader<IExplode> {
|
|
4
|
+
maxSizeFactor: number;
|
|
5
|
+
speed: number;
|
|
6
|
+
constructor();
|
|
7
|
+
load(data?: RecursivePartial<IExplode>): void;
|
|
8
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { DestroyMode } from "../../Enums/DestroyMode.js";
|
|
2
2
|
import type { IDestroyBounds } from "./IDestroyBounds.js";
|
|
3
|
+
import type { IExplode } from "./IExplode.js";
|
|
3
4
|
import type { ISplit } from "./ISplit.js";
|
|
4
5
|
export interface IDestroy {
|
|
5
6
|
bounds: IDestroyBounds;
|
|
7
|
+
explode: IExplode;
|
|
6
8
|
mode: DestroyMode | keyof typeof DestroyMode;
|
|
7
9
|
split: ISplit;
|
|
8
10
|
}
|
package/types/Types.d.ts
CHANGED
|
@@ -9,6 +9,14 @@ export type DestroyParticlesOptions = ParticlesOptions & {
|
|
|
9
9
|
};
|
|
10
10
|
export type DestroyParticle = Particle & {
|
|
11
11
|
destroyBounds?: Partial<IBounds>;
|
|
12
|
+
exploding?: {
|
|
13
|
+
initialFillOpacity: number;
|
|
14
|
+
initialSize: number;
|
|
15
|
+
initialStrokeOpacity: number;
|
|
16
|
+
maxSize: number;
|
|
17
|
+
progress: number;
|
|
18
|
+
speed: number;
|
|
19
|
+
};
|
|
12
20
|
options: DestroyParticlesOptions;
|
|
13
21
|
splitCount?: number;
|
|
14
22
|
unbreakableUntil?: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index.js";
|
package/960.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_updater_destroy=this.webpackChunk_tsparticles_updater_destroy||[]).push([[960],{960(t,e,o){o.d(e,{DestroyUpdater:()=>h});var l,i,s=o(303);class r{bottom;left;right;top;load(t){(0,s.isNull)(t)||(void 0!==t.bottom&&(this.bottom=(0,s.setRangeValue)(t.bottom)),void 0!==t.left&&(this.left=(0,s.setRangeValue)(t.left)),void 0!==t.right&&(this.right=(0,s.setRangeValue)(t.right)),void 0!==t.top&&(this.top=(0,s.setRangeValue)(t.top)))}}(l=i||(i={})).none="none",l.split="split";class n extends s.ValueWithRandom{constructor(){super(),this.value=3}}class a extends s.ValueWithRandom{constructor(){super(),this.value={min:4,max:9}}}class f{count;factor;fillColor;fillColorOffset;particles;rate;sizeOffset;strokeColor;strokeColorOffset;constructor(){this.count=1,this.factor=new n,this.rate=new a,this.sizeOffset=!0}load(t){!(0,s.isNull)(t)&&(void 0!==t.fillColor&&(this.fillColor=s.OptionsColor.create(this.fillColor,t.fillColor)),void 0!==t.strokeColor&&(this.strokeColor=s.OptionsColor.create(this.strokeColor,t.strokeColor)),void 0!==t.count&&(this.count=t.count),this.factor.load(t.factor),this.rate.load(t.rate),this.particles=(0,s.executeOnSingleOrMultiple)(t.particles,t=>(0,s.deepExtend)({},t)),void 0!==t.sizeOffset&&(this.sizeOffset=t.sizeOffset),t.fillColorOffset&&(this.fillColorOffset=this.fillColorOffset??{},void 0!==t.fillColorOffset.h&&(this.fillColorOffset.h=t.fillColorOffset.h),void 0!==t.fillColorOffset.s&&(this.fillColorOffset.s=t.fillColorOffset.s),void 0!==t.fillColorOffset.l&&(this.fillColorOffset.l=t.fillColorOffset.l)),t.strokeColorOffset&&(this.strokeColorOffset=this.strokeColorOffset??{},void 0!==t.strokeColorOffset.h&&(this.strokeColorOffset.h=t.strokeColorOffset.h),void 0!==t.strokeColorOffset.s&&(this.strokeColorOffset.s=t.strokeColorOffset.s),void 0!==t.strokeColorOffset.l&&(this.strokeColorOffset.l=t.strokeColorOffset.l)))}}class u{bounds;mode;split;constructor(){this.bounds=new r,this.mode=i.none,this.split=new f}load(t){(0,s.isNull)(t)||(t.mode&&(this.mode=t.mode),t.bounds&&this.bounds.load(t.bounds),this.split.load(t.split))}}function d(t,e,o,l){if(t&&l){let e,o,i,r,n,a;return e=(0,s.getRangeValue)(t.h??0),o=(0,s.getRangeValue)(t.s??0),i=(0,s.getRangeValue)(t.l??0),r=(l.h+e)%360,n=Math.max(0,Math.min(100,l.s+o)),a=Math.max(0,Math.min(100,l.l+i)),s.AnimatableColor.create(void 0,{value:{hsl:{h:r<0?r+360:r,s:n,l:a}}})}return e?s.AnimatableColor.create(void 0,e):o?s.AnimatableColor.create(void 0,o):l?s.AnimatableColor.create(void 0,{value:{hsl:l}}):void 0}class h{_container;_pluginManager;constructor(t,e){this._container=e,this._pluginManager=t}init(t){let e=this._container,o=t.options.destroy;if(!o)return;t.splitCount=0;let l=o.bounds;t.destroyBounds??={};let{bottom:i,left:r,right:n,top:a}=l,{destroyBounds:f}=t,u=e.canvas.size;i&&(f.bottom=(0,s.getRangeValue)(i)*u.height/s.percentDenominator),r&&(f.left=(0,s.getRangeValue)(r)*u.width/s.percentDenominator),n&&(f.right=(0,s.getRangeValue)(n)*u.width/s.percentDenominator),a&&(f.top=(0,s.getRangeValue)(a)*u.height/s.percentDenominator)}isEnabled(t){return!t.destroyed}loadOptions(t,...e){for(let o of(t.destroy??=new u,e))t.destroy.load(o?.destroy)}particleDestroyed(t,e){if(e)return;let o=t.options.destroy;o?.mode===i.split&&function(t,e,o){let l=o.options.destroy;if(!l)return;let i=l.split;if(i.count>=0){if(void 0===o.splitCount||o.splitCount>i.count)return;o.splitCount++}let r=(0,s.getRangeValue)(i.rate.value),n=(0,s.itemFromSingleOrMultiple)(i.particles);for(let l=0;l<r;l++)!function(t,e,o,l){let i=o.options.destroy;if(!i)return;let r=i.split,n=(0,s.loadParticlesOptions)(t,e,o.options),a=(0,s.itemFromSingleOrMultiple)(r.fillColor),f=(0,s.itemFromSingleOrMultiple)(r.strokeColor),u=o.getFillColor(),h=o.getStrokeColor();n.move.load({center:{x:o.position.x,y:o.position.y,mode:s.PixelMode.precise}});let c=s.identity/(0,s.getRangeValue)(r.factor.value);(0,s.isNumber)(n.size.value)?n.size.value*=c:(n.size.value.min*=c,n.size.value.max*=c),n.load(l);let p=(0,s.itemFromSingleOrMultiple)(n.fill),C=(0,s.itemFromSingleOrMultiple)(n.stroke),g=d(r.fillColorOffset,a,p?.color,u),m=d(r.strokeColorOffset,f,C?.color,h);g&&p&&(p.color=g),m&&C&&(C.color=m);let v=r.sizeOffset?(0,s.setRangeValue)(-o.size.value,o.size.value):0,O={x:o.position.x+(0,s.randomInRangeValue)(v),y:o.position.y+(0,s.randomInRangeValue)(v)};e.particles.addParticle(O,n,o.group,t=>!(t.size.value<.5)&&(t.velocity.length=(0,s.randomInRangeValue)((0,s.setRangeValue)(o.velocity.length,t.velocity.length)),t.splitCount=(o.splitCount??0)+1,t.unbreakable=!0,t.unbreakableUntil=performance.now()+500,!0))}(t,e,o,n)}(this._pluginManager,this._container,t)}update(t){void 0!==t.unbreakableUntil&&performance.now()>=t.unbreakableUntil&&(t.unbreakable=!1,t.unbreakableUntil=void 0);let e=t.getPosition(),o=t.destroyBounds;o&&(void 0!==o.bottom&&e.y>=o.bottom||void 0!==o.left&&e.x<=o.left||void 0!==o.right&&e.x>=o.right||void 0!==o.top&&e.y<=o.top)&&t.destroy()}}}}]);
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Author : Matteo Bruni
|
|
3
|
-
* MIT license: https://opensource.org/licenses/MIT
|
|
4
|
-
* Demo / Generator : https://particles.js.org/
|
|
5
|
-
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
|
-
* How to use? : Check the GitHub README
|
|
7
|
-
* v4.0.0-beta.9
|
|
8
|
-
*/
|
|
9
|
-
"use strict";
|
|
10
|
-
/*
|
|
11
|
-
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
12
|
-
* This devtool is neither made for production nor for readable output files.
|
|
13
|
-
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
|
14
|
-
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
|
15
|
-
* or disable the default devtool with "devtool: false".
|
|
16
|
-
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
|
17
|
-
*/
|
|
18
|
-
(this["webpackChunk_tsparticles_updater_destroy"] = this["webpackChunk_tsparticles_updater_destroy"] || []).push([["dist_browser_DestroyUpdater_js"],{
|
|
19
|
-
|
|
20
|
-
/***/ "./dist/browser/DestroyUpdater.js"
|
|
21
|
-
/*!****************************************!*\
|
|
22
|
-
!*** ./dist/browser/DestroyUpdater.js ***!
|
|
23
|
-
\****************************************/
|
|
24
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
|
-
|
|
26
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DestroyUpdater: () => (/* binding */ DestroyUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Options_Classes_Destroy_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Destroy.js */ \"./dist/browser/Options/Classes/Destroy.js\");\n/* harmony import */ var _Enums_DestroyMode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Enums/DestroyMode.js */ \"./dist/browser/Enums/DestroyMode.js\");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Utils.js */ \"./dist/browser/Utils.js\");\n\n\n\n\nclass DestroyUpdater {\n _container;\n _pluginManager;\n constructor(pluginManager, container){\n this._container = container;\n this._pluginManager = pluginManager;\n }\n init(particle) {\n const container = this._container, particlesOptions = particle.options, destroyOptions = particlesOptions.destroy;\n if (!destroyOptions) {\n return;\n }\n particle.splitCount = 0;\n const destroyBoundsOptions = destroyOptions.bounds;\n particle.destroyBounds ??= {};\n const { bottom, left, right, top } = destroyBoundsOptions, { destroyBounds } = particle, canvasSize = container.canvas.size;\n if (bottom) {\n destroyBounds.bottom = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(bottom) * canvasSize.height / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator;\n }\n if (left) {\n destroyBounds.left = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(left) * canvasSize.width / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator;\n }\n if (right) {\n destroyBounds.right = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(right) * canvasSize.width / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator;\n }\n if (top) {\n destroyBounds.top = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(top) * canvasSize.height / _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.percentDenominator;\n }\n }\n isEnabled(particle) {\n return !particle.destroyed;\n }\n loadOptions(options, ...sources) {\n options.destroy ??= new _Options_Classes_Destroy_js__WEBPACK_IMPORTED_MODULE_1__.Destroy();\n for (const source of sources){\n options.destroy.load(source?.destroy);\n }\n }\n particleDestroyed(particle, override) {\n if (override) {\n return;\n }\n const destroyOptions = particle.options.destroy;\n if (destroyOptions?.mode === _Enums_DestroyMode_js__WEBPACK_IMPORTED_MODULE_2__.DestroyMode.split) {\n (0,_Utils_js__WEBPACK_IMPORTED_MODULE_3__.split)(this._pluginManager, this._container, particle);\n }\n }\n update(particle) {\n if (particle.unbreakableUntil !== undefined && performance.now() >= particle.unbreakableUntil) {\n particle.unbreakable = false;\n particle.unbreakableUntil = undefined;\n }\n const position = particle.getPosition(), bounds = particle.destroyBounds;\n if (!bounds) {\n return;\n }\n if (bounds.bottom !== undefined && position.y >= bounds.bottom || bounds.left !== undefined && position.x <= bounds.left || bounds.right !== undefined && position.x >= bounds.right || bounds.top !== undefined && position.y <= bounds.top) {\n particle.destroy();\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/DestroyUpdater.js?\n}");
|
|
27
|
-
|
|
28
|
-
/***/ },
|
|
29
|
-
|
|
30
|
-
/***/ "./dist/browser/Enums/DestroyMode.js"
|
|
31
|
-
/*!*******************************************!*\
|
|
32
|
-
!*** ./dist/browser/Enums/DestroyMode.js ***!
|
|
33
|
-
\*******************************************/
|
|
34
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
35
|
-
|
|
36
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DestroyMode: () => (/* binding */ DestroyMode)\n/* harmony export */ });\nvar DestroyMode;\n(function(DestroyMode) {\n DestroyMode[\"none\"] = \"none\";\n DestroyMode[\"split\"] = \"split\";\n})(DestroyMode || (DestroyMode = {}));\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Enums/DestroyMode.js?\n}");
|
|
37
|
-
|
|
38
|
-
/***/ },
|
|
39
|
-
|
|
40
|
-
/***/ "./dist/browser/Options/Classes/Destroy.js"
|
|
41
|
-
/*!*************************************************!*\
|
|
42
|
-
!*** ./dist/browser/Options/Classes/Destroy.js ***!
|
|
43
|
-
\*************************************************/
|
|
44
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
45
|
-
|
|
46
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Destroy: () => (/* binding */ Destroy)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _DestroyBounds_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DestroyBounds.js */ \"./dist/browser/Options/Classes/DestroyBounds.js\");\n/* harmony import */ var _Enums_DestroyMode_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../Enums/DestroyMode.js */ \"./dist/browser/Enums/DestroyMode.js\");\n/* harmony import */ var _Split_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Split.js */ \"./dist/browser/Options/Classes/Split.js\");\n\n\n\n\nclass Destroy {\n bounds;\n mode;\n split;\n constructor(){\n this.bounds = new _DestroyBounds_js__WEBPACK_IMPORTED_MODULE_1__.DestroyBounds();\n this.mode = _Enums_DestroyMode_js__WEBPACK_IMPORTED_MODULE_2__.DestroyMode.none;\n this.split = new _Split_js__WEBPACK_IMPORTED_MODULE_3__.Split();\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.mode) {\n this.mode = data.mode;\n }\n if (data.bounds) {\n this.bounds.load(data.bounds);\n }\n this.split.load(data.split);\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/Destroy.js?\n}");
|
|
47
|
-
|
|
48
|
-
/***/ },
|
|
49
|
-
|
|
50
|
-
/***/ "./dist/browser/Options/Classes/DestroyBounds.js"
|
|
51
|
-
/*!*******************************************************!*\
|
|
52
|
-
!*** ./dist/browser/Options/Classes/DestroyBounds.js ***!
|
|
53
|
-
\*******************************************************/
|
|
54
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
55
|
-
|
|
56
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DestroyBounds: () => (/* binding */ DestroyBounds)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass DestroyBounds {\n bottom;\n left;\n right;\n top;\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.bottom !== undefined) {\n this.bottom = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.bottom);\n }\n if (data.left !== undefined) {\n this.left = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.left);\n }\n if (data.right !== undefined) {\n this.right = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.right);\n }\n if (data.top !== undefined) {\n this.top = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(data.top);\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/DestroyBounds.js?\n}");
|
|
57
|
-
|
|
58
|
-
/***/ },
|
|
59
|
-
|
|
60
|
-
/***/ "./dist/browser/Options/Classes/Split.js"
|
|
61
|
-
/*!***********************************************!*\
|
|
62
|
-
!*** ./dist/browser/Options/Classes/Split.js ***!
|
|
63
|
-
\***********************************************/
|
|
64
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
65
|
-
|
|
66
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Split: () => (/* binding */ Split)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _SplitFactor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SplitFactor.js */ \"./dist/browser/Options/Classes/SplitFactor.js\");\n/* harmony import */ var _SplitRate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SplitRate.js */ \"./dist/browser/Options/Classes/SplitRate.js\");\n\n\n\nclass Split {\n count;\n factor;\n fillColor;\n fillColorOffset;\n particles;\n rate;\n sizeOffset;\n strokeColor;\n strokeColorOffset;\n constructor(){\n this.count = 1;\n this.factor = new _SplitFactor_js__WEBPACK_IMPORTED_MODULE_1__.SplitFactor();\n this.rate = new _SplitRate_js__WEBPACK_IMPORTED_MODULE_2__.SplitRate();\n this.sizeOffset = true;\n }\n load(data) {\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNull)(data)) {\n return;\n }\n if (data.fillColor !== undefined) {\n this.fillColor = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OptionsColor.create(this.fillColor, data.fillColor);\n }\n if (data.strokeColor !== undefined) {\n this.strokeColor = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.OptionsColor.create(this.strokeColor, data.strokeColor);\n }\n if (data.count !== undefined) {\n this.count = data.count;\n }\n this.factor.load(data.factor);\n this.rate.load(data.rate);\n this.particles = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.executeOnSingleOrMultiple)(data.particles, (particles)=>{\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.deepExtend)({}, particles);\n });\n if (data.sizeOffset !== undefined) {\n this.sizeOffset = data.sizeOffset;\n }\n if (data.fillColorOffset) {\n this.fillColorOffset = this.fillColorOffset ?? {};\n if (data.fillColorOffset.h !== undefined) {\n this.fillColorOffset.h = data.fillColorOffset.h;\n }\n if (data.fillColorOffset.s !== undefined) {\n this.fillColorOffset.s = data.fillColorOffset.s;\n }\n if (data.fillColorOffset.l !== undefined) {\n this.fillColorOffset.l = data.fillColorOffset.l;\n }\n }\n if (data.strokeColorOffset) {\n this.strokeColorOffset = this.strokeColorOffset ?? {};\n if (data.strokeColorOffset.h !== undefined) {\n this.strokeColorOffset.h = data.strokeColorOffset.h;\n }\n if (data.strokeColorOffset.s !== undefined) {\n this.strokeColorOffset.s = data.strokeColorOffset.s;\n }\n if (data.strokeColorOffset.l !== undefined) {\n this.strokeColorOffset.l = data.strokeColorOffset.l;\n }\n }\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/Split.js?\n}");
|
|
67
|
-
|
|
68
|
-
/***/ },
|
|
69
|
-
|
|
70
|
-
/***/ "./dist/browser/Options/Classes/SplitFactor.js"
|
|
71
|
-
/*!*****************************************************!*\
|
|
72
|
-
!*** ./dist/browser/Options/Classes/SplitFactor.js ***!
|
|
73
|
-
\*****************************************************/
|
|
74
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
75
|
-
|
|
76
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SplitFactor: () => (/* binding */ SplitFactor)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass SplitFactor extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n constructor(){\n super();\n this.value = 3;\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/SplitFactor.js?\n}");
|
|
77
|
-
|
|
78
|
-
/***/ },
|
|
79
|
-
|
|
80
|
-
/***/ "./dist/browser/Options/Classes/SplitRate.js"
|
|
81
|
-
/*!***************************************************!*\
|
|
82
|
-
!*** ./dist/browser/Options/Classes/SplitRate.js ***!
|
|
83
|
-
\***************************************************/
|
|
84
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
85
|
-
|
|
86
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ SplitRate: () => (/* binding */ SplitRate)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nclass SplitRate extends _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.ValueWithRandom {\n constructor(){\n super();\n this.value = {\n min: 4,\n max: 9\n };\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Options/Classes/SplitRate.js?\n}");
|
|
87
|
-
|
|
88
|
-
/***/ },
|
|
89
|
-
|
|
90
|
-
/***/ "./dist/browser/Utils.js"
|
|
91
|
-
/*!*******************************!*\
|
|
92
|
-
!*** ./dist/browser/Utils.js ***!
|
|
93
|
-
\*******************************/
|
|
94
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
95
|
-
|
|
96
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ split: () => (/* binding */ split)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n\nconst defaultOffset = 0, minDestroySize = 0.5, defaultSplitCount = 0, increment = 1, unbreakableTime = 500, minSplitCount = 0, minHue = 0, hueRange = 360, minSaturation = 0, maxSaturation = 100, minLightness = 0, maxLightness = 100;\nfunction createParentColor(parentColor) {\n return _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimatableColor.create(undefined, {\n value: {\n hsl: parentColor\n }\n });\n}\nfunction createOffsetColor(parentColor, offset) {\n const offsetH = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(offset.h ?? defaultOffset), offsetS = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(offset.s ?? defaultOffset), offsetL = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(offset.l ?? defaultOffset), h = (parentColor.h + offsetH) % hueRange, s = Math.max(minSaturation, Math.min(maxSaturation, parentColor.s + offsetS)), l = Math.max(minLightness, Math.min(maxLightness, parentColor.l + offsetL));\n return _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimatableColor.create(undefined, {\n value: {\n hsl: {\n h: h < minHue ? h + hueRange : h,\n s,\n l\n }\n }\n });\n}\nfunction resolveSplitColor(offset, splitColor, splitParticlesColor, parentColor) {\n if (offset && parentColor) {\n return createOffsetColor(parentColor, offset);\n }\n if (splitColor) {\n return _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimatableColor.create(undefined, splitColor);\n }\n if (splitParticlesColor) {\n return _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.AnimatableColor.create(undefined, splitParticlesColor);\n }\n return parentColor ? createParentColor(parentColor) : undefined;\n}\nfunction addSplitParticle(pluginManager, container, parent, splitParticlesOptions) {\n const destroyOptions = parent.options.destroy;\n if (!destroyOptions) {\n return;\n }\n const splitOptions = destroyOptions.split, splitParticleOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.loadParticlesOptions)(pluginManager, container, parent.options), splitFillColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(splitOptions.fillColor), splitStrokeColor = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(splitOptions.strokeColor), parentFillColor = parent.getFillColor(), parentStrokeColor = parent.getStrokeColor();\n splitParticleOptions.move.load({\n center: {\n x: parent.position.x,\n y: parent.position.y,\n mode: _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.PixelMode.precise\n }\n });\n const factor = _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.identity / (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.factor.value);\n if ((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.isNumber)(splitParticleOptions.size.value)) {\n splitParticleOptions.size.value *= factor;\n } else {\n splitParticleOptions.size.value.min *= factor;\n splitParticleOptions.size.value.max *= factor;\n }\n splitParticleOptions.load(splitParticlesOptions);\n const splitParticleFillOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(splitParticleOptions.fill), splitParticleStrokeOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(splitParticleOptions.stroke), fillColor = resolveSplitColor(splitOptions.fillColorOffset, splitFillColor, splitParticleFillOptions?.color, parentFillColor), strokeColor = resolveSplitColor(splitOptions.strokeColorOffset, splitStrokeColor, splitParticleStrokeOptions?.color, parentStrokeColor);\n if (fillColor && splitParticleFillOptions) {\n splitParticleFillOptions.color = fillColor;\n }\n if (strokeColor && splitParticleStrokeOptions) {\n splitParticleStrokeOptions.color = strokeColor;\n }\n const offset = splitOptions.sizeOffset ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(-parent.size.value, parent.size.value) : defaultOffset, position = {\n x: parent.position.x + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRangeValue)(offset),\n y: parent.position.y + (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRangeValue)(offset)\n };\n return container.particles.addParticle(position, splitParticleOptions, parent.group, (particle)=>{\n if (particle.size.value < minDestroySize) {\n return false;\n }\n particle.velocity.length = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.randomInRangeValue)((0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.setRangeValue)(parent.velocity.length, particle.velocity.length));\n particle.splitCount = (parent.splitCount ?? defaultSplitCount) + increment;\n particle.unbreakable = true;\n particle.unbreakableUntil = performance.now() + unbreakableTime;\n return true;\n });\n}\nfunction split(pluginManager, container, particle) {\n const destroyOptions = particle.options.destroy;\n if (!destroyOptions) {\n return;\n }\n const splitOptions = destroyOptions.split;\n if (splitOptions.count >= minSplitCount) {\n if (particle.splitCount === undefined || particle.splitCount > splitOptions.count) {\n return;\n }\n particle.splitCount++;\n }\n const rate = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(splitOptions.rate.value), particlesSplitOptions = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.itemFromSingleOrMultiple)(splitOptions.particles);\n for(let i = 0; i < rate; i++){\n addSplitParticle(pluginManager, container, particle, particlesSplitOptions);\n }\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-destroy/./dist/browser/Utils.js?\n}");
|
|
97
|
-
|
|
98
|
-
/***/ }
|
|
99
|
-
|
|
100
|
-
}]);
|