motiondivision / motiondivision/motion

[BUG] whileInView transition values override the other transition values

Open
#2,636 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
33.7k
Forks
1.4k
Avg merge
1d 10h
Merged PRs (30d)
14

Description

im trying to animate whileHover on a div opacity :[0,1]

what i want:

if i hover on the div the opacity goes from 0 to 1 it works if i hoverd and stayed on the div but..

what happens:

if i ran the mouse on the div fast the delay:3 works but i dont want the whileInView delay value to work if i hoverd on the div

import { motion} from "framer-motion";

export const App= () => {
  return (
    <>
      <motion.div
        style={{ background: "black", marginTop: 10 }}
        initial={{ opacity: 0 }}
        whileInView={{ opacity: 1, transition: { duration: 0.4, delay: 3 } }}
        whileHover={{
          opacity: [0, 1],
          transition: { duration: 0.3, delay: 0 },
        }}
      >
        text
      </motion.div>
    </>
  );
};

https://codesandbox.io/p/devbox/crazy-euler-4flt8c

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked CodeSandbox reproduction and compare the whileInView and whileHover transition behavior described in the issue. Trace the motion component's handling of these props; done means hovering quickly uses the hover transition delay rather than the whileInView delay while preserving the stated opacity animations.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.