festive-effects 1.0.3 → 1.1.1
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 +20 -3
- package/dist/animations/compositeAnimations.d.ts +50 -0
- package/dist/components/FestiveEffects.d.ts +0 -16
- package/dist/effects/index.d.ts +1 -1
- package/dist/index.d.ts +47 -19
- package/dist/index.esm.js +222 -73
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +221 -72
- package/dist/index.js.map +1 -1
- package/dist/modes/InteractiveMode.d.ts +31 -0
- package/dist/modes/index.d.ts +2 -0
- package/dist/particles/index.d.ts +1 -1
- package/dist/types/index.d.ts +46 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,9 +40,9 @@ function App() {
|
|
|
40
40
|
|
|
41
41
|
## 🎨 Available Festivals
|
|
42
42
|
|
|
43
|
-
| Festival | Prop Value | Effect |
|
|
44
|
-
|
|
45
|
-
| 🎄 Christmas | `christmas` | Falling snowflakes |
|
|
43
|
+
| Festival | Prop Value | Effect | Particles |
|
|
44
|
+
|----------|------------|--------|----------|
|
|
45
|
+
| 🎄 Christmas | `christmas` | Falling snowflakes | snowflake, gift, star |
|
|
46
46
|
| 🎆 New Year | `newyear` | Fireworks & confetti |
|
|
47
47
|
| 💝 Valentine | `valentine` | Floating hearts |
|
|
48
48
|
| 🐰 Easter | `easter` | Eggs & flowers |
|
|
@@ -65,6 +65,7 @@ function App() {
|
|
|
65
65
|
| `zIndex` | `number` | `9999` | CSS z-index of overlay |
|
|
66
66
|
| `respectReducedMotion` | `boolean` | `true` | Honor user's motion preferences |
|
|
67
67
|
| `colors` | `string[]` | festival default | Custom color palette |
|
|
68
|
+
| `particleTypes` | `ParticleType[]` | festival default | Override which particles to show |
|
|
68
69
|
|
|
69
70
|
## 📖 Examples
|
|
70
71
|
|
|
@@ -101,6 +102,22 @@ function App() {
|
|
|
101
102
|
/>
|
|
102
103
|
```
|
|
103
104
|
|
|
105
|
+
### Filter Particle Types (New in 1.1.0)
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
// Only snowflakes
|
|
109
|
+
<FestiveEffects
|
|
110
|
+
festival="christmas"
|
|
111
|
+
particleTypes={['snowflake']}
|
|
112
|
+
/>
|
|
113
|
+
|
|
114
|
+
// Snowflakes + gifts (no stars)
|
|
115
|
+
<FestiveEffects
|
|
116
|
+
festival="christmas"
|
|
117
|
+
particleTypes={['snowflake', 'gift']}
|
|
118
|
+
/>
|
|
119
|
+
```
|
|
120
|
+
|
|
104
121
|
### Conditional Rendering
|
|
105
122
|
|
|
106
123
|
```tsx
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Variants, Transition } from 'framer-motion';
|
|
2
|
+
import type { AnimationCustomData } from './index';
|
|
3
|
+
/**
|
|
4
|
+
* Burst animation variants
|
|
5
|
+
* Particles burst from click/center then fade with gravity
|
|
6
|
+
* Combines explosive outward motion with falling behavior
|
|
7
|
+
*/
|
|
8
|
+
export declare const burstVariants: Variants;
|
|
9
|
+
/**
|
|
10
|
+
* Get transition for burst animation
|
|
11
|
+
*/
|
|
12
|
+
export declare function getBurstTransition(custom: AnimationCustomData): Transition;
|
|
13
|
+
/**
|
|
14
|
+
* Spiral animation variants
|
|
15
|
+
* Particles spiral outward/inward from center
|
|
16
|
+
* Creates a hypnotic vortex effect
|
|
17
|
+
*/
|
|
18
|
+
export declare const spiralVariants: Variants;
|
|
19
|
+
/**
|
|
20
|
+
* Get transition for spiral animation
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSpiralTransition(custom: AnimationCustomData): Transition;
|
|
23
|
+
/**
|
|
24
|
+
* Wave animation variants
|
|
25
|
+
* Particles move in wave patterns (sine/cosine motion)
|
|
26
|
+
* Creates flowing, organic movement
|
|
27
|
+
*/
|
|
28
|
+
export declare const waveVariants: Variants;
|
|
29
|
+
/**
|
|
30
|
+
* Get transition for wave animation
|
|
31
|
+
*/
|
|
32
|
+
export declare function getWaveTransition(custom: AnimationCustomData): Transition;
|
|
33
|
+
/**
|
|
34
|
+
* Twinkle animation variants
|
|
35
|
+
* Random opacity flickering for stars/sparks
|
|
36
|
+
* Creates a shimmering, magical effect
|
|
37
|
+
*/
|
|
38
|
+
export declare const twinkleVariants: Variants;
|
|
39
|
+
/**
|
|
40
|
+
* Get transition for twinkle animation
|
|
41
|
+
*/
|
|
42
|
+
export declare function getTwinkleTransition(custom: AnimationCustomData): Transition;
|
|
43
|
+
/**
|
|
44
|
+
* Get animation props for composite animation types
|
|
45
|
+
*/
|
|
46
|
+
export declare function getCompositeAnimationProps(animationType: 'burst' | 'spiral' | 'wave' | 'twinkle', custom: AnimationCustomData): {
|
|
47
|
+
initial: Record<string, unknown>;
|
|
48
|
+
animate: Record<string, unknown>;
|
|
49
|
+
transition: Transition;
|
|
50
|
+
};
|
|
@@ -1,19 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { FestiveEffectsProps } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* FestiveEffects - Main component for rendering festival-themed visual effects
|
|
5
|
-
*
|
|
6
|
-
* Renders a full-screen overlay with animated particles for various festivals.
|
|
7
|
-
* Uses Framer Motion for smooth, GPU-accelerated animations.
|
|
8
|
-
*
|
|
9
|
-
* Features:
|
|
10
|
-
* - Automatic cleanup of timeouts and event listeners on unmount
|
|
11
|
-
* - Pauses animations when browser tab is not visible (performance optimization)
|
|
12
|
-
* - Respects user's reduced motion preferences
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* <FestiveEffects festival="christmas" intensity="medium" />
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
3
|
export declare const FestiveEffects: React.FC<FestiveEffectsProps>;
|
package/dist/effects/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FestivalType, ParticleData, Viewport } from '../types';
|
|
1
2
|
export { ChristmasEffect, generateChristmasParticles, CHRISTMAS_CONFIG } from './ChristmasEffect';
|
|
2
3
|
export { NewYearEffect, generateNewYearParticles, NEWYEAR_CONFIG } from './NewYearEffect';
|
|
3
4
|
export { ValentineEffect, generateValentineParticles, VALENTINE_CONFIG } from './ValentineEffect';
|
|
@@ -10,6 +11,5 @@ export { HoliEffect, generateHoliParticles, HOLI_CONFIG } from './HoliEffect';
|
|
|
10
11
|
export { EidEffect, generateEidParticles, EID_CONFIG } from './EidEffect';
|
|
11
12
|
export { StPatricksEffect, generateStPatricksParticles, STPATRICKS_CONFIG } from './StPatricksEffect';
|
|
12
13
|
export { IndependenceEffect, generateIndependenceParticles, INDEPENDENCE_CONFIG } from './IndependenceEffect';
|
|
13
|
-
import type { FestivalType, ParticleData, Viewport } from '../types';
|
|
14
14
|
export type EffectGenerator = (count: number, viewport: Viewport, colors?: string[]) => ParticleData[];
|
|
15
15
|
export declare const EFFECT_GENERATORS: Record<FestivalType, EffectGenerator>;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,14 @@ declare const FESTIVAL_TYPES: FestivalType[];
|
|
|
13
13
|
* Intensity levels for particle effects
|
|
14
14
|
*/
|
|
15
15
|
type IntensityLevel = 'low' | 'medium' | 'high';
|
|
16
|
+
/**
|
|
17
|
+
* Interactive modes for particle effects
|
|
18
|
+
*/
|
|
19
|
+
type InteractiveMode = 'onHover' | 'onClick' | 'follow' | 'repel';
|
|
20
|
+
/**
|
|
21
|
+
* Particle layer for depth perception (parallax effect)
|
|
22
|
+
*/
|
|
23
|
+
type ParticleLayer = 'far' | 'mid' | 'near';
|
|
16
24
|
/**
|
|
17
25
|
* Props for the main FestiveEffects component
|
|
18
26
|
*/
|
|
@@ -29,6 +37,34 @@ interface FestiveEffectsProps {
|
|
|
29
37
|
respectReducedMotion?: boolean;
|
|
30
38
|
/** Custom colors to override default festival colors */
|
|
31
39
|
colors?: string[];
|
|
40
|
+
/** Override which particle types to show (e.g., ['snowflake', 'gift']) */
|
|
41
|
+
particleTypes?: ParticleType[];
|
|
42
|
+
/** Interactive mode for particle behavior */
|
|
43
|
+
interactiveMode?: InteractiveMode;
|
|
44
|
+
/** Particle density multiplier (overrides intensity) */
|
|
45
|
+
particleDensity?: number;
|
|
46
|
+
/** Delay before effect starts (ms) */
|
|
47
|
+
startDelay?: number;
|
|
48
|
+
/** Fade in duration (ms) */
|
|
49
|
+
fadeIn?: number;
|
|
50
|
+
/** Fade out duration (ms) */
|
|
51
|
+
fadeOut?: number;
|
|
52
|
+
/** Origin point for particles */
|
|
53
|
+
origin?: {
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
} | 'center' | 'mouse';
|
|
57
|
+
/** Bounding box to contain particles */
|
|
58
|
+
boundingBox?: {
|
|
59
|
+
top: number;
|
|
60
|
+
left: number;
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
};
|
|
64
|
+
/** Callback when duration ends */
|
|
65
|
+
onComplete?: () => void;
|
|
66
|
+
/** Callback when particles spawn */
|
|
67
|
+
onParticleSpawn?: (count: number) => void;
|
|
32
68
|
}
|
|
33
69
|
/**
|
|
34
70
|
* Settings for each intensity level
|
|
@@ -55,11 +91,11 @@ interface PhysicsConfig {
|
|
|
55
91
|
/**
|
|
56
92
|
* All particle types available for effects
|
|
57
93
|
*/
|
|
58
|
-
type ParticleType = 'snowflake' | 'firework' | 'confetti' | 'spark' | 'heart' | 'egg' | 'flower' | 'bat' | 'pumpkin' | 'spider' | 'leaf' | 'diya' | 'rangoli' | 'lantern' | 'dragon' | 'color-splash' | 'moon' | 'star' | 'shamrock' | 'rainbow';
|
|
94
|
+
type ParticleType = 'snowflake' | 'firework' | 'confetti' | 'spark' | 'heart' | 'egg' | 'flower' | 'bat' | 'pumpkin' | 'spider' | 'leaf' | 'diya' | 'rangoli' | 'lantern' | 'dragon' | 'color-splash' | 'moon' | 'star' | 'shamrock' | 'rainbow' | 'cracker' | 'ribbon' | 'gift' | 'candle';
|
|
59
95
|
/**
|
|
60
96
|
* Animation types for particle effects
|
|
61
97
|
*/
|
|
62
|
-
type AnimationType = 'fall' | 'rise' | 'explode' | 'float' | 'scatter';
|
|
98
|
+
type AnimationType = 'fall' | 'rise' | 'explode' | 'float' | 'scatter' | 'burst' | 'spiral' | 'wave' | 'twinkle';
|
|
63
99
|
/**
|
|
64
100
|
* Configuration for a festival effect
|
|
65
101
|
*/
|
|
@@ -104,6 +140,10 @@ interface ParticleData {
|
|
|
104
140
|
duration: number;
|
|
105
141
|
/** Additional custom properties for animation */
|
|
106
142
|
custom: Record<string, unknown>;
|
|
143
|
+
/** Particle layer for depth perception */
|
|
144
|
+
layer?: ParticleLayer;
|
|
145
|
+
/** Whether glow effect is enabled */
|
|
146
|
+
hasGlow?: boolean;
|
|
107
147
|
}
|
|
108
148
|
/**
|
|
109
149
|
* Framer Motion animation configuration
|
|
@@ -144,24 +184,12 @@ interface ParticleProps {
|
|
|
144
184
|
type: ParticleType;
|
|
145
185
|
/** Animation configuration */
|
|
146
186
|
animationConfig: AnimationConfig;
|
|
187
|
+
/** Particle layer */
|
|
188
|
+
layer?: ParticleLayer;
|
|
189
|
+
/** Glow effect enabled */
|
|
190
|
+
hasGlow?: boolean;
|
|
147
191
|
}
|
|
148
192
|
|
|
149
|
-
/**
|
|
150
|
-
* FestiveEffects - Main component for rendering festival-themed visual effects
|
|
151
|
-
*
|
|
152
|
-
* Renders a full-screen overlay with animated particles for various festivals.
|
|
153
|
-
* Uses Framer Motion for smooth, GPU-accelerated animations.
|
|
154
|
-
*
|
|
155
|
-
* Features:
|
|
156
|
-
* - Automatic cleanup of timeouts and event listeners on unmount
|
|
157
|
-
* - Pauses animations when browser tab is not visible (performance optimization)
|
|
158
|
-
* - Respects user's reduced motion preferences
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* ```tsx
|
|
162
|
-
* <FestiveEffects festival="christmas" intensity="medium" />
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
165
193
|
declare const FestiveEffects: React.FC<FestiveEffectsProps>;
|
|
166
194
|
|
|
167
195
|
/**
|
|
@@ -183,7 +211,7 @@ declare function getParticleCount(baseCount: number, intensity?: IntensityLevel)
|
|
|
183
211
|
declare const FESTIVAL_CONFIGS: Record<FestivalType, FestivalConfig>;
|
|
184
212
|
|
|
185
213
|
/**
|
|
186
|
-
* SVG definitions for all
|
|
214
|
+
* SVG definitions for all 22 particle types
|
|
187
215
|
* Each SVG is designed to work with currentColor for dynamic coloring
|
|
188
216
|
*/
|
|
189
217
|
declare const PARTICLE_SVGS: Record<ParticleType, string>;
|