Assuming that the question is about how to animate changing word, here is a simple demo:
trigger('wordUpdated', [
transition("* => *", group([
query(':enter', [
style({ opacity: 0, transform: 'translateY(40%)' }),
animate('.5s ease-out', style({ opacity: 1, transform: 'translateY(0%)' }))
], { optional: true }),
query(':leave', [
style({ opacity: 1, transform: 'translateY(0%)' }),
animate('.5s ease-out', style({ opacity: 0, transform: 'translateY(-40%)' }))
], { optional: true })
]))
])
Template:
I like <span class="block" [@wordUpdated]="word">
<span class="span" *ngFor="let word of [ word ]">
{{ word }}
</span>
</span>
It also needs some CSS to place old / new words in the same position:
span.block {
position: relative;
}
span.span {
position: absolute;
left: 0.3em;
}