Skip to content

Prevent delay when hover ends when there is delay present in animate prop. #2649

Discussion options

You must be logged in to vote

Hey there,

I ran into this problem as well, and while I never found a legitimate fix I did find a simple workaround using framer-motion's onAnimationComplete callback.

The idea is to store your delay value in state and update it after the initial animation is complete.

Here is your code with the implemented changes and a codesandbox demo running framer-motion ^3.30:

import React, { useState } from "react";
import { motion } from "framer-motion";
import "./styles.css";

const size = 200;
const radius = 40;
const color = "#0CF";

export default function App() {
  const [delay, setDelay] = useState(2); // Initial value

  const variants = {
    start: { scale: 0 },
    active: { scale: 1.25, t…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Nisan-Shrestha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants