motiondivision / motiondivision/motion
[BUG] stop and starting animation while repeating doesn't work as expected
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 33.7k
- Forks
- 1.4k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 14
Description
2. Describe the bug
When stopping and starting an infinite loop animation it doesn't work as expected. It doesn't complete a full loop anymore.
Example: I have an element that rotates 360 degrees. when I stop the animation at 180 degrees and then start it again, it goes from 180 to 360 but then jumps to 180 again, instead of continuing at 0.
It also happens for translateX and translateY 100%. when stopping and starting, it only goes between stopped percentage and 100%
3. CodeSandbox
https://codesandbox.io/p/sandbox/framer-loop-pause-h4kshh
4. Steps to reproduce
Steps to reproduce the behavior:
- hover over the red box.
- stop and start hovering a few times
5. Expected behavior
The animation should continue at it's current point, and complete a full rotation. when the rotation is complete, the animation should start at 0 again, instead of the previous starting point.
6. Video or screenshots
https://github.com/framer/motion/assets/87395969/2496be79-8cc1-4f73-973f-3e95d31a78d0
7. Environment details
Tested versions:
Framer-motion 10.16.9 & 11.2.12
React 18.2 & 18.3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox and reproduce the issue by hovering over the red box, then stopping and starting the animation repeatedly. Compare the behavior in the reported Framer Motion versions with the expected behavior: a paused loop should resume from its current point, complete the rotation or translation, and restart from 0 only after the loop completes.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100