partycles 0.3.0 → 1.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.
- package/dist/animations/animations/bees.d.ts +8 -0
- package/dist/animations/animations/bees.d.ts.map +1 -0
- package/dist/animations/animations/butterflies.d.ts +8 -0
- package/dist/animations/animations/butterflies.d.ts.map +1 -0
- package/dist/animations/animations/candy.d.ts +8 -0
- package/dist/animations/animations/candy.d.ts.map +1 -0
- package/dist/animations/animations/champagne.d.ts +8 -0
- package/dist/animations/animations/champagne.d.ts.map +1 -0
- package/dist/animations/animations/crystals.d.ts +8 -0
- package/dist/animations/animations/crystals.d.ts.map +1 -0
- package/dist/animations/animations/dandelion.d.ts +8 -0
- package/dist/animations/animations/dandelion.d.ts.map +1 -0
- package/dist/animations/animations/dice.d.ts +8 -0
- package/dist/animations/animations/dice.d.ts.map +1 -0
- package/dist/animations/animations/donuts.d.ts +8 -0
- package/dist/animations/animations/donuts.d.ts.map +1 -0
- package/dist/animations/animations/dragons.d.ts +8 -0
- package/dist/animations/animations/dragons.d.ts.map +1 -0
- package/dist/animations/animations/galaxy.d.ts.map +1 -1
- package/dist/animations/animations/ghosts.d.ts +8 -0
- package/dist/animations/animations/ghosts.d.ts.map +1 -0
- package/dist/animations/animations/glitch.d.ts +8 -0
- package/dist/animations/animations/glitch.d.ts.map +1 -0
- package/dist/animations/animations/index.d.ts.map +1 -1
- package/dist/animations/animations/leaves.d.ts +8 -0
- package/dist/animations/animations/leaves.d.ts.map +1 -0
- package/dist/animations/animations/levelup.d.ts +8 -0
- package/dist/animations/animations/levelup.d.ts.map +1 -0
- package/dist/animations/animations/magicdust.d.ts +8 -0
- package/dist/animations/animations/magicdust.d.ts.map +1 -0
- package/dist/animations/animations/matrix.d.ts +8 -0
- package/dist/animations/animations/matrix.d.ts.map +1 -0
- package/dist/animations/animations/music.d.ts.map +1 -1
- package/dist/animations/animations/pixels.d.ts +8 -0
- package/dist/animations/animations/pixels.d.ts.map +1 -0
- package/dist/animations/animations/pizza.d.ts +8 -0
- package/dist/animations/animations/pizza.d.ts.map +1 -0
- package/dist/animations/animations/popcorn.d.ts +8 -0
- package/dist/animations/animations/popcorn.d.ts.map +1 -0
- package/dist/animations/animations/rain.d.ts +8 -0
- package/dist/animations/animations/rain.d.ts.map +1 -0
- package/dist/animations/animations/runes.d.ts +8 -0
- package/dist/animations/animations/runes.d.ts.map +1 -0
- package/dist/animations/bees.d.ts +8 -0
- package/dist/animations/bees.d.ts.map +1 -0
- package/dist/animations/bubbles.esm.js +3 -3
- package/dist/animations/bubbles.esm.js.map +1 -1
- package/dist/animations/bubbles.js +3 -3
- package/dist/animations/bubbles.js.map +1 -1
- package/dist/animations/butterflies.d.ts +8 -0
- package/dist/animations/butterflies.d.ts.map +1 -0
- package/dist/animations/candy.d.ts +8 -0
- package/dist/animations/candy.d.ts.map +1 -0
- package/dist/animations/champagne.d.ts +8 -0
- package/dist/animations/champagne.d.ts.map +1 -0
- package/dist/animations/confetti.esm.js +1 -1
- package/dist/animations/confetti.esm.js.map +1 -1
- package/dist/animations/confetti.js +1 -1
- package/dist/animations/confetti.js.map +1 -1
- package/dist/animations/crystals.d.ts +8 -0
- package/dist/animations/crystals.d.ts.map +1 -0
- package/dist/animations/dandelion.d.ts +8 -0
- package/dist/animations/dandelion.d.ts.map +1 -0
- package/dist/animations/dice.d.ts +8 -0
- package/dist/animations/dice.d.ts.map +1 -0
- package/dist/animations/donuts.d.ts +8 -0
- package/dist/animations/donuts.d.ts.map +1 -0
- package/dist/animations/dragons.d.ts +8 -0
- package/dist/animations/dragons.d.ts.map +1 -0
- package/dist/animations/emoji.esm.js.map +1 -1
- package/dist/animations/emoji.js.map +1 -1
- package/dist/animations/fireworks.esm.js +1 -1
- package/dist/animations/fireworks.esm.js.map +1 -1
- package/dist/animations/fireworks.js +1 -1
- package/dist/animations/fireworks.js.map +1 -1
- package/dist/animations/galaxy.d.ts.map +1 -1
- package/dist/animations/ghosts.d.ts +8 -0
- package/dist/animations/ghosts.d.ts.map +1 -0
- package/dist/animations/glitch.d.ts +8 -0
- package/dist/animations/glitch.d.ts.map +1 -0
- package/dist/animations/hearts.esm.js +1 -1
- package/dist/animations/hearts.esm.js.map +1 -1
- package/dist/animations/hearts.js +1 -1
- package/dist/animations/hearts.js.map +1 -1
- package/dist/animations/leaves.d.ts +8 -0
- package/dist/animations/leaves.d.ts.map +1 -0
- package/dist/animations/levelup.d.ts +8 -0
- package/dist/animations/levelup.d.ts.map +1 -0
- package/dist/animations/magicdust.d.ts +8 -0
- package/dist/animations/magicdust.d.ts.map +1 -0
- package/dist/animations/matrix.d.ts +8 -0
- package/dist/animations/matrix.d.ts.map +1 -0
- package/dist/animations/music.d.ts.map +1 -1
- package/dist/animations/pixels.d.ts +8 -0
- package/dist/animations/pixels.d.ts.map +1 -0
- package/dist/animations/pizza.d.ts +8 -0
- package/dist/animations/pizza.d.ts.map +1 -0
- package/dist/animations/popcorn.d.ts +8 -0
- package/dist/animations/popcorn.d.ts.map +1 -0
- package/dist/animations/rain.d.ts +8 -0
- package/dist/animations/rain.d.ts.map +1 -0
- package/dist/animations/runes.d.ts +8 -0
- package/dist/animations/runes.d.ts.map +1 -0
- package/dist/animations/snow.esm.js +1 -1
- package/dist/animations/snow.esm.js.map +1 -1
- package/dist/animations/snow.js +1 -1
- package/dist/animations/snow.js.map +1 -1
- package/dist/animations/sparkles.esm.js +1 -1
- package/dist/animations/sparkles.esm.js.map +1 -1
- package/dist/animations/sparkles.js +1 -1
- package/dist/animations/sparkles.js.map +1 -1
- package/dist/animations/stars.esm.js +1 -1
- package/dist/animations/stars.esm.js.map +1 -1
- package/dist/animations/stars.js +1 -1
- package/dist/animations/stars.js.map +1 -1
- package/dist/animations/types.d.ts +1 -1
- package/dist/animations/types.d.ts.map +1 -1
- package/dist/index.esm.js +301 -156
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +301 -156
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
@@ -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];\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};","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: colors[Math.floor(Math.random() * colors.length)] || colors[0],\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};"],"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,EACjB,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;YAC/B,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC;
|
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};","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: colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#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};"],"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,EACjB,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;YAC/B,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,SAAS;AACnF,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;;;;;"}
|
@@ -26,7 +26,7 @@ export interface AnimationConfig {
|
|
26
26
|
friction?: number;
|
27
27
|
};
|
28
28
|
}
|
29
|
-
export type AnimationType = 'confetti' | 'sparkles' | 'fireworks' | 'hearts' | 'stars' | 'bubbles' | 'snow' | 'emoji' | 'coins' | '
|
29
|
+
export type AnimationType = 'confetti' | 'sparkles' | 'fireworks' | 'hearts' | 'stars' | 'bubbles' | 'snow' | 'emoji' | 'coins' | 'petals' | 'aurora' | 'fireflies' | 'paint' | 'balloons' | 'galaxy' | 'leaves' | 'glitch' | 'magicdust' | 'crystals';
|
30
30
|
export interface UseRewardConfig extends AnimationConfig {
|
31
31
|
animationType: AnimationType;
|
32
32
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,UAAU,GACV,WAAW,GACX,QAAQ,GACR,OAAO,GACP,SAAS,GACT,MAAM,GACN,OAAO,GACP,OAAO,GACP,
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,UAAU,GACV,WAAW,GACX,QAAQ,GACR,OAAO,GACP,SAAS,GACT,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,OAAO,GACP,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,UAAU,CAAC;AAEf,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,aAAa,EAAE,aAAa,CAAC;CAC9B"}
|
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];
|
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,9 @@ const createParticleStyle = (particle, containerRect) => {
|
|
26
26
|
};
|
27
27
|
};
|
28
28
|
|
29
|
-
const defaultColors = ['#f44336', '#e91e63', '#9c27b0', '#673ab7', '#3f51b5', '#2196f3', '#03a9f4', '#00bcd4', '#009688', '#4caf50', '#8bc34a', '#cddc39', '#ffeb3b', '#ffc107', '#ff9800', '#ff5722'];
|
29
|
+
const defaultColors$3 = ['#f44336', '#e91e63', '#9c27b0', '#673ab7', '#3f51b5', '#2196f3', '#03a9f4', '#00bcd4', '#009688', '#4caf50', '#8bc34a', '#cddc39', '#ffeb3b', '#ffc107', '#ff9800', '#ff5722'];
|
30
30
|
const createConfettiParticles = (origin, config) => {
|
31
|
-
const { particleCount = 50, startVelocity = 20, colors = defaultColors, elementSize = 20 } = config;
|
31
|
+
const { particleCount = 50, startVelocity = 20, colors = defaultColors$3, elementSize = 20 } = config;
|
32
32
|
const particles = [];
|
33
33
|
for (let i = 0; i < particleCount; i++) {
|
34
34
|
const angle = randomInRange(0, 360);
|
@@ -74,7 +74,7 @@ const createSparkleParticles = (origin, config) => {
|
|
74
74
|
opacity: 0,
|
75
75
|
size: randomInRange(elementSize * 0.4, elementSize * 1.2),
|
76
76
|
rotation: randomInRange(0, 360),
|
77
|
-
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
77
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff',
|
78
78
|
});
|
79
79
|
}
|
80
80
|
return particles;
|
@@ -166,13 +166,13 @@ const createBubbleParticles = (origin, config) => {
|
|
166
166
|
id: generateId(),
|
167
167
|
x: origin.x + randomInRange(-spread, spread),
|
168
168
|
y: origin.y,
|
169
|
-
vx: randomInRange(-
|
170
|
-
vy: -randomInRange(startVelocity * 0.
|
169
|
+
vx: randomInRange(-3, 3),
|
170
|
+
vy: -randomInRange(startVelocity * 0.7, startVelocity * 1.2),
|
171
171
|
life: config.lifetime || 160,
|
172
172
|
opacity: 0.7,
|
173
173
|
size: randomInRange(elementSize * 0.4, elementSize * 1.2),
|
174
174
|
rotation: 0,
|
175
|
-
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
175
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff',
|
176
176
|
});
|
177
177
|
}
|
178
178
|
return particles;
|
@@ -209,7 +209,7 @@ const createStarParticles = (origin, config) => {
|
|
209
209
|
opacity: 1,
|
210
210
|
size: randomInRange(elementSize * 0.5, elementSize * 1.3),
|
211
211
|
rotation: randomInRange(0, 360),
|
212
|
-
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
212
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff',
|
213
213
|
});
|
214
214
|
}
|
215
215
|
return particles;
|
@@ -239,7 +239,7 @@ const createSnowParticles = (origin, config) => {
|
|
239
239
|
opacity: randomInRange(0.4, 0.9),
|
240
240
|
size: randomInRange(elementSize * 0.3, elementSize),
|
241
241
|
rotation: randomInRange(0, 360),
|
242
|
-
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
242
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff',
|
243
243
|
});
|
244
244
|
}
|
245
245
|
return particles;
|
@@ -322,7 +322,7 @@ const createCoinParticles = (origin, config) => {
|
|
322
322
|
opacity: 1,
|
323
323
|
size: randomInRange(elementSize * 0.8, elementSize * 1.2),
|
324
324
|
rotation: randomInRange(0, 360),
|
325
|
-
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
325
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff',
|
326
326
|
});
|
327
327
|
}
|
328
328
|
return particles;
|
@@ -359,61 +359,6 @@ const renderCoinParticle = (particle) => {
|
|
359
359
|
} }, "$")));
|
360
360
|
};
|
361
361
|
|
362
|
-
const lightningColors = ['#FFFF00', '#FFFFFF', '#00FFFF', '#FF00FF'];
|
363
|
-
const createLightningParticles = (origin, config) => {
|
364
|
-
const { particleCount = 20, spread = 360, startVelocity = 50, colors = lightningColors, elementSize = 30 } = config;
|
365
|
-
const particles = [];
|
366
|
-
for (let i = 0; i < particleCount; i++) {
|
367
|
-
const angle = randomInRange(0, spread) * (Math.PI / 180);
|
368
|
-
const velocity = randomInRange(startVelocity * 0.7, startVelocity * 1.3);
|
369
|
-
particles.push({
|
370
|
-
id: generateId(),
|
371
|
-
x: origin.x,
|
372
|
-
y: origin.y,
|
373
|
-
vx: Math.sin(angle) * velocity,
|
374
|
-
vy: -Math.abs(Math.cos(angle) * velocity * 0.5), // Mostly horizontal movement
|
375
|
-
life: config.lifetime || 60, // Quick flashes
|
376
|
-
opacity: 1,
|
377
|
-
size: randomInRange(elementSize * 0.5, elementSize * 1.5),
|
378
|
-
rotation: randomInRange(0, 360),
|
379
|
-
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
380
|
-
});
|
381
|
-
}
|
382
|
-
return particles;
|
383
|
-
};
|
384
|
-
const renderLightningParticle = (particle) => {
|
385
|
-
// Create zigzag pattern based on particle life
|
386
|
-
const zigzagOffset = Math.sin(particle.life * 0.5) * 10;
|
387
|
-
return (React.createElement("div", { key: particle.id, style: {
|
388
|
-
width: `${particle.size}px`,
|
389
|
-
height: `${particle.size * 0.3}px`,
|
390
|
-
position: 'relative',
|
391
|
-
filter: `blur(0.5px) brightness(2)`,
|
392
|
-
transform: `translateX(${zigzagOffset}px) rotate(${particle.rotation}deg)`,
|
393
|
-
} },
|
394
|
-
React.createElement("div", { style: {
|
395
|
-
position: 'absolute',
|
396
|
-
width: '100%',
|
397
|
-
height: '100%',
|
398
|
-
background: particle.color,
|
399
|
-
clipPath: 'polygon(0% 0%, 60% 0%, 40% 45%, 100% 45%, 0% 100%, 40% 55%, 20% 55%, 35% 100%)',
|
400
|
-
boxShadow: `
|
401
|
-
0 0 10px ${particle.color},
|
402
|
-
0 0 20px ${particle.color},
|
403
|
-
0 0 30px ${particle.color}
|
404
|
-
`,
|
405
|
-
} }),
|
406
|
-
React.createElement("div", { style: {
|
407
|
-
position: 'absolute',
|
408
|
-
top: '-50%',
|
409
|
-
left: '-50%',
|
410
|
-
width: '200%',
|
411
|
-
height: '200%',
|
412
|
-
background: `radial-gradient(circle, ${particle.color}88 0%, transparent 70%)`,
|
413
|
-
animation: `electricPulse ${randomInRange(100, 200)}ms infinite`,
|
414
|
-
} })));
|
415
|
-
};
|
416
|
-
|
417
362
|
const petalColors = ['#FFB6C1', '#FFC0CB', '#FF69B4', '#FF1493', '#FFF0F5'];
|
418
363
|
const createPetalParticles = (origin, config) => {
|
419
364
|
const { particleCount = 40, spread = 100, startVelocity = 8, colors = petalColors, elementSize = 20 } = config;
|
@@ -431,7 +376,7 @@ const createPetalParticles = (origin, config) => {
|
|
431
376
|
opacity: randomInRange(0.7, 1),
|
432
377
|
size: randomInRange(elementSize * 0.7, elementSize * 1.3),
|
433
378
|
rotation: randomInRange(0, 360),
|
434
|
-
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
379
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff',
|
435
380
|
});
|
436
381
|
}
|
437
382
|
return particles;
|
@@ -489,7 +434,7 @@ const createAuroraParticles = (origin, config) => {
|
|
489
434
|
opacity: 0,
|
490
435
|
size: randomInRange(elementSize * 0.8, elementSize * 1.2),
|
491
436
|
rotation: randomInRange(-15, 15),
|
492
|
-
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
437
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff',
|
493
438
|
});
|
494
439
|
}
|
495
440
|
return particles;
|
@@ -546,7 +491,7 @@ const createFireflyParticles = (origin, config) => {
|
|
546
491
|
opacity: 0,
|
547
492
|
size: randomInRange(elementSize * 0.6, elementSize),
|
548
493
|
rotation: randomInRange(0, 360), // Used for blink timing
|
549
|
-
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
494
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff',
|
550
495
|
});
|
551
496
|
}
|
552
497
|
return particles;
|
@@ -616,7 +561,7 @@ const createPaintParticles = (origin, config) => {
|
|
616
561
|
? randomInRange(elementSize * 1.5, elementSize * 2.5)
|
617
562
|
: randomInRange(elementSize * 0.3, elementSize),
|
618
563
|
rotation: randomInRange(0, 360),
|
619
|
-
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
564
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff',
|
620
565
|
});
|
621
566
|
}
|
622
567
|
return particles;
|
@@ -679,80 +624,6 @@ const renderPaintParticle = (particle) => {
|
|
679
624
|
} }))));
|
680
625
|
};
|
681
626
|
|
682
|
-
const musicColors = ['#FF006E', '#8338EC', '#3A86FF', '#FB5607', '#FFBE0B'];
|
683
|
-
const createMusicParticles = (origin, config) => {
|
684
|
-
const { particleCount = 20, spread = 100, startVelocity = 8, colors = musicColors, elementSize = 25 } = config;
|
685
|
-
const particles = [];
|
686
|
-
const notes = ['♪', '♫', '♬', '♩', '♭', '♯'];
|
687
|
-
for (let i = 0; i < particleCount; i++) {
|
688
|
-
const angle = randomInRange(-spread / 2, spread / 2) * (Math.PI / 180);
|
689
|
-
const velocity = randomInRange(startVelocity * 0.5, startVelocity);
|
690
|
-
particles.push({
|
691
|
-
id: generateId(),
|
692
|
-
x: origin.x + randomInRange(-20, 20),
|
693
|
-
y: origin.y,
|
694
|
-
vx: Math.sin(angle) * velocity * 0.3,
|
695
|
-
vy: -Math.abs(Math.cos(angle)) * velocity * 0.5, // Always go up slowly
|
696
|
-
life: config.lifetime || 200,
|
697
|
-
opacity: 1,
|
698
|
-
size: randomInRange(elementSize * 0.8, elementSize * 1.2),
|
699
|
-
rotation: i % notes.length, // Store which note to use
|
700
|
-
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
701
|
-
});
|
702
|
-
}
|
703
|
-
return particles;
|
704
|
-
};
|
705
|
-
const renderMusicParticle = (particle) => {
|
706
|
-
const notes = ['♪', '♫', '♬', '♩', '♭', '♯'];
|
707
|
-
const note = notes[Math.floor(particle.rotation)];
|
708
|
-
// Wave motion as notes float up
|
709
|
-
const waveX = Math.sin(particle.life * 0.05) * 20;
|
710
|
-
const wobble = Math.sin(particle.life * 0.1) * 10;
|
711
|
-
// Fade in/out
|
712
|
-
const maxLife = 300; // Use longer lifetime for proper fading
|
713
|
-
const fadeIn = particle.life > (maxLife - 20) ? (maxLife - particle.life) / 20 : 1;
|
714
|
-
const fadeOut = particle.life < 50 ? particle.life / 50 : 1;
|
715
|
-
const opacity = Math.min(fadeIn, fadeOut) * particle.opacity;
|
716
|
-
return (React.createElement("div", { key: particle.id, style: {
|
717
|
-
fontSize: `${particle.size}px`,
|
718
|
-
fontWeight: 'bold',
|
719
|
-
position: 'relative',
|
720
|
-
transform: `
|
721
|
-
translateX(${waveX}px)
|
722
|
-
rotate(${wobble}deg)
|
723
|
-
scale(${0.8 + opacity * 0.2})
|
724
|
-
`,
|
725
|
-
color: particle.color,
|
726
|
-
opacity,
|
727
|
-
textShadow: `
|
728
|
-
0 0 10px ${particle.color}88,
|
729
|
-
0 0 20px ${particle.color}44,
|
730
|
-
2px 2px 3px rgba(0,0,0,0.3)
|
731
|
-
`,
|
732
|
-
transition: 'transform 0.3s ease',
|
733
|
-
userSelect: 'none',
|
734
|
-
} },
|
735
|
-
note,
|
736
|
-
React.createElement("div", { style: {
|
737
|
-
position: 'absolute',
|
738
|
-
top: '40%',
|
739
|
-
left: '-20%',
|
740
|
-
width: '140%',
|
741
|
-
height: '1px',
|
742
|
-
background: `linear-gradient(90deg, transparent, ${particle.color}33, transparent)`,
|
743
|
-
opacity: opacity * 0.5,
|
744
|
-
} }),
|
745
|
-
React.createElement("div", { style: {
|
746
|
-
position: 'absolute',
|
747
|
-
top: '60%',
|
748
|
-
left: '-20%',
|
749
|
-
width: '140%',
|
750
|
-
height: '1px',
|
751
|
-
background: `linear-gradient(90deg, transparent, ${particle.color}33, transparent)`,
|
752
|
-
opacity: opacity * 0.3,
|
753
|
-
} })));
|
754
|
-
};
|
755
|
-
|
756
627
|
const balloonColors = ['#FF006E', '#FB5607', '#FFBE0B', '#8338EC', '#3A86FF', '#06FFB4', '#FF4081'];
|
757
628
|
const createBalloonParticles = (origin, config) => {
|
758
629
|
const { particleCount = 15, spread = 80, startVelocity = 10, colors = balloonColors, elementSize = 35 } = config;
|
@@ -762,15 +633,15 @@ const createBalloonParticles = (origin, config) => {
|
|
762
633
|
const velocity = randomInRange(startVelocity * 0.7, startVelocity);
|
763
634
|
particles.push({
|
764
635
|
id: generateId(),
|
765
|
-
x: origin.x + randomInRange(-
|
766
|
-
y: origin.y + randomInRange(
|
767
|
-
vx: Math.sin(angle) * velocity * 0.
|
636
|
+
x: origin.x + randomInRange(-spread * 0.8, spread * 0.8), // Spread balloons out more
|
637
|
+
y: origin.y + randomInRange(-10, 30),
|
638
|
+
vx: Math.sin(angle) * velocity * 0.3 + randomInRange(-1, 1), // Add horizontal drift
|
768
639
|
vy: -velocity * 0.4, // Balloons float up slowly
|
769
640
|
life: config.lifetime || 250,
|
770
641
|
opacity: 0.9,
|
771
642
|
size: randomInRange(elementSize * 0.8, elementSize * 1.2),
|
772
643
|
rotation: randomInRange(-10, 10),
|
773
|
-
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
644
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff',
|
774
645
|
});
|
775
646
|
}
|
776
647
|
return particles;
|
@@ -866,7 +737,7 @@ const createGalaxyParticles = (origin, config) => {
|
|
866
737
|
opacity: 0,
|
867
738
|
size: randomInRange(elementSize * 0.3, elementSize) * (1 - progress * 0.5), // Smaller at edges
|
868
739
|
rotation: randomInRange(0, 360),
|
869
|
-
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
740
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0] || '#ffffff',
|
870
741
|
});
|
871
742
|
}
|
872
743
|
return particles;
|
@@ -934,6 +805,272 @@ const renderGalaxyParticle = (particle) => {
|
|
934
805
|
} }))));
|
935
806
|
};
|
936
807
|
|
808
|
+
const createGlitchParticles = (origin, config) => {
|
809
|
+
const { particleCount = 20, elementSize = 200 } = config;
|
810
|
+
const particles = [];
|
811
|
+
const channels = ['r', 'g', 'b'];
|
812
|
+
for (let i = 0; i < particleCount; i++) {
|
813
|
+
const isHorizontal = Math.random() > 0.3;
|
814
|
+
const channelIndex = i % 3;
|
815
|
+
const channel = channels[channelIndex];
|
816
|
+
// Encode all data in rotation:
|
817
|
+
// bits 0-1: channel (0=r, 1=g, 2=b)
|
818
|
+
// bit 2: isHorizontal (0=false, 1=true)
|
819
|
+
// bits 3-10: width (0-255)
|
820
|
+
// bits 11-18: height (0-255)
|
821
|
+
// bits 19-24: glitchOffset + 32 (to make positive)
|
822
|
+
const width = isHorizontal ? randomInRange(50, 200) : randomInRange(2, 8);
|
823
|
+
const height = isHorizontal ? randomInRange(2, 8) : randomInRange(50, 200);
|
824
|
+
const glitchOffset = randomInRange(-20, 20);
|
825
|
+
const encodedData = channelIndex +
|
826
|
+
(isHorizontal ? 4 : 0) +
|
827
|
+
(Math.floor(width) << 3) +
|
828
|
+
(Math.floor(height) << 11) +
|
829
|
+
((glitchOffset + 32) << 19);
|
830
|
+
particles.push({
|
831
|
+
id: generateId(),
|
832
|
+
x: origin.x + randomInRange(-elementSize / 2, elementSize / 2),
|
833
|
+
y: origin.y + randomInRange(-elementSize / 2, elementSize / 2),
|
834
|
+
vx: randomInRange(-50, 50),
|
835
|
+
vy: randomInRange(-30, 30),
|
836
|
+
life: config.lifetime || 150,
|
837
|
+
opacity: randomInRange(0.3, 1),
|
838
|
+
size: randomInRange(5, 20), // Store distortionAmount
|
839
|
+
rotation: encodedData,
|
840
|
+
color: channel === 'r' ? '#ff0000' : channel === 'g' ? '#00ff00' : '#0000ff',
|
841
|
+
});
|
842
|
+
}
|
843
|
+
return particles;
|
844
|
+
};
|
845
|
+
const renderGlitchParticle = (particle) => {
|
846
|
+
// Decode data from rotation
|
847
|
+
const channelIndex = particle.rotation & 3;
|
848
|
+
const width = (particle.rotation >> 3) & 255;
|
849
|
+
const height = (particle.rotation >> 11) & 255;
|
850
|
+
const glitchOffset = ((particle.rotation >> 19) & 63) - 32;
|
851
|
+
const channel = ['r', 'g', 'b'][channelIndex];
|
852
|
+
const distortionAmount = particle.size;
|
853
|
+
const colors = {
|
854
|
+
r: channel === 'r' ? 255 : 0,
|
855
|
+
g: channel === 'g' ? 255 : 0,
|
856
|
+
b: channel === 'b' ? 255 : 0,
|
857
|
+
};
|
858
|
+
const mixBlendMode = channel === 'r' ? 'screen' :
|
859
|
+
channel === 'g' ? 'multiply' : 'difference';
|
860
|
+
return (React.createElement("div", { key: particle.id, style: {
|
861
|
+
width: `${width}px`,
|
862
|
+
height: `${height}px`,
|
863
|
+
backgroundColor: `rgba(${colors.r}, ${colors.g}, ${colors.b}, ${particle.opacity})`,
|
864
|
+
mixBlendMode,
|
865
|
+
filter: `blur(${randomInRange(0, 2)}px)`,
|
866
|
+
boxShadow: `${glitchOffset}px 0 ${distortionAmount}px rgba(${colors.r}, ${colors.g}, ${colors.b}, ${particle.opacity * 0.5})`,
|
867
|
+
} }));
|
868
|
+
};
|
869
|
+
|
870
|
+
const defaultColors$2 = ['#9C27B0', '#E91E63', '#FF00FF', '#00FFFF', '#FFD700', '#FF69B4', '#DA70D6', '#9370DB'];
|
871
|
+
const createMagicDustParticles = (origin, config) => {
|
872
|
+
const { particleCount = 40, startVelocity = 8, colors = defaultColors$2, elementSize = 12 } = config;
|
873
|
+
const particles = [];
|
874
|
+
for (let i = 0; i < particleCount; i++) {
|
875
|
+
// Create particles in a circular pattern with some randomness
|
876
|
+
const angle = (i / particleCount) * 360 + randomInRange(-30, 30);
|
877
|
+
const velocity = randomInRange(startVelocity * 0.3, startVelocity);
|
878
|
+
const color = getRandomColor(colors);
|
879
|
+
// Add some particles that trail behind cursor movement
|
880
|
+
const offsetAngle = randomInRange(0, 360);
|
881
|
+
const offsetDistance = randomInRange(0, 30);
|
882
|
+
particles.push({
|
883
|
+
id: generateId(),
|
884
|
+
x: origin.x + Math.cos(degreesToRadians(offsetAngle)) * offsetDistance,
|
885
|
+
y: origin.y + Math.sin(degreesToRadians(offsetAngle)) * offsetDistance,
|
886
|
+
vx: Math.cos(degreesToRadians(angle)) * velocity + randomInRange(-2, 2),
|
887
|
+
vy: Math.sin(degreesToRadians(angle)) * velocity + randomInRange(-2, 2),
|
888
|
+
life: config.lifetime || 120,
|
889
|
+
opacity: randomInRange(0.4, 1),
|
890
|
+
size: randomInRange(elementSize * 0.3, elementSize),
|
891
|
+
rotation: randomInRange(0, 360),
|
892
|
+
color,
|
893
|
+
});
|
894
|
+
}
|
895
|
+
return particles;
|
896
|
+
};
|
897
|
+
const renderMagicDustParticle = (particle) => {
|
898
|
+
const sparkleSize = particle.size * 0.7;
|
899
|
+
return (React.createElement("div", { key: particle.id, style: {
|
900
|
+
width: `${particle.size}px`,
|
901
|
+
height: `${particle.size}px`,
|
902
|
+
position: 'relative',
|
903
|
+
} },
|
904
|
+
React.createElement("div", { style: {
|
905
|
+
position: 'absolute',
|
906
|
+
width: '100%',
|
907
|
+
height: '100%',
|
908
|
+
backgroundColor: particle.color,
|
909
|
+
borderRadius: '50%',
|
910
|
+
boxShadow: `0 0 ${particle.size}px ${particle.color}, 0 0 ${particle.size * 2}px ${particle.color}`,
|
911
|
+
filter: 'blur(1px)',
|
912
|
+
} }),
|
913
|
+
React.createElement("div", { style: {
|
914
|
+
position: 'absolute',
|
915
|
+
top: '50%',
|
916
|
+
left: '50%',
|
917
|
+
width: `${sparkleSize}px`,
|
918
|
+
height: `${sparkleSize}px`,
|
919
|
+
transform: `translate(-50%, -50%) rotate(${particle.rotation}deg)`,
|
920
|
+
} },
|
921
|
+
React.createElement("div", { style: {
|
922
|
+
position: 'absolute',
|
923
|
+
width: '100%',
|
924
|
+
height: '2px',
|
925
|
+
backgroundColor: 'white',
|
926
|
+
top: '50%',
|
927
|
+
left: '0',
|
928
|
+
transform: 'translateY(-50%)',
|
929
|
+
boxShadow: '0 0 4px white',
|
930
|
+
} }),
|
931
|
+
React.createElement("div", { style: {
|
932
|
+
position: 'absolute',
|
933
|
+
width: '2px',
|
934
|
+
height: '100%',
|
935
|
+
backgroundColor: 'white',
|
936
|
+
left: '50%',
|
937
|
+
top: '0',
|
938
|
+
transform: 'translateX(-50%)',
|
939
|
+
boxShadow: '0 0 4px white',
|
940
|
+
} }))));
|
941
|
+
};
|
942
|
+
|
943
|
+
const defaultColors$1 = ['#FF1493', '#00CED1', '#FFD700', '#FF69B4', '#7B68EE', '#00FA9A', '#FF6347', '#4169E1'];
|
944
|
+
const createCrystalParticles = (origin, config) => {
|
945
|
+
const { particleCount = 15, startVelocity = 15, colors = defaultColors$1, elementSize = 25 } = config;
|
946
|
+
const particles = [];
|
947
|
+
for (let i = 0; i < particleCount; i++) {
|
948
|
+
// Crystals explode outward and fall with gravity
|
949
|
+
const angle = randomInRange(0, 360);
|
950
|
+
const velocity = randomInRange(startVelocity * 0.5, startVelocity);
|
951
|
+
const color = getRandomColor(colors);
|
952
|
+
particles.push({
|
953
|
+
id: generateId(),
|
954
|
+
x: origin.x,
|
955
|
+
y: origin.y,
|
956
|
+
vx: Math.cos(degreesToRadians(angle)) * velocity,
|
957
|
+
vy: Math.sin(degreesToRadians(angle)) * velocity - 10,
|
958
|
+
life: config.lifetime || 150,
|
959
|
+
opacity: randomInRange(0.7, 1),
|
960
|
+
size: randomInRange(elementSize * 0.6, elementSize),
|
961
|
+
rotation: randomInRange(0, 360),
|
962
|
+
color,
|
963
|
+
});
|
964
|
+
}
|
965
|
+
return particles;
|
966
|
+
};
|
967
|
+
const renderCrystalParticle = (particle) => {
|
968
|
+
// Create rainbow refraction effect
|
969
|
+
const hue = (Date.now() * 0.5 + particle.x + particle.y) % 360;
|
970
|
+
return (React.createElement("div", { key: particle.id, style: {
|
971
|
+
width: `${particle.size}px`,
|
972
|
+
height: `${particle.size * 1.5}px`,
|
973
|
+
position: 'relative',
|
974
|
+
transform: `rotate(${particle.rotation}deg)`,
|
975
|
+
} },
|
976
|
+
React.createElement("div", { style: {
|
977
|
+
position: 'absolute',
|
978
|
+
width: '100%',
|
979
|
+
height: '100%',
|
980
|
+
background: `linear-gradient(135deg, ${particle.color}, ${particle.color}88, transparent)`,
|
981
|
+
clipPath: 'polygon(50% 0%, 100% 40%, 75% 100%, 25% 100%, 0% 40%)',
|
982
|
+
boxShadow: `0 0 ${particle.size}px ${particle.color}44`,
|
983
|
+
} }),
|
984
|
+
React.createElement("div", { style: {
|
985
|
+
position: 'absolute',
|
986
|
+
width: '80%',
|
987
|
+
height: '80%',
|
988
|
+
top: '10%',
|
989
|
+
left: '10%',
|
990
|
+
background: `linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.4), transparent)`,
|
991
|
+
clipPath: 'polygon(50% 10%, 90% 45%, 65% 90%, 35% 90%, 10% 45%)',
|
992
|
+
} }),
|
993
|
+
React.createElement("div", { style: {
|
994
|
+
position: 'absolute',
|
995
|
+
width: '100%',
|
996
|
+
height: '100%',
|
997
|
+
background: `linear-gradient(${hue}deg,
|
998
|
+
hsla(${hue}, 100%, 50%, 0.3),
|
999
|
+
hsla(${(hue + 60) % 360}, 100%, 50%, 0.3),
|
1000
|
+
hsla(${(hue + 120) % 360}, 100%, 50%, 0.3)
|
1001
|
+
)`,
|
1002
|
+
clipPath: 'polygon(50% 0%, 100% 40%, 75% 100%, 25% 100%, 0% 40%)',
|
1003
|
+
mixBlendMode: 'screen',
|
1004
|
+
} }),
|
1005
|
+
React.createElement("div", { style: {
|
1006
|
+
position: 'absolute',
|
1007
|
+
width: '30%',
|
1008
|
+
height: '30%',
|
1009
|
+
top: '20%',
|
1010
|
+
left: '35%',
|
1011
|
+
background: 'radial-gradient(circle, rgba(255, 255, 255, 0.8), transparent)',
|
1012
|
+
borderRadius: '50%',
|
1013
|
+
filter: 'blur(2px)',
|
1014
|
+
} })));
|
1015
|
+
};
|
1016
|
+
|
1017
|
+
const defaultColors = ['#D2691E', '#CD853F', '#8B4513', '#A0522D', '#FF8C00', '#FF6347'];
|
1018
|
+
const createLeafParticles = (origin, config) => {
|
1019
|
+
const { particleCount = 10, colors = defaultColors, elementSize = 25 } = config;
|
1020
|
+
const particles = [];
|
1021
|
+
for (let i = 0; i < particleCount; i++) {
|
1022
|
+
particles.push({
|
1023
|
+
id: generateId(),
|
1024
|
+
x: origin.x + randomInRange(-100, 100),
|
1025
|
+
y: origin.y + randomInRange(-50, 0),
|
1026
|
+
vx: randomInRange(-1, 1),
|
1027
|
+
vy: randomInRange(0.5, 2),
|
1028
|
+
life: config.lifetime || 300,
|
1029
|
+
opacity: 1,
|
1030
|
+
size: randomInRange(elementSize * 0.6, elementSize),
|
1031
|
+
// Encode tumble phase (0-360), sway phase (0-360), and sway amount (20-40) + rotation speed (-3 to 3)
|
1032
|
+
rotation: Math.floor(randomInRange(0, 360)) +
|
1033
|
+
(Math.floor(randomInRange(0, 360)) * 1000) +
|
1034
|
+
(Math.floor(randomInRange(20, 40)) * 1000000) +
|
1035
|
+
((Math.floor(randomInRange(-3, 3)) + 3) * 100000000),
|
1036
|
+
color: getRandomColor(colors),
|
1037
|
+
});
|
1038
|
+
}
|
1039
|
+
return particles;
|
1040
|
+
};
|
1041
|
+
const renderLeafParticle = (particle) => {
|
1042
|
+
// Extract encoded values
|
1043
|
+
const tumblePhase = particle.rotation % 1000;
|
1044
|
+
const swayPhase = Math.floor((particle.rotation % 1000000) / 1000);
|
1045
|
+
const swayAmount = Math.floor((particle.rotation % 100000000) / 1000000);
|
1046
|
+
const rotationSpeed = (Math.floor(particle.rotation / 100000000) - 3);
|
1047
|
+
// 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;
|
1050
|
+
const rotation = (Date.now() * rotationSpeed * 0.01 + tumble) % 360;
|
1051
|
+
return (React.createElement("div", { key: particle.id, style: {
|
1052
|
+
width: `${particle.size}px`,
|
1053
|
+
height: `${particle.size}px`,
|
1054
|
+
position: 'relative',
|
1055
|
+
transform: `translateX(${swayX}px) rotate(${rotation}deg)`,
|
1056
|
+
} },
|
1057
|
+
React.createElement("svg", { width: particle.size, height: particle.size, viewBox: `-${particle.size / 2} -${particle.size / 2} ${particle.size} ${particle.size}`, style: {
|
1058
|
+
position: 'absolute',
|
1059
|
+
top: 0,
|
1060
|
+
left: 0,
|
1061
|
+
} },
|
1062
|
+
React.createElement("path", { d: `
|
1063
|
+
M 0,-${particle.size / 2}
|
1064
|
+
C -${particle.size / 3},-${particle.size / 3} -${particle.size / 3},${particle.size / 3} 0,${particle.size / 2}
|
1065
|
+
C ${particle.size / 3},${particle.size / 3} ${particle.size / 3},-${particle.size / 3} 0,-${particle.size / 2}
|
1066
|
+
`, fill: particle.color, opacity: "0.9" }),
|
1067
|
+
React.createElement("line", { x1: "0", y1: -particle.size / 2, x2: "0", y2: particle.size / 2, stroke: "#8B4513", strokeWidth: "1", opacity: "0.5" }),
|
1068
|
+
React.createElement("line", { x1: "0", y1: -particle.size / 4, x2: -particle.size / 4, y2: -particle.size / 8, stroke: "#8B4513", strokeWidth: "0.5", opacity: "0.5" }),
|
1069
|
+
React.createElement("line", { x1: "0", y1: -particle.size / 4, x2: particle.size / 4, y2: -particle.size / 8, stroke: "#8B4513", strokeWidth: "0.5", opacity: "0.5" }),
|
1070
|
+
React.createElement("line", { x1: "0", y1: particle.size / 4, x2: -particle.size / 4, y2: particle.size / 8, stroke: "#8B4513", strokeWidth: "0.5", opacity: "0.5" }),
|
1071
|
+
React.createElement("line", { x1: "0", y1: particle.size / 4, x2: particle.size / 4, y2: particle.size / 8, stroke: "#8B4513", strokeWidth: "0.5", opacity: "0.5" }))));
|
1072
|
+
};
|
1073
|
+
|
937
1074
|
const animations = {
|
938
1075
|
confetti: {
|
939
1076
|
createParticles: createConfettiParticles,
|
@@ -971,10 +1108,6 @@ const animations = {
|
|
971
1108
|
createParticles: createCoinParticles,
|
972
1109
|
renderParticle: renderCoinParticle,
|
973
1110
|
},
|
974
|
-
lightning: {
|
975
|
-
createParticles: createLightningParticles,
|
976
|
-
renderParticle: renderLightningParticle,
|
977
|
-
},
|
978
1111
|
petals: {
|
979
1112
|
createParticles: createPetalParticles,
|
980
1113
|
renderParticle: renderPetalParticle,
|
@@ -991,10 +1124,6 @@ const animations = {
|
|
991
1124
|
createParticles: createPaintParticles,
|
992
1125
|
renderParticle: renderPaintParticle,
|
993
1126
|
},
|
994
|
-
music: {
|
995
|
-
createParticles: createMusicParticles,
|
996
|
-
renderParticle: renderMusicParticle,
|
997
|
-
},
|
998
1127
|
balloons: {
|
999
1128
|
createParticles: createBalloonParticles,
|
1000
1129
|
renderParticle: renderBalloonParticle,
|
@@ -1003,6 +1132,22 @@ const animations = {
|
|
1003
1132
|
createParticles: createGalaxyParticles,
|
1004
1133
|
renderParticle: renderGalaxyParticle,
|
1005
1134
|
},
|
1135
|
+
glitch: {
|
1136
|
+
createParticles: createGlitchParticles,
|
1137
|
+
renderParticle: renderGlitchParticle,
|
1138
|
+
},
|
1139
|
+
magicdust: {
|
1140
|
+
createParticles: createMagicDustParticles,
|
1141
|
+
renderParticle: renderMagicDustParticle,
|
1142
|
+
},
|
1143
|
+
crystals: {
|
1144
|
+
createParticles: createCrystalParticles,
|
1145
|
+
renderParticle: renderCrystalParticle,
|
1146
|
+
},
|
1147
|
+
leaves: {
|
1148
|
+
createParticles: createLeafParticles,
|
1149
|
+
renderParticle: renderLeafParticle,
|
1150
|
+
},
|
1006
1151
|
};
|
1007
1152
|
|
1008
1153
|
const useReward = (elementId, animationType, config) => {
|