import { Component } from '@angular/core';
import { trigger, state, style, animate, transition } from '@angular/animations';
@Component({
selector: 'app-animation-example',
templateUrl: './animation-example.component.html',
styleUrls: ['./animation-example.component.css'],
animations: [
trigger('fadeAnimation', [
state('visible', style({ opacity: 1 })),
state('hidden', style({ opacity: 0 })),
transition('visible <=> hidden', animate('300ms')),
]),
],
})
export class AnimationExampleComponent {
isVisible = false;
toggleVisibility() {
this.isVisible = !this.isVisible;
}
}