Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
React Spring coninuous text carousel

I'm trying to create a looping text carousel with React Spring. I've tried with a <h1 />, and an array of <span /> within a <div />, but aren't getting a smooth animation.

Current code:

import React from "react";
import { animated, useSprings } from "react-spring";

interface CarouselProps {
  className?: string;
}

const Carousel: React.FC<CarouselProps> = ({ className }) => {
  const string = [
    "a",
    "b",
    // ...
    "y",
    "z",
  ];

  const springs = useSprings(
    string.length,
    string.map((_, i) => ({
      loop: true,
      from: { translateX: "100%" },
      to: { translateX: "-100%" },
      config: { duration: 3000 },
      delay: (i + 1) * 100,
    }))
  );

  return (
    <div className={className}>
      <h1 className="w-48 bg-red-500 flex items-center">
        {springs.map((styles, i) => (
          <animated.p key={i} style={styles}>
            {string[i]}
          </animated.p>
        ))}
      </h1>
    </div>
  );
};

export default Carousel;

This is the example I'm trying

Edit elastic-chihiro-tpnqm8

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!