Jakub Ledwon
02/18/2021, 7:13 PMAnimatable
instead of AnimatedFloatModel
, I was using fling
and as Animatable
has no fling method I've switched to using animteDecay
, what I need is some way to use both decay
and adjustTarget
as I did with AnimatedFloatModel
how can I achieve it now?Doris Liu
02/18/2021, 9:09 PMcalculateTargetValue
like this: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]idx/compose/animation/core/samples/AnimatableSamples.kt;l=142
That would give you the naturally stopping point based on decay, and you can make decisions to decay or animate to an alternative target based on that stopping point. It's essentially adjustTarget
, expressed in a slightly different way. 🙂Tash
02/18/2021, 9:09 PMTash
02/18/2021, 9:09 PMcalculateTargetValue
too 🙂Tash
02/18/2021, 9:10 PMFlingGame
sample is really coool 😄Doris Liu
02/18/2021, 9:12 PMTash
02/18/2021, 9:14 PMDoris Liu
02/18/2021, 9:24 PM