Ria Choi
← Portfolio

Cinematic Flip Card

A Framer Motion study of timing, perspective, and staggered image transitions in React.

Cinematic Flip Card

I built Cinematic Flip Card to learn how much control Framer Motion gives over a 3D transition. I wanted an image to turn over in a wave of vertical strips, and I focused on keeping the perspective, image alignment, and timing convincing throughout the flip.

Building the flip with Framer Motion

Each strip is a motion.div that animates rotateY. I use an ease-in-out transition with a shared duration, keep the transform in 3D, and hide the back face. The component changes the image midway through the rotation, when the viewer sees the least of the strip. Hover flips a strip in reverse.

JSX
return (
    <motion.div
        className="flex-1 overflow-hidden"

        onMouseEnter={handleHoverStart}
        onMouseLeave={handleHoverEnd}

        animate={{
            rotateY: `${rotation}deg`,
        }}

        transition={{
            duration: FLIP_DURATION / 1000,
            ease: "easeInOut",
        }}

        style={{
            transformStyle: "preserve-3d",
            backfaceVisibility: "hidden",
        }}
    >
        <CardFace
            image={images[faceIndex]}
            index={index}
            totalCards={totalCards}
        />
    </motion.div>
);

Coordinating the stagger across strips

The React stack advances one active column at a time. The first column chooses the next image and the rest follow that target. A short delay between columns creates the wave, and a longer pause between sets leaves room to read the finished image.

JSX
useEffect(() => {
    const delay = activeCardIndex === -1 ? SET_DELAY : FLIP_SPEED;

    const timer = setTimeout(() => {
        setActiveCardIndex((prev) => {
            if (prev === -1) return 0;

            if (prev >= cards.length - 1) return -1;

            return prev + 1;
        });
    }, delay);

    return () => clearTimeout(timer);
}, [activeCardIndex]);

What I learned

Framer Motion gave me a simple way to describe each rotation. The more interesting part was deciding what changes on which frame so dozens of independent strips still look like one image.

Related article

Cinematic Flip Card Interface with React & Framer Motion