partycles 1.2.0 → 1.2.2
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/README.md +47 -4
- package/dist/index.d.mts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +22 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ A lightweight, performant React library for adding delightful animation effects
|
|
|
12
12
|
## ✨ Features
|
|
13
13
|
|
|
14
14
|
- 🎯 **Simple API** - Just one hook to rule them all
|
|
15
|
-
- 🎨 **
|
|
15
|
+
- 🎨 **21 Beautiful Animations** - Confetti, sparkles, hearts, stars, fireworks, bubbles, snow, emoji, coins, petals, aurora, fireflies, paint, balloons, galaxy, glitch, magicdust, crystals, leaves, mortar, and bokeh
|
|
16
16
|
- 📦 **Tiny Bundle** - Zero dependencies, optimized for performance
|
|
17
17
|
- 🚀 **Performant** - Optimized animations using requestAnimationFrame
|
|
18
18
|
- 🎮 **Full Control** - Customize colors, particle count, physics, and more
|
|
@@ -66,7 +66,7 @@ const { reward, isAnimating } = useReward('my-button', 'confetti');
|
|
|
66
66
|
|
|
67
67
|
- **Zero Dependencies** - No bloat, just pure React code
|
|
68
68
|
- **One Hook** - Simple `useReward` hook handles everything
|
|
69
|
-
- **
|
|
69
|
+
- **21 Animations** - From confetti to dreamy bokeh effects, we've got you covered
|
|
70
70
|
- **Fully Typed** - Great TypeScript support out of the box
|
|
71
71
|
- **Customizable** - Tweak colors, physics, particle count, and more
|
|
72
72
|
- **Performant** - Optimized animations that won't slow down your app
|
|
@@ -82,7 +82,7 @@ The main hook for creating reward animations.
|
|
|
82
82
|
|
|
83
83
|
- `targetRef` (RefObject<HTMLElement>): A React ref to the element to animate from (recommended)
|
|
84
84
|
- `elementId` (string): The ID of the element to animate from (legacy, for backward compatibility)
|
|
85
|
-
- `animationType` (string): One of: `'confetti'`, `'sparkles'`, `'hearts'`, `'stars'`, `'fireworks'`, `'bubbles'`, `'snow'`, `'emoji'`, `'coins'`, `'petals'`, `'aurora'`, `'fireflies'`, `'paint'`, `'balloons'`, `'galaxy'`, `'glitch'`, `'magicdust'`, `'crystals'`, `'leaves'`
|
|
85
|
+
- `animationType` (string): One of: `'confetti'`, `'sparkles'`, `'hearts'`, `'stars'`, `'fireworks'`, `'bubbles'`, `'snow'`, `'emoji'`, `'coins'`, `'petals'`, `'aurora'`, `'fireflies'`, `'paint'`, `'balloons'`, `'galaxy'`, `'glitch'`, `'magicdust'`, `'crystals'`, `'leaves'`, `'mortar'`, `'bokeh'`
|
|
86
86
|
- `config` (optional): Animation configuration object
|
|
87
87
|
|
|
88
88
|
#### Returns
|
|
@@ -335,6 +335,29 @@ const { reward } = useReward('buttonId', 'leaves', {
|
|
|
335
335
|
});
|
|
336
336
|
```
|
|
337
337
|
|
|
338
|
+
### Mortar 💥
|
|
339
|
+
Explosive mortar-style bursts with galaxy-like explosions.
|
|
340
|
+
|
|
341
|
+
```tsx
|
|
342
|
+
const { reward } = useReward('buttonId', 'mortar', {
|
|
343
|
+
particleCount: 2,
|
|
344
|
+
spread: 45,
|
|
345
|
+
physics: { gravity: 0.35 }
|
|
346
|
+
});
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Bokeh 🔮
|
|
350
|
+
Soft, dreamy light orbs with depth-of-field effect. Inspired by photography bokeh.
|
|
351
|
+
|
|
352
|
+
```tsx
|
|
353
|
+
const { reward } = useReward('buttonId', 'bokeh', {
|
|
354
|
+
particleCount: 25,
|
|
355
|
+
elementSize: 40,
|
|
356
|
+
lifetime: 400,
|
|
357
|
+
physics: { gravity: -0.02 }
|
|
358
|
+
});
|
|
359
|
+
```
|
|
360
|
+
|
|
338
361
|
## 💡 Examples
|
|
339
362
|
|
|
340
363
|
### Animation Controls
|
|
@@ -604,7 +627,23 @@ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) f
|
|
|
604
627
|
|
|
605
628
|
## 📈 Changelog
|
|
606
629
|
|
|
607
|
-
### v1.
|
|
630
|
+
### v1.2.2 (Latest)
|
|
631
|
+
- 🔮 Added new `bokeh` animation with soft, dreamy light orbs
|
|
632
|
+
- 🙏 Added credits section to acknowledge contributors
|
|
633
|
+
- 📱 Optimized bokeh effect for smooth performance
|
|
634
|
+
|
|
635
|
+
### v1.2.1
|
|
636
|
+
- 🎆 Added new `mortar` animation with galaxy-style explosions
|
|
637
|
+
- 🐛 Fixed particle rendering issues with dynamic particle creation
|
|
638
|
+
- 🎨 Updated emoji assignments for better consistency (fireflies: 🌟, coins: 💰)
|
|
639
|
+
- ⚡ Optimized mortar explosion performance for mobile devices
|
|
640
|
+
- 🔧 Improved animation manager to handle particles created during updates
|
|
641
|
+
|
|
642
|
+
### v1.1.5
|
|
643
|
+
- ✨ Added optional enhanced effects (flutter, twinkle, pulse, spin3D, wobble, windDrift)
|
|
644
|
+
- 📱 Improved mobile performance with automatic optimizations
|
|
645
|
+
|
|
646
|
+
### v1.1.3
|
|
608
647
|
- 🚀 Added automatic mobile performance optimizations
|
|
609
648
|
- 🐛 Fixed Safari compatibility issues
|
|
610
649
|
- 📦 Streamlined bundle size by removing 7 animations
|
|
@@ -613,6 +652,10 @@ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) f
|
|
|
613
652
|
### v1.0.0
|
|
614
653
|
- 🎉 Initial release with 26 animations
|
|
615
654
|
|
|
655
|
+
## 🙏 Credits
|
|
656
|
+
|
|
657
|
+
- **Bokeh effect** inspired by [Sergio A. Carrasco Chavez](https://codepen.io/sergio-carrasco)'s beautiful bokeh implementation
|
|
658
|
+
|
|
616
659
|
## 📄 License
|
|
617
660
|
|
|
618
661
|
MIT © Jonathan Leane
|
package/dist/index.d.mts
CHANGED
|
@@ -11,7 +11,7 @@ interface Particle {
|
|
|
11
11
|
size: number;
|
|
12
12
|
rotation: number;
|
|
13
13
|
color: string;
|
|
14
|
-
element?: React.ReactNode;
|
|
14
|
+
element?: React.ReactNode | string;
|
|
15
15
|
config?: AnimationConfig;
|
|
16
16
|
}
|
|
17
17
|
interface AnimationConfig {
|
|
@@ -37,7 +37,7 @@ interface AnimationConfig {
|
|
|
37
37
|
windDrift?: boolean;
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
type AnimationType = 'confetti' | 'sparkles' | 'fireworks' | 'hearts' | 'stars' | 'bubbles' | 'snow' | 'emoji' | 'coins' | 'petals' | 'aurora' | 'fireflies' | 'paint' | 'balloons' | 'galaxy' | 'leaves' | 'glitch' | 'magicdust' | 'crystals';
|
|
40
|
+
type AnimationType = 'confetti' | 'sparkles' | 'fireworks' | 'hearts' | 'stars' | 'bubbles' | 'snow' | 'emoji' | 'coins' | 'petals' | 'aurora' | 'fireflies' | 'paint' | 'balloons' | 'galaxy' | 'leaves' | 'glitch' | 'magicdust' | 'crystals' | 'mortar' | 'bokeh';
|
|
41
41
|
interface UseRewardConfig extends AnimationConfig {
|
|
42
42
|
animationType: AnimationType;
|
|
43
43
|
}
|
|
@@ -101,7 +101,14 @@ interface AnimationInstance {
|
|
|
101
101
|
wind: number;
|
|
102
102
|
};
|
|
103
103
|
animationType: string;
|
|
104
|
-
config?:
|
|
104
|
+
config?: {
|
|
105
|
+
effects?: {
|
|
106
|
+
flutter?: boolean;
|
|
107
|
+
windDrift?: boolean;
|
|
108
|
+
wobble?: boolean;
|
|
109
|
+
twinkle?: boolean;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
105
112
|
frameCount: number;
|
|
106
113
|
isPaused?: boolean;
|
|
107
114
|
pausedAt?: number;
|
|
@@ -123,6 +130,7 @@ declare class AnimationManager {
|
|
|
123
130
|
private stop;
|
|
124
131
|
private update;
|
|
125
132
|
private applyEffects;
|
|
133
|
+
private handleMortarExplosion;
|
|
126
134
|
private updateOpacity;
|
|
127
135
|
getStats(): {
|
|
128
136
|
activeAnimations: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ interface Particle {
|
|
|
11
11
|
size: number;
|
|
12
12
|
rotation: number;
|
|
13
13
|
color: string;
|
|
14
|
-
element?: React.ReactNode;
|
|
14
|
+
element?: React.ReactNode | string;
|
|
15
15
|
config?: AnimationConfig;
|
|
16
16
|
}
|
|
17
17
|
interface AnimationConfig {
|
|
@@ -37,7 +37,7 @@ interface AnimationConfig {
|
|
|
37
37
|
windDrift?: boolean;
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
type AnimationType = 'confetti' | 'sparkles' | 'fireworks' | 'hearts' | 'stars' | 'bubbles' | 'snow' | 'emoji' | 'coins' | 'petals' | 'aurora' | 'fireflies' | 'paint' | 'balloons' | 'galaxy' | 'leaves' | 'glitch' | 'magicdust' | 'crystals';
|
|
40
|
+
type AnimationType = 'confetti' | 'sparkles' | 'fireworks' | 'hearts' | 'stars' | 'bubbles' | 'snow' | 'emoji' | 'coins' | 'petals' | 'aurora' | 'fireflies' | 'paint' | 'balloons' | 'galaxy' | 'leaves' | 'glitch' | 'magicdust' | 'crystals' | 'mortar' | 'bokeh';
|
|
41
41
|
interface UseRewardConfig extends AnimationConfig {
|
|
42
42
|
animationType: AnimationType;
|
|
43
43
|
}
|
|
@@ -101,7 +101,14 @@ interface AnimationInstance {
|
|
|
101
101
|
wind: number;
|
|
102
102
|
};
|
|
103
103
|
animationType: string;
|
|
104
|
-
config?:
|
|
104
|
+
config?: {
|
|
105
|
+
effects?: {
|
|
106
|
+
flutter?: boolean;
|
|
107
|
+
windDrift?: boolean;
|
|
108
|
+
wobble?: boolean;
|
|
109
|
+
twinkle?: boolean;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
105
112
|
frameCount: number;
|
|
106
113
|
isPaused?: boolean;
|
|
107
114
|
pausedAt?: number;
|
|
@@ -123,6 +130,7 @@ declare class AnimationManager {
|
|
|
123
130
|
private stop;
|
|
124
131
|
private update;
|
|
125
132
|
private applyEffects;
|
|
133
|
+
private handleMortarExplosion;
|
|
126
134
|
private updateOpacity;
|
|
127
135
|
getStats(): {
|
|
128
136
|
activeAnimations: number;
|
package/dist/index.js
CHANGED
|
@@ -1,48 +1,55 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
var
|
|
1
|
+
'use strict';var z=require('react'),client=require('react-dom/client');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var z__default=/*#__PURE__*/_interopDefault(z);/* Partycles - Delightful particle animations for React */
|
|
2
|
+
var Ce=Object.defineProperty,Me=Object.defineProperties;var $e=Object.getOwnPropertyDescriptors;var yt=Object.getOwnPropertySymbols;var we=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable;var gt=(t,e,r)=>e in t?Ce(t,e,{enumerable:true,configurable:true,writable:true,value:r}):t[e]=r,L=(t,e)=>{for(var r in e||(e={}))we.call(e,r)&>(t,r,e[r]);if(yt)for(var r of yt(e))ze.call(e,r)&>(t,r,e[r]);return t},O=(t,e)=>Me(t,$e(e));var o=(t,e)=>Math.random()*(e-t)+t,g=t=>t*Math.PI/180,f=()=>Math.random().toString(36).substring(2,9),F=t=>t[Math.floor(Math.random()*t.length)]||t[0]||"#ffffff",xt=(t,e)=>({position:"absolute",left:`${t.x}px`,top:`${t.y}px`,width:`${t.size}px`,height:`${t.size}px`,transform:`rotate(${t.rotation}deg) translateX(-50%) translateY(-50%)`,opacity:t.opacity,pointerEvents:"none",transition:"none",willChange:"transform, opacity"});var J=class{constructor(e=1e3){this.pool=[];this.created=0;this.maxSize=e;}acquire(){let e=this.pool.pop();return e?(e._pooled=false,e):(this.created++,{id:`p${this.created}`,x:0,y:0,vx:0,vy:0,life:0,opacity:0,size:0,rotation:0,color:"",_pooled:false})}release(e){e._pooled||this.pool.length>=this.maxSize||(e._pooled=true,e.element=void 0,e.config=void 0,this.pool.push(e));}releaseAll(e){e.forEach(r=>this.release(r));}clear(){this.pool=[];}getStats(){return {poolSize:this.pool.length,totalCreated:this.created,maxSize:this.maxSize}}},w=new J;function Ae(t){let e=w.acquire();return Object.assign(e,t),t.id||(e.id=`p${Date.now()}-${Math.random().toString(36).substr(2,9)}`),e}function m(t,e){let r=[];for(let n=0;n<t;n++)r.push(Ae(e(n)));return r}var Re=["#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4caf50","#8bc34a","#cddc39","#ffeb3b","#ffc107","#ff9800","#ff5722"],bt=(t,e)=>{let{particleCount:r=50,startVelocity:n=20,colors:a=Re,elementSize:i=20}=e;return m(r,()=>{let s=o(0,360),l=o(n*.5,n),c=F(a);return {id:f(),x:t.x,y:t.y,vx:Math.cos(g(s))*l,vy:Math.sin(g(s))*l-30,life:e.lifetime||150,opacity:1,size:o(i*.7,i*1.5),rotation:o(0,360),color:c}})},Pt=t=>{var a,i;let n=((i=(a=t.config)==null?void 0:a.effects)==null?void 0:i.flutter)&&t.life>0?`rotateY(${Math.sin(t.life*.1)*360}deg)`:"";return z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"60%",backgroundColor:t.color,borderRadius:"3px",boxShadow:"0 2px 4px rgba(0,0,0,0.2)",transform:n,transformStyle:"preserve-3d",perspective:"1000px"}})};var Ft=(t,e)=>{let{particleCount:r=35,spread:n=120,startVelocity:a=15,elementSize:i=25,colors:s=["#FFD700","#FFFFFF"]}=e;return m(r,()=>{let l=a/45;return {id:f(),x:t.x+o(-n,n),y:t.y+o(-n,n),vx:o(-3,3)*l,vy:o(-3,3)*l,life:e.lifetime||120,opacity:0,size:o(i*.4,i*1.2),rotation:o(0,360),color:s[Math.floor(Math.random()*s.length)]||s[0]||"#ffffff"}})},Ct=t=>{var n,a;let e=t.opacity,r=(a=(n=t.config)==null?void 0:n.effects)!=null&&a.twinkle?.3+Math.abs(Math.sin(t.life*.2))*.7:1;return z__default.default.createElement("svg",{key:t.id,width:"100%",height:"100%",viewBox:"0 0 24 24",style:{transform:`scale(${e}) rotate(${t.rotation}deg)`,filter:"drop-shadow(0 0 6px rgba(255, 215, 0, 0.8))",opacity:r,transition:"opacity 0.1s ease-out"}},z__default.default.createElement("path",{d:"M12 0L14.59 8.41L23 11L14.59 13.59L12 22L9.41 13.59L1 11L9.41 8.41L12 0Z",fill:t.color}))};var Se=["#ff1744","#e91e63","#ff4569","#ff6b6b","#ee5a70"],$t=(t,e)=>{let{particleCount:r=25,startVelocity:n=12,colors:a=Se,elementSize:i=30}=e;return m(r,()=>{let s=o(-45,-135),l=o(n*.7,n*1.3),c=o(-2,2);return {id:f(),x:t.x+o(-10,10),y:t.y,vx:Math.cos(s*Math.PI/180)*l+c,vy:Math.sin(s*Math.PI/180)*l,life:e.lifetime||180,opacity:1,size:o(i*.6,i*1.2),rotation:o(-20,20),color:F(a)}})},wt=t=>{var r,n;let e=(n=(r=t.config)==null?void 0:r.effects)!=null&&n.pulse?1+Math.sin(t.life*.2)*.1:1;return z__default.default.createElement("svg",{key:t.id,width:"100%",height:"100%",viewBox:"0 0 24 24",fill:t.color,style:{filter:`drop-shadow(0 0 ${t.size*.15}px ${t.color})`,transform:`scale(${e})`,transition:"transform 0.1s ease-out"}},z__default.default.createElement("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"}))};var Ee=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ffffff"],zt=(t,e)=>{let{particleCount:r=60,startVelocity:n=25,colors:a=Ee,elementSize:i=8}=e;return m(r,s=>{let l=360/r*s+o(-5,5),c=o(n*.5,n*1.2),u=F(a);return {id:f(),x:t.x,y:t.y,vx:Math.cos(g(l))*c,vy:Math.sin(g(l))*c-10,life:e.lifetime||140,opacity:1,size:o(i*.6,i*1.4),rotation:0,color:u}})},At=t=>z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"100%",backgroundColor:"#ffffff",borderRadius:"50%",boxShadow:`
|
|
3
3
|
0 0 ${t.size}px ${t.color},
|
|
4
4
|
0 0 ${t.size*2}px ${t.color},
|
|
5
5
|
0 0 ${t.size*3}px ${t.color},
|
|
6
6
|
0 0 ${t.size*4}px ${t.color}
|
|
7
|
-
`,background:`radial-gradient(circle, #ffffff 0%, ${t.color} 40%, transparent 70%)`}});var
|
|
7
|
+
`,background:`radial-gradient(circle, #ffffff 0%, ${t.color} 40%, transparent 70%)`}});var De=["rgba(66, 165, 245, 0.4)","rgba(41, 182, 246, 0.4)","rgba(38, 198, 218, 0.4)","rgba(129, 212, 250, 0.4)"],kt=(t,e)=>{let{particleCount:r=30,spread:n=80,startVelocity:a=8,colors:i=De,elementSize:s=40}=e;return m(r,()=>({id:f(),x:t.x+o(-n,n),y:t.y,vx:o(-3,3),vy:-o(a*.7,a*1.2),life:e.lifetime||160,opacity:.7,size:o(s*.4,s*1.2),rotation:0,color:i[Math.floor(Math.random()*i.length)]||i[0]||"#ffffff"}))},Rt=t=>z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"100%",backgroundColor:t.color,borderRadius:"50%",border:"2px solid rgba(255, 255, 255, 0.6)",backgroundImage:"radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), transparent)",boxShadow:`
|
|
8
8
|
inset 0 0 ${t.size*.3}px rgba(255, 255, 255, 0.4),
|
|
9
9
|
0 0 ${t.size*.5}px ${t.color}
|
|
10
|
-
`}});var
|
|
10
|
+
`}});var Te=["#FFD700","#FFA500","#FF6347","#FFE4B5"],It=(t,e)=>{let{particleCount:r=40,startVelocity:n=18,colors:a=Te,elementSize:i=30}=e;return m(r,()=>{let s=o(0,360),l=o(n*.5,n);return {id:f(),x:t.x,y:t.y,vx:Math.cos(s*Math.PI/180)*l,vy:Math.sin(s*Math.PI/180)*l-15,life:e.lifetime||150,opacity:1,size:o(i*.5,i*1.3),rotation:o(0,360),color:a[Math.floor(Math.random()*a.length)]||a[0]||"#ffffff"}})},Et=t=>{var r,n;let e=(n=(r=t.config)==null?void 0:r.effects)!=null&&n.twinkle?.3+Math.abs(Math.sin(t.life*.15))*.7:1;return z__default.default.createElement("svg",{key:t.id,width:"100%",height:"100%",viewBox:"0 0 24 24",fill:t.color,style:{filter:`drop-shadow(0 0 ${t.size*.2}px ${t.color})`,opacity:e,transition:"opacity 0.1s ease-out"}},z__default.default.createElement("path",{d:"M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z"}))};var Oe=["#FFFFFF","#F0F8FF","#F5F5F5","#FAFAFA"],Bt=(t,e)=>{let{particleCount:r=50,spread:n=200,startVelocity:a=3,colors:i=Oe,elementSize:s=15}=e;return m(r,()=>{let l=t.x+o(-n*2,n*2),c=t.y-o(100,300);return {id:f(),x:l,y:c,vx:o(-0.5,.5),vy:o(a*.5,a*1.2),life:e.lifetime||300,opacity:o(.4,.9),size:o(s*.3,s),rotation:o(0,360),color:i[Math.floor(Math.random()*i.length)]||i[0]||"#ffffff"}})},Dt=t=>z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"100%",backgroundColor:t.color,borderRadius:"50%",boxShadow:`
|
|
11
11
|
0 0 ${t.size*.5}px rgba(255, 255, 255, 0.8),
|
|
12
12
|
inset 0 0 ${t.size*.3}px rgba(255, 255, 255, 0.5)
|
|
13
|
-
`,filter:"blur(0.5px)"}});var
|
|
13
|
+
`,filter:"blur(0.5px)"}});var Tt=["\u{1F389}","\u{1F38A}","\u{1F388}","\u{1F381}","\u2728","\u{1F31F}","\u{1F4AB}","\u{1F3AF}"],je=["\u{1F389}","\u{1F38A}","\u{1F973}","\u{1F388}","\u{1F381}","\u{1F37E}","\u{1F942}","\u{1F386}"],Ve=["\u2764\uFE0F","\u{1F495}","\u{1F496}","\u{1F49D}","\u{1F497}","\u{1F493}","\u{1F49E}","\u{1F498}"],He=["\u{1F60A}","\u{1F604}","\u{1F970}","\u{1F60D}","\u{1F917}","\u{1F618}","\u{1F601}","\u{1F929}"],Ue=["\u{1F338}","\u{1F33A}","\u{1F33B}","\u{1F339}","\u{1F337}","\u{1F33C}","\u{1F340}","\u{1F33F}"],We=["\u{1F355}","\u{1F354}","\u{1F35F}","\u{1F32E}","\u{1F37F}","\u{1F369}","\u{1F36A}","\u{1F9C1}"],Lt=(t,e)=>{let{particleCount:r=30,spread:n=100,startVelocity:a=15,elementSize:i=35,emojis:s=Tt}=e;return m(r,()=>{let l=o(-45,-135),c=o(a*.5,a*1.2);return {id:f(),x:t.x+o(-n,n),y:t.y,vx:Math.cos(l*Math.PI/180)*c,vy:Math.sin(l*Math.PI/180)*c,life:e.lifetime||180,opacity:1,size:o(i*.7,i*1.3),rotation:o(-45,45),color:"",element:s[Math.floor(Math.random()*s.length)]}})},Ot=t=>z__default.default.createElement("div",{key:t.id,style:{fontSize:`${t.size}px`,lineHeight:1,userSelect:"none",filter:t.opacity<.5?"blur(1px)":void 0}},t.element),Xe={celebration:je,love:Ve,happy:He,nature:Ue,food:We,default:Tt};var Ge=["#FFD700","#FFA500","#FFB300","#FFC700"],jt=(t,e)=>{let{particleCount:r=30,spread:n=70,startVelocity:a=25,colors:i=Ge,elementSize:s=25}=e;return m(r,()=>{let l=o(-n/2,n/2)*(Math.PI/180),c=o(a*.5,a);return {id:f(),x:t.x,y:t.y,vx:Math.sin(l)*c,vy:-Math.cos(l)*c,life:e.lifetime||120,opacity:1,size:o(s*.8,s*1.2),rotation:o(0,360),color:i[Math.floor(Math.random()*i.length)]||i[0]||"#ffffff"}})},Vt=t=>{var n,a,i,s;let e=(a=(n=t.config)==null?void 0:n.effects)!=null&&a.spin3D?8:2,r=(120-t.life)*e;return z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"100%",background:`radial-gradient(ellipse at 30% 30%, ${t.color}, #B8860B)`,borderRadius:"50%",transform:(s=(i=t.config)==null?void 0:i.effects)!=null&&s.spin3D?`rotateY(${r}deg)`:`rotate(${r}deg)`,transformStyle:"preserve-3d",perspective:"1000px",boxShadow:`
|
|
14
14
|
inset -2px -2px 4px rgba(0, 0, 0, 0.3),
|
|
15
15
|
inset 2px 2px 4px rgba(255, 255, 255, 0.5),
|
|
16
16
|
0 2px 4px rgba(0, 0, 0, 0.3)
|
|
17
|
-
`,border:`1px solid ${t.color}`,position:"relative",overflow:"hidden"
|
|
17
|
+
`,border:`1px solid ${t.color}`,position:"relative",overflow:"hidden"}},z__default.default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:`${t.size*.5}px`,fontWeight:"bold",color:"#B8860B",textShadow:"1px 1px 1px rgba(0, 0, 0, 0.3)",fontFamily:"Arial, sans-serif",opacity:1}},"$"))};var qe=["#FFB6C1","#FFC0CB","#FF69B4","#FF1493","#FFF0F5"],Ht=(t,e)=>{let{particleCount:r=40,spread:n=100,startVelocity:a=8,colors:i=qe,elementSize:s=20}=e;return m(r,()=>{let l=o(-n/2,n/2)*(Math.PI/180),c=o(a*.3,a);return {id:f(),x:t.x+o(-20,20),y:t.y-o(0,30),vx:Math.sin(l)*c,vy:o(2,5),life:e.lifetime||200,opacity:o(.7,1),size:o(s*.7,s*1.3),rotation:o(0,360),color:i[Math.floor(Math.random()*i.length)]||i[0]||"#ffffff"}})},Ut=t=>{let e=(200-t.life)*.1,r=Math.sin(e)*15,n=Math.sin(t.life*.1)*10;return z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"120%",position:"relative",transform:`translateX(${r}px) rotate(${n}deg)`,transformStyle:"preserve-3d"}},z__default.default.createElement("div",{style:{width:"100%",height:"100%",background:`radial-gradient(ellipse at 50% 30%, ${t.color}, ${t.color}DD)`,borderRadius:"0% 100% 0% 100%",position:"absolute",boxShadow:`
|
|
18
18
|
inset 1px 1px 3px rgba(255, 255, 255, 0.5),
|
|
19
19
|
0 2px 4px rgba(0, 0, 0, 0.1)
|
|
20
|
-
`,border:`1px solid ${t.color}CC`,transform:"rotateY(45deg)"}}),
|
|
20
|
+
`,border:`1px solid ${t.color}CC`,transform:"rotateY(45deg)"}}),z__default.default.createElement("div",{style:{width:"100%",height:"100%",background:`radial-gradient(ellipse at 50% 30%, ${t.color}EE, ${t.color}BB)`,borderRadius:"0% 100% 0% 100%",position:"absolute",transform:"rotate(45deg) scale(0.9)",opacity:.8}}))};var Je=["#00ff88","#00ffaa","#00ddff","#0099ff","#0066ff","#9933ff","#ff00ff"],Wt=(t,e)=>{let{particleCount:r=20,spread:n=300,startVelocity:a=.8,colors:i=Je,elementSize:s=100}=e;return m(r,l=>{let c=l/r*n-n/2,u=o(-30,30);return {id:f(),x:t.x+c+u,y:t.y,vx:o(-0.5,.5),vy:-a,life:e.lifetime||250,opacity:1,size:o(s*.8,s*1.2),rotation:o(-15,15),color:i[Math.floor(Math.random()*i.length)]||i[0]||"#ffffff"}})},Xt=t=>{let e=Math.sin(t.life*.02)*10,r=t.opacity,n=t.life>350?(400-t.life)/50:1,a=t.life<50?t.life/50:1,i=r*n*a*.4;return z__default.default.createElement("div",{key:t.id,style:{width:`${t.size}px`,height:`${t.size*.3}px`,position:"relative",transform:`translateX(${e}px)`,filter:"blur(2px)"}},z__default.default.createElement("div",{style:{width:"100%",height:"100%",background:`linear-gradient(90deg, transparent, ${t.color}, transparent)`,borderRadius:"50%",opacity:i,boxShadow:`0 0 ${t.size*.5}px ${t.color}`,animation:"shimmer 2s infinite"}}),z__default.default.createElement("div",{style:{position:"absolute",top:"20%",left:"10%",width:"80%",height:"60%",background:`radial-gradient(ellipse at center, ${t.color}44, transparent)`,borderRadius:"50%",opacity:i*.5,filter:"blur(4px)"}}))};var Ye=["#FFFF99","#FFFFCC","#FFFF66","#FFFFAA"],Gt=(t,e)=>{let{particleCount:r=20,spread:n=150,startVelocity:a=2,colors:i=Ye,elementSize:s=8}=e;return m(r,()=>{let l=o(0,360)*(Math.PI/180),c=o(a*.3,a);return {id:f(),x:t.x+o(-n/2,n/2),y:t.y+o(-20,20),vx:Math.cos(l)*c,vy:Math.sin(l)*c*.5,life:e.lifetime||300,opacity:0,size:o(s*.6,s),rotation:o(0,360),color:i[Math.floor(Math.random()*i.length)]||i[0]||"#ffffff"}})},qt=t=>{let e=Math.sin(t.life*.02+t.rotation)*15,r=Math.cos(t.life*.03+t.rotation)*10,i=Math.sin(t.life*.1+t.rotation*.1)>.3?1:.1,s=Math.min(1,(300-t.life)/30),l=t.life/300,c=Math.min(s,l);return z__default.default.createElement("div",{key:t.id,style:{width:`${t.size}px`,height:`${t.size}px`,position:"relative",transform:`translate(${e}px, ${r}px)`}},z__default.default.createElement("div",{style:{width:"100%",height:"100%",background:t.color,borderRadius:"50%",opacity:c*i,boxShadow:`
|
|
21
21
|
0 0 ${t.size}px ${t.color},
|
|
22
22
|
0 0 ${t.size*2}px ${t.color},
|
|
23
23
|
0 0 ${t.size*3}px ${t.color}88
|
|
24
|
-
`,transition:"opacity 0.3s ease"}}),
|
|
24
|
+
`,transition:"opacity 0.3s ease"}}),z__default.default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",width:`${t.size*4}px`,height:`${t.size*4}px`,background:`radial-gradient(circle, ${t.color}44 0%, transparent 70%)`,borderRadius:"50%",transform:"translate(-50%, -50%)",opacity:c*i*.5,transition:"opacity 0.3s ease"}}))};var _e=["#FF006E","#FB5607","#FFBE0B","#8338EC","#3A86FF","#06FFB4"],Jt=(t,e)=>{let{particleCount:r=25,spread:n=120,startVelocity:a=35,colors:i=_e,elementSize:s=30}=e;return m(r,l=>{let c=o(-n/2,n/2)*(Math.PI/180),u=o(a*.5,a),d=l<5;return {id:f(),x:t.x,y:t.y,vx:Math.sin(c)*u*(d?.3:1),vy:-Math.cos(c)*u*.7+(d?5:0),life:e.lifetime||150,opacity:1,size:d?o(s*1.5,s*2.5):o(s*.3,s),rotation:o(0,360),color:i[Math.floor(Math.random()*i.length)]||i[0]||"#ffffff"}})},Yt=t=>{let e=1+(Math.abs(t.vx)+Math.abs(t.vy))*.01,r=1/e,n=t.size>15&&t.rotation>180,a=n?t.size*.5:0;return z__default.default.createElement("div",{key:t.id,style:{width:`${t.size}px`,height:`${t.size}px`,position:"relative",transform:`
|
|
25
25
|
scaleX(${e})
|
|
26
26
|
scaleY(${r})
|
|
27
27
|
rotate(${Math.atan2(t.vy,t.vx)*180/Math.PI}deg)
|
|
28
|
-
`}},
|
|
28
|
+
`}},z__default.default.createElement("div",{style:{width:"100%",height:"100%",background:t.color,borderRadius:"50%",position:"relative",boxShadow:"inset -2px -2px 4px rgba(0,0,0,0.2)"}},z__default.default.createElement("div",{style:{position:"absolute",top:"20%",left:"20%",width:"30%",height:"30%",background:t.color,borderRadius:"50%",opacity:.8,transform:`translate(${o(-5,5)}px, ${o(-5,5)}px)`}}),z__default.default.createElement("div",{style:{position:"absolute",bottom:"15%",right:"15%",width:"25%",height:"25%",background:t.color,borderRadius:"50%",opacity:.7}})),n&&z__default.default.createElement("div",{style:{position:"absolute",bottom:`-${a}px`,left:"40%",width:"20%",height:`${a}px`,background:t.color,borderRadius:"0 0 50% 50%",opacity:.9}}))};var Ze=["#FF006E","#FB5607","#FFBE0B","#8338EC","#3A86FF","#06FFB4","#FF4081"],_t=(t,e)=>{let{particleCount:r=15,spread:n=80,startVelocity:a=10,colors:i=Ze,elementSize:s=35}=e;return m(r,()=>{let l=o(-n/2,n/2)*(Math.PI/180),c=o(a*.7,a);return {id:f(),x:t.x+o(-n*.8,n*.8),y:t.y+o(-10,30),vx:Math.sin(l)*c*.3+o(-1,1),vy:-c*.4,life:e.lifetime||250,opacity:.9,size:o(s*.8,s*1.2),rotation:o(-10,10),color:i[Math.floor(Math.random()*i.length)]||i[0]||"#ffffff"}})},Zt=t=>{let e=Math.sin(t.life*.03)*15,r=Math.sin(t.life*.05)*5,n=t.life>50?1:t.life/50;return z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"120%",position:"relative",transform:`
|
|
29
29
|
translateX(${e}px)
|
|
30
30
|
translateY(${r}px)
|
|
31
|
-
rotate(${
|
|
32
|
-
`,opacity:t.opacity*n}},
|
|
31
|
+
rotate(${e*.2}deg)
|
|
32
|
+
`,opacity:t.opacity*n}},z__default.default.createElement("div",{style:{width:"100%",height:"100%",background:`radial-gradient(circle at 30% 30%, ${t.color}ee, ${t.color})`,borderRadius:"50% 50% 50% 50% / 60% 60% 40% 40%",position:"relative",boxShadow:`
|
|
33
33
|
inset -5px -5px 10px rgba(0,0,0,0.2),
|
|
34
34
|
0 4px 8px rgba(0,0,0,0.2)
|
|
35
|
-
`}},
|
|
35
|
+
`}},z__default.default.createElement("div",{style:{position:"absolute",top:"15%",left:"20%",width:"25%",height:"30%",background:"radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 70%)",borderRadius:"50%",transform:"rotate(-20deg)"}}),z__default.default.createElement("div",{style:{position:"absolute",bottom:"-5px",left:"50%",transform:"translateX(-50%)",width:"0",height:"0",borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderTop:`8px solid ${t.color}`}})),z__default.default.createElement("svg",{style:{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",width:"2px",height:`${t.size*2}px`,opacity:.6}},z__default.default.createElement("path",{d:`M1 0 Q ${1+Math.sin(t.life*.1)*3} ${t.size} 1 ${t.size*2}`,stroke:t.color,strokeWidth:"1.5",fill:"none",opacity:"0.4"})))};var Qe=["#FFFFFF","#FFF9C4","#BBDEFB","#C5CAE9","#D1C4E9","#FFE082","#FFCCBC"],Qt=(t,e)=>{let{particleCount:r=60,spread:n=200,startVelocity:a=15,colors:i=Qe,elementSize:s=8}=e;return m(r,l=>{let c=l/r,u=c*Math.PI*4,d=c*n,h=o(-0.3,.3),y=o(-10,10),P=u+h,C=d+y,M=Math.cos(P)*C,p=Math.sin(P)*C,v=P+Math.PI/2,$=a*(1-c*.5);return {id:f(),x:t.x,y:t.y,vx:Math.cos(v)*$*.3+M*.02,vy:Math.sin(v)*$*.3+p*.02,life:e.lifetime||250,opacity:0,size:o(s*.3,s)*(1-c*.5),rotation:o(0,360),color:i[Math.floor(Math.random()*i.length)]||i[0]||"#ffffff"}})},Kt=t=>{let r=1+(250-t.life)/250*.5,n=Math.min(1,(250-t.life)/30),a=t.life/250,i=Math.min(n,a),s=Math.sin(t.life*.2+t.rotation)*.3+.7;return z__default.default.createElement("div",{key:t.id,style:{width:`${t.size}px`,height:`${t.size}px`,position:"relative",transform:`scale(${r})`,opacity:i*s}},z__default.default.createElement("div",{style:{width:"100%",height:"100%",background:t.color,borderRadius:"50%",boxShadow:`
|
|
36
36
|
0 0 ${t.size}px ${t.color},
|
|
37
37
|
0 0 ${t.size*2}px ${t.color}88,
|
|
38
38
|
0 0 ${t.size*3}px ${t.color}44
|
|
39
|
-
`,position:"relative"}},
|
|
39
|
+
`,position:"relative"}},z__default.default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",width:`${t.size*3}px`,height:"1px",background:`linear-gradient(90deg, transparent, ${t.color}, transparent)`,transform:`translate(-50%, -50%) rotate(${t.rotation}deg)`,opacity:s}}),z__default.default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",width:"1px",height:`${t.size*3}px`,background:`linear-gradient(180deg, transparent, ${t.color}, transparent)`,transform:`translate(-50%, -50%) rotate(${t.rotation}deg)`,opacity:s}})),t.size>5&&z__default.default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",width:`${t.size*6}px`,height:`${t.size*6}px`,background:`radial-gradient(circle, ${t.color}22 0%, transparent 70%)`,borderRadius:"50%",transform:"translate(-50%, -50%)",opacity:i*.3,filter:"blur(3px)"}}))};var te=(t,e)=>{let{particleCount:r=20,elementSize:n=200}=e,a=[],i=["r","g","b"];for(let s=0;s<r;s++){let l=Math.random()>.3,c=s%3,u=i[c],d=l?o(50,200):o(2,8),h=l?o(2,8):o(50,200),y=o(-20,20),P=c+(l?4:0)+(Math.floor(d)<<3)+(Math.floor(h)<<11)+(y+32<<19);a.push({id:f(),x:t.x+o(-n/2,n/2),y:t.y+o(-n/2,n/2),vx:o(-50,50),vy:o(-30,30),life:e.lifetime||150,opacity:o(.3,1),size:o(5,20),rotation:P,color:u==="r"?"#ff0000":u==="g"?"#00ff00":"#0000ff"});}return a},ee=t=>{let e=t.rotation&3,r=t.rotation>>3&255,n=t.rotation>>11&255,a=(t.rotation>>19&63)-32,i=["r","g","b"][e],s=t.size,l={r:i==="r"?255:0,g:i==="g"?255:0,b:i==="b"?255:0},c=i==="r"?"screen":i==="g"?"multiply":"difference";return z__default.default.createElement("div",{key:t.id,style:{width:`${r}px`,height:`${n}px`,backgroundColor:`rgba(${l.r}, ${l.g}, ${l.b}, ${t.opacity})`,mixBlendMode:c,filter:`blur(${o(0,2)}px)`,boxShadow:`${a}px 0 ${s}px rgba(${l.r}, ${l.g}, ${l.b}, ${t.opacity*.5})`}})};var to=["#9C27B0","#E91E63","#FF00FF","#00FFFF","#FFD700","#FF69B4","#DA70D6","#9370DB"],oe=(t,e)=>{let{particleCount:r=40,startVelocity:n=8,colors:a=to,elementSize:i=12}=e;return m(r,s=>{let l=s/r*360+o(-30,30),c=o(n*.3,n),u=F(a),d=o(0,360),h=o(0,30);return {id:f(),x:t.x+Math.cos(g(d))*h,y:t.y+Math.sin(g(d))*h,vx:Math.cos(g(l))*c+o(-2,2),vy:Math.sin(g(l))*c+o(-2,2),life:e.lifetime||120,opacity:o(.4,1),size:o(i*.3,i),rotation:o(0,360),color:u}})},re=t=>{let e=t.size*.7;return z__default.default.createElement("div",{key:t.id,style:{width:`${t.size}px`,height:`${t.size}px`,position:"relative"}},z__default.default.createElement("div",{style:{position:"absolute",width:"100%",height:"100%",backgroundColor:t.color,borderRadius:"50%",boxShadow:`0 0 ${t.size}px ${t.color}, 0 0 ${t.size*2}px ${t.color}`,filter:"blur(1px)"}}),z__default.default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",width:`${e}px`,height:`${e}px`,transform:`translate(-50%, -50%) rotate(${t.rotation}deg)`}},z__default.default.createElement("div",{style:{position:"absolute",width:"100%",height:"2px",backgroundColor:"white",top:"50%",left:"0",transform:"translateY(-50%)",boxShadow:"0 0 4px white"}}),z__default.default.createElement("div",{style:{position:"absolute",width:"2px",height:"100%",backgroundColor:"white",left:"50%",top:"0",transform:"translateX(-50%)",boxShadow:"0 0 4px white"}})))};var eo=["#FF1493","#00CED1","#FFD700","#FF69B4","#7B68EE","#00FA9A","#FF6347","#4169E1"],ie=(t,e)=>{let{particleCount:r=15,startVelocity:n=15,colors:a=eo,elementSize:i=25}=e;return m(r,()=>{let s=o(0,360),l=o(n*.5,n),c=F(a);return {id:f(),x:t.x,y:t.y,vx:Math.cos(g(s))*l,vy:Math.sin(g(s))*l-10,life:e.lifetime||150,opacity:o(.7,1),size:o(i*.6,i),rotation:o(0,360),color:c}})},ne=t=>{let e=(Date.now()*.5+t.x+t.y)%360;return z__default.default.createElement("div",{key:t.id,style:{width:`${t.size}px`,height:`${t.size*1.5}px`,position:"relative",transform:`rotate(${t.rotation}deg)`}},z__default.default.createElement("div",{style:{position:"absolute",width:"100%",height:"100%",background:`linear-gradient(135deg, ${t.color}, ${t.color}88, transparent)`,clipPath:"polygon(50% 0%, 100% 40%, 75% 100%, 25% 100%, 0% 40%)",boxShadow:`0 0 ${t.size}px ${t.color}44`}}),z__default.default.createElement("div",{style:{position:"absolute",width:"80%",height:"80%",top:"10%",left:"10%",background:"linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.4), transparent)",clipPath:"polygon(50% 10%, 90% 45%, 65% 90%, 35% 90%, 10% 45%)"}}),z__default.default.createElement("div",{style:{position:"absolute",width:"100%",height:"100%",background:`linear-gradient(${e}deg,
|
|
40
40
|
hsla(${e}, 100%, 50%, 0.3),
|
|
41
41
|
hsla(${(e+60)%360}, 100%, 50%, 0.3),
|
|
42
42
|
hsla(${(e+120)%360}, 100%, 50%, 0.3)
|
|
43
|
-
)`,clipPath:"polygon(50% 0%, 100% 40%, 75% 100%, 25% 100%, 0% 40%)",mixBlendMode:"screen"}}),
|
|
43
|
+
)`,clipPath:"polygon(50% 0%, 100% 40%, 75% 100%, 25% 100%, 0% 40%)",mixBlendMode:"screen"}}),z__default.default.createElement("div",{style:{position:"absolute",width:"30%",height:"30%",top:"20%",left:"35%",background:"radial-gradient(circle, rgba(255, 255, 255, 0.8), transparent)",borderRadius:"50%",filter:"blur(2px)"}}))};var oo=["#D2691E","#CD853F","#8B4513","#A0522D","#FF8C00","#FF6347"],ae=(t,e)=>{let{particleCount:r=10,colors:n=oo,elementSize:a=25}=e;return m(r,()=>({id:f(),x:t.x+o(-100,100),y:t.y+o(-50,0),vx:o(-1,1),vy:o(.5,2),life:e.lifetime||300,opacity:1,size:o(a*.6,a),rotation:Math.floor(o(0,360))+Math.floor(o(0,360))*1e3+Math.floor(o(20,40))*1e6+(Math.floor(o(-3,3))+3)*1e8,color:F(n)}))},se=t=>{let e=t.rotation%1e3,r=Math.floor(t.rotation%1e6/1e3),n=Math.floor(t.rotation%1e8/1e6),a=Math.floor(t.rotation/1e8)-3,i=Math.sin((Date.now()*.002+e)*Math.PI/180)*30,s=Math.sin((Date.now()*.001+r)*Math.PI/180)*n,l=(Date.now()*a*.01+i)%360;return z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"100%",position:"relative",transform:`translateX(${s}px) rotate(${l}deg)`}},z__default.default.createElement("svg",{width:"100%",height:"100%",viewBox:`-${t.size/2} -${t.size/2} ${t.size} ${t.size}`,style:{position:"absolute",top:0,left:0}},z__default.default.createElement("path",{d:`
|
|
44
44
|
M 0,-${t.size/2}
|
|
45
45
|
C -${t.size/3},-${t.size/3} -${t.size/3},${t.size/3} 0,${t.size/2}
|
|
46
46
|
C ${t.size/3},${t.size/3} ${t.size/3},-${t.size/3} 0,-${t.size/2}
|
|
47
|
-
`,fill:t.color,opacity:"0.9"}),
|
|
47
|
+
`,fill:t.color,opacity:"0.9"}),z__default.default.createElement("line",{x1:"0",y1:-t.size/2,x2:"0",y2:t.size/2,stroke:"#8B4513",strokeWidth:"1",opacity:"0.5"}),z__default.default.createElement("line",{x1:"0",y1:-t.size/4,x2:-t.size/4,y2:-t.size/8,stroke:"#8B4513",strokeWidth:"0.5",opacity:"0.5"}),z__default.default.createElement("line",{x1:"0",y1:-t.size/4,x2:t.size/4,y2:-t.size/8,stroke:"#8B4513",strokeWidth:"0.5",opacity:"0.5"}),z__default.default.createElement("line",{x1:"0",y1:t.size/4,x2:-t.size/4,y2:t.size/8,stroke:"#8B4513",strokeWidth:"0.5",opacity:"0.5"}),z__default.default.createElement("line",{x1:"0",y1:t.size/4,x2:t.size/4,y2:t.size/8,stroke:"#8B4513",strokeWidth:"0.5",opacity:"0.5"})))};var ro=["#ff6b6b","#4ecdc4","#45b7d1","#f7dc6f","#bb8fce","#85c1f5","#ffd93d","#6bcf7f"],le=(t,e)=>{let{particleCount:r=3,spread:n=60,startVelocity:a=12,colors:i=ro,elementSize:s=8}=e,l=[],c=m(r,u=>{let h=r>1?n/(r-1):0,y=-90-n/2+h*u,P=o(a*.9,a*1.1),C=i[Math.floor(Math.random()*i.length)],M=g(y),p=o(20,35);return {id:f(),x:t.x,y:t.y,vx:Math.cos(M)*P,vy:Math.sin(M)*P,life:e.lifetime||200,opacity:1,size:s,rotation:0,color:C,config:e,element:JSON.stringify({isShell:true,hasExploded:false,timeToExplode:p,burstCount:o(30,45),burstColor:C})}});l.push(...c);for(let u=0;u<8;u++){let d=m(1,()=>({id:f(),x:t.x+o(-5,5),y:t.y,vx:o(-2,2),vy:o(-10,-3),life:o(10,20),opacity:1,size:o(2,3),rotation:0,color:"#ffaa00",element:JSON.stringify({isLaunchSpark:true})}));l.push(...d);}return l},ce=t=>{let e={};try{t.element&&typeof t.element=="string"&&(e=JSON.parse(t.element));}catch(r){}if(e.isLaunchSpark)return z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"100%",backgroundColor:t.color,borderRadius:"50%",opacity:t.opacity,boxShadow:`0 0 3px ${t.color}`}});if(e.isTrail){let r=t.opacity*(t.life/30)*.4;return z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"100%",background:`radial-gradient(circle, ${t.color}88 0%, transparent 60%)`,borderRadius:"50%",opacity:r,filter:"blur(1px)"}})}if(e.isBurst){let r=t.opacity*Math.pow(t.life/120,.5);if(e.isGalaxy){let n=e.twinkle?.3+Math.sin(t.life*.3)*.7:1;return z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"100%",backgroundColor:t.color,borderRadius:"50%",opacity:r*n,boxShadow:`0 0 ${t.size*2}px ${t.color}`,transform:`rotate(${t.rotation}deg)`}})}return e.isCore?z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"100%",backgroundColor:"#FFFFFF",borderRadius:"50%",opacity:r,boxShadow:`0 0 ${t.size*3}px #FFFFFF`}}):z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"100%",backgroundColor:t.color,borderRadius:"50%",opacity:r,boxShadow:`
|
|
48
|
+
0 0 ${t.size}px ${t.color},
|
|
49
|
+
0 0 ${t.size*2}px ${t.color}88
|
|
50
|
+
`,filter:t.life>80?"blur(0px)":"blur(1px)"}})}if(e.isShell){if(e.hasExploded)return null;let r=Math.atan2(t.vy,t.vx)*180/Math.PI;return z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"100%",position:"relative",transform:`rotate(${r}deg)`}},z__default.default.createElement("div",{style:{width:"100%",height:"100%",backgroundColor:"#ffffff",borderRadius:"50%",boxShadow:`
|
|
51
|
+
0 0 ${t.size*.5}px #ffffff,
|
|
52
|
+
0 0 ${t.size}px ${t.color},
|
|
53
|
+
0 0 ${t.size*2}px ${t.color}88
|
|
54
|
+
`}}))}return z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"100%",backgroundColor:t.color,borderRadius:"50%",opacity:t.opacity}})};var io=["#FFFFFF","#FFF8DC","#FFFACD","#FFE4B5","#FFDEAD","#F0E68C","#FFD700"],de=(t,e)=>{let{particleCount:r=25,spread:n=300,startVelocity:a=1,colors:i=io,elementSize:s=40,lifetime:l=400}=e;return m(r,c=>{let u=Math.random()*Math.PI*2,d=o(0,n),h=Math.random(),y=s*(.3+h*.7);return {id:f(),x:t.x+Math.cos(u)*d,y:t.y+Math.sin(u)*d,vx:o(-0.5,.5)*a,vy:o(-0.5,-1.5)*a,life:l,opacity:.1+h*.5,size:y,rotation:0,color:i[Math.floor(Math.random()*i.length)],element:JSON.stringify({depth:h,pulsePhase:Math.random()*Math.PI*2,baseSize:y})}})},fe=t=>{var l;let e={};try{t.element&&typeof t.element=="string"&&(e=JSON.parse(t.element));}catch(c){}let r=Math.sin(t.life*.05+(e.pulsePhase||0))*.1+1,n=(e.baseSize||t.size)*r,a=Math.min(1,(((l=t.config)==null?void 0:l.lifetime)||400-t.life)/20),i=Math.min(1,t.life/40),s=t.opacity*a*i;return z__default.default.createElement("div",{key:t.id,style:{width:"100%",height:"100%",position:"relative"}},z__default.default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",width:`${n*3}px`,height:`${n*3}px`,transform:"translate(-50%, -50%)",background:`radial-gradient(circle, ${t.color}22 0%, transparent 50%)`,filter:"blur(20px)",opacity:s*.6}}),z__default.default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",width:`${n*2}px`,height:`${n*2}px`,transform:"translate(-50%, -50%)",background:`radial-gradient(circle, ${t.color}44 0%, transparent 60%)`,filter:"blur(10px)",opacity:s*.8}}),z__default.default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",width:`${n}px`,height:`${n}px`,transform:"translate(-50%, -50%)",background:`radial-gradient(circle, ${t.color}88 0%, ${t.color}44 50%, transparent 100%)`,borderRadius:"50%",filter:"blur(2px)",opacity:s}}))};var me={confetti:{createParticles:bt,renderParticle:Pt},sparkles:{createParticles:Ft,renderParticle:Ct},hearts:{createParticles:$t,renderParticle:wt},fireworks:{createParticles:zt,renderParticle:At},bubbles:{createParticles:kt,renderParticle:Rt},stars:{createParticles:It,renderParticle:Et},snow:{createParticles:Bt,renderParticle:Dt},emoji:{createParticles:Lt,renderParticle:Ot},coins:{createParticles:jt,renderParticle:Vt},petals:{createParticles:Ht,renderParticle:Ut},aurora:{createParticles:Wt,renderParticle:Xt},fireflies:{createParticles:Gt,renderParticle:qt},paint:{createParticles:Jt,renderParticle:Yt},balloons:{createParticles:_t,renderParticle:Zt},galaxy:{createParticles:Qt,renderParticle:Kt},glitch:{createParticles:te,renderParticle:ee},magicdust:{createParticles:oe,renderParticle:re},crystals:{createParticles:ie,renderParticle:ne},leaves:{createParticles:ae,renderParticle:se},mortar:{createParticles:le,renderParticle:ce},bokeh:{createParticles:de,renderParticle:fe}};var Q=()=>{if(typeof window=="undefined")return false;let t=navigator.userAgent||navigator.vendor||window.opera||"",e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t),r=window.innerWidth<=768,n="ontouchstart"in window||navigator.maxTouchPoints>0;return e||r&&n},K=t=>{var e,r,n;return Q()?O(L({},t),{particleCount:Math.floor((t.particleCount||50)*.6),elementSize:Math.floor((t.elementSize||20)*.8),lifetime:Math.floor((t.lifetime||150)*.8),physics:O(L({},t.physics),{gravity:Math.round((((e=t.physics)==null?void 0:e.gravity)||0)*100)/100,wind:Math.round((((r=t.physics)==null?void 0:r.wind)||0)*100)/100,friction:Math.round((((n=t.physics)==null?void 0:n.friction)||.98)*100)/100})}):t},ue=t=>Q()?t%3===0:false;var tt=class{constructor(){this.animations=new Map;this.rafId=null;this.isRunning=false;this.lastFrameTime=0;this.frameInterval=1e3/60;this.frameCount=0;this.fpsUpdateInterval=1e3;this.lastFpsUpdate=0;this.currentFps=0;this.update=this.update.bind(this);}addAnimation(e){this.animations.set(e.id,e),!this.isRunning&&this.animations.size>0&&this.start();}removeAnimation(e){let r=this.animations.get(e);r&&(w.releaseAll(r.particles),r.containerElement&&document.body.contains(r.containerElement)&&document.body.removeChild(r.containerElement),this.animations.delete(e)),this.animations.size===0&&this.stop();}start(){this.isRunning||(this.isRunning=true,this.lastFrameTime=performance.now(),this.lastFpsUpdate=this.lastFrameTime,this.frameCount=0,this.rafId=requestAnimationFrame(this.update));}stop(){this.isRunning&&(this.isRunning=false,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null));}update(e){let r=e-this.lastFrameTime;if(r<this.frameInterval){this.rafId=requestAnimationFrame(this.update);return}if(this.lastFrameTime=e-r%this.frameInterval,this.frameCount++,e-this.lastFpsUpdate>=this.fpsUpdateInterval&&(this.currentFps=this.frameCount,this.frameCount=0,this.lastFpsUpdate=e),!!document.hidden){this.rafId=requestAnimationFrame(this.update);return}let a=[];this.animations.forEach((i,s)=>{if(i.isPaused)return;i.frameCount++;let l=ue(i.frameCount),c=0,u=[];i.particles=i.particles.map(d=>(d.life<=0||(c++,d.x+=d.vx,d.y+=d.vy,d.vy+=i.physics.gravity,d.vx+=i.physics.wind,d.vx*=i.physics.friction,d.vy*=i.physics.friction,i.animationType==="sparkles"?d.rotation+=5:d.rotation+=d.vx*2,d.life-=1.2,this.applyEffects(d,i),this.handleMortarExplosion(d,i,u),this.updateOpacity(d,i)),d)),u.length>0&&i.particles.push(...u),i.updateCallback&&!l&&i.updateCallback(i.particles),c===0&&(a.push(s),i.onComplete&&i.onComplete());}),a.forEach(i=>this.removeAnimation(i)),this.isRunning&&(this.rafId=requestAnimationFrame(this.update));}applyEffects(e,r){var i;let n=(i=r.config)==null?void 0:i.effects;if(!n)return;let{animationType:a}=r;n.flutter&&a==="confetti"&&(e.x+=Math.sin(e.life*.1)*.5,e.rotation+=Math.sin(e.life*.05)*2),n.windDrift&&(a==="snow"||a==="leaves")&&(e.x+=Math.sin(e.life*.05+e.id.charCodeAt(0))*.8),n.wobble&&a==="bubbles"&&(e.x+=Math.sin(e.life*.08)*.3,e.y+=Math.cos(e.life*.08)*.2);}handleMortarExplosion(e,r,n){var a,i;if(!(r.animationType!=="mortar"||!e.element))try{let s=JSON.parse(e.element);if(s.isShell&&!s.hasExploded){if(r.frameCount%3===0){let d=w.acquire();Object.assign(d,{id:`${e.id}-trail-${Date.now()}`,x:e.x+o(-2,2),y:e.y+o(-2,2),vx:o(-1,1),vy:o(0,2),life:30,opacity:.8,size:e.size*.7,rotation:0,color:e.color,element:JSON.stringify({isTrail:!0}),config:e.config}),n.push(d);}if(((i=(a=e.config)==null?void 0:a.lifetime)!=null?i:200)-e.life>=(s.timeToExplode||25)){s.hasExploded=!0,e.element=JSON.stringify(s);let d=window.innerWidth<768,h=d?20:30,y=[],P=["#FFFFFF","#FFF9C4","#BBDEFB","#C5CAE9","#D1C4E9","#FFE082","#FFCCBC"];for(let p=0;p<h;p++){let v=p/h,$=v*Math.PI*6,I=v*80,E=o(-.4,.4),B=o(-15,15),R=$+E,S=(I+B)*.5,x=R+Math.PI/2,W=3*(1-v*.3),b=w.acquire();Object.assign(b,{id:`${e.id}-burst-${p}`,x:e.x+Math.cos(R)*S*.1,y:e.y+Math.sin(R)*S*.1,vx:Math.cos(x)*W+Math.cos(R)*2,vy:Math.sin(x)*W+Math.sin(R)*2,life:120-v*40,opacity:1,size:o(2,5)*(1-v*.5),rotation:o(0,360),color:P[Math.floor(Math.random()*P.length)],element:JSON.stringify({isBurst:!0,isGalaxy:!0,twinkle:Math.random()>.7}),config:e.config}),y.push(b);}let C=d?5:8;for(let p=0;p<C;p++){let v=Math.PI*2*p/C,$=w.acquire();Object.assign($,{id:`${e.id}-core-${p}`,x:e.x,y:e.y,vx:Math.cos(v)*o(1,2),vy:Math.sin(v)*o(1,2),life:60,opacity:1,size:o(3,5),rotation:0,color:"#FFFFFF",element:JSON.stringify({isBurst:!0,isCore:!0}),config:e.config}),y.push($);}let M=w.acquire();Object.assign(M,{id:`${e.id}-flash`,x:e.x,y:e.y,vx:0,vy:0,life:20,opacity:1,size:30,rotation:0,color:"#ffffff",element:JSON.stringify({isBurst:!0}),config:e.config}),y.push(M),n.push(...y);}}}catch(s){}}updateOpacity(e,r){let{animationType:n,config:a}=r,i=a==null?void 0:a.effects;n==="sparkles"?(e.life>70?e.opacity=(100-e.life)/30:e.life<30&&(e.opacity=e.life/30),i!=null&&i.twinkle&&(e.opacity*=.5+Math.sin(e.life*.3)*.5)):n==="stars"&&(i!=null&&i.twinkle)?e.opacity=e.life/100*(.5+Math.sin(e.life*.3)*.5):e.opacity=e.life/100;}getStats(){return {activeAnimations:this.animations.size,currentFps:this.currentFps,isRunning:this.isRunning,totalParticles:Array.from(this.animations.values()).reduce((e,r)=>e+r.particles.filter(n=>n.life>0).length,0)}}setTargetFPS(e){this.frameInterval=1e3/e;}pauseAnimation(e){let r=this.animations.get(e);r&&!r.isPaused&&(r.isPaused=true,r.pausedAt=performance.now());}resumeAnimation(e){let r=this.animations.get(e);r&&r.isPaused&&(r.isPaused=false,this.animations.size>0&&!this.isRunning&&this.start());}isAnimationPaused(e){let r=this.animations.get(e);return r?!!r.isPaused:false}getAnimation(e){return this.animations.get(e)}},k=new tt;function so(t,e,r){let[n,a]=z.useState(false),i=z.useRef(null),s=z.useRef(null),l=z.useRef(null),c=z.useRef(null),u=typeof t=="string",d=u?c:t,h=z.useCallback(()=>new Promise(I=>{var rt,it,nt,at,st,lt,ct,dt,ft,mt,ut,ht,pt;let E=null;if(u){if(typeof document=="undefined")return;E=document.getElementById(t);}else E=d.current;if(!E){(rt=console.warn)==null||rt.call(console,`[Partycles] Element ${u?`with ID "${t}"`:"from ref"} not found. Make sure the element exists when reward() is called.`),I();return}let B=E.getBoundingClientRect(),R={x:B.left+B.width/2,y:B.top+B.height/2},S=me[e];if(!S){console.error(`Animation type "${e}" not found`),I();return}let x=r?K(r):void 0,W=S.createParticles(R,x||{}).map(q=>O(L({},q),{config:x||r}));if(typeof document=="undefined"){I();return}let b=document.createElement("div");b.style.position="fixed",b.style.top="0",b.style.left="0",b.style.width="100%",b.style.height="100%",b.style.pointerEvents="none",b.style.zIndex="9999",document.body.appendChild(b),s.current=b;let ye=client.createRoot(b);l.current=ye;b.getBoundingClientRect();let xe=e==="bubbles"?-0.1:e==="snow"?.05:.35,be=(st=(at=(it=x==null?void 0:x.physics)==null?void 0:it.gravity)!=null?at:(nt=r==null?void 0:r.physics)==null?void 0:nt.gravity)!=null?st:xe,Pe=(ft=(dt=(lt=x==null?void 0:x.physics)==null?void 0:lt.friction)!=null?dt:(ct=r==null?void 0:r.physics)==null?void 0:ct.friction)!=null?ft:.98,ve=(pt=(ht=(mt=x==null?void 0:x.physics)==null?void 0:mt.wind)!=null?ht:(ut=r==null?void 0:r.physics)==null?void 0:ut.wind)!=null?pt:0,ot=`${Date.now()}-${Math.random().toString(36).substr(2,9)}`;i.current=ot;let Fe=q=>{l.current&&l.current.render(z__default.default.createElement(z__default.default.Fragment,null,q.filter(T=>T.life>0).map(T=>z__default.default.createElement("div",{key:T.id,style:xt(T)},S.renderParticle(T)))));};k.addAnimation({id:ot,particles:W,containerElement:b,renderFunction:S.renderParticle,updateCallback:Fe,onComplete:()=>{l.current&&(l.current.unmount(),l.current=null),s.current=null,i.current=null,a(false),I();},physics:{gravity:be,friction:Pe,wind:ve},animationType:e,config:x||r,frameCount:0}),a(true);}),[t,e,r,u,d]),y=z.useCallback(()=>n?Promise.resolve():h(),[h,n]),P=z.useCallback(()=>{i.current&&k.pauseAnimation(i.current);},[]),C=z.useCallback(()=>{i.current&&k.resumeAnimation(i.current);},[]),M=z.useCallback(()=>(i.current&&(k.removeAnimation(i.current),i.current=null),a(false),h()),[h]),[p,v]=z.useState(null);z.useEffect(()=>{v(i.current);},[n]);let $=z.useMemo(()=>p?k.isAnimationPaused(p):false,[p]);return z.useEffect(()=>()=>{i.current&&k.removeAnimation(i.current),l.current&&(l.current.unmount(),l.current=null),s.current&&document.body.contains(s.current)&&(document.body.removeChild(s.current),s.current=null);},[]),u?{reward:y,isAnimating:n,pause:P,resume:C,replay:M,isPaused:$}:{reward:y,isAnimating:n,targetRef:d,pause:P,resume:C,replay:M,isPaused:$}}exports.animationManager=k;exports.emojiPresets=Xe;exports.isMobileDevice=Q;exports.optimizeConfigForMobile=K;exports.particlePool=w;exports.useReward=so;//# sourceMappingURL=index.js.map
|
|
48
55
|
//# sourceMappingURL=index.js.map
|