@newkrok/three-particles 1.0.3 → 2.0.0

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.
Files changed (44) hide show
  1. package/README.md +28 -12
  2. package/dist/bundle-report.json +1 -0
  3. package/dist/index.d.ts +7 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +6 -0
  6. package/dist/js/effects/three-particles/index.d.ts +7 -0
  7. package/dist/js/effects/three-particles/index.d.ts.map +1 -0
  8. package/dist/js/effects/three-particles/index.js +6 -0
  9. package/dist/js/effects/three-particles/shaders/particle-system-fragment-shader.glsl.d.ts +3 -0
  10. package/dist/js/effects/three-particles/shaders/particle-system-fragment-shader.glsl.d.ts.map +1 -0
  11. package/{src → dist}/js/effects/three-particles/shaders/particle-system-fragment-shader.glsl.js +66 -67
  12. package/dist/js/effects/three-particles/shaders/particle-system-vertex-shader.glsl.d.ts +3 -0
  13. package/dist/js/effects/three-particles/shaders/particle-system-vertex-shader.glsl.d.ts.map +1 -0
  14. package/{src → dist}/js/effects/three-particles/shaders/particle-system-vertex-shader.glsl.js +32 -33
  15. package/dist/js/effects/three-particles/three-particles-bezier.d.ts +5 -0
  16. package/dist/js/effects/three-particles/three-particles-bezier.d.ts.map +1 -0
  17. package/dist/js/effects/three-particles/three-particles-bezier.js +62 -0
  18. package/dist/js/effects/three-particles/three-particles-curves.d.ts +37 -0
  19. package/dist/js/effects/three-particles/three-particles-curves.d.ts.map +1 -0
  20. package/dist/js/effects/three-particles/three-particles-curves.js +37 -0
  21. package/dist/js/effects/three-particles/three-particles-enums.d.ts +25 -0
  22. package/dist/js/effects/three-particles/three-particles-enums.d.ts.map +1 -0
  23. package/dist/js/effects/three-particles/three-particles-enums.js +1 -0
  24. package/dist/js/effects/three-particles/three-particles-modifiers.d.ts +11 -0
  25. package/dist/js/effects/three-particles/three-particles-modifiers.d.ts.map +1 -0
  26. package/dist/js/effects/three-particles/three-particles-modifiers.js +93 -0
  27. package/dist/js/effects/three-particles/three-particles-utils.d.ts +31 -0
  28. package/dist/js/effects/three-particles/three-particles-utils.d.ts.map +1 -0
  29. package/dist/js/effects/three-particles/three-particles-utils.js +145 -0
  30. package/dist/js/effects/three-particles/three-particles.d.ts +13 -0
  31. package/dist/js/effects/three-particles/three-particles.d.ts.map +1 -0
  32. package/dist/js/effects/three-particles/three-particles.js +642 -0
  33. package/dist/js/effects/three-particles/types.d.ts +1037 -0
  34. package/dist/js/effects/three-particles/types.d.ts.map +1 -0
  35. package/dist/js/effects/three-particles/types.js +1 -0
  36. package/dist/three-particles.min.js +1 -0
  37. package/package.json +87 -37
  38. package/src/js/effects/three-particles/three-particles-bezier.js +0 -36
  39. package/src/js/effects/three-particles/three-particles-curves.js +0 -75
  40. package/src/js/effects/three-particles/three-particles-enums.js +0 -23
  41. package/src/js/effects/three-particles/three-particles-modifiers.js +0 -133
  42. package/src/js/effects/three-particles/three-particles-utils.js +0 -212
  43. package/src/js/effects/three-particles.d.ts +0 -138
  44. package/src/js/effects/three-particles.js +0 -931
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/js/effects/three-particles/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,MAAM,yCAAyC,CAAC;AAC9D,OAAO,EACL,QAAQ,EACR,aAAa,EACb,KAAK,EACL,eAAe,EACf,QAAQ,EACT,MAAM,4BAA4B,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;;;;;;;;GASG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,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B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,eAAe,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,gBAAgB,EAAE,8BAA8B,CAAC;IACjD,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,kBAAkB,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,gBAAgB,EAAE,CAAC,IAAI,EAAE;QACvB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;KAC7B,KAAK,IAAI,CAAC;CACZ,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;IACnC,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ import*as t from"THREE";var e={300:t=>{var e=t.exports={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){var e,r=.1;return 0===t?0:1===t?1:(!r||r<1?(r=1,e=.1):e=.4*Math.asin(1/r)/(2*Math.PI),-r*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4))},Out:function(t){var e,r=.1;return 0===t?0:1===t?1:(!r||r<1?(r=1,e=.1):e=.4*Math.asin(1/r)/(2*Math.PI),r*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},InOut:function(t){var e,r=.1,i=.4;return 0===t?0:1===t?1:(!r||r<1?(r=1,e=.1):e=i*Math.asin(1/r)/(2*Math.PI),(t*=2)<1?r*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*-.5:r*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*.5+1)}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-e.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*e.Bounce.In(2*t):.5*e.Bounce.Out(2*t-1)+.5}}}}},r={};function i(t){var n=r[t];if(void 0!==n)return n.exports;var a=r[t]={exports:{}};return e[t](a,a.exports,i),a.exports}i.d=(t,e)=>{for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n={};i.d(n,{pB:()=>z,U_:()=>N,rU:()=>v,M4:()=>h,$H:()=>f,hp:()=>g,l$:()=>y,Y$:()=>b,Tt:()=>s,eL:()=>k,Hc:()=>l,Ao:()=>m,iy:()=>I,Px:()=>F,rJ:()=>x,Pj:()=>c,YR:()=>W});const a=[],o=(t,e)=>{let r=1;for(let i=1;i<=e;i++)r*=(t+1-i)/i;return r},s=(t,e)=>{const r=a.find((t=>t.bezierPoints===e));if(r)return r.referencedBy.includes(t)||r.referencedBy.push(t),r.curveFunction;const i={referencedBy:[t],bezierPoints:e,curveFunction:t=>{if(t<0)return e[0].y;if(t>1)return e[e.length-1].y;let r=0,i=e.length-1;e.find(((e,n)=>{const a=t<(e.percentage??0);return a?i=n:void 0!==e.percentage&&(r=n),a}));const n=i-r,a=(t-(e[r].percentage??0))/((e[i].percentage??1)-(e[r].percentage??0));let s=0;for(let t=0;t<=n;t++){const i=e[r+t];s+=o(n,t)*Math.pow(1-a,n-t)*Math.pow(a,t)*i.y}return s}};return a.push(i),i.curveFunction},c=t=>{for(;;){const e=a.findIndex((e=>e.referencedBy.includes(t)));if(-1===e)break;const r=a[e];r.referencedBy=r.referencedBy.filter((e=>e!==t)),0===r.referencedBy.length&&a.splice(e,1)}},l=()=>a.length;var u=i(300);const d={LINEAR:u.Linear.None,QUADRATIC_IN:u.Quadratic.In,QUADRATIC_OUT:u.Quadratic.Out,QUADRATIC_IN_OUT:u.Quadratic.InOut,CUBIC_IN:u.Cubic.In,CUBIC_OUT:u.Cubic.Out,CUBIC_IN_OUT:u.Cubic.InOut,QUARTIC_IN:u.Quartic.In,QUARTIC_OUT:u.Quartic.Out,QUARTIC_IN_OUT:u.Quartic.InOut,QUINTIC_IN:u.Quintic.In,QUINTIC_OUT:u.Quintic.Out,QUINTIC_IN_OUT:u.Quintic.InOut,SINUSOIDAL_IN:u.Sinusoidal.In,SINUSOIDAL_OUT:u.Sinusoidal.Out,SINUSOIDAL_IN_OUT:u.Sinusoidal.InOut,EXPONENTIAL_IN:u.Exponential.In,EXPONENTIAL_OUT:u.Exponential.Out,EXPONENTIAL_IN_OUT:u.Exponential.InOut,CIRCULAR_IN:u.Circular.In,CIRCULAR_OUT:u.Circular.Out,CIRCULAR_IN_OUT:u.Circular.InOut,ELASTIC_IN:u.Elastic.In,ELASTIC_OUT:u.Elastic.Out,ELASTIC_IN_OUT:u.Elastic.InOut,BACK_IN:u.Back.In,BACK_OUT:u.Back.Out,BACK_IN_OUT:u.Back.InOut,BOUNCE_IN:u.Bounce.In,BOUNCE_OUT:u.Bounce.Out,BOUNCE_IN_OUT:u.Bounce.InOut},m=t=>"function"==typeof t?t:d[t];const p=(t=>{var e={};return i.d(e,t),e})({AdditiveBlending:()=>t.AdditiveBlending,BufferAttribute:()=>t.BufferAttribute,BufferGeometry:()=>t.BufferGeometry,Euler:()=>t.Euler,MathUtils:()=>t.MathUtils,MultiplyBlending:()=>t.MultiplyBlending,NoBlending:()=>t.NoBlending,NormalBlending:()=>t.NormalBlending,Object3D:()=>t.Object3D,Points:()=>t.Points,Quaternion:()=>t.Quaternion,ShaderMaterial:()=>t.ShaderMaterial,SubtractiveBlending:()=>t.SubtractiveBlending,Vector2:()=>t.Vector2,Vector3:()=>t.Vector3}),y=(t,e,r,i,{radius:n,radiusThickness:a,arc:o})=>{const s=Math.random()*(o/360),c=Math.random(),l=Math.random(),u=2*Math.PI*s,d=Math.acos(2*c-1),m=Math.sin(d),p=m*Math.cos(u),y=m*Math.sin(u),f=Math.cos(d),v=1-a;t.x=n*v*p+n*a*l*p,t.y=n*v*y+n*a*l*y,t.z=n*v*f+n*a*l*f,t.applyQuaternion(e);const h=1/t.length();r.set(t.x*h*i,t.y*h*i,t.z*h*i),r.applyQuaternion(e)},f=(t,e,r,i,{radius:n,radiusThickness:a,arc:o,angle:s=90})=>{const c=2*Math.PI*Math.random()*(o/360),l=Math.random(),u=Math.cos(c),d=Math.sin(c),m=1-a;t.x=n*m*u+n*a*l*u,t.y=n*m*d+n*a*l*d,t.z=0,t.applyQuaternion(e);const y=t.length(),f=Math.abs(y/n*p.MathUtils.degToRad(s)),v=Math.sin(f),h=1/y;r.set(t.x*v*h*i,t.y*v*h*i,Math.cos(f)*i),r.applyQuaternion(e)},v=(t,e,r,i,{scale:n,emitFrom:a})=>{const o=n;switch(a){case"VOLUME":t.x=Math.random()*o.x-o.x/2,t.y=Math.random()*o.y-o.y/2,t.z=Math.random()*o.z-o.z/2;break;case"SHELL":const e=Math.floor(6*Math.random()),r=e%3,i=[];i[r]=e>2?1:0,i[(r+1)%3]=Math.random(),i[(r+2)%3]=Math.random(),t.x=i[0]*o.x-o.x/2,t.y=i[1]*o.y-o.y/2,t.z=i[2]*o.z-o.z/2;break;case"EDGE":const n=Math.floor(6*Math.random()),a=n%3,s=Math.floor(4*Math.random()),c=[];c[a]=n>2?1:0,c[(a+1)%3]=s<2?Math.random():s-2,c[(a+2)%3]=s<2?s:Math.random(),t.x=c[0]*o.x-o.x/2,t.y=c[1]*o.y-o.y/2,t.z=c[2]*o.z-o.z/2}t.applyQuaternion(e),r.set(0,0,i),r.applyQuaternion(e)},h=(t,e,r,i,{radius:n,radiusThickness:a,arc:o})=>{const s=2*Math.PI*Math.random()*(o/360),c=Math.random(),l=Math.cos(s),u=Math.sin(s),d=1-a;t.x=n*d*l+n*a*c*l,t.y=n*d*u+n*a*c*u,t.z=0,t.applyQuaternion(e);const m=1/t.length();r.set(t.x*m*i,t.y*m*i,0),r.applyQuaternion(e)},g=(t,e,r,i,{rotation:n,scale:a})=>{const o=a,s=n,c=Math.random()*o.x-o.x/2,l=Math.random()*o.y-o.y/2,u=p.MathUtils.degToRad(s.x),d=p.MathUtils.degToRad(s.y);t.x=c*Math.cos(d),t.y=l*Math.cos(u),t.z=c*Math.sin(d)-l*Math.sin(u),t.applyQuaternion(e),r.set(0,0,i),r.applyQuaternion(e)},x=t=>"number"!=typeof t&&"type"in t,I=(t,e)=>{if("BEZIER"===e.type)return s(t,e.bezierPoints);if("EASING"===e.type)return e.curveFunction;throw new Error(`Unsupported value type: ${e}`)},b=(t,e,r=0)=>{if("number"==typeof e)return e;if("min"in e&&"max"in e)return e.min===e.max?e.min??0:p.MathUtils.randFloat(e.min??0,e.max??1);const i=e;return I(t,i)(r)*(i.scale??1)},M=new p.Vector3(0,0,0),O=new p.Euler,z=({delta:t,generalData:e,normalizedConfig:r,attributes:i,particleLifetimePercentage:n,particleIndex:a})=>{const{particleSystemId:o,startValues:s,lifetimeValues:c,linearVelocityData:l,orbitalVelocityData:u,noise:d}=e,m=3*a,p=i.position.array;if(l){const{speed:e,valueModifiers:r}=l[a],o=r.x?r.x(n):e.x,s=r.y?r.y(n):e.y,c=r.z?r.z(n):e.z;p[m]+=o*t,p[m+1]+=s*t,p[m+2]+=c*t,i.position.needsUpdate=!0}if(u){const{speed:e,positionOffset:r,valueModifiers:o}=u[a];p[m]-=r.x,p[m+1]-=r.y,p[m+2]-=r.z;const s=o.x?o.x(n):e.x,c=o.y?o.y(n):e.y,l=o.z?o.z(n):e.z;O.set(s*t,l*t,c*t),r.applyEuler(O),p[m]+=r.x,p[m+1]+=r.y,p[m+2]+=r.z,i.position.needsUpdate=!0}if(r.sizeOverLifetime.isActive){const t=b(o,r.sizeOverLifetime.lifetimeCurve,n);i.size.array[a]=s.startSize[a]*t,i.size.needsUpdate=!0}if(r.opacityOverLifetime.isActive){const t=b(o,r.opacityOverLifetime.lifetimeCurve,n);i.colorA.array[a]=s.startOpacity[a]*t,i.colorA.needsUpdate=!0}if(c.rotationOverLifetime&&(i.rotation.array[a]+=c.rotationOverLifetime[a]*t*.02,i.rotation.needsUpdate=!0),d.isActive){const{sampler:t,strength:e,offsets:r,positionAmount:o,rotationAmount:s,sizeAmount:c}=d;let l;const u=10*(n+(r?r[a]:0))*e,y=.15*e;M.set(u,0,0),l=t.get3(M),p[m]+=l*y*o,0!==s&&(i.rotation.array[a]+=l*y*s,i.rotation.needsUpdate=!0),0!==c&&(i.size.array[a]+=l*y*c,i.size.needsUpdate=!0),M.set(u,u,0),l=t.get3(M),p[m+1]+=l*y*o,M.set(u,u,u),l=t.get3(M),p[m+2]+=l*y*o,i.position.needsUpdate=!0}};const w=(t,e,r={skippedProperties:[],applyToFirstObject:!1})=>{const i={};return Object.keys(t).forEach((n=>{r.skippedProperties&&r.skippedProperties.includes(n)||("object"==typeof t[n]&&t[n]&&e[n]&&!Array.isArray(t[n])?i[n]=w(t[n],e[n],r):(i[n]=0===e[n]?0:!1!==e[n]&&(e[n]||t[n]),r.applyToFirstObject&&(t[n]=i[n])))})),i},P=new p.Vector3,A=new p.Quaternion,S=new p.Vector3,_=new p.Vector3,C=new p.Quaternion,L=new p.Vector3;class V extends p.Object3D{constructor(){super()}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null!==this.parent?(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(_,C,L),this.matrix.decompose(P,A,S),this.matrixWorld.compose(_,A,L)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(let e=0,r=this.children.length;e<r;e++)this.children[e].updateMatrixWorld(t)}}var T=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];class E{constructor(t){const e=[new p.Vector3(1,1,0),new p.Vector3(-1,1,0),new p.Vector3(1,-1,0),new p.Vector3(-1,-1,0),new p.Vector3(1,0,1),new p.Vector3(-1,0,1),new p.Vector3(1,0,-1),new p.Vector3(-1,0,-1),new p.Vector3(0,1,1),new p.Vector3(0,-1,1),new p.Vector3(0,1,-1),new p.Vector3(0,-1,-1)];var r=new Array(512),i=new Array(512);t||(t=1),t*=65536,(t=Math.floor(t))<256&&(t|=t<<8);for(var n=0;n<256;n++){var a;a=1&n?T[n]^255&t:T[n]^t>>8&255,r[n]=r[n+256]=a,i[n]=i[n+256]=e[a%12]}this._seed=t,this._offsetMatrix=[new p.Vector3(0,0,0),new p.Vector3(0,0,1),new p.Vector3(0,1,0),new p.Vector3(0,1,1),new p.Vector3(1,0,0),new p.Vector3(1,0,1),new p.Vector3(1,1,0),new p.Vector3(1,1,1)],this.shaderChunk={defines:"",header:'#define GLSLIFY 1\n// From https://github.com/hughsk/glsl-noise/blob/master/periodic/2d.glsl\n\n//\n// GLSL textureless classic 2D noise "cnoise",\n// with an RSL-style periodic variant "pnoise".\n// Author: Stefan Gustavson (stefan.gustavson@liu.se)\n// Version: 2011-08-22\n//\n// Many thanks to Ian McEwan of Ashima Arts for the\n// ideas for permutation and gradient selection.\n//\n// Copyright (c) 2011 Stefan Gustavson. All rights reserved.\n// Distributed under the MIT license. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n//\n\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\n\nvec4 permute(vec4 x) { return mod289(((x * 34.0) + 1.0) * x); }\n\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\n\nvec2 fade(vec2 t) { return t * t * t * (t * (t * 6.0 - 15.0) + 10.0); }\n\nfloat map(float value, float min1, float max1, float min2, float max2) {\n return min2 + (value - min1) * (max2 - min2) / (max1 - min1);\n}\n\n// Classic Perlin noise, periodic variant\nfloat perlin(vec2 P) {\n\n vec2 rep = vec2(255.0, 255.0);\n\n vec4 Pi = floor(P.xyxy) + vec4(0.0, 0.0, 1.0, 1.0);\n vec4 Pf = fract(P.xyxy) - vec4(0.0, 0.0, 1.0, 1.0);\n Pi = mod(Pi, rep.xyxy); // To create noise with explicit period\n Pi = mod289(Pi); // To avoid truncation effects in permutation\n vec4 ix = Pi.xzxz;\n vec4 iy = Pi.yyww;\n vec4 fx = Pf.xzxz;\n vec4 fy = Pf.yyww;\n\n vec4 i = permute(permute(ix) + iy);\n\n vec4 gx = fract(i * (1.0 / 41.0)) * 2.0 - 1.0;\n vec4 gy = abs(gx) - 0.5;\n vec4 tx = floor(gx + 0.5);\n gx = gx - tx;\n\n vec2 g00 = vec2(gx.x, gy.x);\n vec2 g10 = vec2(gx.y, gy.y);\n vec2 g01 = vec2(gx.z, gy.z);\n vec2 g11 = vec2(gx.w, gy.w);\n\n vec4 norm = taylorInvSqrt(\n vec4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));\n g00 *= norm.x;\n g01 *= norm.y;\n g10 *= norm.z;\n g11 *= norm.w;\n\n float n00 = dot(g00, vec2(fx.x, fy.x));\n float n10 = dot(g10, vec2(fx.y, fy.y));\n float n01 = dot(g01, vec2(fx.z, fy.z));\n float n11 = dot(g11, vec2(fx.w, fy.w));\n\n vec2 fade_xy = fade(Pf.xy);\n vec2 n_x = mix(vec2(n00, n01), vec2(n10, n11), fade_xy.x);\n float n_xy = mix(n_x.x, n_x.y, fade_xy.y);\n return map(2.3 * n_xy, -1.0, 1.0, 0.0, 1.0);\n}\n\nfloat fbm(vec2 pos, vec4 props) {\n float persistance = props.x;\n float lacunarity = props.y;\n float redistribution = props.z;\n int octaves = int(props.w);\n\n float result = 0.0;\n float amplitude = 1.0;\n float frequency = 1.0;\n float maximum = amplitude;\n\n for (int i = 0; i < 2; i++) {\n\n vec2 p = pos.xy * frequency;\n\n float noiseVal = perlin(p);\n result += noiseVal * amplitude;\n\n frequency *= lacunarity;\n amplitude *= persistance;\n maximum += amplitude;\n }\n\n float redistributed = pow(result, redistribution);\n return redistributed / maximum;\n}\n',main:"",uniforms:[{three_noise_seed:this._seed}]},this.perm=r,this.gradP=i}_fade(t){return t*t*t*(t*(6*t-15)+10)}_lerp(t,e,r){return(1-r)*t+r*e}_gradient(t){return t instanceof p.Vector3?t.x+this.perm[t.y+this.perm[t.z]]:t.x+this.perm[t.y]}static map(t,e,r,i,n){return(t-e)*(n-i)/(r-e)+i}get2(t){void 0!==t.z&&(t=new p.Vector2(t.x,t.y));const e=new p.Vector2(Math.floor(t.x),Math.floor(t.y));t.sub(e),e.x&=255,e.y&=255;const r=[];for(let i=0;i<4;i++){const n=this._offsetMatrix[2*i],a=new p.Vector2(n.x,n.y),o=this.gradP[this._gradient((new p.Vector2).addVectors(e,a))],s=new p.Vector2(o.x,o.y),c=(new p.Vector2).subVectors(t,a);r.push(s.dot(c))}const i=this._fade(t.x),n=this._fade(t.y);return this._lerp(this._lerp(r[0],r[2],i),this._lerp(r[1],r[3],i),n)}get3(t){if(void 0===t.z)throw"Input to Perlin::get3() must be of type THREE.Vector3";const e=new p.Vector3(Math.floor(t.x),Math.floor(t.y),Math.floor(t.z));t.sub(e),e.x&=255,e.y&=255,e.z&=255;const r=[];for(let i=0;i<8;i++){const n=this._offsetMatrix[i],a=this.gradP[this._gradient((new p.Vector3).addVectors(e,n))],o=(new p.Vector3).subVectors(t,n);r.push(a.dot(o))}const i=this._fade(t.x),n=this._fade(t.y),a=this._fade(t.z);return this._lerp(this._lerp(this._lerp(r[0],r[4],i),this._lerp(r[1],r[5],i),a),this._lerp(this._lerp(r[2],r[6],i),this._lerp(r[3],r[7],i),a),n)}}class U{constructor(t){const{seed:e,scale:r,persistance:i,lacunarity:n,octaves:a,redistribution:o}=t;this._noise=new E(e),this._scale=r||1,this._persistance=i||.5,this._lacunarity=n||2,this._octaves=a||6,this._redistribution=o||1}get2(t){let e=0,r=1,i=1,n=r,a=this._noise.get2.bind(this._noise);for(let o=0;o<this._octaves;o++){e+=a(new p.Vector2(t.x*this._scale*i,t.y*this._scale*i))*r,i*=this._lacunarity,r*=this._persistance,n+=r}return Math.pow(e,this._redistribution)/n}get3(t){let e=0,r=1,i=1,n=r,a=this._noise.get3.bind(this._noise);for(let o=0;o<this._octaves;o++){e+=a(new p.Vector3(t.x*this._scale*i,t.y*this._scale*i,t.z*this._scale*i))*r,i*=this._lacunarity,r*=this._persistance,n+=r}return Math.pow(e,this._redistribution)/n}}let B=0,R=[];const N={"THREE.NoBlending":p.NoBlending,"THREE.NormalBlending":p.NormalBlending,"THREE.AdditiveBlending":p.AdditiveBlending,"THREE.SubtractiveBlending":p.SubtractiveBlending,"THREE.MultiplyBlending":p.MultiplyBlending},F=()=>JSON.parse(JSON.stringify(Q)),Q={transform:{position:new p.Vector3,rotation:new p.Vector3,scale:new p.Vector3(1,1,1)},duration:5,looping:!0,startDelay:0,startLifetime:5,startSpeed:1,startSize:1,startOpacity:1,startRotation:0,startColor:{min:{r:1,g:1,b:1},max:{r:1,g:1,b:1}},gravity:0,simulationSpace:"LOCAL",maxParticles:100,emission:{rateOverTime:10,rateOverDistance:0},shape:{shape:"SPHERE",sphere:{radius:1,radiusThickness:1,arc:360},cone:{angle:25,radius:1,radiusThickness:1,arc:360},circle:{radius:1,radiusThickness:1,arc:360},rectangle:{rotation:{x:0,y:0},scale:{x:1,y:1}},box:{scale:{x:1,y:1,z:1},emitFrom:"VOLUME"}},map:void 0,renderer:{blending:p.NormalBlending,discardBackgroundColor:!1,backgroundColorTolerance:1,backgroundColor:{r:1,g:1,b:1},transparent:!0,depthTest:!0,depthWrite:!1},velocityOverLifetime:{isActive:!1,linear:{x:0,y:0,z:0},orbital:{x:0,y:0,z:0}},sizeOverLifetime:{isActive:!1,lifetimeCurve:{type:"BEZIER",scale:1,bezierPoints:[{x:0,y:0,percentage:0},{x:1,y:1,percentage:1}]}},opacityOverLifetime:{isActive:!1,lifetimeCurve:{type:"BEZIER",scale:1,bezierPoints:[{x:0,y:0,percentage:0},{x:1,y:1,percentage:1}]}},rotationOverLifetime:{isActive:!1,min:0,max:0},noise:{isActive:!1,useRandomOffset:!1,strength:1,frequency:.5,octaves:1,positionAmount:1,rotationAmount:0,sizeAmount:0},textureSheetAnimation:{tiles:new p.Vector2(1,1),timeMode:"LIFETIME",fps:30,startFrame:0}},D=(t,{shape:e,sphere:r,cone:i,circle:n,rectangle:a,box:o},s,c,l)=>{const u=b(t.particleSystemId,s,t.normalizedLifetimePercentage);switch(e){case"SPHERE":y(c,t.wrapperQuaternion,l,u,r);break;case"CONE":f(c,t.wrapperQuaternion,l,u,i);break;case"CIRCLE":h(c,t.wrapperQuaternion,l,u,n);break;case"RECTANGLE":g(c,t.wrapperQuaternion,l,u,a);break;case"BOX":v(c,t.wrapperQuaternion,l,u,o)}},k=(t=Q,e)=>{const r=e||Date.now(),i={particleSystemId:B++,normalizedLifetimePercentage:0,distanceFromLastEmitByDistance:0,lastWorldPosition:new p.Vector3(-99999),currentWorldPosition:new p.Vector3(-99999),worldPositionChange:new p.Vector3,worldQuaternion:new p.Quaternion,wrapperQuaternion:new p.Quaternion,lastWorldQuaternion:new p.Quaternion(-99999),worldEuler:new p.Euler,gravityVelocity:new p.Vector3(0,0,0),startValues:{},linearVelocityData:void 0,orbitalVelocityData:void 0,lifetimeValues:{},creationTimes:[],noise:{isActive:!1,strength:0,positionAmount:0,rotationAmount:0,sizeAmount:0},isEnabled:!0},n=w(Q,t),{transform:a,duration:o,looping:s,startDelay:l,startLifetime:u,startSpeed:d,startSize:m,startRotation:y,startColor:f,startOpacity:v,gravity:h,simulationSpace:g,maxParticles:M,emission:O,shape:P,map:A,renderer:S,noise:_,velocityOverLifetime:C,onUpdate:L,onComplete:T,textureSheetAnimation:E}=n;"string"==typeof S?.blending&&(S.blending=N[S.blending]);const F=Array.from({length:M},(()=>new p.Vector3)),k=Array.from({length:M},(()=>new p.Vector3));i.creationTimes=Array.from({length:M},(()=>0)),C.isActive&&(i.linearVelocityData=Array.from({length:M},(()=>({speed:new p.Vector3(C.linear.x?b(i.particleSystemId,C.linear.x,0):0,C.linear.y?b(i.particleSystemId,C.linear.y,0):0,C.linear.z?b(i.particleSystemId,C.linear.z,0):0),valueModifiers:{x:x(C.linear.x||0)?I(i.particleSystemId,C.linear.x):void 0,y:x(C.linear.y||0)?I(i.particleSystemId,C.linear.y):void 0,z:x(C.linear.z||0)?I(i.particleSystemId,C.linear.z):void 0}}))),i.orbitalVelocityData=Array.from({length:M},(()=>({speed:new p.Vector3(C.orbital.x?b(i.particleSystemId,C.orbital.x,0):0,C.orbital.y?b(i.particleSystemId,C.orbital.y,0):0,C.orbital.z?b(i.particleSystemId,C.orbital.z,0):0),valueModifiers:{x:x(C.orbital.x||0)?I(i.particleSystemId,C.orbital.x):void 0,y:x(C.orbital.y||0)?I(i.particleSystemId,C.orbital.y):void 0,z:x(C.orbital.z||0)?I(i.particleSystemId,C.orbital.z):void 0},positionOffset:new p.Vector3}))));["startSize","startOpacity"].forEach((t=>{i.startValues[t]=Array.from({length:M},(()=>b(i.particleSystemId,n[t],0)))}));["rotationOverLifetime"].forEach((t=>{const e=n[t];e.isActive&&(i.lifetimeValues[t]=Array.from({length:M},(()=>p.MathUtils.randFloat(e.min,e.max))))})),i.noise={isActive:_.isActive,strength:_.strength,positionAmount:_.positionAmount,rotationAmount:_.rotationAmount,sizeAmount:_.sizeAmount,sampler:_.isActive?new U({seed:Math.random(),scale:_.frequency,octaves:_.octaves}):void 0,offsets:_.useRandomOffset?Array.from({length:M},(()=>100*Math.random())):void 0};const W=new p.ShaderMaterial({uniforms:{elapsed:{value:0},map:{value:A},tiles:{value:E.tiles},fps:{value:E.fps},useFPSForFrameIndex:{value:"FPS"===E.timeMode},backgroundColor:{value:S.backgroundColor},discardBackgroundColor:{value:S.discardBackgroundColor},backgroundColorTolerance:{value:S.backgroundColorTolerance}},vertexShader:"\n attribute float size;\n attribute float colorR;\n attribute float colorG;\n attribute float colorB;\n attribute float colorA;\n attribute float lifetime;\n attribute float startLifetime;\n attribute float rotation;\n attribute float startFrame;\n\n varying mat4 vPosition;\n varying vec4 vColor;\n varying float vLifetime;\n varying float vStartLifetime;\n varying float vRotation;\n varying float vStartFrame;\n\n void main()\n {\n vColor = vec4(colorR, colorG, colorB, colorA);\n vLifetime = lifetime;\n vStartLifetime = startLifetime;\n vRotation = rotation;\n vStartFrame = startFrame;\n\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_PointSize = size * (100.0 / length(mvPosition.xyz));\n gl_Position = projectionMatrix * mvPosition;\n }\n",fragmentShader:"\n uniform sampler2D map;\n uniform float elapsed;\n uniform float fps;\n uniform bool useFPSForFrameIndex;\n uniform vec2 tiles;\n uniform bool discardBackgroundColor;\n uniform vec3 backgroundColor;\n uniform float backgroundColorTolerance;\n\n varying vec4 vColor;\n varying float vLifetime;\n varying float vStartLifetime;\n varying float vRotation;\n varying float vStartFrame;\n\n void main()\n {\n gl_FragColor = vColor;\n float mid = 0.5;\n\n float frameIndex = round(vStartFrame) + (\n useFPSForFrameIndex == true\n ? fps == 0.0\n ? 0.0\n : max((vLifetime / 1000.0) * fps, 0.0)\n : max(min(floor(min(vLifetime / vStartLifetime, 1.0) * (tiles.x * tiles.y)), tiles.x * tiles.y - 1.0), 0.0)\n );\n \n float spriteXIndex = floor(mod(frameIndex, tiles.x));\n float spriteYIndex = floor(mod(frameIndex / tiles.x, tiles.y));\n\n vec2 frameUV = vec2(\n gl_PointCoord.x / tiles.x + spriteXIndex / tiles.x,\n gl_PointCoord.y / tiles.y + spriteYIndex / tiles.y);\n\n vec2 center = vec2(0.5, 0.5);\n vec2 centeredPoint = gl_PointCoord - center;\n\n mat2 rotation = mat2(\n cos(vRotation), sin(vRotation),\n -sin(vRotation), cos(vRotation)\n );\n\n centeredPoint = rotation * centeredPoint;\n vec2 centeredMiddlePoint = vec2(\n centeredPoint.x + center.x,\n centeredPoint.y + center.y\n );\n\n float dist = distance(centeredMiddlePoint, center);\n if (dist > 0.5) discard;\n\n vec2 uvPoint = vec2(\n centeredMiddlePoint.x / tiles.x + spriteXIndex / tiles.x,\n centeredMiddlePoint.y / tiles.y + spriteYIndex / tiles.y\n );\n\n vec4 rotatedTexture = texture2D(map, uvPoint);\n\n gl_FragColor = gl_FragColor * rotatedTexture;\n\n if (discardBackgroundColor && abs(length(rotatedTexture.rgb - backgroundColor.rgb)) < backgroundColorTolerance ) discard;\n }\n",transparent:S.transparent,blending:S.blending,depthTest:S.depthTest,depthWrite:S.depthWrite}),G=new p.BufferGeometry;for(let t=0;t<M;t++)D(i,P,d,F[t],k[t]);G.setFromPoints(Array.from({length:M},((t,e)=>F[e].clone())));const H=(t,e)=>{(({geometry:t,propertyName:e,maxParticles:r,factory:i})=>{t.setAttribute(e,new p.BufferAttribute(new Float32Array(Array.from({length:r},"function"==typeof i?i:()=>i)),1))})({geometry:G,propertyName:t,maxParticles:M,factory:e})};H("isActive",0),H("lifetime",0),H("startLifetime",(()=>1e3*b(i.particleSystemId,u,0))),H("startFrame",(()=>E.startFrame?b(i.particleSystemId,E.startFrame,0):0)),H("opacity",(()=>b(i.particleSystemId,v,0))),H("rotation",(()=>b(i.particleSystemId,y,0))),H("size",((t,e)=>i.startValues.startSize[e])),H("rotation",0);const j=Math.random();H("colorR",(()=>f.min.r+j*(f.max.r-f.min.r))),H("colorG",(()=>f.min.g+j*(f.max.g-f.min.g))),H("colorB",(()=>f.min.b+j*(f.max.b-f.min.b))),H("colorA",0);let q=new p.Points(G,W);q.position.copy(a.position),q.rotation.x=p.MathUtils.degToRad(a.rotation.x),q.rotation.y=p.MathUtils.degToRad(a.rotation.y),q.rotation.z=p.MathUtils.degToRad(a.rotation.z),q.scale.copy(a.scale);const Y=r+1e3*b(i.particleSystemId,l);let X;"WORLD"===n.simulationSpace&&(X=new V,X.add(q)),R.push({particleSystem:q,wrapper:X,generalData:i,onUpdate:L,onComplete:T,creationTime:Y,lastEmissionTime:Y,duration:o,looping:s,simulationSpace:g,gravity:h,emission:O,normalizedConfig:n,iterationCount:0,velocities:k,deactivateParticle:t=>{G.attributes.isActive.array[t]=0,G.attributes.colorA.array[t]=0,G.attributes.colorA.needsUpdate=!0},activateParticle:({particleIndex:t,activationTime:e,position:r})=>{G.attributes.isActive.array[t]=1,i.creationTimes[t]=e,i.noise.offsets&&(i.noise.offsets[t]=100*Math.random());const a=Math.random();G.attributes.colorR.array[t]=f.min.r+a*(f.max.r-f.min.r),G.attributes.colorR.needsUpdate=!0,G.attributes.colorG.array[t]=f.min.g+a*(f.max.g-f.min.g),G.attributes.colorG.needsUpdate=!0,G.attributes.colorB.array[t]=f.min.b+a*(f.max.b-f.min.b),G.attributes.colorB.needsUpdate=!0,G.attributes.startFrame.array[t]=E.startFrame?b(i.particleSystemId,E.startFrame,0):0,G.attributes.startFrame.needsUpdate=!0,G.attributes.startLifetime.array[t]=1e3*b(i.particleSystemId,u,i.normalizedLifetimePercentage),G.attributes.startLifetime.needsUpdate=!0,i.startValues.startSize[t]=b(i.particleSystemId,m,i.normalizedLifetimePercentage),G.attributes.size.array[t]=i.startValues.startSize[t],G.attributes.size.needsUpdate=!0,i.startValues.startOpacity[t]=b(i.particleSystemId,v,i.normalizedLifetimePercentage),G.attributes.colorA.array[t]=i.startValues.startOpacity[t],G.attributes.colorA.needsUpdate=!0,G.attributes.rotation.array[t]=b(i.particleSystemId,y,i.normalizedLifetimePercentage),G.attributes.rotation.needsUpdate=!0,n.rotationOverLifetime.isActive&&(i.lifetimeValues.rotationOverLifetime[t]=p.MathUtils.randFloat(n.rotationOverLifetime.min,n.rotationOverLifetime.max)),D(i,P,d,F[t],k[t]);const o=Math.floor(3*t);G.attributes.position.array[o]=r.x+F[t].x,G.attributes.position.array[o+1]=r.y+F[t].y,G.attributes.position.array[o+2]=r.z+F[t].z,G.attributes.position.needsUpdate=!0,i.linearVelocityData&&i.linearVelocityData[t].speed.set(n.velocityOverLifetime.linear.x?b(i.particleSystemId,n.velocityOverLifetime.linear.x,0):0,n.velocityOverLifetime.linear.y?b(i.particleSystemId,n.velocityOverLifetime.linear.y,0):0,n.velocityOverLifetime.linear.z?b(i.particleSystemId,n.velocityOverLifetime.linear.z,0):0),i.orbitalVelocityData&&(i.orbitalVelocityData[t].speed.set(n.velocityOverLifetime.orbital.x?b(i.particleSystemId,n.velocityOverLifetime.orbital.x,0):0,n.velocityOverLifetime.orbital.y?b(i.particleSystemId,n.velocityOverLifetime.orbital.y,0):0,n.velocityOverLifetime.orbital.z?b(i.particleSystemId,n.velocityOverLifetime.orbital.z,0):0),i.orbitalVelocityData[t].positionOffset.set(F[t].x,F[t].y,F[t].z)),G.attributes.lifetime.array[t]=0,G.attributes.lifetime.needsUpdate=!0,z({delta:0,generalData:i,normalizedConfig:n,attributes:q.geometry.attributes,particleLifetimePercentage:0,particleIndex:t})}});return{instance:X||q,resumeEmitter:()=>i.isEnabled=!0,pauseEmitter:()=>i.isEnabled=!1,dispose:()=>(t=>{R=R.filter((({particleSystem:e,wrapper:r,generalData:{particleSystemId:i}})=>e!==t&&r!==t||(c(i),e.geometry.dispose(),Array.isArray(e.material)?e.material.forEach((t=>t.dispose())):e.material.dispose(),e.parent&&e.parent.remove(e),!1)))})(q)}},W=({now:t,delta:e,elapsed:r})=>{R.forEach((i=>{const{onUpdate:n,generalData:a,onComplete:o,particleSystem:s,wrapper:c,creationTime:l,lastEmissionTime:u,duration:d,looping:m,emission:y,normalizedConfig:f,iterationCount:v,velocities:h,deactivateParticle:g,activateParticle:x,simulationSpace:I,gravity:M}=i,O=t-l,w=O%(1e3*d);a.normalizedLifetimePercentage=Math.max(Math.min(w/(1e3*d),1),0);const{lastWorldPosition:P,currentWorldPosition:A,worldPositionChange:S,lastWorldQuaternion:_,worldQuaternion:C,worldEuler:L,gravityVelocity:V,isEnabled:T}=a;c?.parent&&a.wrapperQuaternion.copy(c.parent.quaternion);const E={...P};if(Array.isArray(s.material)?s.material.forEach((t=>{t instanceof p.ShaderMaterial&&(t.uniforms.elapsed.value=r)})):s.material instanceof p.ShaderMaterial&&(s.material.uniforms.elapsed.value=r),s.getWorldPosition(A),-99999!==P.x&&S.set(A.x-P.x,A.y-P.y,A.z-P.z),a.distanceFromLastEmitByDistance+=S.length(),s.getWorldPosition(P),s.getWorldQuaternion(C),-99999!==_.x&&_.x===C.x&&_.y===C.y&&_.z===C.z||(L.setFromQuaternion(C),_.copy(C),V.set(P.x,P.y+M,P.z),s.worldToLocal(V)),a.creationTimes.forEach(((r,i)=>{if(s.geometry.attributes.isActive.array[i]){const n=t-r;if(n>s.geometry.attributes.startLifetime.array[i])g(i);else{const t=h[i];if(t.x-=V.x*e,t.y-=V.y*e,t.z-=V.z*e,0!==M||0!==t.x||0!==t.y||0!==t.z||0!==S.x||0!==S.y||0!==S.z){const r=3*i,n=s.geometry.attributes.position.array;"WORLD"===I&&(n[r]-=S.x,n[r+1]-=S.y,n[r+2]-=S.z),n[r]+=t.x*e,n[r+1]+=t.y*e,n[r+2]+=t.z*e,s.geometry.attributes.position.needsUpdate=!0}s.geometry.attributes.lifetime.array[i]=n,s.geometry.attributes.lifetime.needsUpdate=!0;const r=n/s.geometry.attributes.startLifetime.array[i];z({delta:e,generalData:a,normalizedConfig:f,attributes:s.geometry.attributes,particleLifetimePercentage:r,particleIndex:i})}}})),T&&(m||O<1e3*d)){const o=t-u,c=y.rateOverTime?Math.floor(b(a.particleSystemId,y.rateOverTime,a.normalizedLifetimePercentage)*(o/1e3)):0,l=y.rateOverDistance?b(a.particleSystemId,y.rateOverDistance,a.normalizedLifetimePercentage):0,d=l>0&&a.distanceFromLastEmitByDistance>0?Math.floor(a.distanceFromLastEmitByDistance/(1/l)):0,m=d>0?{x:(A.x-E.x)/d,y:(A.y-E.y)/d,z:(A.z-E.z)/d}:null,p=c+d;if(l>0&&d>=1&&(a.distanceFromLastEmitByDistance=0),p>0){let e=0;for(let r=0;r<p;r++){let r=-1;if(s.geometry.attributes.isActive.array.find(((t,e)=>!t&&(r=e,!0))),-1!==r&&r<s.geometry.attributes.isActive.array.length){let n={x:0,y:0,z:0};m&&e<d&&(n={x:m.x*e,y:m.y*e,z:m.z*e},e++),x({particleIndex:r,activationTime:t,position:n}),i.lastEmissionTime=t}}}n&&n({particleSystem:s,delta:e,elapsed:r,lifetime:O,normalizedLifetime:w,iterationCount:v+1})}else o&&o({particleSystem:s})}))};var G=n.pB,H=n.U_,j=n.rU,q=n.M4,Y=n.$H,X=n.hp,$=n.l$,J=n.Y$,K=n.Tt,Z=n.eL,tt=n.Hc,et=n.Ao,rt=n.iy,it=n.Px,nt=n.rJ,at=n.Pj,ot=n.YR;export{G as applyModifiers,H as blendingMap,j as calculateRandomPositionAndVelocityOnBox,q as calculateRandomPositionAndVelocityOnCircle,Y as calculateRandomPositionAndVelocityOnCone,X as calculateRandomPositionAndVelocityOnRectangle,$ as calculateRandomPositionAndVelocityOnSphere,J as calculateValue,K as createBezierCurveFunction,Z as createParticleSystem,tt as getBezierCacheSize,et as getCurveFunction,rt as getCurveFunctionFromConfig,it as getDefaultParticleSystemConfig,nt as isLifeTimeCurve,at as removeBezierCurveFunction,ot as updateParticleSystems};
package/package.json CHANGED
@@ -1,37 +1,87 @@
1
- {
2
- "name": "@newkrok/three-particles",
3
- "version": "1.0.3",
4
- "description": "Particle system for ThreeJS",
5
- "main": "src/js/effects/three-particles.js",
6
- "bin": {
7
- "three-particles": "src/js/effects/three-particles.js"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/NewKrok/three-particles.git"
12
- },
13
- "keywords": [
14
- "threejs",
15
- "particle",
16
- "particles",
17
- "particle engine",
18
- "effects",
19
- "3d",
20
- "lib"
21
- ],
22
- "author": "Istvan Krisztian Somoracz",
23
- "license": "MIT",
24
- "bugs": {
25
- "url": "https://github.com/NewKrok/three-particles/issues"
26
- },
27
- "homepage": "https://github.com/NewKrok/three-particles#readme",
28
- "dependencies": {
29
- "easing-functions": "1.0.1",
30
- "three": "^0.155.0",
31
- "three-noise": "1.1.2",
32
- "@newkrok/three-utils": "^1.0.0"
33
- },
34
- "scripts": {
35
- "test": "echo \"Error: no test specified\" && exit 1"
36
- }
37
- }
1
+ {
2
+ "name": "@newkrok/three-particles",
3
+ "version": "2.0.0",
4
+ "type": "module",
5
+ "description": "Three.js-based high-performance particle system library designed for creating visually stunning particle effects with ease. Perfect for game developers and 3D applications.",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "dist/three-particles.d.ts",
9
+ "files": [
10
+ "dist/",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.js"
18
+ }
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/NewKrok/three-particles.git"
23
+ },
24
+ "keywords": [
25
+ "three",
26
+ "three.js",
27
+ "particles",
28
+ "particle system",
29
+ "webgl",
30
+ "3d",
31
+ "visual effects",
32
+ "game development",
33
+ "3d applications",
34
+ "high performance",
35
+ "javascript",
36
+ "typescript",
37
+ "three-particles",
38
+ "threejs effects"
39
+ ],
40
+ "author": "Istvan Krisztian Somoracz",
41
+ "license": "MIT",
42
+ "bugs": {
43
+ "url": "https://github.com/NewKrok/three-particles/issues"
44
+ },
45
+ "homepage": "https://github.com/NewKrok/three-particles#readme",
46
+ "scripts": {
47
+ "build": "rmdir /s /q dist && tsc && webpack --config webpack.config.js",
48
+ "prepublishOnly": "npm run build",
49
+ "test": "jest",
50
+ "test:watch": "jest --watch",
51
+ "lint": "eslint src"
52
+ },
53
+ "dependencies": {
54
+ "@newkrok/three-utils": "^1.0.0",
55
+ "easing-functions": "1.0.1",
56
+ "three-noise": "1.1.2"
57
+ },
58
+ "peerDependencies": {
59
+ "three": "^0.175.0"
60
+ },
61
+ "devDependencies": {
62
+ "@babel/preset-env": "^7.26.0",
63
+ "@babel/preset-typescript": "^7.26.0",
64
+ "@types/jest": "^29.5.14",
65
+ "@types/node": "^22.10.4",
66
+ "@types/three": "^0.175.0",
67
+ "@typescript-eslint/eslint-plugin": "^8.21.0",
68
+ "@typescript-eslint/parser": "^8.21.0",
69
+ "babel-jest": "^29.7.0",
70
+ "eslint": "^9.18.0",
71
+ "eslint-config-prettier": "^10.0.1",
72
+ "eslint-plugin-import": "^2.31.0",
73
+ "eslint-plugin-prettier": "^5.2.3",
74
+ "jest": "^29.7.0",
75
+ "madge": "^8.0.0",
76
+ "prettier": "^3.4.2",
77
+ "terser-webpack-plugin": "^5.3.11",
78
+ "ts-jest": "^29.2.5",
79
+ "ts-loader": "^9.5.2",
80
+ "ts-node": "^10.9.2",
81
+ "typedoc": "^0.27.6",
82
+ "typescript": "^5.7.3",
83
+ "webpack": "^5.97.1",
84
+ "webpack-bundle-analyzer": "^4.10.2",
85
+ "webpack-cli": "^6.0.1"
86
+ }
87
+ }
@@ -1,36 +0,0 @@
1
- const nCr = (n, k) => {
2
- let z = 1;
3
- for (let i = 1; i <= k; i++) z *= (n + 1 - i) / i;
4
- return z;
5
- };
6
-
7
- export const createBezierCurveFunction = (bezierPoints) => (percentage) => {
8
- if (percentage < 0) return bezierPoints[0];
9
- if (percentage > 1) return bezierPoints[bezierPoints.length - 1];
10
-
11
- let start = 0;
12
- let stop = bezierPoints.length - 1;
13
-
14
- bezierPoints.find((point, index) => {
15
- const result = percentage < point.percentage;
16
- if (result) stop = index;
17
- else if (point.percentage !== undefined) start = index;
18
- return result;
19
- });
20
-
21
- const n = stop - start;
22
- const calculatedPercentage =
23
- (percentage - bezierPoints[start].percentage) /
24
- (bezierPoints[stop].percentage - bezierPoints[start].percentage);
25
-
26
- let value = 0;
27
- for (let i = 0; i <= n; i++) {
28
- const p = bezierPoints[start + i];
29
- const c =
30
- nCr(n, i) *
31
- Math.pow(1 - calculatedPercentage, n - i) *
32
- Math.pow(calculatedPercentage, i);
33
- value += c * p.y;
34
- }
35
- return value;
36
- };
@@ -1,75 +0,0 @@
1
- import Easing from "easing-functions";
2
-
3
- export const CurveFunction = {
4
- BEZIER: "BEZIER",
5
- LINEAR: "LINEAR",
6
- QUADRATIC_IN: "QUADRATIC_IN",
7
- QUADRATIC_OUT: "QUADRATIC_OUT",
8
- QUADRATIC_IN_OUT: "QUADRATIC_IN_OUT",
9
- CUBIC_IN: "CUBIC_IN",
10
- CUBIC_OUT: "CUBIC_OUT",
11
- CUBIC_IN_OUT: "CUBIC_IN_OUT",
12
- QUARTIC_IN: "QUARTIC_IN",
13
- QUARTIC_OUT: "QUARTIC_OUT",
14
- QUARTIC_IN_OUT: "QUARTIC_IN_OUT",
15
- QUINTIC_IN: "QUINTIC_IN",
16
- QUINTIC_OUT: "QUINTIC_OUT",
17
- QUINTIC_IN_OUT: "QUINTIC_IN_OUT",
18
- SINUSOIDAL_IN: "SINUSOIDAL_IN",
19
- SINUSOIDAL_OUT: "SINUSOIDAL_OUT",
20
- SINUSOIDAL_IN_OUT: "SINUSOIDAL_IN_OUT",
21
- EXPONENTIAL_IN: "EXPONENTIAL_IN",
22
- EXPONENTIAL_OUT: "EXPONENTIAL_OUT",
23
- EXPONENTIAL_IN_OUT: "EXPONENTIAL_IN_OUT",
24
- CIRCULAR_IN: "CIRCULAR_IN",
25
- CIRCULAR_OUT: "CIRCULAR_OUT",
26
- CIRCULAR_IN_OUT: "CIRCULAR_IN_OUT",
27
- ELASTIC_IN: "ELASTIC_IN",
28
- ELASTIC_OUT: "ELASTIC_OUT",
29
- ELASTIC_IN_OUT: "ELASTIC_IN_OUT",
30
- BACK_IN: "BACK_IN",
31
- BACK_OUT: "BACK_OUT",
32
- BACK_IN_OUT: "BACK_IN_OUT",
33
- BOUNCE_IN: "BOUNCE_IN",
34
- BOUNCE_OUT: "BOUNCE_OUT",
35
- BOUNCE_IN_OUT: "BOUNCE_IN_OUT",
36
- };
37
-
38
- const CurveFunctionMap = {
39
- [CurveFunction.LINEAR]: Easing.Linear.None,
40
- [CurveFunction.QUADRATIC_IN]: Easing.Quadratic.In,
41
- [CurveFunction.QUADRATIC_OUT]: Easing.Quadratic.Out,
42
- [CurveFunction.QUADRATIC_IN_OUT]: Easing.Quadratic.InOut,
43
- [CurveFunction.CUBIC_IN]: Easing.Cubic.In,
44
- [CurveFunction.CUBIC_OUT]: Easing.Cubic.Out,
45
- [CurveFunction.CUBIC_IN_OUT]: Easing.Cubic.InOut,
46
- [CurveFunction.QUARTIC_IN]: Easing.Quartic.In,
47
- [CurveFunction.QUARTIC_OUT]: Easing.Quartic.Out,
48
- [CurveFunction.QUARTIC_IN_OUT]: Easing.Quartic.InOut,
49
- [CurveFunction.QUINTIC_IN]: Easing.Quintic.In,
50
- [CurveFunction.QUINTIC_OUT]: Easing.Quintic.Out,
51
- [CurveFunction.QUINTIC_IN_OUT]: Easing.Quintic.InOut,
52
- [CurveFunction.SINUSOIDAL_IN]: Easing.Sinusoidal.In,
53
- [CurveFunction.SINUSOIDAL_OUT]: Easing.Sinusoidal.Out,
54
- [CurveFunction.SINUSOIDAL_IN_OUT]: Easing.Sinusoidal.InOut,
55
- [CurveFunction.EXPONENTIAL_IN]: Easing.Exponential.In,
56
- [CurveFunction.EXPONENTIAL_OUT]: Easing.Exponential.Out,
57
- [CurveFunction.EXPONENTIAL_IN_OUT]: Easing.Exponential.InOut,
58
- [CurveFunction.CIRCULAR_IN]: Easing.Circular.In,
59
- [CurveFunction.CIRCULAR_OUT]: Easing.Circular.Out,
60
- [CurveFunction.CIRCULAR_IN_OUT]: Easing.Circular.InOut,
61
- [CurveFunction.ELASTIC_IN]: Easing.Elastic.In,
62
- [CurveFunction.ELASTIC_OUT]: Easing.Elastic.Out,
63
- [CurveFunction.ELASTIC_IN_OUT]: Easing.Elastic.InOut,
64
- [CurveFunction.BACK_IN]: Easing.Back.In,
65
- [CurveFunction.BACK_OUT]: Easing.Back.Out,
66
- [CurveFunction.BACK_IN_OUT]: Easing.Back.InOut,
67
- [CurveFunction.BOUNCE_IN]: Easing.Bounce.In,
68
- [CurveFunction.BOUNCE_OUT]: Easing.Bounce.Out,
69
- [CurveFunction.BOUNCE_IN_OUT]: Easing.Bounce.InOut,
70
- };
71
-
72
- export const getCurveFunction = (curveFunction) =>
73
- typeof curveFunction === "function"
74
- ? curveFunction
75
- : CurveFunctionMap[curveFunction];
@@ -1,23 +0,0 @@
1
- export const SimulationSpace = {
2
- LOCAL: "LOCAL",
3
- WORLD: "WORLD",
4
- };
5
-
6
- export const Shape = {
7
- SPHERE: "SPHERE",
8
- CONE: "CONE",
9
- BOX: "BOX",
10
- CIRCLE: "CIRCLE",
11
- RECTANGLE: "RECTANGLE",
12
- };
13
-
14
- export const EmitFrom = {
15
- VOLUME: "VOLUME",
16
- SHELL: "SHELL",
17
- EDGE: "EDGE",
18
- };
19
-
20
- export const TimeMode = {
21
- LIFETIME: "LIFETIME",
22
- FPS: "FPS",
23
- };
@@ -1,133 +0,0 @@
1
- import * as THREE from "three";
2
-
3
- import { getCurveFunction } from "./three-particles-curves.js";
4
-
5
- const ROTATION_CONVERTER = THREE.MathUtils.radToDeg(1);
6
- const noiseInput = new THREE.Vector3(0, 0, 0);
7
- const orbitalEuler = new THREE.Euler();
8
-
9
- const curveModifiers = [
10
- // {key:"colorOverLifetime", attributeKeys:["colorR", "colorG", "colorB"]},
11
- {
12
- key: "opacityOverLifetime",
13
- attributeKeys: ["colorA"],
14
- startValueKeys: ["startOpacity"],
15
- },
16
- {
17
- key: "sizeOverLifetime",
18
- attributeKeys: ["size"],
19
- startValueKeys: ["startSize"],
20
- },
21
- ];
22
-
23
- export const applyModifiers = ({
24
- delta,
25
- noise,
26
- startValues,
27
- lifetimeValues,
28
- hasOrbitalVelocity,
29
- orbitalVelocityData,
30
- normalizedConfig,
31
- attributes,
32
- particleLifetime,
33
- particleLifetimePercentage,
34
- particleIndex,
35
- forceUpdate = false,
36
- }) => {
37
- if (hasOrbitalVelocity) {
38
- const positionIndex = particleIndex * 3;
39
- const positionArr = attributes.position.array;
40
- const { speed, positionOffset } = orbitalVelocityData[particleIndex];
41
-
42
- positionArr[positionIndex] -= positionOffset.x;
43
- positionArr[positionIndex + 1] -= positionOffset.y;
44
- positionArr[positionIndex + 2] -= positionOffset.z;
45
-
46
- orbitalEuler.set(
47
- speed.x * ROTATION_CONVERTER * delta,
48
- speed.z * ROTATION_CONVERTER * delta,
49
- speed.y * ROTATION_CONVERTER * delta
50
- );
51
- positionOffset.applyEuler(orbitalEuler);
52
-
53
- positionArr[positionIndex] += positionOffset.x;
54
- positionArr[positionIndex + 1] += positionOffset.y;
55
- positionArr[positionIndex + 2] += positionOffset.z;
56
-
57
- attributes.position.needsUpdate = true;
58
- }
59
-
60
- curveModifiers.forEach(({ key, attributeKeys, startValueKeys }) => {
61
- const curveModifier = normalizedConfig[key];
62
- if (curveModifier.isActive) {
63
- const multiplier = getCurveFunction(curveModifier.curveFunction)(
64
- particleLifetimePercentage
65
- );
66
- attributeKeys.forEach((attributeKey, index) => {
67
- attributes[attributeKey].array[particleIndex] =
68
- startValues[startValueKeys[index]][particleIndex] * multiplier;
69
- attributes[attributeKey].needsUpdate = true;
70
- });
71
- } else if (forceUpdate) {
72
- attributeKeys.forEach((attributeKey, index) => {
73
- attributes[attributeKey].array[particleIndex] =
74
- startValues[startValueKeys[index]][particleIndex];
75
- attributes[attributeKey].needsUpdate = true;
76
- });
77
- }
78
- });
79
-
80
- if (lifetimeValues.rotationOverLifetime) {
81
- attributes.rotation.array[particleIndex] +=
82
- lifetimeValues.rotationOverLifetime[particleIndex] * delta * 0.02;
83
- attributes.rotation.needsUpdate = true;
84
- }
85
-
86
- if (noise.isActive) {
87
- const {
88
- sampler,
89
- strength,
90
- offsets,
91
- positionAmount,
92
- rotationAmount,
93
- sizeAmount,
94
- } = noise;
95
- const positionIndex = particleIndex * 3;
96
- const positionArr = attributes.position.array;
97
- let noiseOnPosition;
98
-
99
- const noisePosition =
100
- (particleLifetimePercentage + (offsets ? offsets[particleIndex] : 0)) *
101
- 10 *
102
- strength;
103
- const noisePower = 0.15 * strength;
104
-
105
- noiseInput.set(noisePosition, 0, 0);
106
- noiseOnPosition = sampler.get3(noiseInput);
107
- positionArr[positionIndex] += noiseOnPosition * noisePower * positionAmount;
108
-
109
- if (rotationAmount !== 0) {
110
- attributes.rotation.array[particleIndex] +=
111
- noiseOnPosition * noisePower * rotationAmount;
112
- attributes.rotation.needsUpdate = true;
113
- }
114
-
115
- if (sizeAmount !== 0) {
116
- attributes.size.array[particleIndex] +=
117
- noiseOnPosition * noisePower * sizeAmount;
118
- attributes.size.needsUpdate = true;
119
- }
120
-
121
- noiseInput.set(noisePosition, noisePosition, 0);
122
- noiseOnPosition = sampler.get3(noiseInput);
123
- positionArr[positionIndex + 1] +=
124
- noiseOnPosition * noisePower * positionAmount;
125
-
126
- noiseInput.set(noisePosition, noisePosition, noisePosition);
127
- noiseOnPosition = sampler.get3(noiseInput);
128
- positionArr[positionIndex + 2] +=
129
- noiseOnPosition * noisePower * positionAmount;
130
-
131
- attributes.position.needsUpdate = true;
132
- }
133
- };