react-scroll-media 1.0.1 → 1.0.2

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.
Files changed (3) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +24 -1
  3. package/package.json +1 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Thanniru Sai Teja
3
+ Copyright (c) 2026 Thanniru Sai Teja
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -23,6 +23,13 @@
23
23
 
24
24
  <br />
25
25
 
26
+ <div align="center">
27
+ <img src="https://github.com/iam-saiteja/react-scroll-media/blob/master/demo.gif?raw=true" alt="React Scroll Media Demo" width="600" />
28
+ <p><em><strong>Above:</strong> A 60fps scroll-driven sequence. The animation frame is tied 1:1 to the scroll position, allowing for instant scrubbing and pausing at any angle.</em></p>
29
+ </div>
30
+
31
+ <br />
32
+
26
33
  ## ✨ Features
27
34
 
28
35
  ### 🚀 **Native Performance**
@@ -539,6 +546,13 @@ Unlike libraries that use `position: fixed` or JS-based scroll locking (which br
539
546
 
540
547
  <br />
541
548
 
549
+ <div align="center">
550
+ <img src="https://github.com/iam-saiteja/react-scroll-media/blob/master/demo-213.gif?raw=true" alt="React Scroll Media Technical Demo" width="600" />
551
+ <p><em><strong>Technical Demo:</strong> This visualization shows the direct correlation between the scrollbar position and the rendered frame. The component calculates the exact frame index based on the percentage of the container scrolled, ensuring perfect synchronization without "scroll jacking".</em></p>
552
+ </div>
553
+
554
+ <br />
555
+
542
556
  ### 🔧 Technical Breakdown
543
557
 
544
558
  1. **Container (`relative`)** — This element has the height you specify (e.g., `300vh`). It occupies space in the document flow.
@@ -553,7 +567,16 @@ Unlike libraries that use `position: fixed` or JS-based scroll locking (which br
553
567
  progress = -containerRect.top / (containerHeight - viewportHeight)
554
568
  ```
555
569
 
556
- This gives a precise **0.0 to 1.0** value tied to the pixel position of the scrollbar.
570
+ This gives a precise **0.0 to 1.0** value tied to the pixel position of the scrollbar. This value is then mapped to the corresponding frame index:
571
+
572
+ ```ts
573
+ frameIndex = Math.floor(progress * (totalFrames - 1))
574
+ ```
575
+
576
+ This approach ensures:
577
+ * **Zero Jitter**: The canvas position is handled by the browser's compositor thread (CSS Sticky).
578
+ * **Native Feel**: Momentum scrolling works perfectly on touchpads and mobile.
579
+ * **Exact Sync**: The frame updates are synchronized with the scroll position in a `requestAnimationFrame` loop.
557
580
 
558
581
  <br />
559
582
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-scroll-media",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Production-ready scroll-driven image sequence rendering component for React",
5
5
  "license": "MIT",
6
6
  "author": "Thanniru Sai Teja",