Designed to flow

React + MotionText & scroll

Animated gradient text

A band of color drifts slowly across the headline, over and over, while the rest keeps your text color.

Settings

5s

Code

import { motion } from "framer-motion";

interface GradientTextProps {
  text?: string;
  color?: string;
  /** Segundos por pasada del degradado. */
  speed?: number;
}

export default function GradientText({
  text = "Designed to flow",
  color = "#0071e3",
  speed = 5,
}: GradientTextProps) {
  return (
    // --gradient-fg es el color del texto normal, para que el degradado respete el modo oscuro
    <motion.h2
      className="bg-clip-text text-4xl font-semibold text-transparent [--gradient-fg:#1d1d1f] dark:[--gradient-fg:#f5f5f7]"
      style={{
        backgroundImage: `linear-gradient(90deg,var(--gradient-fg),${color},var(--gradient-fg))`,
        backgroundSize: "200% 100%",
      }}
      animate={{ backgroundPosition: ["0% 0", "200% 0"] }}
      transition={{ duration: speed, repeat: Infinity, ease: "linear" }}
    >
      {text}
    </motion.h2>
  );
}

Prompt for AI

Paste it into ChatGPT, Claude or Cursor and it will adapt the block to your project with these settings, even if you don’t use React.

More in Text & scroll

Where to use it

A moving gradient gives a big headline some life without adding another element to the page. It suits the slogan of a creative studio, the name of an app on its landing page or the title of a conference. Many people search for animated gradient text in CSS; this version is ready for React and stays readable the whole time.

Pick an accent that contrasts with your text color, or the sweep is barely visible. Five seconds per pass feels relaxed, faster gets restless. Save it for large type; on small text it just looks like a rendering glitch.