loloof64
02/05/2021, 12:39 PMloloof64
02/05/2021, 12:41 PMgoBackState.targetState = GoingBackStates.FINAL
(line 178)loloof64
02/05/2021, 12:50 PMgoBackState.currentState = GoingBackStates.INITIAL
loloof64
02/05/2021, 1:07 PMDoris Liu
02/05/2021, 7:37 PMtargetState
(i.e. not the currentState
) of a Transition/MutableTransitionState. If you need to change both the starting point and ending point of a transition, you could create a new MutableTransitionState
like the second sample on this API: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary#updatetransition_1 That would recreate the Transition animation with the new initial/target states specified in the new MutableTransitionState
. Though that would mean that all the current values/velocities of the animation will be lost, and you may therefore see a visual jump.Doris Liu
02/05/2021, 7:43 PMTransition
s is not super expensive. I agree with you that each cell (in the snippet above) should have independent animation/transition states. I'd suggest having an Animatable<Offset>
for each cell to animate their position as needed, independently.loloof64
02/07/2021, 6:02 PMloloof64
02/07/2021, 6:44 PMDoris Liu
02/07/2021, 6:48 PMAnimatable
has a few overloaded factory methods. Also make sure you import the right one. There's also a Drawable class with the same name. 😅loloof64
02/07/2021, 6:53 PMloloof64
02/07/2021, 6:58 PMAnimatable(Offset(0f, 0f), Offset.VectorConverter)
and that's fine.