React-spring: Snap effect when transitioning out of a component.

Created on 7 Mar 2019  路  1Comment  路  Source: pmndrs/react-spring

I am trying to have an animation every time the picture component gets changed. The first animation when the page loads , is fine. When I click the '+' button , the animation kind of snaps back to its final position in a jerk and is not smooth. I don't understand why this snap effect is happening. How do i fix this ?

https://codesandbox.io/s/wn6jp23vxl

question

Most helpful comment

it's easier to think of spring as a value interpolator, it doesn't do magic. if you want two elements on top of one another in css you need to position them absolutely. you can do this in plain css classes (.MainSlide in your case) or even in the spring definition, for instance from: { position: 'absolute', .... in other situations you want items to be stacked, like in a list. but everything's under your full control.

>All comments

it's easier to think of spring as a value interpolator, it doesn't do magic. if you want two elements on top of one another in css you need to position them absolutely. you can do this in plain css classes (.MainSlide in your case) or even in the spring definition, for instance from: { position: 'absolute', .... in other situations you want items to be stacked, like in a list. but everything's under your full control.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cklab picture cklab  路  4Comments

eDubrovsky picture eDubrovsky  路  3Comments

szahn picture szahn  路  3Comments

cmmartin picture cmmartin  路  3Comments

anton-g picture anton-g  路  3Comments