SWEBDEV Telegram 3429
AnimationTrigger для создания сложных анимаций

В Angular AnimationTrigger управляет анимациями компонентов, задавая состояния, их изменения и связывая анимации с событиями.

Пример:
import { Component } from '@angular/core';
import { trigger, state, style, transition, animate } from '@angular/animations';

@Component({
selector: 'app-animated',
template: `
<div [@fadeInOut]="isVisible ? 'visible' : 'hidden'" class="box"></div>
<button (click)="toggle()">Toggle</button>
`,
animations: [
trigger('fadeInOut', [
state('visible', style({ opacity: 1 })),
state('hidden', style({ opacity: 0 })),
transition('hidden => visible', [animate('500ms ease-in')]),
transition('visible => hidden', [animate('300ms ease-out')]),
]),
],
styles: [`.box { width: 100px; height: 100px; background: lightblue; margin: 10px; }`],
})
export class AnimatedComponent {
isVisible = false;
toggle() {
this.isVisible = !this.isVisible;
}
}

👉 @sWebDev
👍4



tgoop.com/sWebDev/3429
Create:
Last Update:

AnimationTrigger для создания сложных анимаций

В Angular AnimationTrigger управляет анимациями компонентов, задавая состояния, их изменения и связывая анимации с событиями.

Пример:

import { Component } from '@angular/core';
import { trigger, state, style, transition, animate } from '@angular/animations';

@Component({
selector: 'app-animated',
template: `
<div [@fadeInOut]="isVisible ? 'visible' : 'hidden'" class="box"></div>
<button (click)="toggle()">Toggle</button>
`,
animations: [
trigger('fadeInOut', [
state('visible', style({ opacity: 1 })),
state('hidden', style({ opacity: 0 })),
transition('hidden => visible', [animate('500ms ease-in')]),
transition('visible => hidden', [animate('300ms ease-out')]),
]),
],
styles: [`.box { width: 100px; height: 100px; background: lightblue; margin: 10px; }`],
})
export class AnimatedComponent {
isVisible = false;
toggle() {
this.isVisible = !this.isVisible;
}
}

👉 @sWebDev

BY Frontender Libs - обзор библиотек JS / CSS




Share with your friend now:
tgoop.com/sWebDev/3429

View MORE
Open in Telegram


Telegram News

Date: |

To edit your name or bio, click the Menu icon and select “Manage Channel.” A vandalised bank during the 2019 protest. File photo: May James/HKFP. How to Create a Private or Public Channel on Telegram? Choose quality over quantity. Remember that one high-quality post is better than five short publications of questionable value. Hui said the messages, which included urging the disruption of airport operations, were attempts to incite followers to make use of poisonous, corrosive or flammable substances to vandalize police vehicles, and also called on others to make weapons to harm police.
from us


Telegram Frontender Libs - обзор библиотек JS / CSS
FROM American