Skip to content

Instantly share code, notes, and snippets.

@sanketmaru
Created February 6, 2020 08:23
Show Gist options
  • Save sanketmaru/72204e52b98b59044b9e5f56062eeafc to your computer and use it in GitHub Desktop.
Save sanketmaru/72204e52b98b59044b9e5f56062eeafc to your computer and use it in GitHub Desktop.
Animating list of items in Angular 8
import { trigger, state, style, animate, transition, query, stagger, group } from '@angular/animations';
export const listAnimation = trigger('listAnimation', [
transition('* => *', [
// each time the binding value changes
query(':enter', [style({ opacity: 0 }), stagger('60ms', animate('600ms ease-out', style({ opacity: 1 })))], {
optional: true
}),
query(':leave', animate('200ms', style({ opacity: 0 })), { optional: true })
// query(':leave', [
// stagger(100, [
// animate('0.5s')
// ])
// ], { optional: true }),
// query(':enter', [
// style({ opacity: 0 }),
// stagger(100, [
// animate('0.5s')
// ])
// ], { optional: true })
])
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment