Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

157
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda