shadimage
paceui-gsap
uibouncing-textsource: ok · refreshed

Bouncing Text

A playful animation where characters bounce in sequence across the text.

npx shadcn add "https://gsap.paceui.com/r/bouncing-text.json"
free

Visual style

playful

Tags auto-generated by rules on 9/24/2026 — empty means no evidence, not lack of support.

Dependencies

Bundle weight · medium
animationgsap

Files1 · source cached 10/8/2026, 5:07:56 AM

components/gsap/bouncing-text.tsx
"use client";

import { ComponentProps, useRef } from "react";

import { useGSAP } from "@gsap/react";
import gsap from "gsap";
import { SplitText } from "gsap/SplitText";

type BouncingTextProps = {
    repeat?: boolean | number;
} & ComponentProps<"p">;

export const BouncingText = ({ repeat = true, ...props }: BouncingTextProps) => {
    const textRef = useRef<HTMLParagraphElement | null>(null);

    useGSAP(
        () => {
            if (!textRef.current) return;
            let bounceCount = 0;
            const bounceChars = new SplitText(textRef.current, { type: "words,chars" }).chars;
            bounceChars.forEach((el) => {
                const tl = gsap.timeline({ repeat: repeat === true ? -1 : repeat === false ? 0 : repeat });
                tl.to(el, {
                    duration: 0,
                    y: -200,
                });
                tl.to(el, {
                    duration: 2,
                    y: 0,
                    rotate: -10,
                    ease: "bounce",
                });
                tl.to(el, {
                    duration: 1,
                    y: 0,
                    rotate: 0,
                    ease: "bounce",
                });
                tl.to(el, {
                    duration: 2,
                    y: -200,
                    rotate: 0,
                    delay: 1,
                    ease: "elastic",
                });
                tl.delay(bounceCount / 8);
                bounceCount++;
            });
        },
        { scope: textRef },
    );

    return <p {...props} ref={textRef} />;
};

More from paceui-gsap

Browse all components in this library →