Introduction to Angular Animations
Explore the fundamentals of Angular animations by understanding how to use the @angular/animations package. Learn to create animation triggers, states, styles, transitions, and control timing for smooth visual effects within Angular components.
Angular animations are based on CSS web transition functionality, which means that anything that can be styled or transformed through CSS can be animated the same way using Angular animations, with the added advantage of giving the developer more control in orchestrating it. This provides us with animations that have CSS-like performance along with the flexibility of JavaScript out of the box without additional dependencies.
How to use
To use @angular/animations in our application, we’ll have to do the following:
- Verify that the
@angular/animationspackage is installed and listed as a dependency in ourpackage.json. If not, add it by runningnpm install --save @angular/animations - Import
BrowserAnimationsModuleand add it to the module’s imports array (line 7):
Angular also comes with
NoopAnimationsModule, ...