I have a list of products which is controlled by a list of categories so when a category is clicked it displays all the products within it
I want to animate this list so that when the category is clicked each list item fades up from +50% to 0 staggered
If a different category is clicked i want the current products list to fade up again but this time from 0 to -50% staggered and then the new items from +50% to 0 staggered
I currently have this
<ul @listInOut>
<li *ngFor="let product of products;">
//item
</li>
<ul>
trigger('listInOut', [
transition(':enter', [
query('li', [
style({ opacity: 0, transform: 'translateY(50%)' }),
stagger(100, [
animate('1s ease', style({ opacity: 1, transform: 'translateY(0)' }))
])
])
]),
transition(':leave', [
query('li', [
style({ opacity: 1, transform: 'translateY(0)' }),
stagger(100, [
animate('.5s ease', style({ opacity: 0, transform: 'translateY(-50%)' }))
])
])
])
])
the first time the category is clicked the animation works as it should but clicking other categories doesn't work at all