Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnimatePresence onUpdate/exit is broken after HMR happens #23

Open
FluffyDiscord opened this issue Jul 16, 2022 · 0 comments
Open

AnimatePresence onUpdate/exit is broken after HMR happens #23

FluffyDiscord opened this issue Jul 16, 2022 · 0 comments

Comments

@FluffyDiscord
Copy link

Any time component hot reloads the onUpdate/exit breaks when playing the exit animation with AnimatePresence show={false} because the onUpdate is called only once, skipping to the end (it should transition for example the --var-clipping-progress from 1 to 0 but it fires only once with value of 0.13710664079394916)

My snippet

<AnimatePresence show={!loading}>
  <Motion
      let:motion
      initial={{
          "--var-clipping-progress": 1.0,
          scaleX: .1,
          scaleY: 1.4,
          y: "150%",
      }}
      animate={{
          "--var-clipping-progress": 0.0,
          scaleX: 1.0,
          scaleY: 1.0,
          y: "0%",
      }}
      exit={{
          "--var-clipping-progress": 1.0,
          scaleX: .1,
          scaleY: 1.4,
          y: "150%",
      }}
      transition={{
          "--var-clipping-progress": {
              duration: .35,
              ease: [0.33, 1, 0.68, 1],
          },
          scaleX: {
              //delay: .1,
              duration: .6,
              ease: [0.33, 1, 0.68, 1],
          },
          scaleY: {
              //delay: .3,
              duration: .45,
              ease: [0.25, 1, 0.5, 1],
          },
          y: {
              //delay: .15,
              duration: .6,
              ease: [0.83, 0, 0.17, 1],
          },
      }}
      onUpdate={handleClippingAnimation}
  >
      <div bind:this={pageContainerRef} use:motion class="flex flex-1 rounded-[45px] bg-neutral-900" style='clip-path: path("{clippingShape}")'>
      </div>
  </Motion>
</AnimatePresence>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant