Skip to content

Conversation

@swamimalode07
Copy link

@swamimalode07 swamimalode07 commented Dec 23, 2025

Closes: #828

Fix: Infinite Marquee Animation with Hover Pause

What I Fixed

The marquee animation wasn't truly infinite
it would finish and reset, creating a bad user experience. Background dots were overlapping the buttons, and the animation didn't pause on hover, making it difficult to interact with the buttons and read the text mentioned on the buttons.

Changes Made

Infinite Scrolling:

  • Switched from direct animation prop to useAnimation hook for better programmatic control
  • Increased card duplicates from 3 to 6 sets for seamless looping
  • Changed animation distance from -100% to -50% to properly align with the 6 duplicate sets

Hover Pause:

  • Added hover state management using useState
  • Implemented useEffect to start/stop animation based on hover state
  • Animation pauses when hovering over the marquee and resumes when mouse leaves

Button Visibility:

  • Added proper z-index layering (z-10 on container, z-20 on buttons) to ensure buttons appear above background decorative elements

How It Works

The infinite loop works by rendering 6 duplicate sets of cards. The animation moves the container by 50% (which moves past 3 sets), and when it loops back, the next 3 sets are perfectly aligned, creating a seamless infinite scroll effect.

Attaching a video for reference:

marquee.fixes.mp4

Summary by CodeRabbit

Release Notes

  • New Features

    • Interactive marquee animation that pauses when hovering over technology items
    • Expanded display showing more technology items simultaneously in the marquee
  • Style

    • Enhanced visual presentation with improved styling and layout adjustments

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions
Copy link
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 23, 2025

📝 Walkthrough

Walkthrough

This change enhances the TechMarquee component by adding interactive hover controls and dynamic animation management. The marquee now starts and stops animation based on hover state, expands the number of displayed items from 3 to 6, and applies performance optimizations through CSS utilities.

Changes

Cohort / File(s) Summary
Interactive Marquee Enhancement
landing-page/src/Pages/Demo/marqu.tsx
Added state management (useState, useEffect, useAnimation) to track hover state and control animation playback. Animation now dynamically starts looping horizontal motion when not hovered and stops on hover. Expanded marquee items from 3 to 6 copies. Enhanced styling with will-change-transform, z-index adjustments, and cursor-pointer utilities.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

UI, enhancement

Suggested reviewers

  • rahulharpal1603

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main changes: implementing infinite marquee animation with hover pause functionality, which aligns with the primary objectives of fixing animation issues and adding hover control.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
landing-page/src/Pages/Demo/marqu.tsx (3)

28-42: Animation speed inconsistency after resume.

When the animation resumes after hover, controls.start() animates from the current position to -50% with a fixed 10-second duration. This causes inconsistent speed depending on where the animation was stopped—stopping at -40% results in a very slow crawl for the remaining 10%, while stopping at -10% makes it faster.

For a smoother experience, consider calculating the remaining duration proportionally:

🔎 Suggested improvement
  useEffect(() => {
    if (!isHovered) {
+     // For truly seamless resume, you could track position and calculate remaining time
      controls.start({
        x: '-50%',
        transition: {
          duration: 10,
          ease: "linear",
          repeat: Infinity,
          repeatType: "loop"
        }
      });
    } else {
      controls.stop();
    }
  }, [isHovered, controls]);

Alternatively, a simpler approach is to reset to initial position before resuming:

} else {
  controls.stop();
  controls.set({ x: '0%' }); // Reset position on hover
}

60-60: Consider a cleaner approach for array duplication.

The repeated spread syntax is verbose. A helper function or Array.from would be more maintainable if the duplication count needs to change.

🔎 Suggested improvement
-        {[...technologies, ...technologies, ...technologies, ...technologies, ...technologies, ...technologies].map((tech, index) => (
+        {Array.from({ length: 6 }, () => technologies).flat().map((tech, index) => (

Or define a constant for clarity:

const DUPLICATE_COUNT = 6;
const marqueeItems = Array.from({ length: DUPLICATE_COUNT }, () => technologies).flat();

28-42: Consider respecting prefers-reduced-motion for accessibility.

Users with vestibular disorders or motion sensitivity may find continuous marquee animations uncomfortable. Adding support for the prefers-reduced-motion preference would improve accessibility.

🔎 Suggested implementation
import { useReducedMotion } from 'framer-motion';

export default function TechMarquee() {
  const [isHovered, setIsHovered] = useState(false);
  const controls = useAnimation();
  const prefersReducedMotion = useReducedMotion();

  useEffect(() => {
    if (prefersReducedMotion) {
      controls.stop();
      return;
    }
    
    if (!isHovered) {
      controls.start({
        x: '-50%',
        transition: {
          duration: 10,
          ease: "linear",
          repeat: Infinity,
          repeatType: "loop"
        }
      });
    } else {
      controls.stop();
    }
  }, [isHovered, controls, prefersReducedMotion]);
  // ...
}
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d07d817 and a7a6d0f.

📒 Files selected for processing (1)
  • landing-page/src/Pages/Demo/marqu.tsx
🔇 Additional comments (2)
landing-page/src/Pages/Demo/marqu.tsx (2)

2-8: LGTM!

The imports and state initialization are appropriate. Using useAnimation for programmatic control and tracking hover state is the right approach for implementing pause-on-hover functionality.


44-59: LGTM!

Good implementation choices:

  • overflow-hidden correctly clips the marquee content
  • will-change-transform optimizes GPU rendering for the animation
  • z-10 appropriately addresses the button visibility issue
  • Hover handlers are properly bound to the container

@divyanshmrawal
Copy link

wow bro perfect good work

@swamimalode07
Copy link
Author

Thanks man ,Hope it gets merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Background Dots Overlapping Buttons, Incomplete Animation & Button Visibility on Hover

2 participants