<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: aka_andy780</title>
    <description>The latest articles on DEV Community by aka_andy780 (@anushkaisuranga).</description>
    <link>https://dev.to/anushkaisuranga</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3606002%2Ffe739911-1431-4765-8648-e8e9f0f30e63.jpeg</url>
      <title>DEV Community: aka_andy780</title>
      <link>https://dev.to/anushkaisuranga</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anushkaisuranga"/>
    <language>en</language>
    <item>
      <title>🧩 How I Built a Lightweight Scroll Animation Library for React</title>
      <dc:creator>aka_andy780</dc:creator>
      <pubDate>Tue, 11 Nov 2025 14:31:26 +0000</pubDate>
      <link>https://dev.to/anushkaisuranga/how-i-built-a-lightweight-scroll-animation-library-for-react-18f0</link>
      <guid>https://dev.to/anushkaisuranga/how-i-built-a-lightweight-scroll-animation-library-for-react-18f0</guid>
      <description>&lt;p&gt;When I started building my personal website, I wanted it to feel a little more alive. I didn’t want everything to just appear instantly. I wanted sections to slide in as you scroll, text to fade in at the right moment, and that smooth sense of motion that makes a site feel polished.&lt;/p&gt;

&lt;p&gt;At first, I tried doing it with inline CSS animations, but it got messy fast. Every new component meant more lines of code, more tweaks, and more inconsistency. What I really wanted was something reusable — a clean React component I could drop anywhere and say, “animate this when it comes into view.”&lt;/p&gt;

&lt;p&gt;I hadn’t heard about animation libraries like Framer Motion or React Spring yet. So I decided to figure it out myself. I started small, using the IntersectionObserver API to detect when elements enter the viewport, and then added a few transition effects.&lt;/p&gt;

&lt;p&gt;That little experiment turned into two reusable components that I’ve been using in almost every project since.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚙️ The idea
&lt;/h2&gt;

&lt;p&gt;The goal was simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep it light and dependency-free&lt;/li&gt;
&lt;li&gt;Make it easy to customize direction, delay, duration, and easing&lt;/li&gt;
&lt;li&gt;Let it work automatically when something becomes visible&lt;/li&gt;
&lt;li&gt;Make it reusable so I could drop it anywhere&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I built two components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AnimatedElement&lt;/strong&gt; – for single items&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AnimationSequence&lt;/strong&gt; – for staggering multiple elements one after another&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They rely entirely on the browser’s built-in IntersectionObserver, which watches when something enters the screen. When it does, the component fades or slides it in with smooth transitions. No external libraries, no extra setup.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🎬 The result: React Scroll Reveal&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After refining and reusing it across projects, I turned it into a small public library called&lt;br&gt;
&lt;a href="https://github.com/AnushkaIsuranga/React_Scroll_Reveal" rel="noopener noreferrer"&gt;👉 React Scroll Reveal&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With just a few lines, you can animate any element as it comes into view:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { AnimatedElement, AnimationSequence } from "react-scroll-reveal";

function Example() {
  return (
    &amp;lt;AnimationSequence direction="up" baseDelay={200} staggerDelay={150}&amp;gt;
      &amp;lt;h2&amp;gt;Hello World&amp;lt;/h2&amp;gt;
      &amp;lt;p&amp;gt;This fades in from below when scrolled into view.&amp;lt;/p&amp;gt;
    &amp;lt;/AnimationSequence&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it. No setup, no heavy libraries.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Why it’s worth checking out?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;It’s lightweight and doesn’t depend on any other animation tools.&lt;/li&gt;
&lt;li&gt;It’s fully customizable — direction, delay, distance, duration, and easing.&lt;/li&gt;
&lt;li&gt;It’s accessible, respecting the user’s motion preferences.&lt;/li&gt;
&lt;li&gt;It works with any React setup, whether that’s Create React App, Next.js, or Vite.&lt;/li&gt;
&lt;li&gt;Because it uses basic CSS transitions and native browser APIs, it’s smooth even on low-end devices.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  🚀 What’s next
&lt;/h2&gt;

&lt;p&gt;I’m planning to add parallax-style effects and new animation presets in the future.&lt;br&gt;
If you want to contribute, suggest features, or just try it out, the repo is open and active:&lt;/p&gt;

&lt;p&gt;🔗 &lt;a href="https://github.com/AnushkaIsuranga/React_Scroll_Reveal" rel="noopener noreferrer"&gt;GitHub: React Scroll Reveal&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ✨ Final thought
&lt;/h2&gt;

&lt;p&gt;This project started because I wanted my personal site to look a bit nicer. I didn’t expect it to become a library that I’d reuse everywhere. Sometimes the tools you build for yourself end up being the most valuable ones to share.&lt;/p&gt;

&lt;p&gt;If you love working with React and care about small, subtle details in your UI, I’d love for you to check it out and tell me what you think.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
