@tsparticles/basic 4.0.0-alpha.26 → 4.0.0-alpha.28
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/116.min.js +1 -0
- package/149.min.js +1 -0
- package/161.min.js +1 -0
- package/{323.min.js → 194.min.js} +1 -1
- package/222.min.js +1 -0
- package/229.min.js +1 -0
- package/268.min.js +1 -0
- package/299.min.js +1 -0
- package/{727.min.js → 413.min.js} +1 -1
- package/465.min.js +1 -0
- package/510.min.js +1 -0
- package/{217.min.js → 578.min.js} +1 -1
- package/638.min.js +1 -0
- package/663.min.js +1 -0
- package/84.min.js +1 -0
- package/{907.min.js → 876.min.js} +1 -1
- package/89.min.js +1 -0
- package/91.min.js +1 -0
- package/964.min.js +1 -0
- package/{123.min.js → 970.min.js} +1 -1
- package/README.md +39 -2
- package/browser/index.js +4 -4
- package/cjs/index.js +4 -4
- package/engine_dist_browser_Core_Container_js.js +3 -3
- package/esm/index.js +4 -4
- package/package.json +11 -11
- package/plugins_colors_hex_dist_browser_HexColorManager_js.js +1 -1
- package/plugins_colors_hex_dist_browser_index_js.js +2 -2
- package/plugins_colors_hsl_dist_browser_HslColorManager_js.js +2 -2
- package/plugins_colors_hsl_dist_browser_index_js.js +2 -2
- package/plugins_colors_rgb_dist_browser_RgbColorManager_js.js +2 -2
- package/plugins_colors_rgb_dist_browser_index_js.js +2 -2
- package/plugins_move_dist_browser_MovePluginInstance_js.js +1 -1
- package/plugins_move_dist_browser_MovePlugin_js.js +1 -1
- package/plugins_move_dist_browser_index_js.js +2 -2
- package/report.html +1 -1
- package/shapes_circle_dist_browser_CircleDrawer_js.js +1 -1
- package/shapes_circle_dist_browser_index_js.js +2 -2
- package/tsparticles.basic.bundle.js +32 -22
- package/tsparticles.basic.bundle.min.js +2 -2
- package/tsparticles.basic.js +17 -17
- package/tsparticles.basic.min.js +1 -1
- package/umd/index.js +4 -4
- package/updaters_fillColor_dist_browser_FillColorUpdater_js.js +30 -0
- package/updaters_fillColor_dist_browser_index_js.js +30 -0
- package/updaters_opacity_dist_browser_OpacityUpdater_js.js +1 -1
- package/updaters_opacity_dist_browser_index_js.js +2 -2
- package/updaters_outModes_dist_browser_OutOfCanvasUpdater_js.js +1 -1
- package/updaters_outModes_dist_browser_index_js.js +2 -2
- package/updaters_size_dist_browser_SizeUpdater_js.js +1 -1
- package/updaters_size_dist_browser_index_js.js +2 -2
- package/121.min.js +0 -1
- package/183.min.js +0 -1
- package/218.min.js +0 -1
- package/245.min.js +0 -1
- package/255.min.js +0 -1
- package/278.min.js +0 -1
- package/32.min.js +0 -1
- package/337.min.js +0 -1
- package/423.min.js +0 -1
- package/439.min.js +0 -1
- package/47.min.js +0 -1
- package/586.min.js +0 -1
- package/662.min.js +0 -1
- package/763.min.js +0 -1
- package/862.min.js +0 -1
- package/updaters_color_dist_browser_ColorUpdater_js.js +0 -30
- package/updaters_color_dist_browser_index_js.js +0 -30
package/116.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[116],{7116(i,e,l){l.d(e,{FillColorUpdater:()=>t});var n=l(1989);class t{_container;_engine;constructor(i,e){this._container=e,this._engine=i}init(i){let e=this._container,l=i.options,t=(0,n.TA3)(l.fill,i.id,l.reduceDuplicates);if(!t)return;i.fillEnabled=t.enable,i.fillOpacity=(0,n.VGA)(t.opacity),i.fillAnimation=t.color.animation;let a=(0,n.R5R)(this._engine,t.color);a&&(i.fillColor=(0,n.pzy)(a,i.fillAnimation,e.retina.reduceFactor))}isEnabled(i){let e=i.fillAnimation,{fillColor:l}=i;return!i.destroyed&&!i.spawning&&!!e&&(l?.h.value!==void 0&&l.h.enable||l?.s.value!==void 0&&l.s.enable||l?.l.value!==void 0&&l.l.enable)}update(i,e){this.isEnabled(i)&&(0,n.JvX)(i.fillColor,e)}}}}]);
|
package/149.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[149],{4149(t,i,e){e.d(i,{Container:()=>O});var s=e(3221),a=e(2509),r=e(6083),n=e(7807),o=e(1160);function l(t,i,e=!1){if(!i)return;let s=t.style,a=new Set;for(let t=0;t<s.length;t++){let i=s.item(t);i&&a.add(i)}for(let t=0;t<i.length;t++){let e=i.item(t);e&&a.add(e)}for(let t of a){let a=i.getPropertyValue(t);a?s.setProperty(t,a,e?"important":""):s.removeProperty(t)}}class h{container;element;size;zoom=a.Pf;_canvasClearPlugins;_canvasPaintPlugins;_canvasSettings;_clearDrawPlugins;_colorPlugins;_context;_drawParticlePlugins;_drawParticlesCleanupPlugins;_drawParticlesSetupPlugins;_drawPlugins;_drawSettingsCleanupPlugins;_drawSettingsSetupPlugins;_engine;_generated;_mutationObserver;_originalStyle;_pointerEvents;_postDrawUpdaters;_preDrawUpdaters;_resizePlugins;_reusableColorStyles={};_reusablePluginColors=[void 0,void 0];_reusableTransform={};_standardSize;_zoomCenter;constructor(t,i){this.container=t,this._engine=i,this._standardSize={height:0,width:0};const e=t.retina.pixelRatio,s=this._standardSize;this.size={height:s.height*e,width:s.width*e},this._context=null,this._generated=!1,this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[],this._canvasClearPlugins=[],this._canvasPaintPlugins=[],this._clearDrawPlugins=[],this._drawParticlePlugins=[],this._drawParticlesCleanupPlugins=[],this._drawParticlesSetupPlugins=[],this._drawPlugins=[],this._drawSettingsSetupPlugins=[],this._drawSettingsCleanupPlugins=[],this._pointerEvents="none"}get settings(){return this._canvasSettings}get _fullScreen(){return this.container.actualOptions.fullScreen.enable}canvasClear(){this.container.actualOptions.clear&&this.draw(t=>{(0,r.IU)(t,this.size)})}clear(){let t=!1;for(let i of this._canvasClearPlugins)if(t=i.canvasClear?.()??!1)break;t||this.canvasClear()}destroy(){if(this.stop(),this._generated){let t=this.element;t?.remove(),this.element=void 0}else this._resetOriginalStyle();this._preDrawUpdaters=[],this._postDrawUpdaters=[],this._resizePlugins=[],this._colorPlugins=[],this._canvasClearPlugins=[],this._canvasPaintPlugins=[],this._clearDrawPlugins=[],this._drawParticlePlugins=[],this._drawParticlesCleanupPlugins=[],this._drawParticlesSetupPlugins=[],this._drawPlugins=[],this._drawSettingsSetupPlugins=[],this._drawSettingsCleanupPlugins=[]}draw(t){let i=this._context;if(i)return t(i)}drawParticle(t,i){if(t.spawning||t.destroyed)return;let e=t.getRadius();if(e<=a.w2)return;let s=t.getFillColor(),n=t.getStrokeColor(),[l,h]=this._getPluginParticleColors(t);if(l??=s,h??=n,!l&&!h)return;let c=this.container,d=t.options.zIndex,p=a.RV-t.zIndexFactor,{fillOpacity:u,opacity:_,strokeOpacity:g}=t.getOpacity(),f=this._reusableTransform,P=this._reusableColorStyles,m=l?(0,o.LC)(l,c.hdr,u*_):void 0,y=h?(0,o.LC)(h,c.hdr,g*_):m;f.a=f.b=f.c=f.d=void 0,P.fill=m,P.stroke=y,this.draw(s=>{for(let e of this._drawParticlesSetupPlugins)e.drawParticleSetup?.(s,t,i);for(let a of(this._applyPreDrawUpdaters(s,t,e,_,P,f),(0,r.p0)({container:c,context:s,particle:t,delta:i,colorStyles:P,radius:e*p**d.sizeRate,opacity:_,transform:f}),this._applyPostDrawUpdaters(t),this._drawParticlesCleanupPlugins))a.drawParticleCleanup?.(s,t,i)})}drawParticlePlugins(t,i){this.draw(e=>{for(let s of this._drawParticlePlugins)(0,r.Wb)(e,s,t,i)})}drawParticles(t){let{particles:i}=this.container;this.clear(),i.update(t),this.draw(e=>{for(let i of this._drawSettingsSetupPlugins)i.drawSettingsSetup?.(e,t);for(let i of this._drawPlugins)i.draw?.(e,t);for(let s of(i.drawParticles(t),this._clearDrawPlugins))s.clearDraw?.(e,t);for(let i of this._drawSettingsCleanupPlugins)i.drawSettingsCleanup?.(e,t)})}getZoomCenter(){let t=this.container.retina.pixelRatio,{width:i,height:e}=this.size;return this._zoomCenter?this._zoomCenter:{x:i*a.MX/t,y:e*a.MX/t}}init(){this._safeMutationObserver(t=>{t.disconnect()}),this._mutationObserver=(0,n.tG)(t=>{for(let i of t)"attributes"===i.type&&"style"===i.attributeName&&this._repairStyle()}),this.resize(),this._initStyle(),this.initBackground(),this._safeMutationObserver(t=>{this.element&&this.element instanceof Node&&t.observe(this.element,{attributes:!0})}),this.initUpdaters(),this.initPlugins(),this.paint()}initBackground(){let{container:t}=this,i=t.actualOptions.background,e=this.element;if(!e)return;let s=e.style,a=(0,o.BN)(this._engine,i.color);a?s.backgroundColor=(0,o.xx)(a,t.hdr,i.opacity):s.backgroundColor="",s.backgroundImage=i.image||"",s.backgroundPosition=i.position||"",s.backgroundRepeat=i.repeat||"",s.backgroundSize=i.size||""}initPlugins(){for(let t of(this._resizePlugins=[],this._colorPlugins=[],this._canvasClearPlugins=[],this._canvasPaintPlugins=[],this._clearDrawPlugins=[],this._drawParticlePlugins=[],this._drawParticlesSetupPlugins=[],this._drawParticlesCleanupPlugins=[],this._drawPlugins=[],this._drawSettingsSetupPlugins=[],this._drawSettingsCleanupPlugins=[],this.container.plugins))t.resize&&this._resizePlugins.push(t),(t.particleFillColor??t.particleStrokeColor)&&this._colorPlugins.push(t),t.canvasClear&&this._canvasClearPlugins.push(t),t.canvasPaint&&this._canvasPaintPlugins.push(t),t.drawParticle&&this._drawParticlePlugins.push(t),t.drawParticleSetup&&this._drawParticlesSetupPlugins.push(t),t.drawParticleCleanup&&this._drawParticlesCleanupPlugins.push(t),t.draw&&this._drawPlugins.push(t),t.drawSettingsSetup&&this._drawSettingsSetupPlugins.push(t),t.drawSettingsCleanup&&this._drawSettingsCleanupPlugins.push(t),t.clearDraw&&this._clearDrawPlugins.push(t)}initUpdaters(){for(let t of(this._preDrawUpdaters=[],this._postDrawUpdaters=[],this.container.particles.updaters))t.afterDraw&&this._postDrawUpdaters.push(t),(t.getColorStyles??t.getTransformValues??t.beforeDraw)&&this._preDrawUpdaters.push(t)}loadCanvas(t){this._generated&&this.element&&this.element.remove();let i=this.container;this._generated=a.eb in t.dataset?"true"===t.dataset[a.eb]:this._generated,this.element=t,this.element.ariaHidden="true",this._originalStyle=(0,n.td)(this.element.style);let e=this._standardSize;e.height=t.offsetHeight,e.width=t.offsetWidth;let s=this.container.retina.pixelRatio,r=this.size;t.height=r.height=e.height*s,t.width=r.width=e.width*s;let o=(0,n.lV)("(color-gamut: p3)");this._canvasSettings={alpha:!0,colorSpace:o?.matches&&i.hdr?"display-p3":"srgb",desynchronized:!0,willReadFrequently:!1},this._context=this.element.getContext("2d",this._canvasSettings),this._context&&(this._context.globalCompositeOperation=a.yj),this._safeMutationObserver(t=>{t.disconnect()}),i.retina.init(),this.initBackground(),this._safeMutationObserver(t=>{this.element&&this.element instanceof Node&&t.observe(this.element,{attributes:!0})})}paint(){let t=!1;for(let i of this._canvasPaintPlugins)if(t=i.canvasPaint?.()??!1)break;t||this.paintBase()}paintBase(t){this.draw(i=>{(0,r.Sn)(i,this.size,t)})}paintImage(t,i){this.draw(e=>{(0,r.Md)(e,this.size,t,i)})}resize(){if(!this.element)return!1;let t=this.container,i=t.canvas._standardSize,e={width:this.element.offsetWidth,height:this.element.offsetHeight},s=t.retina.pixelRatio,a={width:e.width*s,height:e.height*s};if(e.height===i.height&&e.width===i.width&&a.height===this.element.height&&a.width===this.element.width)return!1;let r={...i};i.height=e.height,i.width=e.width;let n=this.size;return this.element.width=n.width=a.width,this.element.height=n.height=a.height,this.container.started&&t.particles.setResizeFactor({width:i.width/r.width,height:i.height/r.height}),!0}setPointerEvents(t){this.element&&(this._pointerEvents=t,this._repairStyle())}setZoom(t,i){this.zoom=t,this._zoomCenter=i}stop(){this._safeMutationObserver(t=>{t.disconnect()}),this._mutationObserver=void 0,this.draw(t=>{(0,r.IU)(t,this.size)})}async windowResize(){if(!this.element||!this.resize())return;let t=this.container,i=t.updateActualOptions();t.particles.setDensity(),this._applyResizePlugins(),i&&await t.refresh()}_applyPostDrawUpdaters=t=>{for(let i of this._postDrawUpdaters)i.afterDraw?.(t)};_applyPreDrawUpdaters=(t,i,e,s,r,n)=>{for(let o of this._preDrawUpdaters){if(o.getColorStyles){let{fill:a,stroke:n}=o.getColorStyles(i,t,e,s);a&&(r.fill=a),n&&(r.stroke=n)}if(o.getTransformValues){let t=o.getTransformValues(i);for(let i in t)!function(t,i,e){let s=i[e];void 0!==s&&(t[e]=(t[e]??a.zs)*s)}(n,t,i)}o.beforeDraw?.(i)}};_applyResizePlugins=()=>{for(let t of this._resizePlugins)t.resize?.()};_getPluginParticleColors=t=>{let i,e;for(let s of this._colorPlugins)if(!i&&s.particleFillColor&&(i=(0,o.R5)(this._engine,s.particleFillColor(t))),!e&&s.particleStrokeColor&&(e=(0,o.R5)(this._engine,s.particleStrokeColor(t))),i&&e)break;return this._reusablePluginColors[0]=i,this._reusablePluginColors[1]=e,this._reusablePluginColors};_initStyle=()=>{let t=this.element,i=this.container.actualOptions;if(t)for(let e in this._fullScreen?this._setFullScreenStyle():this._resetOriginalStyle(),i.style){if(!e||!(e in i.style))continue;let s=i.style[e];s&&t.style.setProperty(e,s,"important")}};_repairStyle=()=>{let t=this.element;if(!t)return;this._safeMutationObserver(t=>{t.disconnect()}),this._initStyle(),this.initBackground();let i=this._pointerEvents;t.style.pointerEvents=i,t.setAttribute("pointer-events",i),this._safeMutationObserver(i=>{t instanceof Node&&i.observe(t,{attributes:!0})})};_resetOriginalStyle=()=>{let t=this.element,i=this._originalStyle;t&&i&&l(t,i,!0)};_safeMutationObserver=t=>{this._mutationObserver&&t(this._mutationObserver)};_setFullScreenStyle=()=>{let t=this.element;t&&l(t,(0,n.hJ)(this.container.actualOptions.fullScreen.zIndex),!0)}}class c{container;_handlers;_resizeObserver;_resizeTimeout;constructor(t){this.container=t,this._handlers={visibilityChange:()=>{this._handleVisibilityChange()},resize:()=>{this._handleWindowResize()}}}addListeners(){this._manageListeners(!0)}removeListeners(){this._manageListeners(!1)}_handleVisibilityChange=()=>{let t=this.container;t.actualOptions.pauseOnBlur&&((0,n.T5)().hidden?(t.pageHidden=!0,t.pause()):(t.pageHidden=!1,t.animationStatus?t.play(!0):t.draw(!0)))};_handleWindowResize=()=>{this._resizeTimeout&&(clearTimeout(this._resizeTimeout),delete this._resizeTimeout);let t=async()=>{let t=this.container.canvas;await t.windowResize()};this._resizeTimeout=setTimeout(()=>void t(),this.container.actualOptions.resize.delay*a.Xu)};_manageListeners=t=>{let i=this._handlers;this._manageResize(t),(0,n.Kp)(document,a.nK,i.visibilityChange,t,!1)};_manageResize=t=>{let i=this._handlers,e=this.container;if(!e.actualOptions.resize.enable)return;if("u"<typeof ResizeObserver)return void(0,n.Kp)(globalThis,a.NF,i.resize,t);let s=e.canvas.element;this._resizeObserver&&!t?(s&&this._resizeObserver.unobserve(s),this._resizeObserver.disconnect(),delete this._resizeObserver):!this._resizeObserver&&t&&s&&(this._resizeObserver=new ResizeObserver(t=>{t.find(t=>t.target===s)&&this._handleWindowResize()}),this._resizeObserver.observe(s))}}var d=e(4967),p=e(7752),u=e(2402),_=e(2056),g=e(5518),f=e(481),P=e(777),m=e(8507);function y(t){if(!(0,n.hn)(t.outMode,t.checkModes))return;let i=t.radius*a.gd;t.coord>t.maxCoord-i?t.setCb(-t.radius):t.coord<i&&t.setCb(t.radius)}class w{container;backColor;bubble;destroyed;direction;effect;effectClose;effectData;fillColor;fillEnabled;fillOpacity;group;id;ignoresResizeRatio;initialPosition;initialVelocity;isRotating;lastPathTime;misplaced;moveCenter;offset;opacity;options;outType;pathRotation;position;randomIndexData;retina;roll;rotation;shape;shapeClose;shapeData;sides;size;slow;spawning;strokeColor;strokeOpacity;strokeWidth;unbreakable;velocity;zIndexFactor;_cachedOpacityData={fillOpacity:a.hv,opacity:a.hv,strokeOpacity:a.hv};_cachedPosition=_.p.origin;_cachedRotateData={sin:0,cos:0};_cachedTransform={a:1,b:0,c:0,d:1};_engine;constructor(t,i){this.container=i,this._engine=t}destroy(t){if(this.unbreakable||this.destroyed)return;this.destroyed=!0,this.bubble.inRange=!1,this.slow.inRange=!1;let i=this.container,e=this.shape?i.particles.shapeDrawers.get(this.shape):void 0;for(let s of(e?.particleDestroy?.(this),i.particleDestroyedPlugins))s.particleDestroyed?.(this,t);for(let e of i.particles.updaters)e.particleDestroyed?.(this,t);this._engine.dispatchEvent(d.B.particleDestroyed,{container:this.container,data:{particle:this}})}draw(t){let i=this.container.canvas;i.drawParticlePlugins(this,t),i.drawParticle(this,t)}getAngle(){return this.rotation+(this.pathRotation?this.velocity.angle:a.tA)}getFillColor(){return this._getRollColor(this.bubble.color??(0,o.O_)(this.fillColor))}getMass(){return this.getRadius()**a.dm*Math.PI*a.MX}getOpacity(){let t=this.options.zIndex,i=a.RV-this.zIndexFactor,e=i**t.opacityRate,r=this.bubble.opacity??(0,s.VG)(this.opacity?.value??a.hv),n=this.fillOpacity??a.hv,o=this.strokeOpacity??a.hv;return this._cachedOpacityData.fillOpacity=r*n*e,this._cachedOpacityData.opacity=r*e,this._cachedOpacityData.strokeOpacity=r*o*e,this._cachedOpacityData}getPosition(){return this._cachedPosition.x=this.position.x+this.offset.x,this._cachedPosition.y=this.position.y+this.offset.y,this._cachedPosition.z=this.position.z,this._cachedPosition}getRadius(){return this.bubble.radius??this.size.value}getRotateData(){let t=this.getAngle();return this._cachedRotateData.sin=Math.sin(t),this._cachedRotateData.cos=Math.cos(t),this._cachedRotateData}getStrokeColor(){return this._getRollColor(this.bubble.color??(0,o.O_)(this.strokeColor))}getTransformData(t){let i=this.getRotateData(),e=this.isRotating;return this._cachedTransform.a=i.cos*(t.a??a.Ug.a),this._cachedTransform.b=e?i.sin*(t.b??a.D_):t.b??a.Ug.b,this._cachedTransform.c=e?-i.sin*(t.c??a.D_):t.c??a.Ug.c,this._cachedTransform.d=i.cos*(t.d??a.Ug.d),this._cachedTransform}init(t,i,e,r){var o,l,h,c;let d,p,u,_,g=this.container;this.id=t,this.group=r,this.effectClose=!0,this.shapeClose=!0,this.pathRotation=!1,this.lastPathTime=0,this.destroyed=!1,this.unbreakable=!1,this.isRotating=!1,this.rotation=0,this.misplaced=!1,this.retina={maxDistance:{}},this.outType=P.x.normal,this.ignoresResizeRatio=!0;let f=g.retina.pixelRatio,y=g.actualOptions,w=(0,m.y)(this._engine,g,y.particles),v=w.reduceDuplicates,z=w.effect.type,b=w.shape.type;this.effect=(0,n.TA)(z,this.id,v),this.shape=(0,n.TA)(b,this.id,v);let S=w.effect,C=w.shape;if(e){if(e.effect?.type){let t=e.effect.type,i=(0,n.TA)(t,this.id,v);i&&(this.effect=i,S.load(e.effect))}if(e.shape?.type){let t=e.shape.type,i=(0,n.TA)(t,this.id,v);i&&(this.shape=i,C.load(e.shape))}}if(this.effect===a.mR){let t=[...this.container.particles.effectDrawers.keys()];this.effect=t[Math.floor((0,s.G0)()*t.length)]}if(this.shape===a.mR){let t=[...this.container.particles.shapeDrawers.keys()];this.shape=t[Math.floor((0,s.G0)()*t.length)]}this.effectData=this.effect?(o=this.effect,l=this.id,u=S.options[o],(0,n.zw)({close:S.close},(0,n.TA)(u,l,v))):void 0,this.shapeData=this.shape?(h=this.shape,c=this.id,_=C.options[h],(0,n.zw)({close:C.close},(0,n.TA)(_,c,v))):void 0,w.load(e);let x=this.effectData;x&&w.load(x.particles);let D=this.shapeData;D&&w.load(D.particles),this.effectClose=x?.close??w.effect.close,this.shapeClose=D?.close??w.shape.close,this.options=w,g.retina.initParticle(this),this.size=(0,n.Xs)(this.options.size,f),this.bubble={inRange:!1},this.slow={inRange:!1,factor:1},this._initPosition(i),this.initialVelocity=this._calculateVelocity(),this.velocity=this.initialVelocity.copy();let O=g.particles;O.setLastZIndex(this.position.z),this.zIndexFactor=this.position.z/g.zLayers,this.sides=24,this.effect&&(d=g.particles.effectDrawers.get(this.effect)),d?.loadEffect&&d.loadEffect(this),this.shape&&(p=g.particles.shapeDrawers.get(this.shape)),p?.loadShape&&p.loadShape(this);let R=p?.getSidesCount;for(let t of(R&&(this.sides=R(this)),this.spawning=!1,O.updaters))t.init(this);for(let t of(d?.particleInit?.(g,this),p?.particleInit?.(g,this),g.particleCreatedPlugins))t.particleCreated?.(this)}isInsideCanvas(){let t=this.getRadius(),i=this.container.canvas.size,e=this.position;return e.x>=-t&&e.y>=-t&&e.y<=i.height+t&&e.x<=i.width+t}isShowingBack(){if(!this.roll)return!1;let t=this.roll.angle;if(this.roll.horizontal&&this.roll.vertical){let i=t%a.R1,e=i<a.tA?i+a.R1:i;return e>=Math.PI*a.MX&&e<Math.PI*a.Nu*a.MX}if(this.roll.horizontal){let i=(t+Math.PI*a.MX)%(Math.PI*a.gd),e=i<a.tA?i+Math.PI*a.gd:i;return e>=Math.PI&&e<Math.PI*a.gd}if(this.roll.vertical){let i=t%(Math.PI*a.gd),e=i<a.tA?i+Math.PI*a.gd:i;return e>=Math.PI&&e<Math.PI*a.gd}return!1}isVisible(){return!this.destroyed&&!this.spawning&&this.isInsideCanvas()}reset(){for(let t of this.container.particles.updaters)t.reset?.(this)}_calcPosition=(t,i)=>{let e=a.rq,r=t?_.p.create(t.x,t.y,i):void 0,n=this.container,o=n.particlePositionPlugins,l=this.options.move.outModes,h=this.getRadius(),c=n.canvas.size,{signal:d}=new AbortController;for(;!d.aborted;){for(let t of o){let e=t.particlePosition?.(r,this);if(e)return _.p.create(e.x,e.y,i)}let t=(0,s.Nx)({size:c,position:r}),d=_.p.create(t.x,t.y,i);this._fixHorizontal(d,h,l.left??l.default),this._fixHorizontal(d,h,l.right??l.default),this._fixVertical(d,h,l.top??l.default),this._fixVertical(d,h,l.bottom??l.default);let p=!0;for(let t of n.particles.checkParticlePositionPlugins)if(!(p=t.checkParticlePosition?.(this,d,e)??!0))break;if(p)return d;e+=a.Eo,r=void 0}return r};_calculateVelocity=()=>{let t=(0,s.$m)(this.direction).copy(),i=this.options.move;if(i.direction===g.F.inside||i.direction===g.F.outside)return t;let e=(0,s.pu)((0,s.VG)(i.angle.value)),r=(0,s.pu)((0,s.VG)(i.angle.offset)),n={left:r-e*a.MX,right:r+e*a.MX};return i.straight||(t.angle+=(0,s.vE)((0,s.DT)(n.left,n.right))),i.random&&"number"==typeof i.speed&&(t.length*=(0,s.G0)()),t};_fixHorizontal=(t,i,e)=>{y({outMode:e,checkModes:[f.Y.bounce],coord:t.x,maxCoord:this.container.canvas.size.width,setCb:i=>t.x+=i,radius:i})};_fixVertical=(t,i,e)=>{y({outMode:e,checkModes:[f.Y.bounce],coord:t.y,maxCoord:this.container.canvas.size.height,setCb:i=>t.y+=i,radius:i})};_getRollColor=t=>t&&this.roll&&(this.backColor||this.roll.alter)&&this.isShowingBack()?this.backColor?this.backColor:this.roll.alter?(0,o.yx)(t,this.roll.alter.type,this.roll.alter.value):t:t;_initPosition=t=>{let i=this.container,e=(0,s.VG)(this.options.zIndex.value),r=this._calcPosition(t,(0,s.qE)(e,a.X_,i.zLayers));if(!r)throw Error("a valid position cannot be found for particle");this.position=r,this.initialPosition=this.position.copy();let o=i.canvas.size;switch(this.moveCenter={...(0,n.E9)(this.options.move.center,o),radius:this.options.move.center.radius,mode:this.options.move.center.mode},this.direction=(0,s.JY)(this.options.move.direction,this.position,this.moveCenter),this.options.move.direction){case g.F.inside:this.outType=P.x.inside;break;case g.F.outside:this.outType=P.x.outside}this.offset=_.M.origin}}var v=e(1810);class z{_cellSize;_cells=new Map;_pendingCellSize;constructor(t){this._cellSize=t}clear(){this._cells.clear();let t=this._pendingCellSize;t&&(this._cellSize=t),this._pendingCellSize=void 0}insert(t){let{x:i,y:e}=t.getPosition(),s=this._cellKeyFromCoords(i,e);this._cells.has(s)||this._cells.set(s,[]),this._cells.get(s)?.push(t)}query(t,i,e=[]){let s=this._getRangeBounds(t);if(!s)return e;let a=Math.floor(s.minX/this._cellSize),r=Math.floor(s.maxX/this._cellSize),n=Math.floor(s.minY/this._cellSize),o=Math.floor(s.maxY/this._cellSize);for(let s=a;s<=r;s++)for(let a=n;a<=o;a++){let r=`${s}_${a}`,n=this._cells.get(r);if(n)for(let s of n)(!i||i(s))&&t.contains(s.getPosition())&&e.push(s)}return e}queryCircle(t,i,e,s=[]){return this.query(new v.jl(t.x,t.y,i),e,s)}queryRectangle(t,i,e,s=[]){return this.query(new v.M_(t.x,t.y,i.width,i.height),e,s)}setCellSize(t){this._pendingCellSize=t}_cellKeyFromCoords(t,i){let e=Math.floor(t/this._cellSize),s=Math.floor(i/this._cellSize);return`${e}_${s}`}_getRangeBounds(t){if(t instanceof v.jl){let i=t.radius,{x:e,y:s}=t.position;return{minX:e-i,maxX:e+i,minY:s-i,maxY:s+i}}if(t instanceof v.M_){let{x:i,y:e}=t.position,{width:s,height:a}=t.size;return{minX:i,maxX:i+s,minY:e,maxY:e+a}}return null}}var b=e(3535);class S{checkParticlePositionPlugins;effectDrawers;grid;shapeDrawers;updaters;_array;_container;_engine;_groupLimits;_limit;_maxZIndex;_minZIndex;_needsSort;_nextId;_particleResetPlugins;_particleUpdatePlugins;_pool;_postParticleUpdatePlugins;_postUpdatePlugins;_resizeFactor;_updatePlugins;_zArray;constructor(t,i){this._engine=t,this._container=i,this._nextId=0,this._array=[],this._zArray=[],this._pool=[],this._limit=0,this._groupLimits=new Map,this._needsSort=!1,this._minZIndex=0,this._maxZIndex=0,this.grid=new z(a.iX),this.effectDrawers=new Map,this.shapeDrawers=new Map,this.updaters=[],this.checkParticlePositionPlugins=[],this._particleResetPlugins=[],this._particleUpdatePlugins=[],this._postUpdatePlugins=[],this._postParticleUpdatePlugins=[],this._updatePlugins=[]}get count(){return this._array.length}addParticle(t,i,e,s){let r=this._container.actualOptions.particles.number.limit.mode,n=void 0===e?this._limit:this._groupLimits.get(e)??this._limit,o=this.count;if(n>a.ou)switch(r){case u.d.delete:{let t=o+a.nq-n;t>a.wM&&this.removeQuantity(t);break}case u.d.wait:if(o>=n)return}try{let a=this._pool.pop()??new w(this._engine,this._container);a.init(this._nextId,t,i,e);let r=!0;if(s&&(r=s(a)),!r)return void this._pool.push(a);return this._array.push(a),this._zArray.push(a),this._nextId++,this._engine.dispatchEvent(d.B.particleAdded,{container:this._container,data:{particle:a}}),a}catch(t){(0,b.t)().warning(`error adding particle: ${t}`)}}clear(){this._array=[],this._zArray=[]}destroy(){let t=this._container;for(let[,i]of this.effectDrawers)i.destroy?.(t);for(let[,i]of this.shapeDrawers)i.destroy?.(t);this._array=[],this._pool.length=0,this._zArray=[],this.effectDrawers=new Map,this.shapeDrawers=new Map,this.updaters=[],this.checkParticlePositionPlugins=[],this._particleResetPlugins=[],this._particleUpdatePlugins=[],this._postUpdatePlugins=[],this._postParticleUpdatePlugins=[],this._updatePlugins=[]}drawParticles(t){for(let i of this._zArray)i.draw(t)}filter(t){return this._array.filter(t)}find(t){return this._array.find(t)}get(t){return this._array[t]}async init(){let t=this._container,i=t.actualOptions;for(let i of(this._minZIndex=0,this._maxZIndex=0,this._needsSort=!1,this.checkParticlePositionPlugins=[],this._updatePlugins=[],this._particleUpdatePlugins=[],this._postUpdatePlugins=[],this._particleResetPlugins=[],this._postParticleUpdatePlugins=[],this.grid=new z(a.iX*t.retina.pixelRatio),t.plugins))i.redrawInit&&await i.redrawInit(),i.checkParticlePosition&&this.checkParticlePositionPlugins.push(i),i.update&&this._updatePlugins.push(i),i.particleUpdate&&this._particleUpdatePlugins.push(i),i.postUpdate&&this._postUpdatePlugins.push(i),i.particleReset&&this._particleResetPlugins.push(i),i.postParticleUpdate&&this._postParticleUpdatePlugins.push(i);for(let i of(await this.initPlugins(),this.effectDrawers.values()))await i.init?.(t);for(let i of this.shapeDrawers.values())await i.init?.(t);let e=!1;for(let i of t.plugins)if(e=i.particlesInitialization?.()??e)break;if(!e){let t=i.particles,e=t.groups;for(let i in e){let s=e[i];if(s)for(let e=this.count,a=0;a<s.number.value&&e<t.number.value;e++,a++)this.addParticle(void 0,s,i)}for(let i=this.count;i<t.number.value;i++)this.addParticle()}}async initPlugins(){let t=this._container;this.effectDrawers=await this._engine.getEffectDrawers(t,!0),this.shapeDrawers=await this._engine.getShapeDrawers(t,!0),this.updaters=await this._engine.getUpdaters(t,!0)}push(t,i,e,s){for(let a=0;a<t;a++)this.addParticle(i,e,s)}async redraw(){this.clear(),await this.init(),this._container.canvas.drawParticles({value:0,factor:0})}remove(t,i,e){this.removeAt(this._array.indexOf(t),void 0,i,e)}removeAt(t,i=a.xd,e,s){if(t<a.z9||t>this.count)return;let r=0;for(let a=t;r<i&&a<this.count;a++)this._removeParticle(a,e,s)&&(a--,r++)}removeQuantity(t,i){this.removeAt(a.z9,t,i)}setDensity(){let t=this._container.actualOptions,i=t.particles.groups,e=0;for(let t of this._container.plugins)t.particlesDensityCount&&(e+=t.particlesDensityCount());for(let t in i){let s=i[t];if(!s)continue;let a=(0,m.y)(this._engine,this._container,s);this._applyDensity(a,e,t)}this._applyDensity(t.particles,e)}setLastZIndex(t){this._needsSort||=t>=this._maxZIndex||t>this._minZIndex&&t<this._maxZIndex}setResizeFactor(t){this._resizeFactor=t}update(t){let i=new Set;for(let i of(this.grid.clear(),this._updatePlugins))i.update?.(t);let e=this._resizeFactor;for(let s of this._array){for(let t of(e&&!s.ignoresResizeRatio&&(s.position.x*=e.width,s.position.y*=e.height,s.initialPosition.x*=e.width,s.initialPosition.y*=e.height),s.ignoresResizeRatio=!1,this._particleResetPlugins))t.particleReset?.(s);for(let i of this._particleUpdatePlugins){if(s.destroyed)break;i.particleUpdate?.(s,t)}if(s.destroyed){i.add(s);continue}this.grid.insert(s)}if(i.size){let t=t=>!i.has(t);for(let e of(this._array=this.filter(t),this._zArray=this._zArray.filter(t),i))this._engine.dispatchEvent(d.B.particleRemoved,{container:this._container,data:{particle:e}});this._addToPool(...i)}for(let i of this._postUpdatePlugins)i.postUpdate?.(t);for(let i of this._array){for(let e of this.updaters)e.update(i,t);if(!i.destroyed&&!i.spawning)for(let e of this._postParticleUpdatePlugins)e.postParticleUpdate?.(i,t)}if(delete this._resizeFactor,this._needsSort){let t=this._zArray;t.sort((t,i)=>i.position.z-t.position.z||t.id-i.id);let i=t[a.z9],e=t[t.length-a.K3];if(!i||!e)return;this._maxZIndex=i.position.z,this._minZIndex=e.position.z,this._needsSort=!1}}_addToPool=(...t)=>{this._pool.push(...t)};_applyDensity=(t,i,e,s)=>{let r=t.number;if(!r.density.enable)return void(void 0===e?this._limit=r.limit.value:(s?.number.limit.value??r.limit.value)&&this._groupLimits.set(e,s?.number.limit.value??r.limit.value));let n=this._initDensityFactor(r.density),o=r.value,l=r.limit.value>a.ou?r.limit.value:o,h=Math.min(o,l)*n+i,c=Math.min(this.count,this.filter(t=>t.group===e).length);void 0===e?this._limit=r.limit.value*n:this._groupLimits.set(e,r.limit.value*n),c<h?this.push(Math.abs(h-c),void 0,t,e):c>h&&this.removeQuantity(c-h,e)};_initDensityFactor=t=>{let i=this._container;if(!i.canvas.element||!t.enable)return a.lA;let e=i.canvas.element,s=i.retina.pixelRatio;return e.width*e.height/(t.height*t.width*s**a.dm)};_removeParticle=(t,i,e)=>{let s=this._array[t];if(!s||s.group!==i)return!1;let r=this._zArray.indexOf(s);return this._array.splice(t,a.LD),this._zArray.splice(r,a.LD),s.destroy(e),this._engine.dispatchEvent(d.B.particleRemoved,{container:this._container,data:{particle:s}}),this._addToPool(s),!0}}class C{container;maxSpeed;pixelRatio;reduceFactor;sizeAnimationSpeed;constructor(t){this.container=t,this.pixelRatio=a.$x,this.reduceFactor=a.Zp}init(){let t=this.container,i=t.actualOptions;this.pixelRatio=i.detectRetina?devicePixelRatio:a.$x,this.reduceFactor=a.Zp;let e=this.pixelRatio,r=t.canvas;if(r.element){let t=r.element;r.size.width=t.offsetWidth*e,r.size.height=t.offsetHeight*e}let n=i.particles,o=n.move;this.maxSpeed=(0,s.VG)(o.gravity.maxSpeed)*e,this.sizeAnimationSpeed=(0,s.VG)(n.size.animation.speed)*e}initParticle(t){let i=t.options,e=this.pixelRatio,a=i.move,r=a.distance,n=t.retina;n.moveDrift=(0,s.VG)(a.drift)*e,n.moveSpeed=(0,s.VG)(a.speed)*e,n.sizeAnimationSpeed=(0,s.VG)(i.size.animation.speed)*e;let o=n.maxDistance;o.horizontal=void 0!==r.horizontal?r.horizontal*e:void 0,o.vertical=void 0!==r.vertical?r.vertical*e:void 0,n.maxSpeed=(0,s.VG)(a.gravity.maxSpeed)*e}}function x(t){return!t.destroyed}function D(t,i,...e){let s=new p.J(t,i);return(0,m.Z)(s,...e),s}class O{actualOptions;canvas;destroyed;fpsLimit;hdr;id;pageHidden;particleCreatedPlugins;particleDestroyedPlugins;particlePositionPlugins;particles;plugins;retina;started;zLayers;_delay;_delayTimeout;_delta={value:0,factor:0};_drawAnimationFrame;_duration;_engine;_eventListeners;_firstStart;_initialSourceOptions;_lastFrameTime;_lifeTime;_options;_paused;_smooth;_sourceOptions;constructor(t,i,e){this._engine=t,this.id=Symbol(i),this.fpsLimit=120,this.hdr=!1,this._smooth=!1,this._delay=0,this._duration=0,this._lifeTime=0,this._firstStart=!0,this.started=!1,this.destroyed=!1,this._paused=!0,this._lastFrameTime=0,this.zLayers=100,this.pageHidden=!1,this._sourceOptions=e,this._initialSourceOptions=e,this.retina=new C(this),this.canvas=new h(this,this._engine),this.particles=new S(this._engine,this),this.plugins=[],this.particleDestroyedPlugins=[],this.particleCreatedPlugins=[],this.particlePositionPlugins=[],this._options=D(this._engine,this),this.actualOptions=D(this._engine,this),this._eventListeners=new c(this),this._engine.dispatchEvent(d.B.containerBuilt,{container:this})}get animationStatus(){return!this._paused&&!this.pageHidden&&x(this)}get options(){return this._options}get sourceOptions(){return this._sourceOptions}addLifeTime(t){this._lifeTime+=t}alive(){return!this._duration||this._lifeTime<=this._duration}destroy(t=!0){if(x(this)){for(let t of(this.stop(),this.particles.destroy(),this.canvas.destroy(),this.plugins))t.destroy?.();if(this.plugins.length=0,this._engine.clearPlugins(this),this.destroyed=!0,t){let t=this._engine.items,i=t.indexOf(this);i>=a.vF&&t.splice(i,a.JC)}this._engine.dispatchEvent(d.B.containerDestroyed,{container:this})}}draw(t){if(!x(this))return;let i=t;this._drawAnimationFrame=(0,s.i0)(t=>{i&&(this._lastFrameTime=void 0,i=!1),this._nextFrame(t)})}async export(t,i={}){for(let e of this.plugins){if(!e.export)continue;let s=await e.export(t,i);if(s.supported)return s.blob}(0,b.t)().error(`Export plugin with type ${t} not found`)}async init(){if(!x(this))return;let t=new Map;for(let i of this._engine.plugins){let e=await i.getPlugin(this);e.preInit&&await e.preInit(),t.set(i,e)}for(let[i,e]of(await this.particles.initPlugins(),this._options=D(this._engine,this,this._initialSourceOptions,this.sourceOptions),this.actualOptions=D(this._engine,this,this._options),this.plugins.length=0,this.particleDestroyedPlugins.length=0,this.particleCreatedPlugins.length=0,this.particlePositionPlugins.length=0,t))i.needsPlugin(this.actualOptions)&&(this.plugins.push(e),e.particleCreated&&this.particleCreatedPlugins.push(e),e.particleDestroyed&&this.particleDestroyedPlugins.push(e),e.particlePosition&&this.particlePositionPlugins.push(e));this.retina.init(),this.canvas.init(),this.updateActualOptions(),this.canvas.initBackground(),this.canvas.resize();let{delay:i,duration:e,fpsLimit:r,hdr:n,smooth:o,zLayers:l}=this.actualOptions;for(let t of(this.hdr=n,this.zLayers=l,this._duration=(0,s.VG)(e)*a.Xu,this._delay=(0,s.VG)(i)*a.Xu,this._lifeTime=0,this.fpsLimit=r>a.DN?r:a.i8,this._smooth=o,this.plugins))await t.init?.();for(let t of(await this.particles.init(),this._engine.dispatchEvent(d.B.containerInit,{container:this}),this.particles.setDensity(),this.plugins))t.particlesSetup?.();this._engine.dispatchEvent(d.B.particlesSetup,{container:this})}pause(){if(x(this)&&(void 0!==this._drawAnimationFrame&&((0,s.px)(this._drawAnimationFrame),delete this._drawAnimationFrame),!this._paused)){for(let t of this.plugins)t.pause?.();this.pageHidden||(this._paused=!0),this._engine.dispatchEvent(d.B.containerPaused,{container:this})}}play(t){if(!x(this))return;let i=this._paused||t;if(this._firstStart&&!this.actualOptions.autoPlay){this._firstStart=!1;return}if(this._paused&&(this._paused=!1),i)for(let t of this.plugins)t.play&&t.play();this._engine.dispatchEvent(d.B.containerPlay,{container:this}),this.draw(i??!1)}async refresh(){if(x(this))return this.stop(),this.start()}async reset(t){if(x(this))return this._initialSourceOptions=t,this._sourceOptions=t,this._options=D(this._engine,this,this._initialSourceOptions,this.sourceOptions),this.actualOptions=D(this._engine,this,this._options),this.refresh()}async start(){x(this)&&!this.started&&(await this.init(),this.started=!0,await new Promise(t=>{let i=async()=>{for(let t of(this._eventListeners.addListeners(),this.plugins))await t.start?.();this._engine.dispatchEvent(d.B.containerStarted,{container:this}),this.play(),t()};this._delayTimeout=setTimeout(()=>void i(),this._delay)}))}stop(){if(x(this)&&this.started){for(let t of(this._delayTimeout&&(clearTimeout(this._delayTimeout),delete this._delayTimeout),this._firstStart=!0,this.started=!1,this._eventListeners.removeListeners(),this.pause(),this.particles.clear(),this.canvas.stop(),this.plugins))t.stop?.();this.particleCreatedPlugins.length=0,this.particleDestroyedPlugins.length=0,this.particlePositionPlugins.length=0,this._sourceOptions=this._options,this._engine.dispatchEvent(d.B.containerStopped,{container:this})}}updateActualOptions(){let t=!1;for(let i of this.plugins)i.updateActualOptions&&(t=i.updateActualOptions()||t);return t}_nextFrame=t=>{try{if(!this._smooth&&void 0!==this._lastFrameTime&&t<this._lastFrameTime+a.Xu/this.fpsLimit||(this._lastFrameTime??=t,!function(t,i,e=a.z$,s=!1){t.value=i,t.factor=s?a.z$/e:a.z$*i/a.Xu}(this._delta,t-this._lastFrameTime,this.fpsLimit,this._smooth),this.addLifeTime(this._delta.value),this._lastFrameTime=t,this._delta.value>a.Xu))return void this.draw(!1);if(this.canvas.drawParticles(this._delta),!this.alive())return void this.destroy();this.animationStatus&&this.draw(!1)}catch(t){(0,b.t)().error("error in animation loop",t)}}}}}]);
|
package/161.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[161],{161(a,t,e){async function i(a){a.checkVersion("4.0.0-alpha.28"),await a.register(a=>{a.addParticleUpdater("color",async t=>{let{FillColorUpdater:i}=await e.e(116).then(e.bind(e,7116));return new i(a,t)})})}e.r(t),e.d(t,{loadFillColorUpdater:()=>i})}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[194],{3194(t,i,e){e.d(i,{OutOfCanvasUpdater:()=>c});var o=e(1989);class s{container;modes;_particleBouncePlugins;constructor(t){this.container=t,this.modes=[o.Yzx.bounce,o.Yzx.split],this._particleBouncePlugins=t.plugins.filter(t=>void 0!==t.particleBounce)}update(t,i,e,s){if(!this.modes.includes(s))return;let n=this.container,a=!1;for(let o of this._particleBouncePlugins)if(a=o.particleBounce?.(t,e,i)??!1)break;if(a)return;let r=t.getPosition(),d=t.offset,c=t.getRadius(),l=(0,o.AEc)(r,c),p=n.canvas.size;!function(t){if(t.outMode!==o.Yzx.bounce&&t.outMode!==o.Yzx.split||t.direction!==o.v5k.left&&t.direction!==o.v5k.right)return;t.bounds.right<0&&t.direction===o.v5k.left?t.particle.position.x=t.size+t.offset.x:t.bounds.left>t.canvasSize.width&&t.direction===o.v5k.right&&(t.particle.position.x=t.canvasSize.width-t.size-t.offset.x);let i=t.particle.velocity.x,e=!1;if(t.direction===o.v5k.right&&t.bounds.right>=t.canvasSize.width&&i>0||t.direction===o.v5k.left&&t.bounds.left<=0&&i<0){let i=(0,o.VGA)(t.particle.options.bounce.horizontal.value);t.particle.velocity.x*=-i,e=!0}if(!e)return;let s=t.offset.x+t.size;t.bounds.right>=t.canvasSize.width&&t.direction===o.v5k.right?t.particle.position.x=t.canvasSize.width-s:t.bounds.left<=0&&t.direction===o.v5k.left&&(t.particle.position.x=s),t.outMode===o.Yzx.split&&t.particle.destroy()}({particle:t,outMode:s,direction:i,bounds:l,canvasSize:p,offset:d,size:c}),function(t){if(t.outMode!==o.Yzx.bounce&&t.outMode!==o.Yzx.split||t.direction!==o.v5k.bottom&&t.direction!==o.v5k.top)return;t.bounds.bottom<0&&t.direction===o.v5k.top?t.particle.position.y=t.size+t.offset.y:t.bounds.top>t.canvasSize.height&&t.direction===o.v5k.bottom&&(t.particle.position.y=t.canvasSize.height-t.size-t.offset.y);let i=t.particle.velocity.y,e=!1;if(t.direction===o.v5k.bottom&&t.bounds.bottom>=t.canvasSize.height&&i>0||t.direction===o.v5k.top&&t.bounds.top<=0&&i<0){let i=(0,o.VGA)(t.particle.options.bounce.vertical.value);t.particle.velocity.y*=-i,e=!0}if(!e)return;let s=t.offset.y+t.size;t.bounds.bottom>=t.canvasSize.height&&t.direction===o.v5k.bottom?t.particle.position.y=t.canvasSize.height-s:t.bounds.top<=0&&t.direction===o.v5k.top&&(t.particle.position.y=s),t.outMode===o.Yzx.split&&t.particle.destroy()}({particle:t,outMode:s,direction:i,bounds:l,canvasSize:p,offset:d,size:c})}}class n{container;modes;constructor(t){this.container=t,this.modes=[o.Yzx.destroy]}update(t,i,e,s){if(!this.modes.includes(s))return;let n=this.container;switch(t.outType){case o.x_I.normal:case o.x_I.outside:if((0,o.Tj8)(t.position,n.canvas.size,o.boI,t.getRadius(),i))return;break;case o.x_I.inside:{let{dx:i,dy:e}=(0,o.vrU)(t.position,t.moveCenter),{x:s,y:n}=t.velocity;if(s<0&&i>t.moveCenter.radius||n<0&&e>t.moveCenter.radius||s>=0&&i<-t.moveCenter.radius||n>=0&&e<-t.moveCenter.radius)return}}n.particles.remove(t,t.group,!0)}}class a{container;modes;constructor(t){this.container=t,this.modes=[o.Yzx.none]}update(t,i,e,s){if(!this.modes.includes(s)||((t.options.move.distance.horizontal&&(i===o.v5k.left||i===o.v5k.right))??(t.options.move.distance.vertical&&(i===o.v5k.top||i===o.v5k.bottom))))return;let n=t.options.move.gravity,a=this.container,r=a.canvas.size,d=t.getRadius();if(n.enable){let e=t.position;(!n.inverse&&e.y>r.height+d&&i===o.v5k.bottom||n.inverse&&e.y<-d&&i===o.v5k.top)&&a.particles.remove(t)}else{if(t.velocity.y>0&&t.position.y<=r.height+d||t.velocity.y<0&&t.position.y>=-d||t.velocity.x>0&&t.position.x<=r.width+d||t.velocity.x<0&&t.position.x>=-d)return;(0,o.Tj8)(t.position,a.canvas.size,o.boI,d,i)||a.particles.remove(t)}}}let r=o.Miz.origin;class d{container;modes;constructor(t){this.container=t,this.modes=[o.Yzx.out]}update(t,i,e,s){if(!this.modes.includes(s))return;let n=this.container;if(t.outType===o.x_I.inside){let{x:i,y:e}=t.velocity;r.setTo(o.boI),r.length=t.moveCenter.radius,r.angle=t.velocity.angle+Math.PI,r.addTo(t.moveCenter);let{dx:s,dy:a}=(0,o.vrU)(t.position,r);if(i<=0&&s>=0||e<=0&&a>=0||i>=0&&s<=0||e>=0&&a<=0)return;t.position.x=Math.floor((0,o.vEz)({min:0,max:n.canvas.size.width})),t.position.y=Math.floor((0,o.vEz)({min:0,max:n.canvas.size.height}));let{dx:d,dy:c}=(0,o.vrU)(t.position,t.moveCenter);t.direction=Math.atan2(-c,-d),t.velocity.angle=t.direction}else{if((0,o.Tj8)(t.position,n.canvas.size,o.boI,t.getRadius(),i))return;switch(t.outType){case o.x_I.outside:{t.position.x=Math.floor((0,o.vEz)({min:-t.moveCenter.radius,max:t.moveCenter.radius}))+t.moveCenter.x,t.position.y=Math.floor((0,o.vEz)({min:-t.moveCenter.radius,max:t.moveCenter.radius}))+t.moveCenter.y;let{dx:i,dy:e}=(0,o.vrU)(t.position,t.moveCenter);t.moveCenter.radius&&(t.direction=Math.atan2(e,i),t.velocity.angle=t.direction);break}case o.x_I.normal:{let e=t.options.move.warp,s=n.canvas.size,a={bottom:s.height+t.getRadius()+t.offset.y,left:-t.getRadius()-t.offset.x,right:s.width+t.getRadius()+t.offset.x,top:-t.getRadius()-t.offset.y},r=t.getRadius(),d=(0,o.AEc)(t.position,r);i===o.v5k.right&&d.left>s.width+t.offset.x?(t.position.x=a.left,t.initialPosition.x=t.position.x,e||(t.position.y=(0,o.G0i)()*s.height,t.initialPosition.y=t.position.y)):i===o.v5k.left&&d.right<-t.offset.x&&(t.position.x=a.right,t.initialPosition.x=t.position.x,e||(t.position.y=(0,o.G0i)()*s.height,t.initialPosition.y=t.position.y)),i===o.v5k.bottom&&d.top>s.height+t.offset.y?(e||(t.position.x=(0,o.G0i)()*s.width,t.initialPosition.x=t.position.x),t.position.y=a.top,t.initialPosition.y=t.position.y):i===o.v5k.top&&d.bottom<-t.offset.y&&(e||(t.position.x=(0,o.G0i)()*s.width,t.initialPosition.x=t.position.x),t.position.y=a.bottom,t.initialPosition.y=t.position.y)}}}}}class c{updaters;container;constructor(t){this.container=t,this.updaters=new Map}init(t){this._addUpdaterIfMissing(t,o.Yzx.bounce,t=>new s(t)),this._addUpdaterIfMissing(t,o.Yzx.out,t=>new d(t)),this._addUpdaterIfMissing(t,o.Yzx.destroy,t=>new n(t)),this._addUpdaterIfMissing(t,o.Yzx.none,t=>new a(t))}isEnabled(t){return!t.destroyed&&!t.spawning}update(t,i){let e=t.options.move.outModes;this._updateOutMode(t,i,e.bottom??e.default,o.v5k.bottom),this._updateOutMode(t,i,e.left??e.default,o.v5k.left),this._updateOutMode(t,i,e.right??e.default,o.v5k.right),this._updateOutMode(t,i,e.top??e.default,o.v5k.top)}_addUpdaterIfMissing=(t,i,e)=>{let o=t.options.move.outModes;this.updaters.has(i)||o.default!==i&&o.bottom!==i&&o.left!==i&&o.right!==i&&o.top!==i||this.updaters.set(i,e(this.container))};_updateOutMode=(t,i,e,o)=>{for(let s of this.updaters.values())s.update(t,o,i,e)}}}}]);
|
package/222.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[222],{8222(a,t,e){async function i(a){a.checkVersion("4.0.0-alpha.28"),await a.register(a=>{a.addParticleUpdater("opacity",async a=>{let{OpacityUpdater:t}=await e.e(510).then(e.bind(e,1510));return new t(a)})})}e.r(t),e.d(t,{loadOpacityUpdater:()=>i})}}]);
|
package/229.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[229],{229(a,s,e){async function i(a){a.checkVersion("4.0.0-alpha.28"),await a.register(async a=>{let{HslColorManager:s}=await e.e(84).then(e.bind(e,84));a.addColorManager("hsl",new s)})}e.r(s),e.d(s,{loadHslColorPlugin:()=>i})}}]);
|
package/268.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[268],{4268(a,e,t){async function i(a){a.checkVersion("4.0.0-alpha.28"),await a.register(a=>{a.addParticleUpdater("size",async()=>{let{SizeUpdater:a}=await t.e(970).then(t.bind(t,6970));return new a})})}t.r(e),t.d(e,{loadSizeUpdater:()=>i})}}]);
|
package/299.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[299],{6299(t,a,e){async function s(t){t.checkVersion("4.0.0-alpha.28"),await t.register(t=>{t.addParticleUpdater("outModes",async t=>{let{OutOfCanvasUpdater:a}=await e.e(194).then(e.bind(e,3194));return new a(t)})})}e.r(a),e.d(a,{loadOutModesUpdater:()=>s})}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[413],{3413(a,e,i){i.d(e,{CircleDrawer:()=>t});var c=i(1989);class t{draw(a){!function(a){let{context:e,particle:i,radius:t}=a;i.circleRange??={min:0,max:c.R1e};let n=i.circleRange;e.arc(c.boI.x,c.boI.y,t,n.min,n.max,!1)}(a)}getSidesCount(){return 12}particleInit(a,e){let i=e.shapeData,t=i?.angle??{max:360,min:0};e.circleRange=(0,c.Gvm)(t)?{min:(0,c.puj)(t.min),max:(0,c.puj)(t.max)}:{min:0,max:(0,c.puj)(t)}}}}}]);
|
package/465.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[465],{6465(a,s,e){async function i(a){a.checkVersion("4.0.0-alpha.28"),await a.register(async a=>{let{RgbColorManager:s}=await e.e(964).then(e.bind(e,5964));a.addColorManager("rgb",new s)})}e.r(s),e.d(s,{loadRgbColorPlugin:()=>i})}}]);
|
package/510.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[510],{1510(t,i,a){a.d(i,{OpacityUpdater:()=>c});var o=a(1989);class c{container;constructor(t){this.container=t}init(t){let i=t.options.opacity;t.opacity=(0,o.XsS)(i,1);let a=i.animation;a.enable&&(t.opacity.velocity=(0,o.VGA)(a.speed)/o.a56*this.container.retina.reduceFactor,a.sync||(t.opacity.velocity*=(0,o.G0i)()))}isEnabled(t){return!t.destroyed&&!t.spawning&&!!t.opacity&&t.opacity.enable&&((t.opacity.maxLoops??0)<=0||(t.opacity.maxLoops??0)>0&&(t.opacity.loops??0)<(t.opacity.maxLoops??0))}reset(t){t.opacity&&(t.opacity.time=0,t.opacity.loops=0)}update(t,i){this.isEnabled(t)&&t.opacity&&(0,o.UC0)(t,t.opacity,!0,t.options.opacity.animation.destroy,i)}}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[578],{9578(a,e,t){t.r(e),t.d(e,{ensureBaseMoverLoaded:()=>n,loadMovePlugin:()=>i});var r=t(1989);async function i(a){a.checkVersion("4.0.0-alpha.28"),await a.register(async a=>{a.initializers.pathGenerators??=new Map,a.pathGenerators??=new Map,a.addPathGenerator=(e,t)=>{a.initializers.pathGenerators??=new Map,a.initializers.pathGenerators.set(e,t)},a.getPathGenerators=async(e,t=!1)=>(a.initializers.pathGenerators??=new Map,a.pathGenerators??=new Map,(0,r.OtU)(e,a.pathGenerators,a.initializers.pathGenerators,t));let{MovePlugin:e}=await t.e(638).then(t.bind(t,6638));a.addPlugin(new e(a))})}function n(a){if(!a.addPathGenerator)throw Error("tsParticles Base Mover is not loaded")}}}]);
|
package/638.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[638],{6638(e,n,i){i.d(n,{MovePlugin:()=>s});class s{id="move";_engine;constructor(e){this._engine=e}async getPlugin(e){let{MovePluginInstance:n}=await i.e(89).then(i.bind(i,4089));return new n(this._engine,e)}loadOptions(){}needsPlugin(){return!0}}}}]);
|
package/663.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[663],{3663(a,e,c){async function i(a){a.checkVersion("4.0.0-alpha.28"),await a.register(a=>{a.addShape(["circle"],async()=>{let{CircleDrawer:a}=await c.e(413).then(c.bind(c,3413));return new a})})}c.r(e),c.d(e,{loadCircleShape:()=>i})}}]);
|
package/84.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[84],{84(s,e,a){a.d(e,{HslColorManager:()=>n});var l,t,r=a(1989);(l=t||(t={}))[l.h=1]="h",l[l.s=2]="s",l[l.l=3]="l",l[l.a=5]="a";let h=/hsla?\(\s*(\d+)\s*[\s,]\s*(\d+)%\s*[\s,]\s*(\d+)%\s*([\s,]\s*(0|1|0?\.\d+|(\d{1,3})%)\s*)?\)/i;class n{accepts(s){return s.startsWith("hsl")}handleColor(s){let e=s.value.hsl??s.value;if("h"in e&&"s"in e&&"l"in e)return(0,r.YLU)(e)}handleRangeColor(s){let e=s.value.hsl??s.value;if("h"in e&&"s"in e&&"l"in e)return(0,r.YLU)({h:(0,r.VGA)(e.h),l:(0,r.VGA)(e.l),s:(0,r.VGA)(e.s)})}parseString(s){if(!this.accepts(s))return;let e=h.exec(s);return e?(0,r.ayx)({a:e.length>4?(0,r.M3Y)(e[t.a]):1,h:Number.parseInt(e[t.h]??"0",10),l:Number.parseInt(e[t.l]??"0",10),s:Number.parseInt(e[t.s]??"0",10)}):void 0}}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[876],{7876(r,a,e){var t,s;e.d(a,{HexColorManager:()=>p}),(s=t||(t={}))[s.r=1]="r",s[s.g=2]="g",s[s.b=3]="b",s[s.a=4]="a";let i=/^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i,n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i;class p{accepts(r){return r.startsWith("#")}handleColor(r){return this._parseString(r.value)}handleRangeColor(r){return this._parseString(r.value)}parseString(r){return this._parseString(r)}_parseString(r){if("string"!=typeof r||!this.accepts(r))return;let a=r.replace(i,(r,a,e,t,s)=>a+a+e+e+t+t+(void 0===s?"":s+s)),e=n.exec(a);return e?{a:e[t.a]?Number.parseInt(e[t.a],16)/255:1,b:Number.parseInt(e[t.b]??"0",16),g:Number.parseInt(e[t.g]??"0",16),r:Number.parseInt(e[t.r]??"0",16)}:void 0}}}}]);
|
package/89.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[89],{4089(e,t,i){i.d(t,{MovePluginInstance:()=>n});var a=i(1989);class n{availablePathGenerators;pathGenerators;_container;_engine;constructor(e,t){this._engine=e,this._container=t,this.availablePathGenerators=new Map,this.pathGenerators=new Map}destroy(){this.availablePathGenerators=new Map,this.pathGenerators=new Map}isEnabled(e){return!e.destroyed&&e.options.move.enable}particleCreated(e){let t=e.options,i=t.move.gravity,n=t.move.path;if(e.moveDecay=a.WH8-(0,a.VGA)(t.move.decay),e.pathDelay=(0,a.VGA)(n.delay.value)*a.XuV,n.generator){let t=this.pathGenerators.get(n.generator);!t&&(t=this.availablePathGenerators.get(n.generator))&&(this.pathGenerators.set(n.generator,t),t.init()),e.pathGenerator=t}e.gravity={enable:i.enable,acceleration:(0,a.VGA)(i.acceleration),inverse:i.inverse},function(e){let t=e.container,i=e.options.move.spin;if(!i.enable)return;let n=i.position??{x:50,y:50},r={x:.01*n.x*t.canvas.size.width,y:.01*n.y*t.canvas.size.height},s=e.getPosition(),o=(0,a.YfF)(s,r),l=(0,a.VGA)(i.acceleration);e.retina.spinAcceleration=l*t.retina.pixelRatio,e.spin={center:r,direction:e.velocity.x>=0?a.pTR.clockwise:a.pTR.counterClockwise,angle:(0,a.G0i)()*a.R1e,radius:o,acceleration:e.retina.spinAcceleration}}(e)}particleDestroyed(e){let t=e.pathGenerator;t?.reset(e)}particleUpdate(e,t){let i=e.options,n=i.move;if(!n.enable)return;let r=e.container,s=r.retina.pixelRatio;e.retina.moveSpeed??=(0,a.VGA)(n.speed)*s,e.retina.moveDrift??=(0,a.VGA)(e.options.move.drift)*s;let o=e.slow.inRange?e.slow.factor:1,l=r.retina.reduceFactor,c=e.retina.moveSpeed,p=e.retina.moveDrift,h=(0,a.W9e)(i.size.value)*s,y=c*(n.size?e.getRadius()/h:1)*o*(t.factor||1)/2,v=e.retina.maxSpeed??r.retina.maxSpeed;n.spin.enable?function(e,t,i){let n=e.container;if(!e.spin)return;let r=e.spin.direction===a.pTR.clockwise,s={x:r?Math.cos:Math.sin,y:r?Math.sin:Math.cos};e.position.x=e.spin.center.x+e.spin.radius*s.x(e.spin.angle)*i,e.position.y=e.spin.center.y+e.spin.radius*s.y(e.spin.angle)*i,e.spin.radius+=e.spin.acceleration*i;let o=Math.max(n.canvas.size.width,n.canvas.size.height),l=o*a.MXx;e.spin.radius>l?(e.spin.radius=l,e.spin.acceleration*=-1):e.spin.radius<0&&(e.spin.radius=0,e.spin.acceleration*=-1),e.spin.angle+=.01*t*(1-e.spin.radius/o)}(e,y,l):function(e,t,i,n,r,s,o){!function(e,t){let i=e.options.move.path;if(!i.enable)return;let n=e.pathDelay??0;if(e.lastPathTime<=n){e.lastPathTime+=t.value;return}let r=e.pathGenerator?.generate(e,t);r&&e.velocity.addTo(r),i.clamp&&(e.velocity.x=(0,a.qE8)(e.velocity.x,-1,1),e.velocity.y=(0,a.qE8)(e.velocity.y,-1,1)),e.lastPathTime-=n}(e,o);let l=e.gravity,c=l?.enable&&l.inverse?-1:1;r&&i&&(e.velocity.x+=r*o.factor/(60*i)),l?.enable&&i&&(e.velocity.y+=c*(l.acceleration*o.factor)/(60*i));let p=e.moveDecay;e.velocity.multTo(p??1);let h=e.velocity.mult(i);l?.enable&&n>0&&(!l.inverse&&h.y>=0&&h.y>=n||l.inverse&&h.y<=0&&h.y<=-n)&&(h.y=c*n,i&&(e.velocity.y=h.y/i));let y=e.options.zIndex,v=(1-e.zIndexFactor)**y.velocityRate;h.multTo(v),h.multTo(s);let{position:d}=e;d.addTo(h),t.vibrate&&(d.x+=Math.sin(d.x*Math.cos(d.y))*s,d.y+=Math.cos(d.y*Math.sin(d.x))*s)}(e,n,y,v,p,l,t),function(e){let t=e.initialPosition,{dx:i,dy:n}=(0,a.vrU)(t,e.position),r=Math.abs(i),s=Math.abs(n),{maxDistance:o}=e.retina,l=o.horizontal,c=o.vertical;if(l||c){if((l&&r>=l||c&&s>=c)&&!e.misplaced)e.misplaced=!!l&&r>l||!!c&&s>c,l&&(e.velocity.x=e.velocity.y*a.MXx-e.velocity.x),c&&(e.velocity.y=e.velocity.x*a.MXx-e.velocity.y);else if((!l||r<l)&&(!c||s<c)&&e.misplaced)e.misplaced=!1;else if(e.misplaced){let i=e.position,n=e.velocity;l&&(i.x<t.x&&n.x<0||i.x>t.x&&n.x>0)&&(n.x*=-(0,a.G0i)()),c&&(i.y<t.y&&n.y<0||i.y>t.y&&n.y>0)&&(n.y*=-(0,a.G0i)())}}}(e)}preInit(){return this._init()}redrawInit(){return this._init()}update(){for(let e of this.pathGenerators.values())e.update()}async _init(){let e=await this._engine.getPathGenerators?.(this._container,!0);if(e)for(let t of(this.availablePathGenerators=e,this.pathGenerators=new Map,this.pathGenerators.values()))t.init()}}}}]);
|
package/91.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[91],{3091(a,e,s){async function i(a){a.checkVersion("4.0.0-alpha.28"),await a.register(async a=>{let{HexColorManager:e}=await s.e(876).then(s.bind(s,7876));a.addColorManager("hex",new e)})}s.r(e),s.d(e,{loadHexColorPlugin:()=>i})}}]);
|
package/964.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[964],{5964(r,s,e){e.d(s,{RgbColorManager:()=>b});var a,t,n=e(1989);(a=t||(t={}))[a.r=1]="r",a[a.g=2]="g",a[a.b=3]="b",a[a.a=5]="a";let i=/rgba?\(\s*(\d{1,3})\s*[\s,]\s*(\d{1,3})\s*[\s,]\s*(\d{1,3})\s*([\s,]\s*(0|1|0?\.\d+|(\d{1,3})%)\s*)?\)/i;class b{accepts(r){return r.startsWith("rgb")}handleColor(r){let s=r.value.rgb??r.value;if("r"in s&&"g"in s&&"b"in s)return s}handleRangeColor(r){let s=r.value.rgb??r.value;if("r"in s&&"g"in s&&"b"in s)return{r:(0,n.VGA)(s.r),g:(0,n.VGA)(s.g),b:(0,n.VGA)(s.b)}}parseString(r){if(!this.accepts(r))return;let s=i.exec(r);return s?{a:s.length>4?(0,n.M3Y)(s[t.a]):1,b:parseInt(s[t.b]??"0",10),g:parseInt(s[t.g]??"0",10),r:parseInt(s[t.r]??"0",10)}:void 0}}}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_basic=this.webpackChunk_tsparticles_basic||[]).push([[970],{6970(e,i,s){s.d(i,{SizeUpdater:()=>t});var a=s(1989);class t{init(e){let i=e.container,s=e.options.size.animation;s.enable&&(e.size.velocity=(e.retina.sizeAnimationSpeed??i.retina.sizeAnimationSpeed)/a.a56*i.retina.reduceFactor,s.sync||(e.size.velocity*=(0,a.G0i)()))}isEnabled(e){return!e.destroyed&&!e.spawning&&e.size.enable&&((e.size.maxLoops??0)<=0||(e.size.maxLoops??0)>0&&(e.size.loops??0)<(e.size.maxLoops??0))}reset(e){e.size.loops=0}update(e,i){this.isEnabled(e)&&(0,a.UC0)(e,e.size,!0,e.options.size.animation.destroy,i)}}}}]);
|
package/README.md
CHANGED
|
@@ -14,11 +14,48 @@
|
|
|
14
14
|
- [@tsparticles/plugin-hsl-color](https://github.com/tsparticles/tsparticles/tree/main/plugins/colors/hslColor)
|
|
15
15
|
- [@tsparticles/plugin-rgb-color](https://github.com/tsparticles/tsparticles/tree/main/plugins/colors/rgbColor)
|
|
16
16
|
- [@tsparticles/shape-circle](https://github.com/tsparticles/tsparticles/tree/main/shapes/circle)
|
|
17
|
-
- [@tsparticles/updater-color](https://github.com/tsparticles/tsparticles/tree/main/updaters/color)
|
|
17
|
+
- [@tsparticles/updater-fill-color](https://github.com/tsparticles/tsparticles/tree/main/updaters/color)
|
|
18
18
|
- [@tsparticles/updater-opacity](https://github.com/tsparticles/tsparticles/tree/main/updaters/opacity)
|
|
19
19
|
- [@tsparticles/updater-out-modes](https://github.com/tsparticles/tsparticles/tree/main/updaters/outModes)
|
|
20
20
|
- [@tsparticles/updater-size](https://github.com/tsparticles/tsparticles/tree/main/updaters/size)
|
|
21
21
|
|
|
22
|
+
## Dependency Graph
|
|
23
|
+
|
|
24
|
+
```mermaid
|
|
25
|
+
flowchart TD
|
|
26
|
+
|
|
27
|
+
subgraph b [Bundle]
|
|
28
|
+
bb[tsparticles/basic]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
subgraph c [Core]
|
|
32
|
+
ce[tsparticles/engine]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
subgraph p [Plugins]
|
|
36
|
+
pm[tsparticles/plugin-move]
|
|
37
|
+
ph[tsparticles/plugin-hex-color]
|
|
38
|
+
phs[tsparticles/plugin-hsl-color]
|
|
39
|
+
pr[tsparticles/plugin-rgb-color]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
subgraph s [Shapes]
|
|
43
|
+
sc[tsparticles/shape-circle]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
subgraph u [Updaters]
|
|
47
|
+
uf[tsparticles/updater-fill-color]
|
|
48
|
+
uo[tsparticles/updater-opacity]
|
|
49
|
+
uom[tsparticles/updater-out-modes]
|
|
50
|
+
us[tsparticles/updater-size]
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
bb --> ce
|
|
54
|
+
bb --> p
|
|
55
|
+
bb --> s
|
|
56
|
+
bb --> u
|
|
57
|
+
```
|
|
58
|
+
|
|
22
59
|
## How to use it
|
|
23
60
|
|
|
24
61
|
### CDN / Vanilla JS / jQuery
|
|
@@ -164,7 +201,7 @@ let options = {
|
|
|
164
201
|
/* custom options */
|
|
165
202
|
};
|
|
166
203
|
|
|
167
|
-
let particlesInit = async
|
|
204
|
+
let particlesInit = async engine => {
|
|
168
205
|
await loadBasic(engine);
|
|
169
206
|
};
|
|
170
207
|
```
|
package/browser/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export async function loadBasic(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.28");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
|
-
const [{ loadHexColorPlugin }, { loadHslColorPlugin }, { loadRgbColorPlugin }, { loadMovePlugin }, { loadCircleShape }, {
|
|
4
|
+
const [{ loadHexColorPlugin }, { loadHslColorPlugin }, { loadRgbColorPlugin }, { loadMovePlugin }, { loadCircleShape }, { loadFillColorUpdater }, { loadOpacityUpdater }, { loadOutModesUpdater }, { loadSizeUpdater },] = await Promise.all([
|
|
5
5
|
import("@tsparticles/plugin-hex-color"),
|
|
6
6
|
import("@tsparticles/plugin-hsl-color"),
|
|
7
7
|
import("@tsparticles/plugin-rgb-color"),
|
|
8
8
|
import("@tsparticles/plugin-move"),
|
|
9
9
|
import("@tsparticles/shape-circle"),
|
|
10
|
-
import("@tsparticles/updater-color"),
|
|
10
|
+
import("@tsparticles/updater-fill-color"),
|
|
11
11
|
import("@tsparticles/updater-opacity"),
|
|
12
12
|
import("@tsparticles/updater-out-modes"),
|
|
13
13
|
import("@tsparticles/updater-size"),
|
|
@@ -18,7 +18,7 @@ export async function loadBasic(engine) {
|
|
|
18
18
|
loadRgbColorPlugin(e),
|
|
19
19
|
loadMovePlugin(e),
|
|
20
20
|
loadCircleShape(e),
|
|
21
|
-
|
|
21
|
+
loadFillColorUpdater(e),
|
|
22
22
|
loadOpacityUpdater(e),
|
|
23
23
|
loadOutModesUpdater(e),
|
|
24
24
|
loadSizeUpdater(e),
|
package/cjs/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export async function loadBasic(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.28");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
|
-
const [{ loadHexColorPlugin }, { loadHslColorPlugin }, { loadRgbColorPlugin }, { loadMovePlugin }, { loadCircleShape }, {
|
|
4
|
+
const [{ loadHexColorPlugin }, { loadHslColorPlugin }, { loadRgbColorPlugin }, { loadMovePlugin }, { loadCircleShape }, { loadFillColorUpdater }, { loadOpacityUpdater }, { loadOutModesUpdater }, { loadSizeUpdater },] = await Promise.all([
|
|
5
5
|
import("@tsparticles/plugin-hex-color"),
|
|
6
6
|
import("@tsparticles/plugin-hsl-color"),
|
|
7
7
|
import("@tsparticles/plugin-rgb-color"),
|
|
8
8
|
import("@tsparticles/plugin-move"),
|
|
9
9
|
import("@tsparticles/shape-circle"),
|
|
10
|
-
import("@tsparticles/updater-color"),
|
|
10
|
+
import("@tsparticles/updater-fill-color"),
|
|
11
11
|
import("@tsparticles/updater-opacity"),
|
|
12
12
|
import("@tsparticles/updater-out-modes"),
|
|
13
13
|
import("@tsparticles/updater-size"),
|
|
@@ -18,7 +18,7 @@ export async function loadBasic(engine) {
|
|
|
18
18
|
loadRgbColorPlugin(e),
|
|
19
19
|
loadMovePlugin(e),
|
|
20
20
|
loadCircleShape(e),
|
|
21
|
-
|
|
21
|
+
loadFillColorUpdater(e),
|
|
22
22
|
loadOpacityUpdater(e),
|
|
23
23
|
loadOutModesUpdater(e),
|
|
24
24
|
loadSizeUpdater(e),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v4.0.0-alpha.
|
|
7
|
+
* v4.0.0-alpha.28
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
\************************************************/
|
|
24
24
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
25
|
|
|
26
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Canvas: () => (/* binding */ Canvas)\n/* harmony export */ });\n/* harmony import */ var _Utils_CanvasUtils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Utils/CanvasUtils.js */ \"../../engine/dist/browser/Utils/CanvasUtils.js\");\n/* harmony import */ var _Utils_Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Utils/Utils.js */ \"../../engine/dist/browser/Utils/Utils.js\");\n/* harmony import */ var _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils/Constants.js */ \"../../engine/dist/browser/Core/Utils/Constants.js\");\n/* harmony import */ var _Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Utils/ColorUtils.js */ \"../../engine/dist/browser/Utils/ColorUtils.js\");\n\n\n\n\nconst fColorIndex = 0, sColorIndex = 1;\nfunction setTransformValue(factor, newFactor, key) {\n const newValue = newFactor[key];\n if (newValue !== undefined) {\n factor[key] = (factor[key] ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.defaultTransformValue) * newValue;\n }\n}\nfunction setStyle(canvas, style, important = false) {\n if (!style) {\n return;\n }\n const element = canvas, elementStyle = element.style, keys = new Set();\n for(let i = 0; i < elementStyle.length; i++){\n const key = elementStyle.item(i);\n if (!key) {\n continue;\n }\n keys.add(key);\n }\n for(let i = 0; i < style.length; i++){\n const key = style.item(i);\n if (!key) {\n continue;\n }\n keys.add(key);\n }\n for (const key of keys){\n const value = style.getPropertyValue(key);\n if (value) {\n elementStyle.setProperty(key, value, important ? \"important\" : \"\");\n } else {\n elementStyle.removeProperty(key);\n }\n }\n}\nclass Canvas {\n container;\n element;\n size;\n zoom = _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.defaultZoom;\n _canvasClearPlugins;\n _canvasPaintPlugins;\n _canvasSettings;\n _clearDrawPlugins;\n _colorPlugins;\n _context;\n _drawParticlePlugins;\n _drawParticlesCleanupPlugins;\n _drawParticlesSetupPlugins;\n _drawPlugins;\n _drawSettingsCleanupPlugins;\n _drawSettingsSetupPlugins;\n _engine;\n _generated;\n _mutationObserver;\n _originalStyle;\n _pointerEvents;\n _postDrawUpdaters;\n _preDrawUpdaters;\n _resizePlugins;\n _reusableColorStyles = {};\n _reusablePluginColors = [\n undefined,\n undefined\n ];\n _reusableTransform = {};\n _standardSize;\n _zoomCenter;\n constructor(container, engine){\n this.container = container;\n this._engine = engine;\n this._standardSize = {\n height: 0,\n width: 0\n };\n const pxRatio = container.retina.pixelRatio, stdSize = this._standardSize;\n this.size = {\n height: stdSize.height * pxRatio,\n width: stdSize.width * pxRatio\n };\n this._context = null;\n this._generated = false;\n this._preDrawUpdaters = [];\n this._postDrawUpdaters = [];\n this._resizePlugins = [];\n this._colorPlugins = [];\n this._canvasClearPlugins = [];\n this._canvasPaintPlugins = [];\n this._clearDrawPlugins = [];\n this._drawParticlePlugins = [];\n this._drawParticlesCleanupPlugins = [];\n this._drawParticlesSetupPlugins = [];\n this._drawPlugins = [];\n this._drawSettingsSetupPlugins = [];\n this._drawSettingsCleanupPlugins = [];\n this._pointerEvents = \"none\";\n }\n get settings() {\n return this._canvasSettings;\n }\n get _fullScreen() {\n return this.container.actualOptions.fullScreen.enable;\n }\n canvasClear() {\n if (!this.container.actualOptions.clear) {\n return;\n }\n this.draw((ctx)=>{\n (0,_Utils_CanvasUtils_js__WEBPACK_IMPORTED_MODULE_0__.clear)(ctx, this.size);\n });\n }\n clear() {\n let pluginHandled = false;\n for (const plugin of this._canvasClearPlugins){\n pluginHandled = plugin.canvasClear?.() ?? false;\n if (pluginHandled) {\n break;\n }\n }\n if (pluginHandled) {\n return;\n }\n this.canvasClear();\n }\n destroy() {\n this.stop();\n if (this._generated) {\n const element = this.element;\n element?.remove();\n this.element = undefined;\n } else {\n this._resetOriginalStyle();\n }\n this._preDrawUpdaters = [];\n this._postDrawUpdaters = [];\n this._resizePlugins = [];\n this._colorPlugins = [];\n this._canvasClearPlugins = [];\n this._canvasPaintPlugins = [];\n this._clearDrawPlugins = [];\n this._drawParticlePlugins = [];\n this._drawParticlesCleanupPlugins = [];\n this._drawParticlesSetupPlugins = [];\n this._drawPlugins = [];\n this._drawSettingsSetupPlugins = [];\n this._drawSettingsCleanupPlugins = [];\n }\n draw(cb) {\n const ctx = this._context;\n if (!ctx) {\n return;\n }\n return cb(ctx);\n }\n drawParticle(particle, delta) {\n if (particle.spawning || particle.destroyed) {\n return;\n }\n const radius = particle.getRadius();\n if (radius <= _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.minimumSize) {\n return;\n }\n const pfColor = particle.getFillColor(), psColor = particle.getStrokeColor() ?? pfColor;\n let [fColor, sColor] = this._getPluginParticleColors(particle);\n fColor ??= pfColor;\n sColor ??= psColor;\n if (!fColor && !sColor) {\n return;\n }\n const container = this.container, zIndexOptions = particle.options.zIndex, zIndexFactor = _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.zIndexFactorOffset - particle.zIndexFactor, { opacity, strokeOpacity } = particle.getOpacity(), transform = this._reusableTransform, colorStyles = this._reusableColorStyles, fill = fColor ? (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_3__.getStyleFromHsl)(fColor, container.hdr, opacity) : undefined, stroke = sColor ? (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_3__.getStyleFromHsl)(sColor, container.hdr, strokeOpacity) : fill;\n transform.a = transform.b = transform.c = transform.d = undefined;\n colorStyles.fill = fill;\n colorStyles.stroke = stroke;\n this.draw((context)=>{\n for (const plugin of this._drawParticlesSetupPlugins){\n plugin.drawParticleSetup?.(context, particle, delta);\n }\n this._applyPreDrawUpdaters(context, particle, radius, opacity, colorStyles, transform);\n (0,_Utils_CanvasUtils_js__WEBPACK_IMPORTED_MODULE_0__.drawParticle)({\n container,\n context,\n particle,\n delta,\n colorStyles,\n radius: radius * zIndexFactor ** zIndexOptions.sizeRate,\n opacity: opacity,\n transform\n });\n this._applyPostDrawUpdaters(particle);\n for (const plugin of this._drawParticlesCleanupPlugins){\n plugin.drawParticleCleanup?.(context, particle, delta);\n }\n });\n }\n drawParticlePlugins(particle, delta) {\n this.draw((ctx)=>{\n for (const plugin of this._drawParticlePlugins){\n (0,_Utils_CanvasUtils_js__WEBPACK_IMPORTED_MODULE_0__.drawParticlePlugin)(ctx, plugin, particle, delta);\n }\n });\n }\n drawParticles(delta) {\n const { particles } = this.container;\n this.clear();\n particles.update(delta);\n this.draw((ctx)=>{\n for (const plugin of this._drawSettingsSetupPlugins){\n plugin.drawSettingsSetup?.(ctx, delta);\n }\n for (const plugin of this._drawPlugins){\n plugin.draw?.(ctx, delta);\n }\n particles.drawParticles(delta);\n for (const plugin of this._clearDrawPlugins){\n plugin.clearDraw?.(ctx, delta);\n }\n for (const plugin of this._drawSettingsCleanupPlugins){\n plugin.drawSettingsCleanup?.(ctx, delta);\n }\n });\n }\n getZoomCenter() {\n const pxRatio = this.container.retina.pixelRatio, { width, height } = this.size;\n if (this._zoomCenter) {\n return this._zoomCenter;\n }\n return {\n x: width * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.half / pxRatio,\n y: height * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.half / pxRatio\n };\n }\n init() {\n this._safeMutationObserver((obs)=>{\n obs.disconnect();\n });\n this._mutationObserver = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_1__.safeMutationObserver)((records)=>{\n for (const record of records){\n if (record.type === \"attributes\" && record.attributeName === \"style\") {\n this._repairStyle();\n }\n }\n });\n this.resize();\n this._initStyle();\n this.initBackground();\n this._safeMutationObserver((obs)=>{\n if (!this.element || !(this.element instanceof Node)) {\n return;\n }\n obs.observe(this.element, {\n attributes: true\n });\n });\n this.initUpdaters();\n this.initPlugins();\n this.paint();\n }\n initBackground() {\n const { container } = this, options = container.actualOptions, background = options.background, element = this.element;\n if (!element) {\n return;\n }\n const elementStyle = element.style, color = (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_3__.rangeColorToRgb)(this._engine, background.color);\n if (color) {\n elementStyle.backgroundColor = (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_3__.getStyleFromRgb)(color, container.hdr, background.opacity);\n } else {\n elementStyle.backgroundColor = \"\";\n }\n elementStyle.backgroundImage = background.image || \"\";\n elementStyle.backgroundPosition = background.position || \"\";\n elementStyle.backgroundRepeat = background.repeat || \"\";\n elementStyle.backgroundSize = background.size || \"\";\n }\n initPlugins() {\n this._resizePlugins = [];\n this._colorPlugins = [];\n this._canvasClearPlugins = [];\n this._canvasPaintPlugins = [];\n this._clearDrawPlugins = [];\n this._drawParticlePlugins = [];\n this._drawParticlesSetupPlugins = [];\n this._drawParticlesCleanupPlugins = [];\n this._drawPlugins = [];\n this._drawSettingsSetupPlugins = [];\n this._drawSettingsCleanupPlugins = [];\n for (const plugin of this.container.plugins){\n if (plugin.resize) {\n this._resizePlugins.push(plugin);\n }\n if (plugin.particleFillColor ?? plugin.particleStrokeColor) {\n this._colorPlugins.push(plugin);\n }\n if (plugin.canvasClear) {\n this._canvasClearPlugins.push(plugin);\n }\n if (plugin.canvasPaint) {\n this._canvasPaintPlugins.push(plugin);\n }\n if (plugin.drawParticle) {\n this._drawParticlePlugins.push(plugin);\n }\n if (plugin.drawParticleSetup) {\n this._drawParticlesSetupPlugins.push(plugin);\n }\n if (plugin.drawParticleCleanup) {\n this._drawParticlesCleanupPlugins.push(plugin);\n }\n if (plugin.draw) {\n this._drawPlugins.push(plugin);\n }\n if (plugin.drawSettingsSetup) {\n this._drawSettingsSetupPlugins.push(plugin);\n }\n if (plugin.drawSettingsCleanup) {\n this._drawSettingsCleanupPlugins.push(plugin);\n }\n if (plugin.clearDraw) {\n this._clearDrawPlugins.push(plugin);\n }\n }\n }\n initUpdaters() {\n this._preDrawUpdaters = [];\n this._postDrawUpdaters = [];\n for (const updater of this.container.particles.updaters){\n if (updater.afterDraw) {\n this._postDrawUpdaters.push(updater);\n }\n if (updater.getColorStyles ?? updater.getTransformValues ?? updater.beforeDraw) {\n this._preDrawUpdaters.push(updater);\n }\n }\n }\n loadCanvas(canvas) {\n if (this._generated && this.element) {\n this.element.remove();\n }\n const container = this.container;\n this._generated = _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.generatedAttribute in canvas.dataset ? canvas.dataset[_Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.generatedAttribute] === \"true\" : this._generated;\n this.element = canvas;\n this.element.ariaHidden = \"true\";\n this._originalStyle = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_1__.cloneStyle)(this.element.style);\n const standardSize = this._standardSize;\n standardSize.height = canvas.offsetHeight;\n standardSize.width = canvas.offsetWidth;\n const pxRatio = this.container.retina.pixelRatio, retinaSize = this.size;\n canvas.height = retinaSize.height = standardSize.height * pxRatio;\n canvas.width = retinaSize.width = standardSize.width * pxRatio;\n const canSupportHdrQuery = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_1__.safeMatchMedia)(\"(color-gamut: p3)\");\n this._canvasSettings = {\n alpha: true,\n colorSpace: canSupportHdrQuery?.matches && container.hdr ? \"display-p3\" : \"srgb\",\n desynchronized: true,\n willReadFrequently: false\n };\n this._context = this.element.getContext(\"2d\", this._canvasSettings);\n this._safeMutationObserver((obs)=>{\n obs.disconnect();\n });\n container.retina.init();\n this.initBackground();\n this._safeMutationObserver((obs)=>{\n if (!this.element || !(this.element instanceof Node)) {\n return;\n }\n obs.observe(this.element, {\n attributes: true\n });\n });\n }\n paint() {\n let handled = false;\n for (const plugin of this._canvasPaintPlugins){\n handled = plugin.canvasPaint?.() ?? false;\n if (handled) {\n break;\n }\n }\n if (handled) {\n return;\n }\n this.paintBase();\n }\n paintBase(baseColor) {\n this.draw((ctx)=>{\n (0,_Utils_CanvasUtils_js__WEBPACK_IMPORTED_MODULE_0__.paintBase)(ctx, this.size, baseColor);\n });\n }\n paintImage(image, opacity) {\n this.draw((ctx)=>{\n (0,_Utils_CanvasUtils_js__WEBPACK_IMPORTED_MODULE_0__.paintImage)(ctx, this.size, image, opacity);\n });\n }\n resize() {\n if (!this.element) {\n return false;\n }\n const container = this.container, currentSize = container.canvas._standardSize, newSize = {\n width: this.element.offsetWidth,\n height: this.element.offsetHeight\n }, pxRatio = container.retina.pixelRatio, retinaSize = {\n width: newSize.width * pxRatio,\n height: newSize.height * pxRatio\n };\n if (newSize.height === currentSize.height && newSize.width === currentSize.width && retinaSize.height === this.element.height && retinaSize.width === this.element.width) {\n return false;\n }\n const oldSize = {\n ...currentSize\n };\n currentSize.height = newSize.height;\n currentSize.width = newSize.width;\n const canvasSize = this.size;\n this.element.width = canvasSize.width = retinaSize.width;\n this.element.height = canvasSize.height = retinaSize.height;\n if (this.container.started) {\n container.particles.setResizeFactor({\n width: currentSize.width / oldSize.width,\n height: currentSize.height / oldSize.height\n });\n }\n return true;\n }\n setPointerEvents(type) {\n const element = this.element;\n if (!element) {\n return;\n }\n this._pointerEvents = type;\n this._repairStyle();\n }\n setZoom(zoomLevel, center) {\n this.zoom = zoomLevel;\n this._zoomCenter = center;\n }\n stop() {\n this._safeMutationObserver((obs)=>{\n obs.disconnect();\n });\n this._mutationObserver = undefined;\n this.draw((ctx)=>{\n (0,_Utils_CanvasUtils_js__WEBPACK_IMPORTED_MODULE_0__.clear)(ctx, this.size);\n });\n }\n async windowResize() {\n if (!this.element || !this.resize()) {\n return;\n }\n const container = this.container, needsRefresh = container.updateActualOptions();\n container.particles.setDensity();\n this._applyResizePlugins();\n if (needsRefresh) {\n await container.refresh();\n }\n }\n _applyPostDrawUpdaters = (particle)=>{\n for (const updater of this._postDrawUpdaters){\n updater.afterDraw?.(particle);\n }\n };\n _applyPreDrawUpdaters = (ctx, particle, radius, zOpacity, colorStyles, transform)=>{\n for (const updater of this._preDrawUpdaters){\n if (updater.getColorStyles) {\n const { fill, stroke } = updater.getColorStyles(particle, ctx, radius, zOpacity);\n if (fill) {\n colorStyles.fill = fill;\n }\n if (stroke) {\n colorStyles.stroke = stroke;\n }\n }\n if (updater.getTransformValues) {\n const updaterTransform = updater.getTransformValues(particle);\n for(const key in updaterTransform){\n setTransformValue(transform, updaterTransform, key);\n }\n }\n updater.beforeDraw?.(particle);\n }\n };\n _applyResizePlugins = ()=>{\n for (const plugin of this._resizePlugins){\n plugin.resize?.();\n }\n };\n _getPluginParticleColors = (particle)=>{\n let fColor, sColor;\n for (const plugin of this._colorPlugins){\n if (!fColor && plugin.particleFillColor) {\n fColor = (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_3__.rangeColorToHsl)(this._engine, plugin.particleFillColor(particle));\n }\n if (!sColor && plugin.particleStrokeColor) {\n sColor = (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_3__.rangeColorToHsl)(this._engine, plugin.particleStrokeColor(particle));\n }\n if (fColor && sColor) {\n break;\n }\n }\n this._reusablePluginColors[fColorIndex] = fColor;\n this._reusablePluginColors[sColorIndex] = sColor;\n return this._reusablePluginColors;\n };\n _initStyle = ()=>{\n const element = this.element, options = this.container.actualOptions;\n if (!element) {\n return;\n }\n if (this._fullScreen) {\n this._setFullScreenStyle();\n } else {\n this._resetOriginalStyle();\n }\n for(const key in options.style){\n if (!key || !Object.hasOwn(options.style, key)) {\n continue;\n }\n const value = options.style[key];\n if (!value) {\n continue;\n }\n element.style.setProperty(key, value, \"important\");\n }\n };\n _repairStyle = ()=>{\n const element = this.element;\n if (!element) {\n return;\n }\n this._safeMutationObserver((observer)=>{\n observer.disconnect();\n });\n this._initStyle();\n this.initBackground();\n const pointerEvents = this._pointerEvents;\n element.style.pointerEvents = pointerEvents;\n element.setAttribute(\"pointer-events\", pointerEvents);\n this._safeMutationObserver((observer)=>{\n if (!(element instanceof Node)) {\n return;\n }\n observer.observe(element, {\n attributes: true\n });\n });\n };\n _resetOriginalStyle = ()=>{\n const element = this.element, originalStyle = this._originalStyle;\n if (!element || !originalStyle) {\n return;\n }\n setStyle(element, originalStyle, true);\n };\n _safeMutationObserver = (callback)=>{\n if (!this._mutationObserver) {\n return;\n }\n callback(this._mutationObserver);\n };\n _setFullScreenStyle = ()=>{\n const element = this.element;\n if (!element) {\n return;\n }\n setStyle(element, (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_1__.getFullScreenStyle)(this.container.actualOptions.fullScreen.zIndex), true);\n };\n}\n\n\n//# sourceURL=webpack://@tsparticles/basic/../../engine/dist/browser/Core/Canvas.js?\n}");
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Canvas: () => (/* binding */ Canvas)\n/* harmony export */ });\n/* harmony import */ var _Utils_CanvasUtils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Utils/CanvasUtils.js */ \"../../engine/dist/browser/Utils/CanvasUtils.js\");\n/* harmony import */ var _Utils_Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Utils/Utils.js */ \"../../engine/dist/browser/Utils/Utils.js\");\n/* harmony import */ var _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils/Constants.js */ \"../../engine/dist/browser/Core/Utils/Constants.js\");\n/* harmony import */ var _Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Utils/ColorUtils.js */ \"../../engine/dist/browser/Utils/ColorUtils.js\");\n\n\n\n\nconst fColorIndex = 0, sColorIndex = 1;\nfunction setTransformValue(factor, newFactor, key) {\n const newValue = newFactor[key];\n if (newValue !== undefined) {\n factor[key] = (factor[key] ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.defaultTransformValue) * newValue;\n }\n}\nfunction setStyle(canvas, style, important = false) {\n if (!style) {\n return;\n }\n const element = canvas, elementStyle = element.style, keys = new Set();\n for(let i = 0; i < elementStyle.length; i++){\n const key = elementStyle.item(i);\n if (!key) {\n continue;\n }\n keys.add(key);\n }\n for(let i = 0; i < style.length; i++){\n const key = style.item(i);\n if (!key) {\n continue;\n }\n keys.add(key);\n }\n for (const key of keys){\n const value = style.getPropertyValue(key);\n if (value) {\n elementStyle.setProperty(key, value, important ? \"important\" : \"\");\n } else {\n elementStyle.removeProperty(key);\n }\n }\n}\nclass Canvas {\n container;\n element;\n size;\n zoom = _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.defaultZoom;\n _canvasClearPlugins;\n _canvasPaintPlugins;\n _canvasSettings;\n _clearDrawPlugins;\n _colorPlugins;\n _context;\n _drawParticlePlugins;\n _drawParticlesCleanupPlugins;\n _drawParticlesSetupPlugins;\n _drawPlugins;\n _drawSettingsCleanupPlugins;\n _drawSettingsSetupPlugins;\n _engine;\n _generated;\n _mutationObserver;\n _originalStyle;\n _pointerEvents;\n _postDrawUpdaters;\n _preDrawUpdaters;\n _resizePlugins;\n _reusableColorStyles = {};\n _reusablePluginColors = [\n undefined,\n undefined\n ];\n _reusableTransform = {};\n _standardSize;\n _zoomCenter;\n constructor(container, engine){\n this.container = container;\n this._engine = engine;\n this._standardSize = {\n height: 0,\n width: 0\n };\n const pxRatio = container.retina.pixelRatio, stdSize = this._standardSize;\n this.size = {\n height: stdSize.height * pxRatio,\n width: stdSize.width * pxRatio\n };\n this._context = null;\n this._generated = false;\n this._preDrawUpdaters = [];\n this._postDrawUpdaters = [];\n this._resizePlugins = [];\n this._colorPlugins = [];\n this._canvasClearPlugins = [];\n this._canvasPaintPlugins = [];\n this._clearDrawPlugins = [];\n this._drawParticlePlugins = [];\n this._drawParticlesCleanupPlugins = [];\n this._drawParticlesSetupPlugins = [];\n this._drawPlugins = [];\n this._drawSettingsSetupPlugins = [];\n this._drawSettingsCleanupPlugins = [];\n this._pointerEvents = \"none\";\n }\n get settings() {\n return this._canvasSettings;\n }\n get _fullScreen() {\n return this.container.actualOptions.fullScreen.enable;\n }\n canvasClear() {\n if (!this.container.actualOptions.clear) {\n return;\n }\n this.draw((ctx)=>{\n (0,_Utils_CanvasUtils_js__WEBPACK_IMPORTED_MODULE_0__.clear)(ctx, this.size);\n });\n }\n clear() {\n let pluginHandled = false;\n for (const plugin of this._canvasClearPlugins){\n pluginHandled = plugin.canvasClear?.() ?? false;\n if (pluginHandled) {\n break;\n }\n }\n if (pluginHandled) {\n return;\n }\n this.canvasClear();\n }\n destroy() {\n this.stop();\n if (this._generated) {\n const element = this.element;\n element?.remove();\n this.element = undefined;\n } else {\n this._resetOriginalStyle();\n }\n this._preDrawUpdaters = [];\n this._postDrawUpdaters = [];\n this._resizePlugins = [];\n this._colorPlugins = [];\n this._canvasClearPlugins = [];\n this._canvasPaintPlugins = [];\n this._clearDrawPlugins = [];\n this._drawParticlePlugins = [];\n this._drawParticlesCleanupPlugins = [];\n this._drawParticlesSetupPlugins = [];\n this._drawPlugins = [];\n this._drawSettingsSetupPlugins = [];\n this._drawSettingsCleanupPlugins = [];\n }\n draw(cb) {\n const ctx = this._context;\n if (!ctx) {\n return;\n }\n return cb(ctx);\n }\n drawParticle(particle, delta) {\n if (particle.spawning || particle.destroyed) {\n return;\n }\n const radius = particle.getRadius();\n if (radius <= _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.minimumSize) {\n return;\n }\n const pfColor = particle.getFillColor(), psColor = particle.getStrokeColor();\n let [fColor, sColor] = this._getPluginParticleColors(particle);\n fColor ??= pfColor;\n sColor ??= psColor;\n if (!fColor && !sColor) {\n return;\n }\n const container = this.container, zIndexOptions = particle.options.zIndex, zIndexFactor = _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.zIndexFactorOffset - particle.zIndexFactor, { fillOpacity, opacity, strokeOpacity } = particle.getOpacity(), transform = this._reusableTransform, colorStyles = this._reusableColorStyles, fill = fColor ? (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_3__.getStyleFromHsl)(fColor, container.hdr, fillOpacity * opacity) : undefined, stroke = sColor ? (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_3__.getStyleFromHsl)(sColor, container.hdr, strokeOpacity * opacity) : fill;\n transform.a = transform.b = transform.c = transform.d = undefined;\n colorStyles.fill = fill;\n colorStyles.stroke = stroke;\n this.draw((context)=>{\n for (const plugin of this._drawParticlesSetupPlugins){\n plugin.drawParticleSetup?.(context, particle, delta);\n }\n this._applyPreDrawUpdaters(context, particle, radius, opacity, colorStyles, transform);\n (0,_Utils_CanvasUtils_js__WEBPACK_IMPORTED_MODULE_0__.drawParticle)({\n container,\n context,\n particle,\n delta,\n colorStyles,\n radius: radius * zIndexFactor ** zIndexOptions.sizeRate,\n opacity: opacity,\n transform\n });\n this._applyPostDrawUpdaters(particle);\n for (const plugin of this._drawParticlesCleanupPlugins){\n plugin.drawParticleCleanup?.(context, particle, delta);\n }\n });\n }\n drawParticlePlugins(particle, delta) {\n this.draw((ctx)=>{\n for (const plugin of this._drawParticlePlugins){\n (0,_Utils_CanvasUtils_js__WEBPACK_IMPORTED_MODULE_0__.drawParticlePlugin)(ctx, plugin, particle, delta);\n }\n });\n }\n drawParticles(delta) {\n const { particles } = this.container;\n this.clear();\n particles.update(delta);\n this.draw((ctx)=>{\n for (const plugin of this._drawSettingsSetupPlugins){\n plugin.drawSettingsSetup?.(ctx, delta);\n }\n for (const plugin of this._drawPlugins){\n plugin.draw?.(ctx, delta);\n }\n particles.drawParticles(delta);\n for (const plugin of this._clearDrawPlugins){\n plugin.clearDraw?.(ctx, delta);\n }\n for (const plugin of this._drawSettingsCleanupPlugins){\n plugin.drawSettingsCleanup?.(ctx, delta);\n }\n });\n }\n getZoomCenter() {\n const pxRatio = this.container.retina.pixelRatio, { width, height } = this.size;\n if (this._zoomCenter) {\n return this._zoomCenter;\n }\n return {\n x: width * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.half / pxRatio,\n y: height * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.half / pxRatio\n };\n }\n init() {\n this._safeMutationObserver((obs)=>{\n obs.disconnect();\n });\n this._mutationObserver = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_1__.safeMutationObserver)((records)=>{\n for (const record of records){\n if (record.type === \"attributes\" && record.attributeName === \"style\") {\n this._repairStyle();\n }\n }\n });\n this.resize();\n this._initStyle();\n this.initBackground();\n this._safeMutationObserver((obs)=>{\n if (!this.element || !(this.element instanceof Node)) {\n return;\n }\n obs.observe(this.element, {\n attributes: true\n });\n });\n this.initUpdaters();\n this.initPlugins();\n this.paint();\n }\n initBackground() {\n const { container } = this, options = container.actualOptions, background = options.background, element = this.element;\n if (!element) {\n return;\n }\n const elementStyle = element.style, color = (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_3__.rangeColorToRgb)(this._engine, background.color);\n if (color) {\n elementStyle.backgroundColor = (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_3__.getStyleFromRgb)(color, container.hdr, background.opacity);\n } else {\n elementStyle.backgroundColor = \"\";\n }\n elementStyle.backgroundImage = background.image || \"\";\n elementStyle.backgroundPosition = background.position || \"\";\n elementStyle.backgroundRepeat = background.repeat || \"\";\n elementStyle.backgroundSize = background.size || \"\";\n }\n initPlugins() {\n this._resizePlugins = [];\n this._colorPlugins = [];\n this._canvasClearPlugins = [];\n this._canvasPaintPlugins = [];\n this._clearDrawPlugins = [];\n this._drawParticlePlugins = [];\n this._drawParticlesSetupPlugins = [];\n this._drawParticlesCleanupPlugins = [];\n this._drawPlugins = [];\n this._drawSettingsSetupPlugins = [];\n this._drawSettingsCleanupPlugins = [];\n for (const plugin of this.container.plugins){\n if (plugin.resize) {\n this._resizePlugins.push(plugin);\n }\n if (plugin.particleFillColor ?? plugin.particleStrokeColor) {\n this._colorPlugins.push(plugin);\n }\n if (plugin.canvasClear) {\n this._canvasClearPlugins.push(plugin);\n }\n if (plugin.canvasPaint) {\n this._canvasPaintPlugins.push(plugin);\n }\n if (plugin.drawParticle) {\n this._drawParticlePlugins.push(plugin);\n }\n if (plugin.drawParticleSetup) {\n this._drawParticlesSetupPlugins.push(plugin);\n }\n if (plugin.drawParticleCleanup) {\n this._drawParticlesCleanupPlugins.push(plugin);\n }\n if (plugin.draw) {\n this._drawPlugins.push(plugin);\n }\n if (plugin.drawSettingsSetup) {\n this._drawSettingsSetupPlugins.push(plugin);\n }\n if (plugin.drawSettingsCleanup) {\n this._drawSettingsCleanupPlugins.push(plugin);\n }\n if (plugin.clearDraw) {\n this._clearDrawPlugins.push(plugin);\n }\n }\n }\n initUpdaters() {\n this._preDrawUpdaters = [];\n this._postDrawUpdaters = [];\n for (const updater of this.container.particles.updaters){\n if (updater.afterDraw) {\n this._postDrawUpdaters.push(updater);\n }\n if (updater.getColorStyles ?? updater.getTransformValues ?? updater.beforeDraw) {\n this._preDrawUpdaters.push(updater);\n }\n }\n }\n loadCanvas(canvas) {\n if (this._generated && this.element) {\n this.element.remove();\n }\n const container = this.container;\n this._generated = _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.generatedAttribute in canvas.dataset ? canvas.dataset[_Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.generatedAttribute] === \"true\" : this._generated;\n this.element = canvas;\n this.element.ariaHidden = \"true\";\n this._originalStyle = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_1__.cloneStyle)(this.element.style);\n const standardSize = this._standardSize;\n standardSize.height = canvas.offsetHeight;\n standardSize.width = canvas.offsetWidth;\n const pxRatio = this.container.retina.pixelRatio, retinaSize = this.size;\n canvas.height = retinaSize.height = standardSize.height * pxRatio;\n canvas.width = retinaSize.width = standardSize.width * pxRatio;\n const canSupportHdrQuery = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_1__.safeMatchMedia)(\"(color-gamut: p3)\");\n this._canvasSettings = {\n alpha: true,\n colorSpace: canSupportHdrQuery?.matches && container.hdr ? \"display-p3\" : \"srgb\",\n desynchronized: true,\n willReadFrequently: false\n };\n this._context = this.element.getContext(\"2d\", this._canvasSettings);\n if (this._context) {\n this._context.globalCompositeOperation = _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_2__.defaultCompositeValue;\n }\n this._safeMutationObserver((obs)=>{\n obs.disconnect();\n });\n container.retina.init();\n this.initBackground();\n this._safeMutationObserver((obs)=>{\n if (!this.element || !(this.element instanceof Node)) {\n return;\n }\n obs.observe(this.element, {\n attributes: true\n });\n });\n }\n paint() {\n let handled = false;\n for (const plugin of this._canvasPaintPlugins){\n handled = plugin.canvasPaint?.() ?? false;\n if (handled) {\n break;\n }\n }\n if (handled) {\n return;\n }\n this.paintBase();\n }\n paintBase(baseColor) {\n this.draw((ctx)=>{\n (0,_Utils_CanvasUtils_js__WEBPACK_IMPORTED_MODULE_0__.paintBase)(ctx, this.size, baseColor);\n });\n }\n paintImage(image, opacity) {\n this.draw((ctx)=>{\n (0,_Utils_CanvasUtils_js__WEBPACK_IMPORTED_MODULE_0__.paintImage)(ctx, this.size, image, opacity);\n });\n }\n resize() {\n if (!this.element) {\n return false;\n }\n const container = this.container, currentSize = container.canvas._standardSize, newSize = {\n width: this.element.offsetWidth,\n height: this.element.offsetHeight\n }, pxRatio = container.retina.pixelRatio, retinaSize = {\n width: newSize.width * pxRatio,\n height: newSize.height * pxRatio\n };\n if (newSize.height === currentSize.height && newSize.width === currentSize.width && retinaSize.height === this.element.height && retinaSize.width === this.element.width) {\n return false;\n }\n const oldSize = {\n ...currentSize\n };\n currentSize.height = newSize.height;\n currentSize.width = newSize.width;\n const canvasSize = this.size;\n this.element.width = canvasSize.width = retinaSize.width;\n this.element.height = canvasSize.height = retinaSize.height;\n if (this.container.started) {\n container.particles.setResizeFactor({\n width: currentSize.width / oldSize.width,\n height: currentSize.height / oldSize.height\n });\n }\n return true;\n }\n setPointerEvents(type) {\n const element = this.element;\n if (!element) {\n return;\n }\n this._pointerEvents = type;\n this._repairStyle();\n }\n setZoom(zoomLevel, center) {\n this.zoom = zoomLevel;\n this._zoomCenter = center;\n }\n stop() {\n this._safeMutationObserver((obs)=>{\n obs.disconnect();\n });\n this._mutationObserver = undefined;\n this.draw((ctx)=>{\n (0,_Utils_CanvasUtils_js__WEBPACK_IMPORTED_MODULE_0__.clear)(ctx, this.size);\n });\n }\n async windowResize() {\n if (!this.element || !this.resize()) {\n return;\n }\n const container = this.container, needsRefresh = container.updateActualOptions();\n container.particles.setDensity();\n this._applyResizePlugins();\n if (needsRefresh) {\n await container.refresh();\n }\n }\n _applyPostDrawUpdaters = (particle)=>{\n for (const updater of this._postDrawUpdaters){\n updater.afterDraw?.(particle);\n }\n };\n _applyPreDrawUpdaters = (ctx, particle, radius, zOpacity, colorStyles, transform)=>{\n for (const updater of this._preDrawUpdaters){\n if (updater.getColorStyles) {\n const { fill, stroke } = updater.getColorStyles(particle, ctx, radius, zOpacity);\n if (fill) {\n colorStyles.fill = fill;\n }\n if (stroke) {\n colorStyles.stroke = stroke;\n }\n }\n if (updater.getTransformValues) {\n const updaterTransform = updater.getTransformValues(particle);\n for(const key in updaterTransform){\n setTransformValue(transform, updaterTransform, key);\n }\n }\n updater.beforeDraw?.(particle);\n }\n };\n _applyResizePlugins = ()=>{\n for (const plugin of this._resizePlugins){\n plugin.resize?.();\n }\n };\n _getPluginParticleColors = (particle)=>{\n let fColor, sColor;\n for (const plugin of this._colorPlugins){\n if (!fColor && plugin.particleFillColor) {\n fColor = (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_3__.rangeColorToHsl)(this._engine, plugin.particleFillColor(particle));\n }\n if (!sColor && plugin.particleStrokeColor) {\n sColor = (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_3__.rangeColorToHsl)(this._engine, plugin.particleStrokeColor(particle));\n }\n if (fColor && sColor) {\n break;\n }\n }\n this._reusablePluginColors[fColorIndex] = fColor;\n this._reusablePluginColors[sColorIndex] = sColor;\n return this._reusablePluginColors;\n };\n _initStyle = ()=>{\n const element = this.element, options = this.container.actualOptions;\n if (!element) {\n return;\n }\n if (this._fullScreen) {\n this._setFullScreenStyle();\n } else {\n this._resetOriginalStyle();\n }\n for(const key in options.style){\n if (!key || !(key in options.style)) {\n continue;\n }\n const value = options.style[key];\n if (!value) {\n continue;\n }\n element.style.setProperty(key, value, \"important\");\n }\n };\n _repairStyle = ()=>{\n const element = this.element;\n if (!element) {\n return;\n }\n this._safeMutationObserver((observer)=>{\n observer.disconnect();\n });\n this._initStyle();\n this.initBackground();\n const pointerEvents = this._pointerEvents;\n element.style.pointerEvents = pointerEvents;\n element.setAttribute(\"pointer-events\", pointerEvents);\n this._safeMutationObserver((observer)=>{\n if (!(element instanceof Node)) {\n return;\n }\n observer.observe(element, {\n attributes: true\n });\n });\n };\n _resetOriginalStyle = ()=>{\n const element = this.element, originalStyle = this._originalStyle;\n if (!element || !originalStyle) {\n return;\n }\n setStyle(element, originalStyle, true);\n };\n _safeMutationObserver = (callback)=>{\n if (!this._mutationObserver) {\n return;\n }\n callback(this._mutationObserver);\n };\n _setFullScreenStyle = ()=>{\n const element = this.element;\n if (!element) {\n return;\n }\n setStyle(element, (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_1__.getFullScreenStyle)(this.container.actualOptions.fullScreen.zIndex), true);\n };\n}\n\n\n//# sourceURL=webpack://@tsparticles/basic/../../engine/dist/browser/Core/Canvas.js?\n}");
|
|
27
27
|
|
|
28
28
|
/***/ },
|
|
29
29
|
|
|
@@ -43,7 +43,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
43
43
|
\**************************************************/
|
|
44
44
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
45
45
|
|
|
46
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Particle: () => (/* binding */ Particle)\n/* harmony export */ });\n/* harmony import */ var _Utils_Vectors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utils/Vectors.js */ \"../../engine/dist/browser/Core/Utils/Vectors.js\");\n/* harmony import */ var _Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Utils/ColorUtils.js */ \"../../engine/dist/browser/Utils/ColorUtils.js\");\n/* harmony import */ var _Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Utils/MathUtils.js */ \"../../engine/dist/browser/Utils/MathUtils.js\");\n/* harmony import */ var _Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Utils/Utils.js */ \"../../engine/dist/browser/Utils/Utils.js\");\n/* harmony import */ var _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Utils/Constants.js */ \"../../engine/dist/browser/Core/Utils/Constants.js\");\n/* harmony import */ var _Enums_Types_EventType_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Enums/Types/EventType.js */ \"../../engine/dist/browser/Enums/Types/EventType.js\");\n/* harmony import */ var _Enums_Directions_MoveDirection_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Enums/Directions/MoveDirection.js */ \"../../engine/dist/browser/Enums/Directions/MoveDirection.js\");\n/* harmony import */ var _Enums_Modes_OutMode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Enums/Modes/OutMode.js */ \"../../engine/dist/browser/Enums/Modes/OutMode.js\");\n/* harmony import */ var _Enums_Types_ParticleOutType_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Enums/Types/ParticleOutType.js */ \"../../engine/dist/browser/Enums/Types/ParticleOutType.js\");\n/* harmony import */ var _Utils_OptionsUtils_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Utils/OptionsUtils.js */ \"../../engine/dist/browser/Utils/OptionsUtils.js\");\n\n\n\n\n\n\n\n\n\n\nfunction loadEffectData(effect, effectOptions, id, reduceDuplicates) {\n const effectData = effectOptions.options[effect];\n return (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.deepExtend)({\n close: effectOptions.close,\n fill: effectOptions.fill\n }, (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.itemFromSingleOrMultiple)(effectData, id, reduceDuplicates));\n}\nfunction loadShapeData(shape, shapeOptions, id, reduceDuplicates) {\n const shapeData = shapeOptions.options[shape];\n return (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.deepExtend)({\n close: shapeOptions.close,\n fill: shapeOptions.fill\n }, (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.itemFromSingleOrMultiple)(shapeData, id, reduceDuplicates));\n}\nfunction fixOutMode(data) {\n if (!(0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.isInArray)(data.outMode, data.checkModes)) {\n return;\n }\n const diameter = data.radius * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.double;\n if (data.coord > data.maxCoord - diameter) {\n data.setCb(-data.radius);\n } else if (data.coord < diameter) {\n data.setCb(data.radius);\n }\n}\nclass Particle {\n container;\n backColor;\n bubble;\n color;\n destroyed;\n direction;\n effect;\n effectClose;\n effectData;\n effectFill;\n group;\n id;\n ignoresResizeRatio;\n initialPosition;\n initialVelocity;\n isRotating;\n lastPathTime;\n misplaced;\n moveCenter;\n offset;\n opacity;\n options;\n outType;\n pathRotation;\n position;\n randomIndexData;\n retina;\n roll;\n rotation;\n shape;\n shapeClose;\n shapeData;\n shapeFill;\n sides;\n size;\n slow;\n spawning;\n strokeColor;\n strokeOpacity;\n strokeWidth;\n unbreakable;\n velocity;\n zIndexFactor;\n _cachedOpacityData = {\n opacity: _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultOpacity,\n strokeOpacity: _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultOpacity\n };\n _cachedPosition = _Utils_Vectors_js__WEBPACK_IMPORTED_MODULE_0__.Vector3d.origin;\n _cachedRotateData = {\n sin: 0,\n cos: 0\n };\n _cachedTransform = {\n a: 1,\n b: 0,\n c: 0,\n d: 1\n };\n _engine;\n constructor(engine, container){\n this.container = container;\n this._engine = engine;\n }\n destroy(override) {\n if (this.unbreakable || this.destroyed) {\n return;\n }\n this.destroyed = true;\n this.bubble.inRange = false;\n this.slow.inRange = false;\n const container = this.container, shapeDrawer = this.shape ? container.particles.shapeDrawers.get(this.shape) : undefined;\n shapeDrawer?.particleDestroy?.(this);\n for (const plugin of container.particleDestroyedPlugins){\n plugin.particleDestroyed?.(this, override);\n }\n for (const updater of container.particles.updaters){\n updater.particleDestroyed?.(this, override);\n }\n this._engine.dispatchEvent(_Enums_Types_EventType_js__WEBPACK_IMPORTED_MODULE_5__.EventType.particleDestroyed, {\n container: this.container,\n data: {\n particle: this\n }\n });\n }\n draw(delta) {\n const container = this.container, canvas = container.canvas;\n canvas.drawParticlePlugins(this, delta);\n canvas.drawParticle(this, delta);\n }\n getAngle() {\n return this.rotation + (this.pathRotation ? this.velocity.angle : _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultAngle);\n }\n getFillColor() {\n return this._getRollColor(this.bubble.color ?? (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_1__.getHslFromAnimation)(this.color));\n }\n getMass() {\n return this.getRadius() ** _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.squareExp * Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.half;\n }\n getOpacity() {\n const zIndexOptions = this.options.zIndex, zIndexFactor = _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.zIndexFactorOffset - this.zIndexFactor, zOpacityFactor = zIndexFactor ** zIndexOptions.opacityRate, opacity = this.bubble.opacity ?? (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getRangeValue)(this.opacity?.value ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultOpacity), strokeOpacity = this.strokeOpacity ?? opacity;\n this._cachedOpacityData.opacity = opacity * zOpacityFactor;\n this._cachedOpacityData.strokeOpacity = strokeOpacity * zOpacityFactor;\n return this._cachedOpacityData;\n }\n getPosition() {\n this._cachedPosition.x = this.position.x + this.offset.x;\n this._cachedPosition.y = this.position.y + this.offset.y;\n this._cachedPosition.z = this.position.z;\n return this._cachedPosition;\n }\n getRadius() {\n return this.bubble.radius ?? this.size.value;\n }\n getRotateData() {\n const angle = this.getAngle();\n this._cachedRotateData.sin = Math.sin(angle);\n this._cachedRotateData.cos = Math.cos(angle);\n return this._cachedRotateData;\n }\n getStrokeColor() {\n return this._getRollColor(this.bubble.color ?? (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_1__.getHslFromAnimation)(this.strokeColor));\n }\n getTransformData(externalTransform) {\n const rotateData = this.getRotateData(), rotating = this.isRotating;\n this._cachedTransform.a = rotateData.cos * (externalTransform.a ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultTransform.a);\n this._cachedTransform.b = rotating ? rotateData.sin * (externalTransform.b ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.identity) : externalTransform.b ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultTransform.b;\n this._cachedTransform.c = rotating ? -rotateData.sin * (externalTransform.c ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.identity) : externalTransform.c ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultTransform.c;\n this._cachedTransform.d = rotateData.cos * (externalTransform.d ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultTransform.d);\n return this._cachedTransform;\n }\n init(id, position, overrideOptions, group) {\n const container = this.container;\n this.id = id;\n this.group = group;\n this.effectClose = true;\n this.effectFill = true;\n this.shapeClose = true;\n this.shapeFill = true;\n this.pathRotation = false;\n this.lastPathTime = 0;\n this.destroyed = false;\n this.unbreakable = false;\n this.isRotating = false;\n this.rotation = 0;\n this.misplaced = false;\n this.retina = {\n maxDistance: {}\n };\n this.outType = _Enums_Types_ParticleOutType_js__WEBPACK_IMPORTED_MODULE_8__.ParticleOutType.normal;\n this.ignoresResizeRatio = true;\n const pxRatio = container.retina.pixelRatio, mainOptions = container.actualOptions, particlesOptions = (0,_Utils_OptionsUtils_js__WEBPACK_IMPORTED_MODULE_9__.loadParticlesOptions)(this._engine, container, mainOptions.particles), reduceDuplicates = particlesOptions.reduceDuplicates, effectType = particlesOptions.effect.type, shapeType = particlesOptions.shape.type;\n this.effect = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.itemFromSingleOrMultiple)(effectType, this.id, reduceDuplicates);\n this.shape = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.itemFromSingleOrMultiple)(shapeType, this.id, reduceDuplicates);\n const effectOptions = particlesOptions.effect, shapeOptions = particlesOptions.shape;\n if (overrideOptions) {\n if (overrideOptions.effect?.type) {\n const overrideEffectType = overrideOptions.effect.type, effect = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.itemFromSingleOrMultiple)(overrideEffectType, this.id, reduceDuplicates);\n if (effect) {\n this.effect = effect;\n effectOptions.load(overrideOptions.effect);\n }\n }\n if (overrideOptions.shape?.type) {\n const overrideShapeType = overrideOptions.shape.type, shape = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.itemFromSingleOrMultiple)(overrideShapeType, this.id, reduceDuplicates);\n if (shape) {\n this.shape = shape;\n shapeOptions.load(overrideOptions.shape);\n }\n }\n }\n if (this.effect === _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.randomColorValue) {\n const availableEffects = [\n ...this.container.particles.effectDrawers.keys()\n ];\n this.effect = availableEffects[Math.floor((0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getRandom)() * availableEffects.length)];\n }\n if (this.shape === _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.randomColorValue) {\n const availableShapes = [\n ...this.container.particles.shapeDrawers.keys()\n ];\n this.shape = availableShapes[Math.floor((0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getRandom)() * availableShapes.length)];\n }\n this.effectData = this.effect ? loadEffectData(this.effect, effectOptions, this.id, reduceDuplicates) : undefined;\n this.shapeData = this.shape ? loadShapeData(this.shape, shapeOptions, this.id, reduceDuplicates) : undefined;\n particlesOptions.load(overrideOptions);\n const effectData = this.effectData;\n if (effectData) {\n particlesOptions.load(effectData.particles);\n }\n const shapeData = this.shapeData;\n if (shapeData) {\n particlesOptions.load(shapeData.particles);\n }\n this.effectFill = effectData?.fill ?? particlesOptions.effect.fill;\n this.effectClose = effectData?.close ?? particlesOptions.effect.close;\n this.shapeFill = shapeData?.fill ?? particlesOptions.shape.fill;\n this.shapeClose = shapeData?.close ?? particlesOptions.shape.close;\n this.options = particlesOptions;\n container.retina.initParticle(this);\n this.size = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.initParticleNumericAnimationValue)(this.options.size, pxRatio);\n this.bubble = {\n inRange: false\n };\n this.slow = {\n inRange: false,\n factor: 1\n };\n this._initPosition(position);\n this.initialVelocity = this._calculateVelocity();\n this.velocity = this.initialVelocity.copy();\n const particles = container.particles;\n particles.setLastZIndex(this.position.z);\n this.zIndexFactor = this.position.z / container.zLayers;\n this.sides = 24;\n let effectDrawer, shapeDrawer;\n if (this.effect) {\n effectDrawer = container.particles.effectDrawers.get(this.effect);\n }\n if (effectDrawer?.loadEffect) {\n effectDrawer.loadEffect(this);\n }\n if (this.shape) {\n shapeDrawer = container.particles.shapeDrawers.get(this.shape);\n }\n if (shapeDrawer?.loadShape) {\n shapeDrawer.loadShape(this);\n }\n const sideCountFunc = shapeDrawer?.getSidesCount;\n if (sideCountFunc) {\n this.sides = sideCountFunc(this);\n }\n this.spawning = false;\n for (const updater of particles.updaters){\n updater.init(this);\n }\n effectDrawer?.particleInit?.(container, this);\n shapeDrawer?.particleInit?.(container, this);\n for (const plugin of container.particleCreatedPlugins){\n plugin.particleCreated?.(this);\n }\n }\n isInsideCanvas() {\n const radius = this.getRadius(), canvasSize = this.container.canvas.size, position = this.position;\n return position.x >= -radius && position.y >= -radius && position.y <= canvasSize.height + radius && position.x <= canvasSize.width + radius;\n }\n isShowingBack() {\n if (!this.roll) {\n return false;\n }\n const angle = this.roll.angle;\n if (this.roll.horizontal && this.roll.vertical) {\n const normalizedAngle = angle % _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.doublePI, adjustedAngle = normalizedAngle < _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultAngle ? normalizedAngle + _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.doublePI : normalizedAngle;\n return adjustedAngle >= Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.half && adjustedAngle < Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.triple * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.half;\n }\n if (this.roll.horizontal) {\n const normalizedAngle = (angle + Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.half) % (Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.double), adjustedAngle = normalizedAngle < _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultAngle ? normalizedAngle + Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.double : normalizedAngle;\n return adjustedAngle >= Math.PI && adjustedAngle < Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.double;\n }\n if (this.roll.vertical) {\n const normalizedAngle = angle % (Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.double), adjustedAngle = normalizedAngle < _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultAngle ? normalizedAngle + Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.double : normalizedAngle;\n return adjustedAngle >= Math.PI && adjustedAngle < Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.double;\n }\n return false;\n }\n isVisible() {\n return !this.destroyed && !this.spawning && this.isInsideCanvas();\n }\n reset() {\n for (const updater of this.container.particles.updaters){\n updater.reset?.(this);\n }\n }\n _calcPosition = (position, zIndex)=>{\n let tryCount = _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultRetryCount, posVec = position ? _Utils_Vectors_js__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create(position.x, position.y, zIndex) : undefined;\n const container = this.container, plugins = container.particlePositionPlugins, outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size, abortController = new AbortController(), { signal } = abortController;\n while(!signal.aborted){\n for (const plugin of plugins){\n const pluginPos = plugin.particlePosition?.(posVec, this);\n if (pluginPos) {\n return _Utils_Vectors_js__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create(pluginPos.x, pluginPos.y, zIndex);\n }\n }\n const exactPosition = (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.calcExactPositionOrRandomFromSize)({\n size: canvasSize,\n position: posVec\n }), pos = _Utils_Vectors_js__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create(exactPosition.x, exactPosition.y, zIndex);\n this._fixHorizontal(pos, radius, outModes.left ?? outModes.default);\n this._fixHorizontal(pos, radius, outModes.right ?? outModes.default);\n this._fixVertical(pos, radius, outModes.top ?? outModes.default);\n this._fixVertical(pos, radius, outModes.bottom ?? outModes.default);\n let isValidPosition = true;\n for (const plugin of container.particles.checkParticlePositionPlugins){\n isValidPosition = plugin.checkParticlePosition?.(this, pos, tryCount) ?? true;\n if (!isValidPosition) {\n break;\n }\n }\n if (isValidPosition) {\n return pos;\n }\n tryCount += _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.tryCountIncrement;\n posVec = undefined;\n }\n return posVec;\n };\n _calculateVelocity = ()=>{\n const baseVelocity = (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getParticleBaseVelocity)(this.direction), res = baseVelocity.copy(), moveOptions = this.options.move;\n if (moveOptions.direction === _Enums_Directions_MoveDirection_js__WEBPACK_IMPORTED_MODULE_6__.MoveDirection.inside || moveOptions.direction === _Enums_Directions_MoveDirection_js__WEBPACK_IMPORTED_MODULE_6__.MoveDirection.outside) {\n return res;\n }\n const rad = (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.degToRad)((0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getRangeValue)(moveOptions.angle.value)), radOffset = (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.degToRad)((0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getRangeValue)(moveOptions.angle.offset)), range = {\n left: radOffset - rad * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.half,\n right: radOffset + rad * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.half\n };\n if (!moveOptions.straight) {\n res.angle += (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.randomInRangeValue)((0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.setRangeValue)(range.left, range.right));\n }\n if (moveOptions.random && typeof moveOptions.speed === \"number\") {\n res.length *= (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getRandom)();\n }\n return res;\n };\n _fixHorizontal = (pos, radius, outMode)=>{\n fixOutMode({\n outMode,\n checkModes: [\n _Enums_Modes_OutMode_js__WEBPACK_IMPORTED_MODULE_7__.OutMode.bounce\n ],\n coord: pos.x,\n maxCoord: this.container.canvas.size.width,\n setCb: (value)=>pos.x += value,\n radius\n });\n };\n _fixVertical = (pos, radius, outMode)=>{\n fixOutMode({\n outMode,\n checkModes: [\n _Enums_Modes_OutMode_js__WEBPACK_IMPORTED_MODULE_7__.OutMode.bounce\n ],\n coord: pos.y,\n maxCoord: this.container.canvas.size.height,\n setCb: (value)=>pos.y += value,\n radius\n });\n };\n _getRollColor = (color)=>{\n if (!color || !this.roll || !this.backColor && !this.roll.alter) {\n return color;\n }\n if (!this.isShowingBack()) {\n return color;\n }\n if (this.backColor) {\n return this.backColor;\n }\n if (this.roll.alter) {\n return (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_1__.alterHsl)(color, this.roll.alter.type, this.roll.alter.value);\n }\n return color;\n };\n _initPosition = (position)=>{\n const container = this.container, zIndexValue = (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getRangeValue)(this.options.zIndex.value), initialPosition = this._calcPosition(position, (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.clamp)(zIndexValue, _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.minZ, container.zLayers));\n if (!initialPosition) {\n throw new Error(\"a valid position cannot be found for particle\");\n }\n this.position = initialPosition;\n this.initialPosition = this.position.copy();\n const canvasSize = container.canvas.size;\n this.moveCenter = {\n ...(0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.getPosition)(this.options.move.center, canvasSize),\n radius: this.options.move.center.radius,\n mode: this.options.move.center.mode\n };\n this.direction = (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getParticleDirectionAngle)(this.options.move.direction, this.position, this.moveCenter);\n switch(this.options.move.direction){\n case _Enums_Directions_MoveDirection_js__WEBPACK_IMPORTED_MODULE_6__.MoveDirection.inside:\n this.outType = _Enums_Types_ParticleOutType_js__WEBPACK_IMPORTED_MODULE_8__.ParticleOutType.inside;\n break;\n case _Enums_Directions_MoveDirection_js__WEBPACK_IMPORTED_MODULE_6__.MoveDirection.outside:\n this.outType = _Enums_Types_ParticleOutType_js__WEBPACK_IMPORTED_MODULE_8__.ParticleOutType.outside;\n break;\n default:\n break;\n }\n this.offset = _Utils_Vectors_js__WEBPACK_IMPORTED_MODULE_0__.Vector.origin;\n };\n}\n\n\n//# sourceURL=webpack://@tsparticles/basic/../../engine/dist/browser/Core/Particle.js?\n}");
|
|
46
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Particle: () => (/* binding */ Particle)\n/* harmony export */ });\n/* harmony import */ var _Utils_Vectors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utils/Vectors.js */ \"../../engine/dist/browser/Core/Utils/Vectors.js\");\n/* harmony import */ var _Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Utils/ColorUtils.js */ \"../../engine/dist/browser/Utils/ColorUtils.js\");\n/* harmony import */ var _Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Utils/MathUtils.js */ \"../../engine/dist/browser/Utils/MathUtils.js\");\n/* harmony import */ var _Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Utils/Utils.js */ \"../../engine/dist/browser/Utils/Utils.js\");\n/* harmony import */ var _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Utils/Constants.js */ \"../../engine/dist/browser/Core/Utils/Constants.js\");\n/* harmony import */ var _Enums_Types_EventType_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Enums/Types/EventType.js */ \"../../engine/dist/browser/Enums/Types/EventType.js\");\n/* harmony import */ var _Enums_Directions_MoveDirection_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Enums/Directions/MoveDirection.js */ \"../../engine/dist/browser/Enums/Directions/MoveDirection.js\");\n/* harmony import */ var _Enums_Modes_OutMode_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Enums/Modes/OutMode.js */ \"../../engine/dist/browser/Enums/Modes/OutMode.js\");\n/* harmony import */ var _Enums_Types_ParticleOutType_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Enums/Types/ParticleOutType.js */ \"../../engine/dist/browser/Enums/Types/ParticleOutType.js\");\n/* harmony import */ var _Utils_OptionsUtils_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Utils/OptionsUtils.js */ \"../../engine/dist/browser/Utils/OptionsUtils.js\");\n\n\n\n\n\n\n\n\n\n\nfunction loadEffectData(effect, effectOptions, id, reduceDuplicates) {\n const effectData = effectOptions.options[effect];\n return (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.deepExtend)({\n close: effectOptions.close\n }, (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.itemFromSingleOrMultiple)(effectData, id, reduceDuplicates));\n}\nfunction loadShapeData(shape, shapeOptions, id, reduceDuplicates) {\n const shapeData = shapeOptions.options[shape];\n return (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.deepExtend)({\n close: shapeOptions.close\n }, (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.itemFromSingleOrMultiple)(shapeData, id, reduceDuplicates));\n}\nfunction fixOutMode(data) {\n if (!(0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.isInArray)(data.outMode, data.checkModes)) {\n return;\n }\n const diameter = data.radius * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.double;\n if (data.coord > data.maxCoord - diameter) {\n data.setCb(-data.radius);\n } else if (data.coord < diameter) {\n data.setCb(data.radius);\n }\n}\nclass Particle {\n container;\n backColor;\n bubble;\n destroyed;\n direction;\n effect;\n effectClose;\n effectData;\n fillColor;\n fillEnabled;\n fillOpacity;\n group;\n id;\n ignoresResizeRatio;\n initialPosition;\n initialVelocity;\n isRotating;\n lastPathTime;\n misplaced;\n moveCenter;\n offset;\n opacity;\n options;\n outType;\n pathRotation;\n position;\n randomIndexData;\n retina;\n roll;\n rotation;\n shape;\n shapeClose;\n shapeData;\n sides;\n size;\n slow;\n spawning;\n strokeColor;\n strokeOpacity;\n strokeWidth;\n unbreakable;\n velocity;\n zIndexFactor;\n _cachedOpacityData = {\n fillOpacity: _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultOpacity,\n opacity: _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultOpacity,\n strokeOpacity: _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultOpacity\n };\n _cachedPosition = _Utils_Vectors_js__WEBPACK_IMPORTED_MODULE_0__.Vector3d.origin;\n _cachedRotateData = {\n sin: 0,\n cos: 0\n };\n _cachedTransform = {\n a: 1,\n b: 0,\n c: 0,\n d: 1\n };\n _engine;\n constructor(engine, container){\n this.container = container;\n this._engine = engine;\n }\n destroy(override) {\n if (this.unbreakable || this.destroyed) {\n return;\n }\n this.destroyed = true;\n this.bubble.inRange = false;\n this.slow.inRange = false;\n const container = this.container, shapeDrawer = this.shape ? container.particles.shapeDrawers.get(this.shape) : undefined;\n shapeDrawer?.particleDestroy?.(this);\n for (const plugin of container.particleDestroyedPlugins){\n plugin.particleDestroyed?.(this, override);\n }\n for (const updater of container.particles.updaters){\n updater.particleDestroyed?.(this, override);\n }\n this._engine.dispatchEvent(_Enums_Types_EventType_js__WEBPACK_IMPORTED_MODULE_5__.EventType.particleDestroyed, {\n container: this.container,\n data: {\n particle: this\n }\n });\n }\n draw(delta) {\n const container = this.container, canvas = container.canvas;\n canvas.drawParticlePlugins(this, delta);\n canvas.drawParticle(this, delta);\n }\n getAngle() {\n return this.rotation + (this.pathRotation ? this.velocity.angle : _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultAngle);\n }\n getFillColor() {\n return this._getRollColor(this.bubble.color ?? (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_1__.getHslFromAnimation)(this.fillColor));\n }\n getMass() {\n return this.getRadius() ** _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.squareExp * Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.half;\n }\n getOpacity() {\n const zIndexOptions = this.options.zIndex, zIndexFactor = _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.zIndexFactorOffset - this.zIndexFactor, zOpacityFactor = zIndexFactor ** zIndexOptions.opacityRate, opacity = this.bubble.opacity ?? (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getRangeValue)(this.opacity?.value ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultOpacity), fillOpacity = this.fillOpacity ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultOpacity, strokeOpacity = this.strokeOpacity ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultOpacity;\n this._cachedOpacityData.fillOpacity = opacity * fillOpacity * zOpacityFactor;\n this._cachedOpacityData.opacity = opacity * zOpacityFactor;\n this._cachedOpacityData.strokeOpacity = opacity * strokeOpacity * zOpacityFactor;\n return this._cachedOpacityData;\n }\n getPosition() {\n this._cachedPosition.x = this.position.x + this.offset.x;\n this._cachedPosition.y = this.position.y + this.offset.y;\n this._cachedPosition.z = this.position.z;\n return this._cachedPosition;\n }\n getRadius() {\n return this.bubble.radius ?? this.size.value;\n }\n getRotateData() {\n const angle = this.getAngle();\n this._cachedRotateData.sin = Math.sin(angle);\n this._cachedRotateData.cos = Math.cos(angle);\n return this._cachedRotateData;\n }\n getStrokeColor() {\n return this._getRollColor(this.bubble.color ?? (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_1__.getHslFromAnimation)(this.strokeColor));\n }\n getTransformData(externalTransform) {\n const rotateData = this.getRotateData(), rotating = this.isRotating;\n this._cachedTransform.a = rotateData.cos * (externalTransform.a ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultTransform.a);\n this._cachedTransform.b = rotating ? rotateData.sin * (externalTransform.b ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.identity) : externalTransform.b ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultTransform.b;\n this._cachedTransform.c = rotating ? -rotateData.sin * (externalTransform.c ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.identity) : externalTransform.c ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultTransform.c;\n this._cachedTransform.d = rotateData.cos * (externalTransform.d ?? _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultTransform.d);\n return this._cachedTransform;\n }\n init(id, position, overrideOptions, group) {\n const container = this.container;\n this.id = id;\n this.group = group;\n this.effectClose = true;\n this.shapeClose = true;\n this.pathRotation = false;\n this.lastPathTime = 0;\n this.destroyed = false;\n this.unbreakable = false;\n this.isRotating = false;\n this.rotation = 0;\n this.misplaced = false;\n this.retina = {\n maxDistance: {}\n };\n this.outType = _Enums_Types_ParticleOutType_js__WEBPACK_IMPORTED_MODULE_8__.ParticleOutType.normal;\n this.ignoresResizeRatio = true;\n const pxRatio = container.retina.pixelRatio, mainOptions = container.actualOptions, particlesOptions = (0,_Utils_OptionsUtils_js__WEBPACK_IMPORTED_MODULE_9__.loadParticlesOptions)(this._engine, container, mainOptions.particles), reduceDuplicates = particlesOptions.reduceDuplicates, effectType = particlesOptions.effect.type, shapeType = particlesOptions.shape.type;\n this.effect = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.itemFromSingleOrMultiple)(effectType, this.id, reduceDuplicates);\n this.shape = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.itemFromSingleOrMultiple)(shapeType, this.id, reduceDuplicates);\n const effectOptions = particlesOptions.effect, shapeOptions = particlesOptions.shape;\n if (overrideOptions) {\n if (overrideOptions.effect?.type) {\n const overrideEffectType = overrideOptions.effect.type, effect = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.itemFromSingleOrMultiple)(overrideEffectType, this.id, reduceDuplicates);\n if (effect) {\n this.effect = effect;\n effectOptions.load(overrideOptions.effect);\n }\n }\n if (overrideOptions.shape?.type) {\n const overrideShapeType = overrideOptions.shape.type, shape = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.itemFromSingleOrMultiple)(overrideShapeType, this.id, reduceDuplicates);\n if (shape) {\n this.shape = shape;\n shapeOptions.load(overrideOptions.shape);\n }\n }\n }\n if (this.effect === _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.randomColorValue) {\n const availableEffects = [\n ...this.container.particles.effectDrawers.keys()\n ];\n this.effect = availableEffects[Math.floor((0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getRandom)() * availableEffects.length)];\n }\n if (this.shape === _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.randomColorValue) {\n const availableShapes = [\n ...this.container.particles.shapeDrawers.keys()\n ];\n this.shape = availableShapes[Math.floor((0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getRandom)() * availableShapes.length)];\n }\n this.effectData = this.effect ? loadEffectData(this.effect, effectOptions, this.id, reduceDuplicates) : undefined;\n this.shapeData = this.shape ? loadShapeData(this.shape, shapeOptions, this.id, reduceDuplicates) : undefined;\n particlesOptions.load(overrideOptions);\n const effectData = this.effectData;\n if (effectData) {\n particlesOptions.load(effectData.particles);\n }\n const shapeData = this.shapeData;\n if (shapeData) {\n particlesOptions.load(shapeData.particles);\n }\n this.effectClose = effectData?.close ?? particlesOptions.effect.close;\n this.shapeClose = shapeData?.close ?? particlesOptions.shape.close;\n this.options = particlesOptions;\n container.retina.initParticle(this);\n this.size = (0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.initParticleNumericAnimationValue)(this.options.size, pxRatio);\n this.bubble = {\n inRange: false\n };\n this.slow = {\n inRange: false,\n factor: 1\n };\n this._initPosition(position);\n this.initialVelocity = this._calculateVelocity();\n this.velocity = this.initialVelocity.copy();\n const particles = container.particles;\n particles.setLastZIndex(this.position.z);\n this.zIndexFactor = this.position.z / container.zLayers;\n this.sides = 24;\n let effectDrawer, shapeDrawer;\n if (this.effect) {\n effectDrawer = container.particles.effectDrawers.get(this.effect);\n }\n if (effectDrawer?.loadEffect) {\n effectDrawer.loadEffect(this);\n }\n if (this.shape) {\n shapeDrawer = container.particles.shapeDrawers.get(this.shape);\n }\n if (shapeDrawer?.loadShape) {\n shapeDrawer.loadShape(this);\n }\n const sideCountFunc = shapeDrawer?.getSidesCount;\n if (sideCountFunc) {\n this.sides = sideCountFunc(this);\n }\n this.spawning = false;\n for (const updater of particles.updaters){\n updater.init(this);\n }\n effectDrawer?.particleInit?.(container, this);\n shapeDrawer?.particleInit?.(container, this);\n for (const plugin of container.particleCreatedPlugins){\n plugin.particleCreated?.(this);\n }\n }\n isInsideCanvas() {\n const radius = this.getRadius(), canvasSize = this.container.canvas.size, position = this.position;\n return position.x >= -radius && position.y >= -radius && position.y <= canvasSize.height + radius && position.x <= canvasSize.width + radius;\n }\n isShowingBack() {\n if (!this.roll) {\n return false;\n }\n const angle = this.roll.angle;\n if (this.roll.horizontal && this.roll.vertical) {\n const normalizedAngle = angle % _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.doublePI, adjustedAngle = normalizedAngle < _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultAngle ? normalizedAngle + _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.doublePI : normalizedAngle;\n return adjustedAngle >= Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.half && adjustedAngle < Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.triple * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.half;\n }\n if (this.roll.horizontal) {\n const normalizedAngle = (angle + Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.half) % (Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.double), adjustedAngle = normalizedAngle < _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultAngle ? normalizedAngle + Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.double : normalizedAngle;\n return adjustedAngle >= Math.PI && adjustedAngle < Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.double;\n }\n if (this.roll.vertical) {\n const normalizedAngle = angle % (Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.double), adjustedAngle = normalizedAngle < _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultAngle ? normalizedAngle + Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.double : normalizedAngle;\n return adjustedAngle >= Math.PI && adjustedAngle < Math.PI * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.double;\n }\n return false;\n }\n isVisible() {\n return !this.destroyed && !this.spawning && this.isInsideCanvas();\n }\n reset() {\n for (const updater of this.container.particles.updaters){\n updater.reset?.(this);\n }\n }\n _calcPosition = (position, zIndex)=>{\n let tryCount = _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.defaultRetryCount, posVec = position ? _Utils_Vectors_js__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create(position.x, position.y, zIndex) : undefined;\n const container = this.container, plugins = container.particlePositionPlugins, outModes = this.options.move.outModes, radius = this.getRadius(), canvasSize = container.canvas.size, abortController = new AbortController(), { signal } = abortController;\n while(!signal.aborted){\n for (const plugin of plugins){\n const pluginPos = plugin.particlePosition?.(posVec, this);\n if (pluginPos) {\n return _Utils_Vectors_js__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create(pluginPos.x, pluginPos.y, zIndex);\n }\n }\n const exactPosition = (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.calcExactPositionOrRandomFromSize)({\n size: canvasSize,\n position: posVec\n }), pos = _Utils_Vectors_js__WEBPACK_IMPORTED_MODULE_0__.Vector3d.create(exactPosition.x, exactPosition.y, zIndex);\n this._fixHorizontal(pos, radius, outModes.left ?? outModes.default);\n this._fixHorizontal(pos, radius, outModes.right ?? outModes.default);\n this._fixVertical(pos, radius, outModes.top ?? outModes.default);\n this._fixVertical(pos, radius, outModes.bottom ?? outModes.default);\n let isValidPosition = true;\n for (const plugin of container.particles.checkParticlePositionPlugins){\n isValidPosition = plugin.checkParticlePosition?.(this, pos, tryCount) ?? true;\n if (!isValidPosition) {\n break;\n }\n }\n if (isValidPosition) {\n return pos;\n }\n tryCount += _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.tryCountIncrement;\n posVec = undefined;\n }\n return posVec;\n };\n _calculateVelocity = ()=>{\n const baseVelocity = (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getParticleBaseVelocity)(this.direction), res = baseVelocity.copy(), moveOptions = this.options.move;\n if (moveOptions.direction === _Enums_Directions_MoveDirection_js__WEBPACK_IMPORTED_MODULE_6__.MoveDirection.inside || moveOptions.direction === _Enums_Directions_MoveDirection_js__WEBPACK_IMPORTED_MODULE_6__.MoveDirection.outside) {\n return res;\n }\n const rad = (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.degToRad)((0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getRangeValue)(moveOptions.angle.value)), radOffset = (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.degToRad)((0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getRangeValue)(moveOptions.angle.offset)), range = {\n left: radOffset - rad * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.half,\n right: radOffset + rad * _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.half\n };\n if (!moveOptions.straight) {\n res.angle += (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.randomInRangeValue)((0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.setRangeValue)(range.left, range.right));\n }\n if (moveOptions.random && typeof moveOptions.speed === \"number\") {\n res.length *= (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getRandom)();\n }\n return res;\n };\n _fixHorizontal = (pos, radius, outMode)=>{\n fixOutMode({\n outMode,\n checkModes: [\n _Enums_Modes_OutMode_js__WEBPACK_IMPORTED_MODULE_7__.OutMode.bounce\n ],\n coord: pos.x,\n maxCoord: this.container.canvas.size.width,\n setCb: (value)=>pos.x += value,\n radius\n });\n };\n _fixVertical = (pos, radius, outMode)=>{\n fixOutMode({\n outMode,\n checkModes: [\n _Enums_Modes_OutMode_js__WEBPACK_IMPORTED_MODULE_7__.OutMode.bounce\n ],\n coord: pos.y,\n maxCoord: this.container.canvas.size.height,\n setCb: (value)=>pos.y += value,\n radius\n });\n };\n _getRollColor = (color)=>{\n if (!color || !this.roll || !this.backColor && !this.roll.alter) {\n return color;\n }\n if (!this.isShowingBack()) {\n return color;\n }\n if (this.backColor) {\n return this.backColor;\n }\n if (this.roll.alter) {\n return (0,_Utils_ColorUtils_js__WEBPACK_IMPORTED_MODULE_1__.alterHsl)(color, this.roll.alter.type, this.roll.alter.value);\n }\n return color;\n };\n _initPosition = (position)=>{\n const container = this.container, zIndexValue = (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getRangeValue)(this.options.zIndex.value), initialPosition = this._calcPosition(position, (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.clamp)(zIndexValue, _Utils_Constants_js__WEBPACK_IMPORTED_MODULE_4__.minZ, container.zLayers));\n if (!initialPosition) {\n throw new Error(\"a valid position cannot be found for particle\");\n }\n this.position = initialPosition;\n this.initialPosition = this.position.copy();\n const canvasSize = container.canvas.size;\n this.moveCenter = {\n ...(0,_Utils_Utils_js__WEBPACK_IMPORTED_MODULE_3__.getPosition)(this.options.move.center, canvasSize),\n radius: this.options.move.center.radius,\n mode: this.options.move.center.mode\n };\n this.direction = (0,_Utils_MathUtils_js__WEBPACK_IMPORTED_MODULE_2__.getParticleDirectionAngle)(this.options.move.direction, this.position, this.moveCenter);\n switch(this.options.move.direction){\n case _Enums_Directions_MoveDirection_js__WEBPACK_IMPORTED_MODULE_6__.MoveDirection.inside:\n this.outType = _Enums_Types_ParticleOutType_js__WEBPACK_IMPORTED_MODULE_8__.ParticleOutType.inside;\n break;\n case _Enums_Directions_MoveDirection_js__WEBPACK_IMPORTED_MODULE_6__.MoveDirection.outside:\n this.outType = _Enums_Types_ParticleOutType_js__WEBPACK_IMPORTED_MODULE_8__.ParticleOutType.outside;\n break;\n default:\n break;\n }\n this.offset = _Utils_Vectors_js__WEBPACK_IMPORTED_MODULE_0__.Vector.origin;\n };\n}\n\n\n//# sourceURL=webpack://@tsparticles/basic/../../engine/dist/browser/Core/Particle.js?\n}");
|
|
47
47
|
|
|
48
48
|
/***/ },
|
|
49
49
|
|
package/esm/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export async function loadBasic(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-alpha.
|
|
2
|
+
engine.checkVersion("4.0.0-alpha.28");
|
|
3
3
|
await engine.register(async (e) => {
|
|
4
|
-
const [{ loadHexColorPlugin }, { loadHslColorPlugin }, { loadRgbColorPlugin }, { loadMovePlugin }, { loadCircleShape }, {
|
|
4
|
+
const [{ loadHexColorPlugin }, { loadHslColorPlugin }, { loadRgbColorPlugin }, { loadMovePlugin }, { loadCircleShape }, { loadFillColorUpdater }, { loadOpacityUpdater }, { loadOutModesUpdater }, { loadSizeUpdater },] = await Promise.all([
|
|
5
5
|
import("@tsparticles/plugin-hex-color"),
|
|
6
6
|
import("@tsparticles/plugin-hsl-color"),
|
|
7
7
|
import("@tsparticles/plugin-rgb-color"),
|
|
8
8
|
import("@tsparticles/plugin-move"),
|
|
9
9
|
import("@tsparticles/shape-circle"),
|
|
10
|
-
import("@tsparticles/updater-color"),
|
|
10
|
+
import("@tsparticles/updater-fill-color"),
|
|
11
11
|
import("@tsparticles/updater-opacity"),
|
|
12
12
|
import("@tsparticles/updater-out-modes"),
|
|
13
13
|
import("@tsparticles/updater-size"),
|
|
@@ -18,7 +18,7 @@ export async function loadBasic(engine) {
|
|
|
18
18
|
loadRgbColorPlugin(e),
|
|
19
19
|
loadMovePlugin(e),
|
|
20
20
|
loadCircleShape(e),
|
|
21
|
-
|
|
21
|
+
loadFillColorUpdater(e),
|
|
22
22
|
loadOpacityUpdater(e),
|
|
23
23
|
loadOutModesUpdater(e),
|
|
24
24
|
loadSizeUpdater(e),
|