The goal of this project is to get for Angular2+ the same animation available for angularJS called animation anchoring: https://docs.angularjs.org/api/ngAnimate#animation-anchoring-via-ng-animate-ref-
The effect is as an element is animating to its new position when navigating to an other page
https://stackblitz.com/github/foxx9/ngx-animate-ref
- You need to use Angular router for your routing
npm install --save ngx-animate-ref
@NgModule({
imports: [
AnimateRefModule.forRoot({defaultTransition: '0.5s ease-in-out all', enableBlur: true}),
]
})
export class AppModule { }
Give them a unique identifier shared across pages as the value, the library will do the rest.
Element in page A :
<div [animateRef]="'myText'" style="background: blue">Hello there</div>
Element in page B :
<div [animateRef]="'myText'" style="background: red"> Hello there</div>
- Directive should be placed on elements without margin, so you should wrap them if they have one
- Wrap images in divs