Search

5. Reverse

When using repeat, you can add a repeatType of "reverse" to make the animation go back and forth.

⚡️ Some Examples – 05 – Reverse
open in CodeSandbox
export function Example() {
    return (
        <motion.div
            style={{
                width: 150,
                height: 150,
                borderRadius: 30,
                backgroundColor: "#fff"
            }}
            animate={{ rotate: 360 }}
            transition={{
                duration: 2,
                repeat: Infinity,
                repeatType: "reverse"
            }}
        />
    );
}

Leave a Reply

plugins premium WordPress
Scroll to Top