modal_bottom_sheet icon indicating copy to clipboard operation
modal_bottom_sheet copied to clipboard

iOS modal opening curve speed is different with native one

Open sooxt98 opened this issue 5 years ago • 6 comments
trafficstars

modal_bottom_sheet animation seems like using a linear curve, while native's one is using an easeOut curve

sooxt98 avatar Oct 27 '20 06:10 sooxt98

Any updates on this?

axelthat avatar Feb 02 '21 14:02 axelthat

Right now it uses const Curve _decelerateEasing = Cubic(0.0, 0.0, 0.2, 1.0); I would like to know how to calculate the curve of the native animation

jamesblasco avatar Feb 19 '21 15:02 jamesblasco

https://stackoverflow.com/questions/25726563/what-is-the-default-animation-easing-function-in-ios

according to them, it would be: Cubic(0.42, 0, 0.58, 1) over 0.25 seconds of duration Which is ease-in-out

https://cubic-bezier.com/#.42,0,.58,1

CavalcanteLeo avatar Aug 26 '21 23:08 CavalcanteLeo

https://stackoverflow.com/questions/25726563/what-is-the-default-animation-easing-function-in-ios

according to them, it would be: Cubic(0.42, 0, 0.58, 1) over 0.25 seconds of duration Which is ease-in-out

https://cubic-bezier.com/#.42,0,.58,1

I'm afraid that post was outdated as it was over 8 years old ;(

I believe iOS currently use spring physics-based animation instead of a bezier curve. https://developer.apple.com/videos/play/wwdc2018/803/ (the part about spring driven animation starts around 23 mins mark). A few packages in pub.dev can do spring animation, like this https://github.com/lukepighetti/sprung. I don't know the exact parameters apple uses in their native animation but I think it should be possible to replicate it.

It would be nice if this package could expose the timing function or the animation controller so that the animation can be fine-tuned either to replicate native iOS animation or something else.

shenghan97 avatar Nov 18 '22 20:11 shenghan97

Any update on this?

31Carlton7 avatar Jan 18 '23 23:01 31Carlton7

Just wanted to follow up on this as well

vega-labs avatar Jan 24 '23 04:01 vega-labs