Skip to main content

Fade and height animations

1. Features

This library includes two commonly used animations — fadeAnimation() and heightAnimation(). Both functions are factories that are to be used inside component decorators' animations array. Configurable properties are duration (in ms) and triggerName with the following default values:

AnimationTrigger nameDuration [ms]
fadeAnimation()fade250
heightAnimation()height250

2. Usage

@NgComponent({
animations: [heightAnimation(), fadeAnimation()],
})
export class MyComponent {}
<button (click)="isOpened = !isOpened">Toggle</button>

<div *ngIf="isOpened" @fade @height>Lorem ipsum...</div>

For general information about Angular animations, please consider visiting the official Angular animations documentation