vide
09/19/2023, 8:56 PMAnimatedContent to only start animating after the content is ready to be drawn? When switching between complex scenes the animation time has already passed in real time before the content was ready to be drawn, and as a result no animation is seen.Ian Lake
09/20/2023, 4:01 PMvide
09/20/2023, 4:19 PMAnimatedContent host which effectively contains navigation routes near the root of the composition. Some of our screen-level routes are so complex that the initial composition might take 1-2s in real time. We would still like to show a brief transition (fadeOut(), fadeIn()) in this case to ease the transition a bit. However, the transition starts running immediately when the target state is changed, and the animation (600ms) is usually finished before the composition is ready, and the change is abrupt.vide
09/20/2023, 4:23 PMNavHost as it also uses AnimatedContent internally. Probably the case with Crossfade as well. It would be nice to have something to enable finer control of all the similar animation helpers.vide
09/20/2023, 4:31 PMTransition public, some changes would probably needed to components that use it as well to accommodate the different behaviour... I'm not sure what the best API surface would be, but I think it would add value to make it as generic as possible, while also enabling this usecase without too much boilerplate.Ian Lake
09/20/2023, 4:34 PMReportDrawn APIs from androidx.activity that bubble up 'readiness' to higher level components like AnimatedContent to indicate when the transition should actually start?
https://developer.android.com/reference/kotlin/androidx/activity/compose/package-summary#ReportDrawnWhen(kotlin.Function0)vide
09/20/2023, 4:50 PMMy use case is having a flow of screens, where you move from one to the other currently using AnimatedContent. But in some scenarios, as the user is interacting with the content, that transition should sometimes stop, slow down and so on.
vide
09/20/2023, 4:53 PMReportDrawn could be used to start the actual transition by the user manually instead of AnimatedContent hiding the implementation completely, but it could have a default though. Allowing users to control the transition state of AnimatedContent & co. separately from the target state would allow a wider range of user implementations.vide
09/20/2023, 4:54 PMcurrentlyVisible entries could be decoupled from the actual state of the transitions?Ian Lake
09/20/2023, 4:56 PMAnimatedContent already supports the new SeekableTransition APIs for seeking the transition that is in progress.vide
09/20/2023, 5:02 PMvide
09/20/2023, 5:15 PMIan Lake
09/20/2023, 5:17 PMSeekableTransitionState API introduced in Compose Animation 1.6.0-alpha04, which works on all API levels: https://developer.android.com/jetpack/androidx/releases/compose-animation#1.6.0-alpha04vide
09/20/2023, 5:42 PMvide
09/20/2023, 9:16 PMSeekableTransitionState incompatible with more than 2 states in AnimatedContent? The transition is never considered finished by AnimatedContent as currentState is constant:
override val currentState: S = initialState
The example only has 2 static states, while AnimatedContent is (usually?) used with many different transition start & endpoints. targetState is also not modifiable in SeekableTransitionState.vide
09/20/2023, 9:20 PMSeekableTransitionState.currentState is not backed by a MutableState.
/**
* Current state of the transition. This will always be the initialState of the transition
* until the transition is finished. Once the transition is finished, [currentState] will be
* set to [targetState]. [currentState] is backed by a [MutableState].
*/
val currentState: S
get() = transitionState.currentStatevide
09/20/2023, 9:21 PMIan Lake
09/20/2023, 11:31 PMIan Lake
09/20/2023, 11:35 PM