Attempting to add animation to my webpage has presented a challenge:
I have a content div on my page, along with a button that triggers the opening of another div above the content. My goal is to have this top div fade and slide into view while simultaneously having the content div slide down or up. Although I managed to create the desired animation for the div that appears upon clicking the button, I am unsure how to handle the content div as shown in the code snippet below:
<div class="wrapper">
<button (click)="animated = !animated"></button>
<div *ngIf="animated" [@slideInOutAnimation] class="animated-div">
THIS DIV IS ANIMATED</div>
<div class="content">THIS IS CONTENT DIV</div>
</div>
TYPESCRIPT:
animations: [
trigger('slideInOutAnimation', [
state('*', style({
})),
transition(':enter', [
style({
transform: 'translateY(-10%)',
opacity: 0
}),
animate('.5s ease-in-out', style({
transform: 'translateY(0)',
opacity: 1
}))
]),
transition(':leave', [
animate('.5s ease-in-out', style({
transform: 'translateY(-10%)',
opacity: 0
}))
])
])
]
Do I need to create an additional trigger to move my content div along with the animated one?