1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Crossfade composable
//!
//! Mirrors Jetpack Compose's `Crossfade` from
//! `androidx.compose.animation.Crossfade`: an
//! [`AnimatedContent`](crate::AnimatedContent) whose contents fade.
use AnimationType;
use crate::;
/// Crossfade allows switching between two layouts with a crossfade
/// animation.
///
/// Mirrors Jetpack Compose:
/// `Crossfade(targetState, animationSpec) { state -> ... }`.
///
/// When `target_state` changes, the content for the previous state fades out
/// while the content for the new state fades in. Compose semantics are
/// preserved: both compositions stay alive during the transition, each
/// wrapped in an alpha graphics layer, and the outgoing content leaves the
/// composition once its fade-out completes. The content shown on first
/// composition appears without an animation, and retargeting mid-transition
/// keeps every in-flight content fading until it finishes.
///
/// `content` is invoked with each in-flight state, so it must not capture
/// the current target; use the provided value instead.
/// [`Crossfade`] that a gesture can move part of the way, as Compose's
/// `SeekableTransitionState` moves a transition. While `seek` is set, the
/// content for `seek.toward` shows beneath the target's at
/// `seek.fraction`, and the target's at the rest. When the gesture ends, the
/// target either becomes `seek.toward` or stays, and both contents animate
/// on from where the gesture left them, with `animation`.