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