Framer X » Animation » Example animations » 6. Event: WhileHover

6. Event: WhileHover

You’ve heard of whileTap? Here’s whileHover.

Open Framer Motion version in CodeSandbox

Code Component

export function CC06EventWhileHover() {
    return (
        <Frame
            // Visual & layout
            size={150}
            radius={30}
            backgroundColor="#fff"
            center
            // Animation
            whileHover={{ scale: 0.8 }}
        />
    )
}

Framer Motion

export function FM06EventWhileHover() {
    return (
        <Center>
            <motion.div
                style={{
                    width: 150,
                    height: 150,
                    borderRadius: 30,
                    backgroundColor: "#fff",
                }}
                whileHover={{ scale: 0.8 }}
            />
        </Center>
    )
}

Override

export function Event_WhileHover(): Override {
    return {
        whileHover: { scale: 0.8 },
    }
}

Leave a Reply