Animating All Layout
Transition.allLayout()
allows easily animating all layout changes, without having to assign transitionKey
s to all Component
s
@OnCreateTransition
static Transition onCreateTransition(ComponentContext c) {
return Transition.allLayout().animator(ANIMATOR);
}
Note, that Transition.allLayout()
:
- Targets
AnimatedProperty.X
,Y
,HEIGHT
andWIDTH
of allComponent
s present in layout tree. - Could be used to define transitions of change type only. For defining appearing and disappearing transitions,
transitionKey
s still need to be assigned. - Could be used as a part of more complex choreography.
@OnCreateTransition
static Transition onCreateTransition(ComponentContext c) {
return Transition.parallel(
Transition.allLayout().animator(ANIMATOR),
Transition.create(TRANSITION_KEY_TEXT)
.animate(AnimatedProperties.WIDTH)
.appearFrom(0f)
.disappearTo(0f)
.animator(ANIMATOR),
Transition.create(TRANSITION_KEY_TEXT)
.animate(AnimatedProperties.ALPHA)
.appearFrom(0f)
.disappearTo(0f)
.animator(ANIMATOR));
}