partycles 1.1.0 → 1.1.4
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 +55 -24
- package/dist/animations/animations/aurora.d.ts.map +1 -1
- package/dist/animations/animations/balloons.d.ts.map +1 -1
- package/dist/animations/animations/bubbles.d.ts.map +1 -1
- package/dist/animations/animations/coins.d.ts.map +1 -1
- package/dist/animations/animations/confetti.d.ts.map +1 -1
- package/dist/animations/animations/crystals.d.ts.map +1 -1
- package/dist/animations/animations/fireflies.d.ts.map +1 -1
- package/dist/animations/animations/fireworks.d.ts.map +1 -1
- package/dist/animations/animations/galaxy.d.ts.map +1 -1
- package/dist/animations/animations/glitch.d.ts.map +1 -1
- package/dist/animations/animations/index.d.ts.map +1 -1
- package/dist/animations/animations/leaves.d.ts.map +1 -1
- package/dist/animations/animations/magicdust.d.ts.map +1 -1
- package/dist/animations/animations/paint.d.ts.map +1 -1
- package/dist/animations/animations/petals.d.ts.map +1 -1
- package/dist/animations/animations/snow.d.ts.map +1 -1
- package/dist/animations/animations/sparkles.d.ts.map +1 -1
- package/dist/animations/animations/stars.d.ts.map +1 -1
- package/dist/animations/aurora.d.ts.map +1 -1
- package/dist/animations/balloons.d.ts.map +1 -1
- package/dist/animations/bubbles.d.ts.map +1 -1
- package/dist/animations/bubbles.esm.js +10 -3
- package/dist/animations/bubbles.esm.js.map +1 -1
- package/dist/animations/bubbles.js +10 -3
- package/dist/animations/bubbles.js.map +1 -1
- package/dist/animations/coins.d.ts.map +1 -1
- package/dist/animations/confetti.d.ts.map +1 -1
- package/dist/animations/confetti.esm.js +20 -3
- package/dist/animations/confetti.esm.js.map +1 -1
- package/dist/animations/confetti.js +20 -3
- package/dist/animations/confetti.js.map +1 -1
- package/dist/animations/crystals.d.ts.map +1 -1
- package/dist/animations/emoji.esm.js +3 -3
- package/dist/animations/emoji.esm.js.map +1 -1
- package/dist/animations/emoji.js +3 -3
- package/dist/animations/emoji.js.map +1 -1
- package/dist/animations/fireflies.d.ts.map +1 -1
- package/dist/animations/fireworks.d.ts.map +1 -1
- package/dist/animations/fireworks.esm.js +11 -3
- package/dist/animations/fireworks.esm.js.map +1 -1
- package/dist/animations/fireworks.js +11 -3
- package/dist/animations/fireworks.js.map +1 -1
- package/dist/animations/galaxy.d.ts.map +1 -1
- package/dist/animations/glitch.d.ts.map +1 -1
- package/dist/animations/hearts.esm.js +2 -2
- package/dist/animations/hearts.esm.js.map +1 -1
- package/dist/animations/hearts.js +2 -2
- package/dist/animations/hearts.js.map +1 -1
- package/dist/animations/leaves.d.ts.map +1 -1
- package/dist/animations/magicdust.d.ts.map +1 -1
- package/dist/animations/mobileOptimizations.d.ts.map +1 -1
- package/dist/animations/paint.d.ts.map +1 -1
- package/dist/animations/petals.d.ts.map +1 -1
- package/dist/animations/snow.d.ts.map +1 -1
- package/dist/animations/snow.esm.js +4 -2
- package/dist/animations/snow.esm.js.map +1 -1
- package/dist/animations/snow.js +4 -2
- package/dist/animations/snow.js.map +1 -1
- package/dist/animations/sparkles.d.ts.map +1 -1
- package/dist/animations/sparkles.esm.js +4 -2
- package/dist/animations/sparkles.esm.js.map +1 -1
- package/dist/animations/sparkles.js +4 -2
- package/dist/animations/sparkles.js.map +1 -1
- package/dist/animations/stars.d.ts.map +1 -1
- package/dist/animations/stars.esm.js +4 -2
- package/dist/animations/stars.esm.js.map +1 -1
- package/dist/animations/stars.js +4 -2
- package/dist/animations/stars.js.map +1 -1
- package/dist/animations/useReward.d.ts.map +1 -1
- package/dist/animations/utils.d.ts.map +1 -1
- package/dist/index.esm.js +174 -56
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +174 -56
- package/dist/index.js.map +1 -1
- package/dist/mobileOptimizations.d.ts.map +1 -1
- package/dist/useReward.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +14 -3
- package/dist/animations/animations/bees.d.ts +0 -8
- package/dist/animations/animations/bees.d.ts.map +0 -1
- package/dist/animations/animations/butterflies.d.ts +0 -8
- package/dist/animations/animations/butterflies.d.ts.map +0 -1
- package/dist/animations/animations/candy.d.ts +0 -8
- package/dist/animations/animations/candy.d.ts.map +0 -1
- package/dist/animations/animations/champagne.d.ts +0 -8
- package/dist/animations/animations/champagne.d.ts.map +0 -1
- package/dist/animations/animations/dandelion.d.ts +0 -8
- package/dist/animations/animations/dandelion.d.ts.map +0 -1
- package/dist/animations/animations/dice.d.ts +0 -8
- package/dist/animations/animations/dice.d.ts.map +0 -1
- package/dist/animations/animations/donuts.d.ts +0 -8
- package/dist/animations/animations/donuts.d.ts.map +0 -1
- package/dist/animations/animations/dragons.d.ts +0 -8
- package/dist/animations/animations/dragons.d.ts.map +0 -1
- package/dist/animations/animations/ghosts.d.ts +0 -8
- package/dist/animations/animations/ghosts.d.ts.map +0 -1
- package/dist/animations/animations/levelup.d.ts +0 -8
- package/dist/animations/animations/levelup.d.ts.map +0 -1
- package/dist/animations/animations/lightning.d.ts +0 -8
- package/dist/animations/animations/lightning.d.ts.map +0 -1
- package/dist/animations/animations/matrix.d.ts +0 -8
- package/dist/animations/animations/matrix.d.ts.map +0 -1
- package/dist/animations/animations/music.d.ts +0 -8
- package/dist/animations/animations/music.d.ts.map +0 -1
- package/dist/animations/animations/pixels.d.ts +0 -8
- package/dist/animations/animations/pixels.d.ts.map +0 -1
- package/dist/animations/animations/pizza.d.ts +0 -8
- package/dist/animations/animations/pizza.d.ts.map +0 -1
- package/dist/animations/animations/popcorn.d.ts +0 -8
- package/dist/animations/animations/popcorn.d.ts.map +0 -1
- package/dist/animations/animations/rain.d.ts +0 -8
- package/dist/animations/animations/rain.d.ts.map +0 -1
- package/dist/animations/animations/runes.d.ts +0 -8
- package/dist/animations/animations/runes.d.ts.map +0 -1
- package/dist/animations/bees.d.ts +0 -8
- package/dist/animations/bees.d.ts.map +0 -1
- package/dist/animations/butterflies.d.ts +0 -8
- package/dist/animations/butterflies.d.ts.map +0 -1
- package/dist/animations/candy.d.ts +0 -8
- package/dist/animations/candy.d.ts.map +0 -1
- package/dist/animations/champagne.d.ts +0 -8
- package/dist/animations/champagne.d.ts.map +0 -1
- package/dist/animations/dandelion.d.ts +0 -8
- package/dist/animations/dandelion.d.ts.map +0 -1
- package/dist/animations/dice.d.ts +0 -8
- package/dist/animations/dice.d.ts.map +0 -1
- package/dist/animations/donuts.d.ts +0 -8
- package/dist/animations/donuts.d.ts.map +0 -1
- package/dist/animations/dragons.d.ts +0 -8
- package/dist/animations/dragons.d.ts.map +0 -1
- package/dist/animations/ghosts.d.ts +0 -8
- package/dist/animations/ghosts.d.ts.map +0 -1
- package/dist/animations/levelup.d.ts +0 -8
- package/dist/animations/levelup.d.ts.map +0 -1
- package/dist/animations/lightning.d.ts +0 -8
- package/dist/animations/lightning.d.ts.map +0 -1
- package/dist/animations/matrix.d.ts +0 -8
- package/dist/animations/matrix.d.ts.map +0 -1
- package/dist/animations/music.d.ts +0 -8
- package/dist/animations/music.d.ts.map +0 -1
- package/dist/animations/pixels.d.ts +0 -8
- package/dist/animations/pixels.d.ts.map +0 -1
- package/dist/animations/pizza.d.ts +0 -8
- package/dist/animations/pizza.d.ts.map +0 -1
- package/dist/animations/popcorn.d.ts +0 -8
- package/dist/animations/popcorn.d.ts.map +0 -1
- package/dist/animations/rain.d.ts +0 -8
- package/dist/animations/rain.d.ts.map +0 -1
- package/dist/animations/runes.d.ts +0 -8
- package/dist/animations/runes.d.ts.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stars.js","sources":["../../src/utils.ts","../../src/animations/stars.tsx"],"sourcesContent":["import { Particle } from './types';\n\nexport const randomInRange = (min: number, max: number): number => {\n return Math.random() * (max - min) + min;\n};\n\nexport const degreesToRadians = (degrees: number): number => {\n return (degrees * Math.PI) / 180;\n};\n\nexport const generateId = (): string => {\n return Math.random().toString(36).substring(2, 9);\n};\n\nexport const getRandomColor = (colors: string[]): string => {\n return colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff';\n};\n\nexport const createParticleStyle = (\n particle: Particle,\n containerRect: DOMRect\n): React.CSSProperties => {\n return {\n position: 'absolute',\n left: `${particle.x - containerRect.left}px`,\n top: `${particle.y - containerRect.top}px`,\n transform: `rotate(${particle.rotation}deg)`,\n opacity: particle.opacity,\n pointerEvents: 'none',\n transition: 'none',\n willChange: 'transform, opacity',\n };\n}
|
1
|
+
{"version":3,"file":"stars.js","sources":["../../src/utils.ts","../../src/animations/stars.tsx"],"sourcesContent":["import { Particle } from './types';\n\nexport const randomInRange = (min: number, max: number): number => {\n return Math.random() * (max - min) + min;\n};\n\nexport const degreesToRadians = (degrees: number): number => {\n return (degrees * Math.PI) / 180;\n};\n\nexport const generateId = (): string => {\n return Math.random().toString(36).substring(2, 9);\n};\n\nexport const getRandomColor = (colors: string[]): string => {\n return (\n colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff'\n );\n};\n\nexport const createParticleStyle = (\n particle: Particle,\n containerRect: DOMRect\n): React.CSSProperties => {\n return {\n position: 'absolute',\n left: `${particle.x - containerRect.left}px`,\n top: `${particle.y - containerRect.top}px`,\n transform: `rotate(${particle.rotation}deg)`,\n opacity: particle.opacity,\n pointerEvents: 'none',\n transition: 'none',\n willChange: 'transform, opacity',\n };\n};\n","import React from 'react';\nimport { AnimationConfig, Particle } from '../types';\nimport { randomInRange, generateId } from '../utils';\n\nconst starColors = ['#FFD700', '#FFA500', '#FF6347', '#FFE4B5'];\n\nexport const createStarParticles = (\n origin: { x: number; y: number },\n config: AnimationConfig\n): Particle[] => {\n const {\n particleCount = 40,\n startVelocity = 18,\n colors = starColors,\n elementSize = 30,\n } = config;\n\n const particles: Particle[] = [];\n\n for (let i = 0; i < particleCount; i++) {\n const angle = randomInRange(0, 360);\n const velocity = randomInRange(startVelocity * 0.5, startVelocity);\n\n particles.push({\n id: generateId(),\n x: origin.x,\n y: origin.y,\n vx: Math.cos((angle * Math.PI) / 180) * velocity,\n vy: Math.sin((angle * Math.PI) / 180) * velocity - 15,\n life: config.lifetime || 150,\n opacity: 1,\n size: randomInRange(elementSize * 0.5, elementSize * 1.3),\n rotation: randomInRange(0, 360),\n color:\n colors[Math.floor(Math.random() * colors.length)] ||\n colors[0] ||\n '#ffffff',\n });\n }\n\n return particles;\n};\n\nexport const renderStarParticle = (particle: Particle): React.ReactNode => {\n return (\n <svg\n key={particle.id}\n width={particle.size}\n height={particle.size}\n viewBox=\"0 0 24 24\"\n fill={particle.color}\n style={{\n filter: `drop-shadow(0 0 ${particle.size * 0.2}px ${particle.color})`,\n }}\n >\n <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\" />\n </svg>\n );\n};\n"],"names":[],"mappings":";;;;AAEO,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,GAAW,KAAY;AAChE,IAAA,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG;AAC1C,CAAC;AAMM,MAAM,UAAU,GAAG,MAAa;AACrC,IAAA,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;AACnD,CAAC;;ACRD,MAAM,UAAU,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;MAElD,mBAAmB,GAAG,CACjC,MAAgC,EAChC,MAAuB,KACT;AACd,IAAA,MAAM,EACJ,aAAa,GAAG,EAAE,EAClB,aAAa,GAAG,EAAE,EAClB,MAAM,GAAG,UAAU,EACnB,WAAW,GAAG,EAAE,GACjB,GAAG,MAAM;IAEV,MAAM,SAAS,GAAe,EAAE;AAEhC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC;QACnC,MAAM,QAAQ,GAAG,aAAa,CAAC,aAAa,GAAG,GAAG,EAAE,aAAa,CAAC;QAElE,SAAS,CAAC,IAAI,CAAC;YACb,EAAE,EAAE,UAAU,EAAE;YAChB,CAAC,EAAE,MAAM,CAAC,CAAC;YACX,CAAC,EAAE,MAAM,CAAC,CAAC;AACX,YAAA,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,IAAI,GAAG,CAAC,GAAG,QAAQ;AAChD,YAAA,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,IAAI,GAAG,CAAC,GAAG,QAAQ,GAAG,EAAE;AACrD,YAAA,IAAI,EAAE,MAAM,CAAC,QAAQ,IAAI,GAAG;AAC5B,YAAA,OAAO,EAAE,CAAC;YACV,IAAI,EAAE,aAAa,CAAC,WAAW,GAAG,GAAG,EAAE,WAAW,GAAG,GAAG,CAAC;AACzD,YAAA,QAAQ,EAAE,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC;AAC/B,YAAA,KAAK,EACH,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;gBACjD,MAAM,CAAC,CAAC,CAAC;gBACT,SAAS;AACZ,SAAA,CAAC;;AAGJ,IAAA,OAAO,SAAS;AAClB;AAEa,MAAA,kBAAkB,GAAG,CAAC,QAAkB,KAAqB;AACxE,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAE,QAAQ,CAAC,EAAE,EAChB,KAAK,EAAE,QAAQ,CAAC,IAAI,EACpB,MAAM,EAAE,QAAQ,CAAC,IAAI,EACrB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAE,QAAQ,CAAC,KAAK,EACpB,KAAK,EAAE;YACL,MAAM,EAAE,CAAmB,gBAAA,EAAA,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAM,GAAA,EAAA,QAAQ,CAAC,KAAK,CAAG,CAAA,CAAA;AACtE,SAAA,EAAA;AAED,QAAA,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAM,CAAC,EAAC,sGAAsG,EAAG,CAAA,CAC7G;AAEV;;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useReward.d.ts","sourceRoot":"","sources":["../src/useReward.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAY,MAAM,SAAS,CAAC;
|
1
|
+
{"version":3,"file":"useReward.d.ts","sourceRoot":"","sources":["../src/useReward.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAY,MAAM,SAAS,CAAC;AAQnE,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,SAAS,GACpB,WAAW,MAAM,EACjB,eAAe,aAAa,EAC5B,SAAS,eAAe,KACvB,eAwLF,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,KAAG,MAExD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,SAAS,MAAM,KAAG,MAElD,CAAC;AAEF,eAAO,MAAM,UAAU,QAAO,MAE7B,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,EAAE,KAAG,
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,EAAE,KAAK,MAAM,KAAG,MAExD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,SAAS,MAAM,KAAG,MAElD,CAAC;AAEF,eAAO,MAAM,UAAU,QAAO,MAE7B,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,EAAE,KAAG,MAIjD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,UAAU,QAAQ,EAClB,eAAe,OAAO,KACrB,KAAK,CAAC,aAWR,CAAC"}
|
package/dist/index.esm.js
CHANGED
@@ -11,7 +11,7 @@ const generateId = () => {
|
|
11
11
|
return Math.random().toString(36).substring(2, 9);
|
12
12
|
};
|
13
13
|
const getRandomColor = (colors) => {
|
14
|
-
return colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff';
|
14
|
+
return (colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff');
|
15
15
|
};
|
16
16
|
const createParticleStyle = (particle, containerRect) => {
|
17
17
|
return {
|
@@ -26,9 +26,26 @@ const createParticleStyle = (particle, containerRect) => {
|
|
26
26
|
};
|
27
27
|
};
|
28
28
|
|
29
|
-
const defaultColors$3 = [
|
29
|
+
const defaultColors$3 = [
|
30
|
+
'#f44336',
|
31
|
+
'#e91e63',
|
32
|
+
'#9c27b0',
|
33
|
+
'#673ab7',
|
34
|
+
'#3f51b5',
|
35
|
+
'#2196f3',
|
36
|
+
'#03a9f4',
|
37
|
+
'#00bcd4',
|
38
|
+
'#009688',
|
39
|
+
'#4caf50',
|
40
|
+
'#8bc34a',
|
41
|
+
'#cddc39',
|
42
|
+
'#ffeb3b',
|
43
|
+
'#ffc107',
|
44
|
+
'#ff9800',
|
45
|
+
'#ff5722',
|
46
|
+
];
|
30
47
|
const createConfettiParticles = (origin, config) => {
|
31
|
-
const { particleCount = 50, startVelocity = 20, colors = defaultColors$3, elementSize = 20 } = config;
|
48
|
+
const { particleCount = 50, startVelocity = 20, colors = defaultColors$3, elementSize = 20, } = config;
|
32
49
|
const particles = [];
|
33
50
|
for (let i = 0; i < particleCount; i++) {
|
34
51
|
const angle = randomInRange(0, 360);
|
@@ -60,7 +77,7 @@ const renderConfettiParticle = (particle) => {
|
|
60
77
|
};
|
61
78
|
|
62
79
|
const createSparkleParticles = (origin, config) => {
|
63
|
-
const { particleCount = 35, spread = 120, startVelocity = 15, elementSize = 25, colors = ['#FFD700', '#FFFFFF'] } = config;
|
80
|
+
const { particleCount = 35, spread = 120, startVelocity = 15, elementSize = 25, colors = ['#FFD700', '#FFFFFF'], } = config;
|
64
81
|
const particles = [];
|
65
82
|
for (let i = 0; i < particleCount; i++) {
|
66
83
|
const velocityScale = startVelocity / 45; // Scale based on default
|
@@ -74,7 +91,9 @@ const createSparkleParticles = (origin, config) => {
|
|
74
91
|
opacity: 0,
|
75
92
|
size: randomInRange(elementSize * 0.4, elementSize * 1.2),
|
76
93
|
rotation: randomInRange(0, 360),
|
77
|
-
color: colors[Math.floor(Math.random() * colors.length)] ||
|
94
|
+
color: colors[Math.floor(Math.random() * colors.length)] ||
|
95
|
+
colors[0] ||
|
96
|
+
'#ffffff',
|
78
97
|
});
|
79
98
|
}
|
80
99
|
return particles;
|
@@ -90,7 +109,7 @@ const renderSparkleParticle = (particle) => {
|
|
90
109
|
|
91
110
|
const heartColors = ['#ff1744', '#e91e63', '#ff4569', '#ff6b6b', '#ee5a70'];
|
92
111
|
const createHeartParticles = (origin, config) => {
|
93
|
-
const { particleCount = 25, startVelocity = 12, colors = heartColors, elementSize = 30 } = config;
|
112
|
+
const { particleCount = 25, startVelocity = 12, colors = heartColors, elementSize = 30, } = config;
|
94
113
|
const particles = [];
|
95
114
|
for (let i = 0; i < particleCount; i++) {
|
96
115
|
const angle = randomInRange(-45, -135);
|
@@ -118,9 +137,17 @@ const renderHeartParticle = (particle) => {
|
|
118
137
|
React.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" })));
|
119
138
|
};
|
120
139
|
|
121
|
-
const fireworkColors = [
|
140
|
+
const fireworkColors = [
|
141
|
+
'#ff0000',
|
142
|
+
'#00ff00',
|
143
|
+
'#0000ff',
|
144
|
+
'#ffff00',
|
145
|
+
'#ff00ff',
|
146
|
+
'#00ffff',
|
147
|
+
'#ffffff',
|
148
|
+
];
|
122
149
|
const createFireworkParticles = (origin, config) => {
|
123
|
-
const { particleCount = 60, startVelocity = 25, colors = fireworkColors, elementSize = 8 } = config;
|
150
|
+
const { particleCount = 60, startVelocity = 25, colors = fireworkColors, elementSize = 8, } = config;
|
124
151
|
const particles = [];
|
125
152
|
for (let i = 0; i < particleCount; i++) {
|
126
153
|
const angle = (360 / particleCount) * i + randomInRange(-5, 5);
|
@@ -157,9 +184,14 @@ const renderFireworkParticle = (particle) => {
|
|
157
184
|
} }));
|
158
185
|
};
|
159
186
|
|
160
|
-
const bubbleColors = [
|
187
|
+
const bubbleColors = [
|
188
|
+
'rgba(66, 165, 245, 0.4)',
|
189
|
+
'rgba(41, 182, 246, 0.4)',
|
190
|
+
'rgba(38, 198, 218, 0.4)',
|
191
|
+
'rgba(129, 212, 250, 0.4)',
|
192
|
+
];
|
161
193
|
const createBubbleParticles = (origin, config) => {
|
162
|
-
const { particleCount = 30, spread = 80, startVelocity = 8, colors = bubbleColors, elementSize = 40 } = config;
|
194
|
+
const { particleCount = 30, spread = 80, startVelocity = 8, colors = bubbleColors, elementSize = 40, } = config;
|
163
195
|
const particles = [];
|
164
196
|
for (let i = 0; i < particleCount; i++) {
|
165
197
|
particles.push({
|
@@ -172,7 +204,9 @@ const createBubbleParticles = (origin, config) => {
|
|
172
204
|
opacity: 0.7,
|
173
205
|
size: randomInRange(elementSize * 0.4, elementSize * 1.2),
|
174
206
|
rotation: 0,
|
175
|
-
color: colors[Math.floor(Math.random() * colors.length)] ||
|
207
|
+
color: colors[Math.floor(Math.random() * colors.length)] ||
|
208
|
+
colors[0] ||
|
209
|
+
'#ffffff',
|
176
210
|
});
|
177
211
|
}
|
178
212
|
return particles;
|
@@ -194,7 +228,7 @@ const renderBubbleParticle = (particle) => {
|
|
194
228
|
|
195
229
|
const starColors = ['#FFD700', '#FFA500', '#FF6347', '#FFE4B5'];
|
196
230
|
const createStarParticles = (origin, config) => {
|
197
|
-
const { particleCount = 40, startVelocity = 18, colors = starColors, elementSize = 30 } = config;
|
231
|
+
const { particleCount = 40, startVelocity = 18, colors = starColors, elementSize = 30, } = config;
|
198
232
|
const particles = [];
|
199
233
|
for (let i = 0; i < particleCount; i++) {
|
200
234
|
const angle = randomInRange(0, 360);
|
@@ -209,7 +243,9 @@ const createStarParticles = (origin, config) => {
|
|
209
243
|
opacity: 1,
|
210
244
|
size: randomInRange(elementSize * 0.5, elementSize * 1.3),
|
211
245
|
rotation: randomInRange(0, 360),
|
212
|
-
color: colors[Math.floor(Math.random() * colors.length)] ||
|
246
|
+
color: colors[Math.floor(Math.random() * colors.length)] ||
|
247
|
+
colors[0] ||
|
248
|
+
'#ffffff',
|
213
249
|
});
|
214
250
|
}
|
215
251
|
return particles;
|
@@ -223,7 +259,7 @@ const renderStarParticle = (particle) => {
|
|
223
259
|
|
224
260
|
const snowColors = ['#FFFFFF', '#F0F8FF', '#F5F5F5', '#FAFAFA'];
|
225
261
|
const createSnowParticles = (origin, config) => {
|
226
|
-
const { particleCount = 50, spread = 200, startVelocity = 3, colors = snowColors, elementSize = 15 } = config;
|
262
|
+
const { particleCount = 50, spread = 200, startVelocity = 3, colors = snowColors, elementSize = 15, } = config;
|
227
263
|
const particles = [];
|
228
264
|
for (let i = 0; i < particleCount; i++) {
|
229
265
|
// Spread particles across the width, starting from above viewport
|
@@ -239,7 +275,9 @@ const createSnowParticles = (origin, config) => {
|
|
239
275
|
opacity: randomInRange(0.4, 0.9),
|
240
276
|
size: randomInRange(elementSize * 0.3, elementSize),
|
241
277
|
rotation: randomInRange(0, 360),
|
242
|
-
color: colors[Math.floor(Math.random() * colors.length)] ||
|
278
|
+
color: colors[Math.floor(Math.random() * colors.length)] ||
|
279
|
+
colors[0] ||
|
280
|
+
'#ffffff',
|
243
281
|
});
|
244
282
|
}
|
245
283
|
return particles;
|
@@ -266,7 +304,7 @@ const happyEmojis = ['😊', '😄', '🥰', '😍', '🤗', '😘', '😁', '
|
|
266
304
|
const natureEmojis = ['🌸', '🌺', '🌻', '🌹', '🌷', '🌼', '🍀', '🌿'];
|
267
305
|
const foodEmojis = ['🍕', '🍔', '🍟', '🌮', '🍿', '🍩', '🍪', '🧁'];
|
268
306
|
const createEmojiParticles = (origin, config) => {
|
269
|
-
const { particleCount = 30, spread = 100, startVelocity = 15, elementSize = 35, emojis = defaultEmojis } = config;
|
307
|
+
const { particleCount = 30, spread = 100, startVelocity = 15, elementSize = 35, emojis = defaultEmojis, } = config;
|
270
308
|
const particles = [];
|
271
309
|
for (let i = 0; i < particleCount; i++) {
|
272
310
|
const angle = randomInRange(-45, -135);
|
@@ -282,7 +320,7 @@ const createEmojiParticles = (origin, config) => {
|
|
282
320
|
size: randomInRange(elementSize * 0.7, elementSize * 1.3),
|
283
321
|
rotation: randomInRange(-45, 45),
|
284
322
|
color: '', // Not used for emojis
|
285
|
-
element: emojis[Math.floor(Math.random() * emojis.length)]
|
323
|
+
element: emojis[Math.floor(Math.random() * emojis.length)],
|
286
324
|
});
|
287
325
|
}
|
288
326
|
return particles;
|
@@ -302,12 +340,12 @@ const emojiPresets = {
|
|
302
340
|
happy: happyEmojis,
|
303
341
|
nature: natureEmojis,
|
304
342
|
food: foodEmojis,
|
305
|
-
default: defaultEmojis
|
343
|
+
default: defaultEmojis,
|
306
344
|
};
|
307
345
|
|
308
346
|
const coinColors = ['#FFD700', '#FFA500', '#FFB300', '#FFC700'];
|
309
347
|
const createCoinParticles = (origin, config) => {
|
310
|
-
const { particleCount = 30, spread = 70, startVelocity = 25, colors = coinColors, elementSize = 25 } = config;
|
348
|
+
const { particleCount = 30, spread = 70, startVelocity = 25, colors = coinColors, elementSize = 25, } = config;
|
311
349
|
const particles = [];
|
312
350
|
for (let i = 0; i < particleCount; i++) {
|
313
351
|
const angle = randomInRange(-spread / 2, spread / 2) * (Math.PI / 180);
|
@@ -322,7 +360,9 @@ const createCoinParticles = (origin, config) => {
|
|
322
360
|
opacity: 1,
|
323
361
|
size: randomInRange(elementSize * 0.8, elementSize * 1.2),
|
324
362
|
rotation: randomInRange(0, 360),
|
325
|
-
color: colors[Math.floor(Math.random() * colors.length)] ||
|
363
|
+
color: colors[Math.floor(Math.random() * colors.length)] ||
|
364
|
+
colors[0] ||
|
365
|
+
'#ffffff',
|
326
366
|
});
|
327
367
|
}
|
328
368
|
return particles;
|
@@ -361,7 +401,7 @@ const renderCoinParticle = (particle) => {
|
|
361
401
|
|
362
402
|
const petalColors = ['#FFB6C1', '#FFC0CB', '#FF69B4', '#FF1493', '#FFF0F5'];
|
363
403
|
const createPetalParticles = (origin, config) => {
|
364
|
-
const { particleCount = 40, spread = 100, startVelocity = 8, colors = petalColors, elementSize = 20 } = config;
|
404
|
+
const { particleCount = 40, spread = 100, startVelocity = 8, colors = petalColors, elementSize = 20, } = config;
|
365
405
|
const particles = [];
|
366
406
|
for (let i = 0; i < particleCount; i++) {
|
367
407
|
const angle = randomInRange(-spread / 2, spread / 2) * (Math.PI / 180);
|
@@ -376,7 +416,9 @@ const createPetalParticles = (origin, config) => {
|
|
376
416
|
opacity: randomInRange(0.7, 1),
|
377
417
|
size: randomInRange(elementSize * 0.7, elementSize * 1.3),
|
378
418
|
rotation: randomInRange(0, 360),
|
379
|
-
color: colors[Math.floor(Math.random() * colors.length)] ||
|
419
|
+
color: colors[Math.floor(Math.random() * colors.length)] ||
|
420
|
+
colors[0] ||
|
421
|
+
'#ffffff',
|
380
422
|
});
|
381
423
|
}
|
382
424
|
return particles;
|
@@ -417,9 +459,17 @@ const renderPetalParticle = (particle) => {
|
|
417
459
|
} })));
|
418
460
|
};
|
419
461
|
|
420
|
-
const auroraColors = [
|
462
|
+
const auroraColors = [
|
463
|
+
'#00ff88',
|
464
|
+
'#00ffaa',
|
465
|
+
'#00ddff',
|
466
|
+
'#0099ff',
|
467
|
+
'#0066ff',
|
468
|
+
'#9933ff',
|
469
|
+
'#ff00ff',
|
470
|
+
];
|
421
471
|
const createAuroraParticles = (origin, config) => {
|
422
|
-
const { particleCount = 15, spread = 200, startVelocity = 3, colors = auroraColors, elementSize = 100 } = config;
|
472
|
+
const { particleCount = 15, spread = 200, startVelocity = 3, colors = auroraColors, elementSize = 100, } = config;
|
423
473
|
const particles = [];
|
424
474
|
for (let i = 0; i < particleCount; i++) {
|
425
475
|
const angle = (i / particleCount) * spread - spread / 2;
|
@@ -434,7 +484,9 @@ const createAuroraParticles = (origin, config) => {
|
|
434
484
|
opacity: 0,
|
435
485
|
size: randomInRange(elementSize * 0.8, elementSize * 1.2),
|
436
486
|
rotation: randomInRange(-15, 15),
|
437
|
-
color: colors[Math.floor(Math.random() * colors.length)] ||
|
487
|
+
color: colors[Math.floor(Math.random() * colors.length)] ||
|
488
|
+
colors[0] ||
|
489
|
+
'#ffffff',
|
438
490
|
});
|
439
491
|
}
|
440
492
|
return particles;
|
@@ -476,7 +528,7 @@ const renderAuroraParticle = (particle) => {
|
|
476
528
|
|
477
529
|
const fireflyColors = ['#FFFF99', '#FFFFCC', '#FFFF66', '#FFFFAA'];
|
478
530
|
const createFireflyParticles = (origin, config) => {
|
479
|
-
const { particleCount = 20, spread = 150, startVelocity = 2, colors = fireflyColors, elementSize = 8 } = config;
|
531
|
+
const { particleCount = 20, spread = 150, startVelocity = 2, colors = fireflyColors, elementSize = 8, } = config;
|
480
532
|
const particles = [];
|
481
533
|
for (let i = 0; i < particleCount; i++) {
|
482
534
|
const angle = randomInRange(0, 360) * (Math.PI / 180);
|
@@ -491,7 +543,9 @@ const createFireflyParticles = (origin, config) => {
|
|
491
543
|
opacity: 0,
|
492
544
|
size: randomInRange(elementSize * 0.6, elementSize),
|
493
545
|
rotation: randomInRange(0, 360), // Used for blink timing
|
494
|
-
color: colors[Math.floor(Math.random() * colors.length)] ||
|
546
|
+
color: colors[Math.floor(Math.random() * colors.length)] ||
|
547
|
+
colors[0] ||
|
548
|
+
'#ffffff',
|
495
549
|
});
|
496
550
|
}
|
497
551
|
return particles;
|
@@ -541,9 +595,16 @@ const renderFireflyParticle = (particle) => {
|
|
541
595
|
} })));
|
542
596
|
};
|
543
597
|
|
544
|
-
const paintColors = [
|
598
|
+
const paintColors = [
|
599
|
+
'#FF006E',
|
600
|
+
'#FB5607',
|
601
|
+
'#FFBE0B',
|
602
|
+
'#8338EC',
|
603
|
+
'#3A86FF',
|
604
|
+
'#06FFB4',
|
605
|
+
];
|
545
606
|
const createPaintParticles = (origin, config) => {
|
546
|
-
const { particleCount = 25, spread = 120, startVelocity = 35, colors = paintColors, elementSize = 30 } = config;
|
607
|
+
const { particleCount = 25, spread = 120, startVelocity = 35, colors = paintColors, elementSize = 30, } = config;
|
547
608
|
const particles = [];
|
548
609
|
for (let i = 0; i < particleCount; i++) {
|
549
610
|
const angle = randomInRange(-spread / 2, spread / 2) * (Math.PI / 180);
|
@@ -561,7 +622,9 @@ const createPaintParticles = (origin, config) => {
|
|
561
622
|
? randomInRange(elementSize * 1.5, elementSize * 2.5)
|
562
623
|
: randomInRange(elementSize * 0.3, elementSize),
|
563
624
|
rotation: randomInRange(0, 360),
|
564
|
-
color: colors[Math.floor(Math.random() * colors.length)] ||
|
625
|
+
color: colors[Math.floor(Math.random() * colors.length)] ||
|
626
|
+
colors[0] ||
|
627
|
+
'#ffffff',
|
565
628
|
});
|
566
629
|
}
|
567
630
|
return particles;
|
@@ -580,7 +643,7 @@ const renderPaintParticle = (particle) => {
|
|
580
643
|
transform: `
|
581
644
|
scaleX(${stretch})
|
582
645
|
scaleY(${squish})
|
583
|
-
rotate(${Math.atan2(particle.vy, particle.vx) * 180 / Math.PI}deg)
|
646
|
+
rotate(${(Math.atan2(particle.vy, particle.vx) * 180) / Math.PI}deg)
|
584
647
|
`,
|
585
648
|
} },
|
586
649
|
React.createElement("div", { style: {
|
@@ -624,9 +687,17 @@ const renderPaintParticle = (particle) => {
|
|
624
687
|
} }))));
|
625
688
|
};
|
626
689
|
|
627
|
-
const balloonColors = [
|
690
|
+
const balloonColors = [
|
691
|
+
'#FF006E',
|
692
|
+
'#FB5607',
|
693
|
+
'#FFBE0B',
|
694
|
+
'#8338EC',
|
695
|
+
'#3A86FF',
|
696
|
+
'#06FFB4',
|
697
|
+
'#FF4081',
|
698
|
+
];
|
628
699
|
const createBalloonParticles = (origin, config) => {
|
629
|
-
const { particleCount = 15, spread = 80, startVelocity = 10, colors = balloonColors, elementSize = 35 } = config;
|
700
|
+
const { particleCount = 15, spread = 80, startVelocity = 10, colors = balloonColors, elementSize = 35, } = config;
|
630
701
|
const particles = [];
|
631
702
|
for (let i = 0; i < particleCount; i++) {
|
632
703
|
const angle = randomInRange(-spread / 2, spread / 2) * (Math.PI / 180);
|
@@ -641,7 +712,9 @@ const createBalloonParticles = (origin, config) => {
|
|
641
712
|
opacity: 0.9,
|
642
713
|
size: randomInRange(elementSize * 0.8, elementSize * 1.2),
|
643
714
|
rotation: randomInRange(-10, 10),
|
644
|
-
color: colors[Math.floor(Math.random() * colors.length)] ||
|
715
|
+
color: colors[Math.floor(Math.random() * colors.length)] ||
|
716
|
+
colors[0] ||
|
717
|
+
'#ffffff',
|
645
718
|
});
|
646
719
|
}
|
647
720
|
return particles;
|
@@ -707,9 +780,17 @@ const renderBalloonParticle = (particle) => {
|
|
707
780
|
React.createElement("path", { d: `M1 0 Q ${1 + Math.sin(particle.life * 0.1) * 3} ${particle.size} 1 ${particle.size * 2}`, stroke: particle.color, strokeWidth: "1.5", fill: "none", opacity: "0.4" }))));
|
708
781
|
};
|
709
782
|
|
710
|
-
const galaxyColors = [
|
783
|
+
const galaxyColors = [
|
784
|
+
'#FFFFFF',
|
785
|
+
'#FFF9C4',
|
786
|
+
'#BBDEFB',
|
787
|
+
'#C5CAE9',
|
788
|
+
'#D1C4E9',
|
789
|
+
'#FFE082',
|
790
|
+
'#FFCCBC',
|
791
|
+
];
|
711
792
|
const createGalaxyParticles = (origin, config) => {
|
712
|
-
const { particleCount = 60, spread = 200, startVelocity = 15, colors = galaxyColors, elementSize = 8 } = config;
|
793
|
+
const { particleCount = 60, spread = 200, startVelocity = 15, colors = galaxyColors, elementSize = 8, } = config;
|
713
794
|
const particles = [];
|
714
795
|
for (let i = 0; i < particleCount; i++) {
|
715
796
|
// Create spiral distribution
|
@@ -737,7 +818,9 @@ const createGalaxyParticles = (origin, config) => {
|
|
737
818
|
opacity: 0,
|
738
819
|
size: randomInRange(elementSize * 0.3, elementSize) * (1 - progress * 0.5), // Smaller at edges
|
739
820
|
rotation: randomInRange(0, 360),
|
740
|
-
color: colors[Math.floor(Math.random() * colors.length)] ||
|
821
|
+
color: colors[Math.floor(Math.random() * colors.length)] ||
|
822
|
+
colors[0] ||
|
823
|
+
'#ffffff',
|
741
824
|
});
|
742
825
|
}
|
743
826
|
return particles;
|
@@ -855,8 +938,7 @@ const renderGlitchParticle = (particle) => {
|
|
855
938
|
g: channel === 'g' ? 255 : 0,
|
856
939
|
b: channel === 'b' ? 255 : 0,
|
857
940
|
};
|
858
|
-
const mixBlendMode = channel === 'r' ? 'screen' :
|
859
|
-
channel === 'g' ? 'multiply' : 'difference';
|
941
|
+
const mixBlendMode = channel === 'r' ? 'screen' : channel === 'g' ? 'multiply' : 'difference';
|
860
942
|
return (React.createElement("div", { key: particle.id, style: {
|
861
943
|
width: `${width}px`,
|
862
944
|
height: `${height}px`,
|
@@ -867,9 +949,18 @@ const renderGlitchParticle = (particle) => {
|
|
867
949
|
} }));
|
868
950
|
};
|
869
951
|
|
870
|
-
const defaultColors$2 = [
|
952
|
+
const defaultColors$2 = [
|
953
|
+
'#9C27B0',
|
954
|
+
'#E91E63',
|
955
|
+
'#FF00FF',
|
956
|
+
'#00FFFF',
|
957
|
+
'#FFD700',
|
958
|
+
'#FF69B4',
|
959
|
+
'#DA70D6',
|
960
|
+
'#9370DB',
|
961
|
+
];
|
871
962
|
const createMagicDustParticles = (origin, config) => {
|
872
|
-
const { particleCount = 40, startVelocity = 8, colors = defaultColors$2, elementSize = 12 } = config;
|
963
|
+
const { particleCount = 40, startVelocity = 8, colors = defaultColors$2, elementSize = 12, } = config;
|
873
964
|
const particles = [];
|
874
965
|
for (let i = 0; i < particleCount; i++) {
|
875
966
|
// Create particles in a circular pattern with some randomness
|
@@ -940,9 +1031,18 @@ const renderMagicDustParticle = (particle) => {
|
|
940
1031
|
} }))));
|
941
1032
|
};
|
942
1033
|
|
943
|
-
const defaultColors$1 = [
|
1034
|
+
const defaultColors$1 = [
|
1035
|
+
'#FF1493',
|
1036
|
+
'#00CED1',
|
1037
|
+
'#FFD700',
|
1038
|
+
'#FF69B4',
|
1039
|
+
'#7B68EE',
|
1040
|
+
'#00FA9A',
|
1041
|
+
'#FF6347',
|
1042
|
+
'#4169E1',
|
1043
|
+
];
|
944
1044
|
const createCrystalParticles = (origin, config) => {
|
945
|
-
const { particleCount = 15, startVelocity = 15, colors = defaultColors$1, elementSize = 25 } = config;
|
1045
|
+
const { particleCount = 15, startVelocity = 15, colors = defaultColors$1, elementSize = 25, } = config;
|
946
1046
|
const particles = [];
|
947
1047
|
for (let i = 0; i < particleCount; i++) {
|
948
1048
|
// Crystals explode outward and fall with gravity
|
@@ -1014,9 +1114,16 @@ const renderCrystalParticle = (particle) => {
|
|
1014
1114
|
} })));
|
1015
1115
|
};
|
1016
1116
|
|
1017
|
-
const defaultColors = [
|
1117
|
+
const defaultColors = [
|
1118
|
+
'#D2691E',
|
1119
|
+
'#CD853F',
|
1120
|
+
'#8B4513',
|
1121
|
+
'#A0522D',
|
1122
|
+
'#FF8C00',
|
1123
|
+
'#FF6347',
|
1124
|
+
];
|
1018
1125
|
const createLeafParticles = (origin, config) => {
|
1019
|
-
const { particleCount = 10, colors = defaultColors, elementSize = 25 } = config;
|
1126
|
+
const { particleCount = 10, colors = defaultColors, elementSize = 25, } = config;
|
1020
1127
|
const particles = [];
|
1021
1128
|
for (let i = 0; i < particleCount; i++) {
|
1022
1129
|
particles.push({
|
@@ -1030,9 +1137,9 @@ const createLeafParticles = (origin, config) => {
|
|
1030
1137
|
size: randomInRange(elementSize * 0.6, elementSize),
|
1031
1138
|
// Encode tumble phase (0-360), sway phase (0-360), and sway amount (20-40) + rotation speed (-3 to 3)
|
1032
1139
|
rotation: Math.floor(randomInRange(0, 360)) +
|
1033
|
-
|
1034
|
-
|
1035
|
-
(
|
1140
|
+
Math.floor(randomInRange(0, 360)) * 1000 +
|
1141
|
+
Math.floor(randomInRange(20, 40)) * 1000000 +
|
1142
|
+
(Math.floor(randomInRange(-3, 3)) + 3) * 100000000,
|
1036
1143
|
color: getRandomColor(colors),
|
1037
1144
|
});
|
1038
1145
|
}
|
@@ -1043,10 +1150,10 @@ const renderLeafParticle = (particle) => {
|
|
1043
1150
|
const tumblePhase = particle.rotation % 1000;
|
1044
1151
|
const swayPhase = Math.floor((particle.rotation % 1000000) / 1000);
|
1045
1152
|
const swayAmount = Math.floor((particle.rotation % 100000000) / 1000000);
|
1046
|
-
const rotationSpeed =
|
1153
|
+
const rotationSpeed = Math.floor(particle.rotation / 100000000) - 3;
|
1047
1154
|
// Calculate tumbling and swaying
|
1048
|
-
const tumble = Math.sin((Date.now() * 0.002 + tumblePhase) * Math.PI / 180) * 30;
|
1049
|
-
const swayX = Math.sin((Date.now() * 0.001 + swayPhase) * Math.PI / 180) * swayAmount;
|
1155
|
+
const tumble = Math.sin(((Date.now() * 0.002 + tumblePhase) * Math.PI) / 180) * 30;
|
1156
|
+
const swayX = Math.sin(((Date.now() * 0.001 + swayPhase) * Math.PI) / 180) * swayAmount;
|
1050
1157
|
const rotation = (Date.now() * rotationSpeed * 0.01 + tumble) % 360;
|
1051
1158
|
return (React.createElement("div", { key: particle.id, style: {
|
1052
1159
|
width: `${particle.size}px`,
|
@@ -1154,7 +1261,10 @@ const isMobileDevice = () => {
|
|
1154
1261
|
if (typeof window === 'undefined')
|
1155
1262
|
return false;
|
1156
1263
|
// Check user agent
|
1157
|
-
const userAgent = navigator.userAgent ||
|
1264
|
+
const userAgent = navigator.userAgent ||
|
1265
|
+
navigator.vendor ||
|
1266
|
+
window.opera ||
|
1267
|
+
'';
|
1158
1268
|
const isMobileUA = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
|
1159
1269
|
// Check viewport width
|
1160
1270
|
const isMobileWidth = window.innerWidth <= 768;
|
@@ -1217,7 +1327,9 @@ const useReward = (elementId, animationType, config) => {
|
|
1217
1327
|
return;
|
1218
1328
|
}
|
1219
1329
|
// Apply mobile performance optimizations
|
1220
|
-
const optimizedConfig = config
|
1330
|
+
const optimizedConfig = config
|
1331
|
+
? optimizeConfigForMobile(config)
|
1332
|
+
: undefined;
|
1221
1333
|
// Create particles
|
1222
1334
|
particlesRef.current = animationHandler.createParticles(origin, optimizedConfig || {});
|
1223
1335
|
// Create container
|
@@ -1236,7 +1348,11 @@ const useReward = (elementId, animationType, config) => {
|
|
1236
1348
|
rootRef.current = root;
|
1237
1349
|
const containerRect = container.getBoundingClientRect();
|
1238
1350
|
// Default gravity varies by animation type
|
1239
|
-
const defaultGravity = animationType === 'bubbles'
|
1351
|
+
const defaultGravity = animationType === 'bubbles'
|
1352
|
+
? -0.1
|
1353
|
+
: animationType === 'snow'
|
1354
|
+
? 0.05
|
1355
|
+
: 0.35;
|
1240
1356
|
const gravity = (_b = (_a = config === null || config === void 0 ? void 0 : config.physics) === null || _a === void 0 ? void 0 : _a.gravity) !== null && _b !== void 0 ? _b : defaultGravity;
|
1241
1357
|
const friction = (_d = (_c = config === null || config === void 0 ? void 0 : config.physics) === null || _c === void 0 ? void 0 : _c.friction) !== null && _d !== void 0 ? _d : 0.98;
|
1242
1358
|
const wind = (_f = (_e = config === null || config === void 0 ? void 0 : config.physics) === null || _e === void 0 ? void 0 : _e.wind) !== null && _f !== void 0 ? _f : 0;
|
@@ -1292,7 +1408,8 @@ const useReward = (elementId, animationType, config) => {
|
|
1292
1408
|
rootRef.current.unmount();
|
1293
1409
|
rootRef.current = null;
|
1294
1410
|
}
|
1295
|
-
if (containerRef.current &&
|
1411
|
+
if (containerRef.current &&
|
1412
|
+
document.body.contains(containerRef.current)) {
|
1296
1413
|
document.body.removeChild(containerRef.current);
|
1297
1414
|
containerRef.current = null;
|
1298
1415
|
}
|
@@ -1317,7 +1434,8 @@ const useReward = (elementId, animationType, config) => {
|
|
1317
1434
|
rootRef.current.unmount();
|
1318
1435
|
rootRef.current = null;
|
1319
1436
|
}
|
1320
|
-
if (containerRef.current &&
|
1437
|
+
if (containerRef.current &&
|
1438
|
+
document.body.contains(containerRef.current)) {
|
1321
1439
|
document.body.removeChild(containerRef.current);
|
1322
1440
|
containerRef.current = null;
|
1323
1441
|
}
|