Giter VIP home page Giter VIP logo

Comments (8)

mattgperry avatar mattgperry commented on June 11, 2024 2

I’m gonna look into this as part of Framer Motion 2 and AnimateSharedLayout

from motion.

colepeters avatar colepeters commented on June 11, 2024 1

@InventingWithMonster Just following up — I've updated to to 2.0 and notice this staggered exit/smooth entrance issue is still around. Is it something you're still looking into, or is it fixed and I'm just not implementing it properly?

from motion.

mattgperry avatar mattgperry commented on June 11, 2024

Edit: Ah I misunderstood. Yes I see the problem. The exiting children have to be physically removed from the DOM before the surrounding nodes can measure their new position.

I'm going to mark this as wontfix for now I'm afraid. I had this feature in Pose and it's responsible for the majority of the Popmotion issues board. The problem with doing it this way is you have to "pop out" the elements from their flow using position: absolute and manually setting their size and measurements. This is actually something you could do yourself via the style tag but after trying to implement a general solution I don't personally believe there's a way of achieving this that isn't bespoke to a specific design.

Original comment:

I'm not sure I understand exactly the problem here, maybe the snapping of the parent is confusing things.

If you keep the parent static between renders by changing body to:

  justify-content: flex-start;
  align-items: flex-start;

Does the bug as you perceive it still occur?

The reason for this is positionTransition works when the offset of a component relative to its nearest-positioned parent changes as the result of a render. But if the parent itself is also moving then that also needs a positionTransition of its own.

However this is complicated with AnimatePresence because the parent component only really moves relative to the document once the exiting children are removed. The re-render to do this only happens locally within AnimatePresence. So the parent isn't informed.

We are talking about a component that will allow AnimatePresence to communicate changes within it back up the tree. So something along the lines of:

<LayoutContext>
  <motion.ul positionTransition>
    <AnimatePresence>
          <motion.li
            animate={{ opacity: 1 }}
            initial={{ opacity: 0 }}
            exit={{ opacity: 0 }}
            key={background}
            positionTransition={spring}
          />
    </AnimatePresence>
  </motion.ul>
</LayoutContext>

Will animate the parent smoothly even when children are removed.

from motion.

colepeters avatar colepeters commented on June 11, 2024

The problem with doing it this way is you have to "pop out" the elements from their flow using position: absolute and manually setting their size and measurements. This is actually something you could do yourself via the style tag but after trying to implement a general solution I don't personally believe there's a way of achieving this that isn't bespoke to a specific design.

@InventingWithMonster sorry to bring up an old issue but wondering if you could elaborate on this? I'm facing the same issue the OP was, and if there's a way to work around it I'd love to give it a try. I'm just not sure I understand what needs to be done to achieve the desired effect based on your description.

from motion.

colepeters avatar colepeters commented on June 11, 2024

@InventingWithMonster That would be phenomenal! Please remind me to send you a cake if this makes it into the release! 😄

from motion.

tgdn avatar tgdn commented on June 11, 2024

Any news on this issue?

from motion.

vladtihonovskiy avatar vladtihonovskiy commented on June 11, 2024

Hi, @colepeters.
Did you find a solution?
Because looks like the issue closed but I also get this problem

from motion.

justinpeake avatar justinpeake commented on June 11, 2024

Also getting this problem.

from motion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.