Vsevolod Ganin
02/24/2021, 6:35 PMFlingConfig
which produces function adjustTarget
from the list of anchors
. Do I need to recreate it manually now or is there an analogue?matvei
02/24/2021, 6:59 PMswipeable
If you were using FlingConfig with scroll-based APIs, there's a better, suspending version called FlingBehaviour
If you are using FlingConfig to precalculate your own anchors in a custom way and don't need a swipeable and the package that comes with it: you can just make it happen with the APIs that exist in beta 🙂
You need to calculate the approximate target yourself using AnimationSpec of your choice, and then adjust it to the anchor to get the real target value to animate to. Them, choose the API from the animation stack to use (Animatable, AnimationState, transition even?) and animate! 🙂 It gives even more control to you much overhead compared to the FlingConfig.
Hit me up with any question that you have!Vsevolod Ganin
02/24/2021, 7:32 PMFlingConfig
for good at last 😁 I have a couple of questions if you don’t mind.
• What is the default decay spec for true androidish fling feel? There was some factory function like androidFlingSomething
though I may be wrong. SwipeableDefaults
suggests just SpringSpec<Float>()
I believe. So it’s just that?
• I’m getting a bit lost between decay specs. Earlier in alpha12 I discovered that there is some generalization over FloatDecayAnimationSpec
that is VectorizedDecayAnimationSpec
. And there is DecayAnimationSpec
which produces VectorizedDecayAnimationSpec
. Is there a plan to get rid of FloatDecayAnimationSpec
in the future?
• FlingBehaviour
sounds really interesting. Unfortunately it seems I am not able to find the corresponding APIs... Could you please direct me to any doc page mentioning it?Albert Chang
02/25/2021, 8:56 AMFlingBehavior
. Unfortunately I've found a bug so you may need some workarounds if you want to use it.Vsevolod Ganin
02/25/2021, 9:46 AMmatvei
02/25/2021, 1:01 PMVectorizedDecayAnimationSpec
is the decay spec for a generic vectorized value. Vectorized value can have more than one value changing at a time (imagine Color which is a 4d vector since you are animating r,g,b and alpha). FloatDecayAnimationSpec is a particular 1dimentional float based spec, which is used commonly since we usually decay float pixels in the scroll/viewpager/etc. Can be quite confusing on the first glance, but in general it's a powerful toolset for anything you might want to animate 🙂