@sarthak03dot/romantic-animations 1.0.3 โ†’ 1.2.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 CHANGED
@@ -1,40 +1,327 @@
1
- # romantic-animations ๐Ÿ’–
1
+ # ๐Ÿ’– Romantic Animations v1.2.0
2
2
 
3
- A beautiful JavaScript library for romantic particle effects such as floating hearts, heart trails, love bursts, and more. Perfect for Valentine's Day, wedding websites, or any love-themed project.
3
+ <p align="center">
4
+ <b>A premium, lightweight, zero-dependency JavaScript canvas particle library for gorgeous romantic & celebratory effects.</b>
5
+ </p>
4
6
 
5
- ## โœจ Features
6
- - โค๏ธ Floating hearts animation
7
- - ๐Ÿ’˜ Easy to integrate
8
- - ๐Ÿ“ฆ Zero dependencies
9
- - โš™๏ธ Fully customizable (soon)
7
+ <p align="center">
8
+ Perfect for Valentine's Day, weddings, anniversaries, landing pages, or any celebratory web application needing high-quality hardware-accelerated visual particle overlays.
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/@sarthak03dot/romantic-animations">
13
+ <img src="https://img.shields.io/npm/v/@sarthak03dot/romantic-animations.svg" alt="NPM Version" />
14
+ </a>
15
+ <a href="https://opensource.org/licenses/MIT">
16
+ <img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" />
17
+ </a>
18
+ <a href="https://sarthak03dot.github.io/romantic-animations/">
19
+ <img src="https://img.shields.io/badge/Demo-Interactive%20Showcase-ff4d6d.svg" alt="Interactive Showcase" />
20
+ </a>
21
+ </p>
22
+
23
+ ---
24
+
25
+ ## ๐Ÿ–ผ๏ธ Gallery & Screenshots (Placeholder Previews)
26
+
27
+ Here is a sneak peek at the gorgeous, performance-tuned particle renderers in action.
28
+ *(You can swap these placeholders with your actual screenshots in `docs/screenshots/`)*
29
+
30
+ <div align="center">
31
+ <h3>โœจ Floating Hearts & Live Tweaks</h3>
32
+ <img src="https://placehold.co/800x450/1e1e24/ff4d6d?text=Preview:+Floating+Hearts+Effect" width="800" alt="Floating Hearts Effect Preview" style="border-radius: 12px; border: 1px solid rgba(255, 77, 109, 0.2); margin-bottom: 20px;" />
33
+
34
+ <h3>๐ŸŽ† Starry Fireworks Celebration</h3>
35
+ <img src="https://placehold.co/800x450/0f0f16/c77dff?text=Preview:+Starry+Fireworks+Effect" width="800" alt="Starry Fireworks Effect Preview" style="border-radius: 12px; border: 1px solid rgba(199, 125, 255, 0.2); margin-bottom: 20px;" />
36
+
37
+ <h3>๐Ÿ“š Integrated Live Customizer & Developer Portal</h3>
38
+ <img src="https://placehold.co/800x450/faf9ff/028090?text=Preview:+Light+Theme+Developer+Portal" width="800" alt="Light Theme Developer Portal Preview" style="border-radius: 12px; border: 1px solid rgba(2, 128, 144, 0.2);" />
39
+ </div>
40
+
41
+ ---
42
+
43
+ ## ๐Ÿš€ Key Features
44
+
45
+ * ๐Ÿš€ **High Performance & Zero Dependencies**: Built directly on raw HTML5 `<canvas>` API with optimal mathematical loop calculations (`requestAnimationFrame`), keeping your bundle size extremely small.
46
+ * ๐ŸŒ“ **Responsive Dual-Theme Customizer**: Fully styled and responsive landing page that seamlessly toggles between a neon-drenched **Dark Mode** and a clean, high-contrast **Light Mode** for accessibility.
47
+ * ๐Ÿ“ฑ **Touch & Mobile Optimizations**: Fully responsive drawer nav overlays, click-burst triggers for tapping screens, and custom mobile menu structures.
48
+ * ๐Ÿ“š **Collapsible Developer Portal**: Hash-routed playground switcher containing dynamic CDN, Vanilla, React, and Next.js SSR setups.
49
+
50
+ ---
10
51
 
11
52
  ## ๐Ÿ“ฆ Installation
53
+
54
+ To begin adding romantic canvas overlays to your codebase:
55
+
12
56
  ```bash
13
- npm install romantic-animations
57
+ # Using npm
58
+ npm install @sarthak03dot/romantic-animations
59
+
60
+ # Using pnpm
61
+ pnpm add @sarthak03dot/romantic-animations
62
+
63
+ # Using yarn
64
+ yarn add @sarthak03dot/romantic-animations
14
65
  ```
15
66
 
16
- ## ๐Ÿš€ Usage
67
+ ---
68
+
69
+ ## โœจ Available Animations & API reference
70
+
71
+ Each animation function returns a unique **`sessionId`** string. Keep this reference to stop or update the animation loops when pages change.
72
+
73
+ ### 1. `startFloatingHearts(container, options)`
74
+ Rises hearts from the bottom edge of the container that drift sideways via a sinusoidal wave.
75
+ * **Best for**: Romantic background ambient atmosphere.
76
+ * **Special options**:
77
+ * `count`: Particle spawning density multiplier (`0.01` to `1.0`, default `0.15`).
78
+
79
+ ### 2. `startHeartTrail(container, options)`
80
+ Leaves a beautiful floating heart trail trailing directly behind the mouse pointer or fingertip touches.
81
+ * **Best for**: High-user-interaction sections.
82
+ * **Special options**:
83
+ * `maxSize`: Tail sizing bounds.
84
+
85
+ ### 3. `startHeartBurst(container, options)`
86
+ Spawns explosive, colorful shockwaves of hearts, stars, or sparkles radiating outwards from a click/tap coordinate.
87
+ * **Best for**: Interactive buttons, click rewards, and anniversary triggers.
88
+
89
+ ### 4. `startSparkles(container, options)`
90
+ Twinkling 4-point cross sparkles that gently float down, simulating glowing fairy dust.
91
+ * **Best for**: Mystical theme overlays.
92
+
93
+ ### 5. `startLoveRain(container, options)`
94
+ A falling downpour of romantic emojis (`๐Ÿ’–`, `๐Ÿ’•`, `๐ŸŒธ`, etc.) and hearts drifting on wind vectors.
95
+ * **Best for**: Wedding banners and celebration announcements.
96
+
97
+ ### 6. `startConfetti(container, options)`
98
+ Celebration ribbons and flakes launched from the screen edges falling under the influence of gravity, rotational twist, and drag.
99
+ * **Best for**: Checkout success, checkout completions, or birthday triggers.
100
+
101
+ ### 7. `startFireworks(container, options)`
102
+ Auto-firing rockets launching upwards, leaving trail paths before bursting into colorful star coordinate arrays.
103
+ * **Best for**: Festivities and new-year celebrations.
104
+
105
+ ### 8. `startStarField(container, options)`
106
+ An interactive warp speed stellar coordinate system drawing sleek geometric line links to nearby stars.
107
+ * **Best for**: Interactive hero pages.
108
+
109
+ ### 9. `startButterflies(container, options)`
110
+ Wing-flapping glowing butterfly paths that hover organically with realistic flight drift algorithms.
111
+ * **Best for**: Spring-time landing themes.
112
+
113
+ ### 10. `startMagicDust(container, options)`
114
+ Swirling trails of glittering particles that drift slowly on the screen.
115
+
116
+ ### 11. `startFloatingOrbs(container, options)`
117
+ Large, soft bokeh globes bouncing gently off the screen boundaries.
118
+
119
+ ### 12. `startShootingStars(container, options)`
120
+ Cosmic meteor streaks flashing randomly across the dark skyline.
121
+
122
+ ---
123
+
124
+ ## ๐Ÿ’ป Integration Guides
125
+
126
+ ### 1. Vanilla JavaScript ESM Setup
127
+ Ensure your container is structured to overlap the viewport properly:
128
+
17
129
  ```html
18
- <div id="animation-container"></div>
130
+ <!-- Main Overlay Wrapper -->
131
+ <div id="romantic-canvas-container" style="position: fixed; inset: 0; pointer-events: none; z-index: 9999;"></div>
132
+
19
133
  <script type="module">
20
- import { startFloatingHearts } from 'romantic-animations';
21
- startFloatingHearts("animation-container");
134
+ import { startFloatingHearts } from '@sarthak03dot/romantic-animations';
135
+
136
+ // Spawn romantic drifting hearts
137
+ const sessionId = startFloatingHearts('romantic-canvas-container', {
138
+ count: 0.2,
139
+ minSize: 10,
140
+ maxSize: 30,
141
+ colors: ['#ff4d6d', '#ff85a1', '#e8c1a0'],
142
+ glow: true
143
+ });
22
144
  </script>
23
145
  ```
24
146
 
25
- ## ๐Ÿ“ File Structure
26
- - `src/` โ€“ core engine and animation modules
27
- - `demo/` โ€“ live preview setup using Vite
28
- - `package.json` โ€“ npm config
147
+ ---
148
+
149
+ ### 2. React Components (Zero-Leak Hooks)
150
+ Always clean up your active canvas sessions when components unmount to prevent memory leaks in single-page apps:
151
+
152
+ ```jsx
153
+ import React, { useEffect, useRef } from 'react';
154
+ import { startConfetti, stopAnimation } from '@sarthak03dot/romantic-animations';
155
+
156
+ export const ConfettiCelebration = () => {
157
+ const containerRef = useRef(null);
158
+ const sessionRef = useRef(null);
159
+
160
+ useEffect(() => {
161
+ if (containerRef.current) {
162
+ sessionRef.current = startConfetti(containerRef.current, {
163
+ count: 0.35,
164
+ colors: ['#ff4d6d', '#ff85a1', '#c77dff', '#48cae4']
165
+ });
166
+ }
29
167
 
30
- ## ๐Ÿ”ฎ Upcoming
31
- - ๐Ÿ’ซ Cursor heart trails
32
- - ๐ŸŽ‰ Love confetti bursts
33
- - ๐ŸŒˆ Color customization
34
- - ๐ŸŽจ Preset themes
168
+ // Stop active canvas loops immediately on unmount
169
+ return () => {
170
+ if (sessionRef.current) {
171
+ stopAnimation(sessionRef.current);
172
+ }
173
+ };
174
+ }, []);
175
+
176
+ return (
177
+ <div
178
+ ref={containerRef}
179
+ style={{
180
+ position: 'fixed',
181
+ inset: 0,
182
+ pointerEvents: 'none',
183
+ zIndex: 9999
184
+ }}
185
+ />
186
+ );
187
+ };
188
+ ```
189
+
190
+ ---
191
+
192
+ ### 3. Next.js Client Integrations (SSR Protection)
193
+ Canvas rendering references the global browser `window` object. Guard imports using a client-side execution block:
194
+
195
+ ```jsx
196
+ 'use client';
197
+
198
+ import React, { useEffect } from 'react';
199
+
200
+ export default function LandingPage() {
201
+ useEffect(() => {
202
+ // Dynamic import inside useEffect to safely isolate client-only UMD scripts
203
+ import('@sarthak03dot/romantic-animations').then((lib) => {
204
+ lib.startShootingStars('shooting-stars-overlay', {
205
+ speed: 2.5,
206
+ count: 0.15
207
+ });
208
+ });
209
+ }, []);
210
+
211
+ return (
212
+ <div style={{ position: 'relative', minHeight: '100vh', background: '#0b0c10' }}>
213
+ <div
214
+ id="shooting-stars-overlay"
215
+ style={{
216
+ position: 'absolute',
217
+ inset: 0,
218
+ pointerEvents: 'none',
219
+ zIndex: 10
220
+ }}
221
+ />
222
+ </div>
223
+ );
224
+ }
225
+ ```
226
+
227
+ ---
228
+
229
+ ### 4. Direct Browser UMD CDN Script Integration
230
+ Excellent for quick testing inside simple HTML static assets:
231
+
232
+ ```html
233
+ <!DOCTYPE html>
234
+ <html lang="en">
235
+ <head>
236
+ <meta charset="UTF-8">
237
+ <title>Romantic Page</title>
238
+ </head>
239
+ <body>
240
+ <!-- Canvas overlay -->
241
+ <div id="overlay-container" style="position: fixed; inset: 0; pointer-events: none; z-index: 9999;"></div>
242
+
243
+ <!-- UMD script loading -->
244
+ <script src="https://cdn.jsdelivr.net/npm/@sarthak03dot/romantic-animations@1.2.0/dist/romantic-animations.umd.js"></script>
245
+
246
+ <script>
247
+ // Access via global window namespace
248
+ RomanticAnimations.startSparkles('overlay-container', {
249
+ count: 0.25,
250
+ glow: true
251
+ });
252
+ </script>
253
+ </body>
254
+ </html>
255
+ ```
256
+
257
+ ---
258
+
259
+ ## โš™๏ธ Configuration Properties
260
+
261
+ The second parameter supports rich custom tokens:
262
+
263
+ | Property | Type | Default | Description |
264
+ | :--- | :--- | :--- | :--- |
265
+ | `count` | `Number` | `0.2` | Particle spawn density rate (range: `0.01` to `1.0`). |
266
+ | `minSize` | `Number` | `10` | Minimum particle rendering size in pixels. |
267
+ | `maxSize` | `Number` | `30` | Maximum particle rendering size in pixels. |
268
+ | `colors` | `Array` | `['#ff4d6d']` | List of color hex/rgb strings chosen randomly for particles. |
269
+ | `glow` | `Boolean` | `true` | Enables/disables radial neon drop shadows. |
270
+ | `speed` | `Number` | `1.5` | Particle speed modifier multiplier. |
271
+
272
+ ---
273
+
274
+ ## ๐Ÿงน Session Management & Lifecycle Cleansing
275
+
276
+ Stop active loops cleanly with the lifecycle triggers:
277
+
278
+ ```javascript
279
+ import { startFloatingHearts, stopAnimation, stopAll } from '@sarthak03dot/romantic-animations';
280
+
281
+ // Start session
282
+ const session = startFloatingHearts('canvas-wrapper');
283
+
284
+ // Clean up just this single session
285
+ stopAnimation(session);
286
+
287
+ // Clean up all running canvas loops on the page at once
288
+ stopAll();
289
+ ```
290
+
291
+ ---
292
+
293
+ ## ๐Ÿค Contributing & Running Locally
294
+
295
+ We welcome bug fixes, enhancement requests, and brand new canvas effect implementations!
296
+
297
+ 1. **Fork the Repository** and clone it.
298
+ 2. Install all dev packages:
299
+ ```bash
300
+ npm install
301
+ ```
302
+ 3. Boot the local development server:
303
+ ```bash
304
+ npm run dev
305
+ ```
306
+ 4. Write your gorgeous animation source codes inside `src/animations/` and wire them into the global entry inside `src/index.js`.
307
+ 5. Run the production build validation:
308
+ ```bash
309
+ npm run build
310
+ npm run build:demo
311
+ ```
312
+ 6. Submit a **Pull Request** detailing your upgrades!
313
+
314
+ ---
35
315
 
36
316
  ## ๐Ÿง‘โ€๐Ÿ’ป Author
37
- Made with โค๏ธ by **Sarthak Singh**
317
+
318
+ **Sarthak Singh ๐Ÿ‘‹**
319
+ * Passionate front-end developer crafting interactive canvas web experiences.
320
+ * **Email**: [sarthak03december@gmail.com](mailto:sarthak03december@gmail.com)
321
+ * **GitHub**: [@sarthak03dot](https://github.com/sarthak03dot)
322
+
323
+ ---
38
324
 
39
325
  ## ๐Ÿ“„ License
40
- MIT
326
+
327
+ This repository is licensed under the [MIT License](LICENSE).
package/dist/icon.png ADDED
Binary file