Swiftorial Logo
Home
Swift Lessons
AI Tools
Learn More
Career
Resources

Angular FAQ: Top Questions

46. What are Angular animations?

Angular animations are built using the @angular/animations module, allowing complex transition effects based on state changes. These animations use trigger and transition functions with states.


trigger('openClose', [
  state('open', style({ height: '200px', opacity: 1 })),
  state('closed', style({ height: '100px', opacity: 0.5 })),
  transition('open <=> closed', [animate('0.5s')])
])
        

Use [@openClose]="isOpen ? 'open' : 'closed'" in your component template.