Created
February 6, 2020 08:26
-
-
Save sanketmaru/d6952f065ccb17ff5b02b3e652390e57 to your computer and use it in GitHub Desktop.
Router Slide In Animation for Angular 8 App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { trigger, state, style, animate, transition, query, group, animateChild } from '@angular/animations'; | |
export const slideInAnimation = trigger('routeAnimations', [ | |
transition('* <=> *', [ | |
style({ position: 'relative' }), | |
query( | |
':enter, :leave', | |
[ | |
style({ | |
position: 'absolute', | |
top: 0, | |
left: 0, | |
width: '100%' | |
}) | |
], | |
{ optional: true } | |
), | |
group([ | |
query( | |
':enter', | |
[ | |
style({ transform: 'translateY(100%)' }), | |
// animate(1000) | |
animate('0.8s ease-in-out') | |
], | |
{ optional: true } | |
), | |
query( | |
':leave', | |
[ | |
// style({ transform: 'translateY(0%)' }), | |
// animate(1000) | |
animate('0.3s ease-in-out', style({ transform: 'translateY(-100%)' })), | |
style({ opacity: 0 }) | |
], | |
{ optional: true } | |
) | |
]) | |
]) | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment