Skip to content

Commit

Permalink
feat: add route transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
tomastrajan committed Jul 24, 2017
1 parent ac4a97d commit df94736
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/app/core/animations/router.transition.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {
animate,
group,
query,
style,
transition,
trigger,
stagger
} from '@angular/animations';

export const routerTransition = trigger('routerTransition', [
transition('* <=> *', [
query(':enter, :leave',
style({ position: 'fixed', width: '100%' }),
{ optional: true }),
query(':enter .route-enter-staggered',
style({ opacity: 0 }),
{ optional: true }),
group([
query(':enter', [
style({ transform: 'translateY(-5%)', opacity: 0 }),
animate('0.5s 0.5s ease-in-out',
style({ transform: 'translateY(0%)', opacity: 1 }))
], { optional: true }),
query(':leave', [
style({ transform: 'translateY(0%)', opacity: 1 }),
animate('0.2s ease-in-out',
style({ transform: 'translateY(-5%)', opacity: 0 }))
], { optional: true })
]),
query(':enter .route-enter-staggered', stagger(100, [
style({ transform: 'translateY(10%)', opacity: 0 }),
animate('0.5s ease-in-out',
style({ transform: 'translateY(0%)', opacity: 1 })),
]), { optional: true }),
])
]);
1 change: 1 addition & 0 deletions src/app/core/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './local-storage/local-storage.service';
export * from './animations/router.transition';
export * from './auth/auth.reducer';
export * from './core.interfaces';
export * from './core.module';

0 comments on commit df94736

Please sign in to comment.