Skip to content

Instantly share code, notes, and snippets.

@benjanderson
Forked from gsans/router.animations.ts
Created July 25, 2017 20:58
Show Gist options
  • Save benjanderson/d29ca44abf8f70a6613ae4a1d1c2b74e to your computer and use it in GitHub Desktop.
Save benjanderson/d29ca44abf8f70a6613ae4a1d1c2b74e to your computer and use it in GitHub Desktop.
import {trigger, animate, style, group, animateChild, query, stagger, transition} from '@angular/animations';
export const routerTransition = trigger('routerTransition', [
transition('* <=> *', [
/* order */
/* 1 */ query(':enter, :leave', style({ position: 'fixed', width:'100%' })
, { optional: true }),
/* 2 */ group([ // block executes in parallel
query(':enter', [
style({ transform: 'translateX(100%)' }),
animate('0.5s ease-in-out', style({ transform: 'translateX(0%)' }))
], { optional: true }),
query(':leave', [
style({ transform: 'translateX(0%)' }),
animate('0.5s ease-in-out', style({ transform: 'translateX(-100%)' }))
], { optional: true }),
])
])
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment