diff --git a/packages/framer-motion/src/animation/animators/js/__tests__/animate.test.ts b/packages/framer-motion/src/animation/animators/js/__tests__/animate.test.ts index 74537c467e..4972c84694 100644 --- a/packages/framer-motion/src/animation/animators/js/__tests__/animate.test.ts +++ b/packages/framer-motion/src/animation/animators/js/__tests__/animate.test.ts @@ -1231,4 +1231,15 @@ describe("animate", () => { expect(output).toEqual([0, 20, 40, 20, 0]) }) + + test("Correctly ends animations with duration: 0", async () => { + const animation = animateValue({ + keyframes: [0, 100], + driver: syncDriver(20), + duration: 0, + ease: linear, + }) + + await animation + }) }) diff --git a/packages/framer-motion/src/animation/animators/js/index.ts b/packages/framer-motion/src/animation/animators/js/index.ts index fe104eb2cc..2d03c65ab3 100644 --- a/packages/framer-motion/src/animation/animators/js/index.ts +++ b/packages/framer-motion/src/animation/animators/js/index.ts @@ -142,7 +142,7 @@ export function animateValue({ let resolvedDuration = Infinity let totalDuration = Infinity - if (calculatedDuration) { + if (calculatedDuration !== null) { resolvedDuration = calculatedDuration + repeatDelay totalDuration = resolvedDuration * (repeat + 1) - repeatDelay }