2018-08-29 13:21:25 +02:00
|
|
|
import { trigger, animate, transition, style, query, stagger, group } from '@angular/animations';
|
2018-07-31 15:46:55 +02:00
|
|
|
|
2018-10-05 16:34:08 +02:00
|
|
|
const fadeVanish = [
|
|
|
|
style({ transform: 'translateY(0%)', opacity: 1 }),
|
|
|
|
animate(
|
|
|
|
'200ms ease-in-out',
|
|
|
|
style({
|
|
|
|
transform: 'translateY(0%)',
|
|
|
|
opacity: 0
|
|
|
|
})
|
|
|
|
)
|
|
|
|
];
|
|
|
|
|
|
|
|
const fadeAppear = [
|
|
|
|
style({ transform: 'translateY(0%)', opacity: 0 }),
|
|
|
|
animate('200ms ease-in-out', style({ transform: 'translateY(0%)', opacity: 1 }))
|
|
|
|
];
|
|
|
|
|
|
|
|
const justEnterDom = [style({ opacity: 0 })];
|
|
|
|
|
|
|
|
const fadeMoveIn = [
|
|
|
|
style({ transform: 'translateY(30px)' }),
|
|
|
|
animate('250ms ease-in-out', style({ transform: 'translateY(0px)', opacity: 1 }))
|
|
|
|
];
|
|
|
|
|
2018-07-31 15:46:55 +02:00
|
|
|
export const pageTransition = trigger('pageTransition', [
|
|
|
|
transition('* => *', [
|
2018-09-04 11:35:50 +02:00
|
|
|
/** this will avoid the dom-copy-effect */
|
|
|
|
query(':enter, :leave', style({ position: 'absolute', width: '100%' }), { optional: true }),
|
2018-10-05 16:34:08 +02:00
|
|
|
|
2018-07-31 15:46:55 +02:00
|
|
|
/** keep the dom clean - let all items "just" enter */
|
2018-10-05 16:34:08 +02:00
|
|
|
query(':enter mat-card', justEnterDom, { optional: true }),
|
|
|
|
query(':enter .on-transition-fade', justEnterDom, { optional: true }),
|
|
|
|
query(':enter mat-row', justEnterDom, { optional: true }),
|
|
|
|
query(':enter mat-expansion-panel', justEnterDom, { optional: true }),
|
2018-07-31 15:46:55 +02:00
|
|
|
|
|
|
|
/** parallel vanishing */
|
|
|
|
group([
|
2018-10-05 16:34:08 +02:00
|
|
|
query(':leave .on-transition-fade', fadeVanish, { optional: true }),
|
|
|
|
query(':leave mat-card', fadeVanish, { optional: true }),
|
|
|
|
query(':leave mat-row', fadeVanish, { optional: true }),
|
|
|
|
query(':leave mat-expansion-panel', fadeVanish, { optional: true })
|
2018-07-31 15:46:55 +02:00
|
|
|
]),
|
|
|
|
|
|
|
|
/** parallel appearing */
|
|
|
|
group([
|
|
|
|
/** animate fade in for the selected components */
|
2018-10-05 16:34:08 +02:00
|
|
|
query(':enter .on-transition-fade', fadeAppear, { optional: true }),
|
|
|
|
|
|
|
|
/** Staggered appearing = "one after another" */
|
|
|
|
query(':enter mat-card', stagger(50, fadeMoveIn), { optional: true }),
|
|
|
|
query(':enter mat-row', stagger(30, fadeMoveIn), { optional: true })
|
|
|
|
// disabled for now. They somehow appear expanded which looks strange
|
|
|
|
// query(':enter mat-expansion-panel', stagger(30, fadeMoveIn), { optional: true })
|
2018-07-31 15:46:55 +02:00
|
|
|
])
|
|
|
|
])
|
|
|
|
]);
|
|
|
|
|
2018-10-05 16:34:08 +02:00
|
|
|
const slideIn = [style({ transform: 'translateX(-85%)' }), animate('600ms ease')];
|
|
|
|
const slideOut = [
|
|
|
|
style({ transform: 'translateX(0)' }),
|
|
|
|
animate(
|
|
|
|
'600ms ease',
|
|
|
|
style({
|
|
|
|
transform: 'translateX(-85%)'
|
|
|
|
})
|
|
|
|
)
|
|
|
|
];
|
|
|
|
|
|
|
|
export const navItemAnim = trigger('navItemAnim', [transition(':enter', slideIn), transition(':leave', slideOut)]);
|