partycles 0.2.0 → 0.3.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/README.md +62 -2
- package/dist/animations/animations/aurora.d.ts +8 -0
- package/dist/animations/animations/aurora.d.ts.map +1 -0
- package/dist/animations/animations/balloons.d.ts +8 -0
- package/dist/animations/animations/balloons.d.ts.map +1 -0
- package/dist/animations/animations/fireflies.d.ts +8 -0
- package/dist/animations/animations/fireflies.d.ts.map +1 -0
- package/dist/animations/animations/galaxy.d.ts +8 -0
- package/dist/animations/animations/galaxy.d.ts.map +1 -0
- package/dist/animations/animations/index.d.ts.map +1 -1
- package/dist/animations/animations/music.d.ts +8 -0
- package/dist/animations/animations/music.d.ts.map +1 -0
- package/dist/animations/animations/paint.d.ts +8 -0
- package/dist/animations/animations/paint.d.ts.map +1 -0
- package/dist/animations/aurora.d.ts +8 -0
- package/dist/animations/aurora.d.ts.map +1 -0
- package/dist/animations/balloons.d.ts +8 -0
- package/dist/animations/balloons.d.ts.map +1 -0
- package/dist/animations/bubbles.esm.js +2 -2
- package/dist/animations/bubbles.esm.js.map +1 -1
- package/dist/animations/bubbles.js +2 -2
- package/dist/animations/bubbles.js.map +1 -1
- package/dist/animations/fireflies.d.ts +8 -0
- package/dist/animations/fireflies.d.ts.map +1 -0
- package/dist/animations/galaxy.d.ts +8 -0
- package/dist/animations/galaxy.d.ts.map +1 -0
- package/dist/animations/music.d.ts +8 -0
- package/dist/animations/music.d.ts.map +1 -0
- package/dist/animations/paint.d.ts +8 -0
- package/dist/animations/paint.d.ts.map +1 -0
- package/dist/animations/types.d.ts +1 -1
- package/dist/animations/types.d.ts.map +1 -1
- package/dist/index.esm.js +488 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +488 -2
- 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 +1 -1
package/dist/index.esm.js
CHANGED
@@ -166,8 +166,8 @@ 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(-2, 2),
|
170
|
+
vy: -randomInRange(startVelocity * 0.3, startVelocity * 0.6),
|
171
171
|
life: config.lifetime || 160,
|
172
172
|
opacity: 0.7,
|
173
173
|
size: randomInRange(elementSize * 0.4, elementSize * 1.2),
|
@@ -472,6 +472,468 @@ const renderPetalParticle = (particle) => {
|
|
472
472
|
} })));
|
473
473
|
};
|
474
474
|
|
475
|
+
const auroraColors = ['#00ff88', '#00ffaa', '#00ddff', '#0099ff', '#0066ff', '#9933ff', '#ff00ff'];
|
476
|
+
const createAuroraParticles = (origin, config) => {
|
477
|
+
const { particleCount = 15, spread = 200, startVelocity = 3, colors = auroraColors, elementSize = 100 } = config;
|
478
|
+
const particles = [];
|
479
|
+
for (let i = 0; i < particleCount; i++) {
|
480
|
+
const angle = (i / particleCount) * spread - spread / 2;
|
481
|
+
const offset = randomInRange(-30, 30);
|
482
|
+
particles.push({
|
483
|
+
id: generateId(),
|
484
|
+
x: origin.x + angle + offset,
|
485
|
+
y: origin.y,
|
486
|
+
vx: randomInRange(-1, 1),
|
487
|
+
vy: -startVelocity,
|
488
|
+
life: config.lifetime || 250,
|
489
|
+
opacity: 0,
|
490
|
+
size: randomInRange(elementSize * 0.8, elementSize * 1.2),
|
491
|
+
rotation: randomInRange(-15, 15),
|
492
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
493
|
+
});
|
494
|
+
}
|
495
|
+
return particles;
|
496
|
+
};
|
497
|
+
const renderAuroraParticle = (particle) => {
|
498
|
+
// Create flowing wave motion
|
499
|
+
const wave = Math.sin(particle.life * 0.05) * 20;
|
500
|
+
const fadeIn = Math.min(1, (250 - particle.life) / 50);
|
501
|
+
const fadeOut = particle.life / 250;
|
502
|
+
const opacity = Math.min(fadeIn, fadeOut) * 0.4;
|
503
|
+
return (React.createElement("div", { key: particle.id, style: {
|
504
|
+
width: `${particle.size}px`,
|
505
|
+
height: `${particle.size * 0.3}px`,
|
506
|
+
position: 'relative',
|
507
|
+
transform: `translateX(${wave}px) rotate(${particle.rotation}deg)`,
|
508
|
+
filter: 'blur(2px)',
|
509
|
+
} },
|
510
|
+
React.createElement("div", { style: {
|
511
|
+
width: '100%',
|
512
|
+
height: '100%',
|
513
|
+
background: `linear-gradient(90deg, transparent, ${particle.color}, transparent)`,
|
514
|
+
borderRadius: '50%',
|
515
|
+
opacity,
|
516
|
+
boxShadow: `0 0 ${particle.size * 0.5}px ${particle.color}`,
|
517
|
+
animation: 'shimmer 2s infinite',
|
518
|
+
} }),
|
519
|
+
React.createElement("div", { style: {
|
520
|
+
position: 'absolute',
|
521
|
+
top: '20%',
|
522
|
+
left: '10%',
|
523
|
+
width: '80%',
|
524
|
+
height: '60%',
|
525
|
+
background: `radial-gradient(ellipse at center, ${particle.color}44, transparent)`,
|
526
|
+
borderRadius: '50%',
|
527
|
+
opacity: opacity * 0.5,
|
528
|
+
filter: 'blur(4px)',
|
529
|
+
} })));
|
530
|
+
};
|
531
|
+
|
532
|
+
const fireflyColors = ['#FFFF99', '#FFFFCC', '#FFFF66', '#FFFFAA'];
|
533
|
+
const createFireflyParticles = (origin, config) => {
|
534
|
+
const { particleCount = 20, spread = 150, startVelocity = 2, colors = fireflyColors, elementSize = 8 } = config;
|
535
|
+
const particles = [];
|
536
|
+
for (let i = 0; i < particleCount; i++) {
|
537
|
+
const angle = randomInRange(0, 360) * (Math.PI / 180);
|
538
|
+
const velocity = randomInRange(startVelocity * 0.3, startVelocity);
|
539
|
+
particles.push({
|
540
|
+
id: generateId(),
|
541
|
+
x: origin.x + randomInRange(-spread / 2, spread / 2),
|
542
|
+
y: origin.y + randomInRange(-20, 20),
|
543
|
+
vx: Math.cos(angle) * velocity,
|
544
|
+
vy: Math.sin(angle) * velocity * 0.5, // More horizontal movement
|
545
|
+
life: config.lifetime || 300,
|
546
|
+
opacity: 0,
|
547
|
+
size: randomInRange(elementSize * 0.6, elementSize),
|
548
|
+
rotation: randomInRange(0, 360), // Used for blink timing
|
549
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
550
|
+
});
|
551
|
+
}
|
552
|
+
return particles;
|
553
|
+
};
|
554
|
+
const renderFireflyParticle = (particle) => {
|
555
|
+
// Create organic floating motion
|
556
|
+
const floatX = Math.sin(particle.life * 0.02 + particle.rotation) * 15;
|
557
|
+
const floatY = Math.cos(particle.life * 0.03 + particle.rotation) * 10;
|
558
|
+
// Blinking effect - each firefly has its own rhythm based on rotation
|
559
|
+
const blinkCycle = Math.sin(particle.life * 0.1 + particle.rotation * 0.1);
|
560
|
+
const isBlinking = blinkCycle > 0.3;
|
561
|
+
const glowIntensity = isBlinking ? 1 : 0.1;
|
562
|
+
// Fade in/out
|
563
|
+
const fadeIn = Math.min(1, (300 - particle.life) / 30);
|
564
|
+
const fadeOut = particle.life / 300;
|
565
|
+
const baseFade = Math.min(fadeIn, fadeOut);
|
566
|
+
return (React.createElement("div", { key: particle.id, style: {
|
567
|
+
width: `${particle.size}px`,
|
568
|
+
height: `${particle.size}px`,
|
569
|
+
position: 'relative',
|
570
|
+
transform: `translate(${floatX}px, ${floatY}px)`,
|
571
|
+
} },
|
572
|
+
React.createElement("div", { style: {
|
573
|
+
width: '100%',
|
574
|
+
height: '100%',
|
575
|
+
background: particle.color,
|
576
|
+
borderRadius: '50%',
|
577
|
+
opacity: baseFade * glowIntensity,
|
578
|
+
boxShadow: `
|
579
|
+
0 0 ${particle.size}px ${particle.color},
|
580
|
+
0 0 ${particle.size * 2}px ${particle.color},
|
581
|
+
0 0 ${particle.size * 3}px ${particle.color}88
|
582
|
+
`,
|
583
|
+
transition: 'opacity 0.3s ease',
|
584
|
+
} }),
|
585
|
+
React.createElement("div", { style: {
|
586
|
+
position: 'absolute',
|
587
|
+
top: '50%',
|
588
|
+
left: '50%',
|
589
|
+
width: `${particle.size * 4}px`,
|
590
|
+
height: `${particle.size * 4}px`,
|
591
|
+
background: `radial-gradient(circle, ${particle.color}44 0%, transparent 70%)`,
|
592
|
+
borderRadius: '50%',
|
593
|
+
transform: 'translate(-50%, -50%)',
|
594
|
+
opacity: baseFade * glowIntensity * 0.5,
|
595
|
+
transition: 'opacity 0.3s ease',
|
596
|
+
} })));
|
597
|
+
};
|
598
|
+
|
599
|
+
const paintColors = ['#FF006E', '#FB5607', '#FFBE0B', '#8338EC', '#3A86FF', '#06FFB4'];
|
600
|
+
const createPaintParticles = (origin, config) => {
|
601
|
+
const { particleCount = 25, spread = 120, startVelocity = 35, colors = paintColors, elementSize = 30 } = config;
|
602
|
+
const particles = [];
|
603
|
+
for (let i = 0; i < particleCount; i++) {
|
604
|
+
const angle = randomInRange(-spread / 2, spread / 2) * (Math.PI / 180);
|
605
|
+
const velocity = randomInRange(startVelocity * 0.5, startVelocity);
|
606
|
+
const isMainSplat = i < 5; // First few particles are bigger splats
|
607
|
+
particles.push({
|
608
|
+
id: generateId(),
|
609
|
+
x: origin.x,
|
610
|
+
y: origin.y,
|
611
|
+
vx: Math.sin(angle) * velocity * (isMainSplat ? 0.3 : 1),
|
612
|
+
vy: -Math.cos(angle) * velocity * 0.7 + (isMainSplat ? 5 : 0),
|
613
|
+
life: config.lifetime || 150,
|
614
|
+
opacity: 1,
|
615
|
+
size: isMainSplat
|
616
|
+
? randomInRange(elementSize * 1.5, elementSize * 2.5)
|
617
|
+
: randomInRange(elementSize * 0.3, elementSize),
|
618
|
+
rotation: randomInRange(0, 360),
|
619
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
620
|
+
});
|
621
|
+
}
|
622
|
+
return particles;
|
623
|
+
};
|
624
|
+
const renderPaintParticle = (particle) => {
|
625
|
+
// Paint splatter gets more stretched as it flies
|
626
|
+
const stretch = 1 + (Math.abs(particle.vx) + Math.abs(particle.vy)) * 0.01;
|
627
|
+
const squish = 1 / stretch;
|
628
|
+
// Drip effect for some particles
|
629
|
+
const isDripping = particle.size > 15 && particle.rotation > 180;
|
630
|
+
const dripLength = isDripping ? particle.size * 0.5 : 0;
|
631
|
+
return (React.createElement("div", { key: particle.id, style: {
|
632
|
+
width: `${particle.size}px`,
|
633
|
+
height: `${particle.size}px`,
|
634
|
+
position: 'relative',
|
635
|
+
transform: `
|
636
|
+
scaleX(${stretch})
|
637
|
+
scaleY(${squish})
|
638
|
+
rotate(${Math.atan2(particle.vy, particle.vx) * 180 / Math.PI}deg)
|
639
|
+
`,
|
640
|
+
} },
|
641
|
+
React.createElement("div", { style: {
|
642
|
+
width: '100%',
|
643
|
+
height: '100%',
|
644
|
+
background: particle.color,
|
645
|
+
borderRadius: '50%',
|
646
|
+
position: 'relative',
|
647
|
+
boxShadow: `inset -2px -2px 4px rgba(0,0,0,0.2)`,
|
648
|
+
} },
|
649
|
+
React.createElement("div", { style: {
|
650
|
+
position: 'absolute',
|
651
|
+
top: '20%',
|
652
|
+
left: '20%',
|
653
|
+
width: '30%',
|
654
|
+
height: '30%',
|
655
|
+
background: particle.color,
|
656
|
+
borderRadius: '50%',
|
657
|
+
opacity: 0.8,
|
658
|
+
transform: `translate(${randomInRange(-5, 5)}px, ${randomInRange(-5, 5)}px)`,
|
659
|
+
} }),
|
660
|
+
React.createElement("div", { style: {
|
661
|
+
position: 'absolute',
|
662
|
+
bottom: '15%',
|
663
|
+
right: '15%',
|
664
|
+
width: '25%',
|
665
|
+
height: '25%',
|
666
|
+
background: particle.color,
|
667
|
+
borderRadius: '50%',
|
668
|
+
opacity: 0.7,
|
669
|
+
} })),
|
670
|
+
isDripping && (React.createElement("div", { style: {
|
671
|
+
position: 'absolute',
|
672
|
+
bottom: `-${dripLength}px`,
|
673
|
+
left: '40%',
|
674
|
+
width: '20%',
|
675
|
+
height: `${dripLength}px`,
|
676
|
+
background: particle.color,
|
677
|
+
borderRadius: '0 0 50% 50%',
|
678
|
+
opacity: 0.9,
|
679
|
+
} }))));
|
680
|
+
};
|
681
|
+
|
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
|
+
const balloonColors = ['#FF006E', '#FB5607', '#FFBE0B', '#8338EC', '#3A86FF', '#06FFB4', '#FF4081'];
|
757
|
+
const createBalloonParticles = (origin, config) => {
|
758
|
+
const { particleCount = 15, spread = 80, startVelocity = 10, colors = balloonColors, elementSize = 35 } = config;
|
759
|
+
const particles = [];
|
760
|
+
for (let i = 0; i < particleCount; i++) {
|
761
|
+
const angle = randomInRange(-spread / 2, spread / 2) * (Math.PI / 180);
|
762
|
+
const velocity = randomInRange(startVelocity * 0.7, startVelocity);
|
763
|
+
particles.push({
|
764
|
+
id: generateId(),
|
765
|
+
x: origin.x + randomInRange(-30, 30),
|
766
|
+
y: origin.y + randomInRange(0, 20),
|
767
|
+
vx: Math.sin(angle) * velocity * 0.2,
|
768
|
+
vy: -velocity * 0.4, // Balloons float up slowly
|
769
|
+
life: config.lifetime || 250,
|
770
|
+
opacity: 0.9,
|
771
|
+
size: randomInRange(elementSize * 0.8, elementSize * 1.2),
|
772
|
+
rotation: randomInRange(-10, 10),
|
773
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
774
|
+
});
|
775
|
+
}
|
776
|
+
return particles;
|
777
|
+
};
|
778
|
+
const renderBalloonParticle = (particle) => {
|
779
|
+
// Gentle swaying motion
|
780
|
+
const sway = Math.sin(particle.life * 0.03) * 15;
|
781
|
+
const bob = Math.sin(particle.life * 0.05) * 5;
|
782
|
+
// Fade out near the end
|
783
|
+
const fadeOut = particle.life > 50 ? 1 : particle.life / 50;
|
784
|
+
return (React.createElement("div", { key: particle.id, style: {
|
785
|
+
width: `${particle.size}px`,
|
786
|
+
height: `${particle.size * 1.2}px`,
|
787
|
+
position: 'relative',
|
788
|
+
transform: `
|
789
|
+
translateX(${sway}px)
|
790
|
+
translateY(${bob}px)
|
791
|
+
rotate(${particle.rotation + sway * 0.2}deg)
|
792
|
+
`,
|
793
|
+
opacity: particle.opacity * fadeOut,
|
794
|
+
} },
|
795
|
+
React.createElement("div", { style: {
|
796
|
+
width: '100%',
|
797
|
+
height: '100%',
|
798
|
+
background: `radial-gradient(circle at 30% 30%, ${particle.color}ee, ${particle.color})`,
|
799
|
+
borderRadius: '50% 50% 50% 50% / 60% 60% 40% 40%',
|
800
|
+
position: 'relative',
|
801
|
+
boxShadow: `
|
802
|
+
inset -5px -5px 10px rgba(0,0,0,0.2),
|
803
|
+
0 4px 8px rgba(0,0,0,0.2)
|
804
|
+
`,
|
805
|
+
} },
|
806
|
+
React.createElement("div", { style: {
|
807
|
+
position: 'absolute',
|
808
|
+
top: '15%',
|
809
|
+
left: '20%',
|
810
|
+
width: '25%',
|
811
|
+
height: '30%',
|
812
|
+
background: 'radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 70%)',
|
813
|
+
borderRadius: '50%',
|
814
|
+
transform: 'rotate(-20deg)',
|
815
|
+
} }),
|
816
|
+
React.createElement("div", { style: {
|
817
|
+
position: 'absolute',
|
818
|
+
bottom: '-5px',
|
819
|
+
left: '50%',
|
820
|
+
transform: 'translateX(-50%)',
|
821
|
+
width: '0',
|
822
|
+
height: '0',
|
823
|
+
borderLeft: '4px solid transparent',
|
824
|
+
borderRight: '4px solid transparent',
|
825
|
+
borderTop: `8px solid ${particle.color}`,
|
826
|
+
} })),
|
827
|
+
React.createElement("svg", { style: {
|
828
|
+
position: 'absolute',
|
829
|
+
top: '100%',
|
830
|
+
left: '50%',
|
831
|
+
transform: 'translateX(-50%)',
|
832
|
+
width: '2px',
|
833
|
+
height: `${particle.size * 2}px`,
|
834
|
+
opacity: 0.6,
|
835
|
+
} },
|
836
|
+
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" }))));
|
837
|
+
};
|
838
|
+
|
839
|
+
const galaxyColors = ['#FFFFFF', '#FFF9C4', '#BBDEFB', '#C5CAE9', '#D1C4E9', '#FFE082', '#FFCCBC'];
|
840
|
+
const createGalaxyParticles = (origin, config) => {
|
841
|
+
const { particleCount = 60, spread = 200, startVelocity = 15, colors = galaxyColors, elementSize = 8 } = config;
|
842
|
+
const particles = [];
|
843
|
+
for (let i = 0; i < particleCount; i++) {
|
844
|
+
// Create spiral distribution
|
845
|
+
const progress = i / particleCount;
|
846
|
+
const spiralAngle = progress * Math.PI * 4; // 2 full rotations
|
847
|
+
const radius = progress * spread;
|
848
|
+
// Add some randomness to make it look natural
|
849
|
+
const angleOffset = randomInRange(-0.3, 0.3);
|
850
|
+
const radiusOffset = randomInRange(-10, 10);
|
851
|
+
const finalAngle = spiralAngle + angleOffset;
|
852
|
+
const finalRadius = radius + radiusOffset;
|
853
|
+
// Position based on spiral
|
854
|
+
const offsetX = Math.cos(finalAngle) * finalRadius;
|
855
|
+
const offsetY = Math.sin(finalAngle) * finalRadius;
|
856
|
+
// Velocity follows the spiral tangent
|
857
|
+
const tangentAngle = finalAngle + Math.PI / 2;
|
858
|
+
const speed = startVelocity * (1 - progress * 0.5); // Outer stars move slower
|
859
|
+
particles.push({
|
860
|
+
id: generateId(),
|
861
|
+
x: origin.x,
|
862
|
+
y: origin.y,
|
863
|
+
vx: Math.cos(tangentAngle) * speed * 0.3 + offsetX * 0.02,
|
864
|
+
vy: Math.sin(tangentAngle) * speed * 0.3 + offsetY * 0.02,
|
865
|
+
life: config.lifetime || 250,
|
866
|
+
opacity: 0,
|
867
|
+
size: randomInRange(elementSize * 0.3, elementSize) * (1 - progress * 0.5), // Smaller at edges
|
868
|
+
rotation: randomInRange(0, 360),
|
869
|
+
color: colors[Math.floor(Math.random() * colors.length)] || colors[0],
|
870
|
+
});
|
871
|
+
}
|
872
|
+
return particles;
|
873
|
+
};
|
874
|
+
const renderGalaxyParticle = (particle) => {
|
875
|
+
// Particles slowly rotate around center while expanding
|
876
|
+
const age = (250 - particle.life) / 250;
|
877
|
+
const expansionRate = 1 + age * 0.5;
|
878
|
+
// Fade in quickly, fade out slowly
|
879
|
+
const fadeIn = Math.min(1, (250 - particle.life) / 30);
|
880
|
+
const fadeOut = particle.life / 250;
|
881
|
+
const opacity = Math.min(fadeIn, fadeOut);
|
882
|
+
// Twinkle effect
|
883
|
+
const twinkle = Math.sin(particle.life * 0.2 + particle.rotation) * 0.3 + 0.7;
|
884
|
+
return (React.createElement("div", { key: particle.id, style: {
|
885
|
+
width: `${particle.size}px`,
|
886
|
+
height: `${particle.size}px`,
|
887
|
+
position: 'relative',
|
888
|
+
transform: `scale(${expansionRate})`,
|
889
|
+
opacity: opacity * twinkle,
|
890
|
+
} },
|
891
|
+
React.createElement("div", { style: {
|
892
|
+
width: '100%',
|
893
|
+
height: '100%',
|
894
|
+
background: particle.color,
|
895
|
+
borderRadius: '50%',
|
896
|
+
boxShadow: `
|
897
|
+
0 0 ${particle.size}px ${particle.color},
|
898
|
+
0 0 ${particle.size * 2}px ${particle.color}88,
|
899
|
+
0 0 ${particle.size * 3}px ${particle.color}44
|
900
|
+
`,
|
901
|
+
position: 'relative',
|
902
|
+
} },
|
903
|
+
React.createElement("div", { style: {
|
904
|
+
position: 'absolute',
|
905
|
+
top: '50%',
|
906
|
+
left: '50%',
|
907
|
+
width: `${particle.size * 3}px`,
|
908
|
+
height: '1px',
|
909
|
+
background: `linear-gradient(90deg, transparent, ${particle.color}, transparent)`,
|
910
|
+
transform: `translate(-50%, -50%) rotate(${particle.rotation}deg)`,
|
911
|
+
opacity: twinkle,
|
912
|
+
} }),
|
913
|
+
React.createElement("div", { style: {
|
914
|
+
position: 'absolute',
|
915
|
+
top: '50%',
|
916
|
+
left: '50%',
|
917
|
+
width: '1px',
|
918
|
+
height: `${particle.size * 3}px`,
|
919
|
+
background: `linear-gradient(180deg, transparent, ${particle.color}, transparent)`,
|
920
|
+
transform: `translate(-50%, -50%) rotate(${particle.rotation}deg)`,
|
921
|
+
opacity: twinkle,
|
922
|
+
} })),
|
923
|
+
particle.size > 5 && (React.createElement("div", { style: {
|
924
|
+
position: 'absolute',
|
925
|
+
top: '50%',
|
926
|
+
left: '50%',
|
927
|
+
width: `${particle.size * 6}px`,
|
928
|
+
height: `${particle.size * 6}px`,
|
929
|
+
background: `radial-gradient(circle, ${particle.color}22 0%, transparent 70%)`,
|
930
|
+
borderRadius: '50%',
|
931
|
+
transform: 'translate(-50%, -50%)',
|
932
|
+
opacity: opacity * 0.3,
|
933
|
+
filter: 'blur(3px)',
|
934
|
+
} }))));
|
935
|
+
};
|
936
|
+
|
475
937
|
const animations = {
|
476
938
|
confetti: {
|
477
939
|
createParticles: createConfettiParticles,
|
@@ -517,6 +979,30 @@ const animations = {
|
|
517
979
|
createParticles: createPetalParticles,
|
518
980
|
renderParticle: renderPetalParticle,
|
519
981
|
},
|
982
|
+
aurora: {
|
983
|
+
createParticles: createAuroraParticles,
|
984
|
+
renderParticle: renderAuroraParticle,
|
985
|
+
},
|
986
|
+
fireflies: {
|
987
|
+
createParticles: createFireflyParticles,
|
988
|
+
renderParticle: renderFireflyParticle,
|
989
|
+
},
|
990
|
+
paint: {
|
991
|
+
createParticles: createPaintParticles,
|
992
|
+
renderParticle: renderPaintParticle,
|
993
|
+
},
|
994
|
+
music: {
|
995
|
+
createParticles: createMusicParticles,
|
996
|
+
renderParticle: renderMusicParticle,
|
997
|
+
},
|
998
|
+
balloons: {
|
999
|
+
createParticles: createBalloonParticles,
|
1000
|
+
renderParticle: renderBalloonParticle,
|
1001
|
+
},
|
1002
|
+
galaxy: {
|
1003
|
+
createParticles: createGalaxyParticles,
|
1004
|
+
renderParticle: renderGalaxyParticle,
|
1005
|
+
},
|
520
1006
|
};
|
521
1007
|
|
522
1008
|
const useReward = (elementId, animationType, config) => {
|