Я пытаюсь использовать простую анимацию вращения. Я сделал стиль, но это происходит немедленно, без какой-либо реальной анимации.
HTML:
<img class="icon" [@rotation]="liked? 'rotate' : 'straight'" (click)="liked = ! liked" src="mySource"/>
TS:
import { Component, OnInit, Input } from '@angular/core';
import {trigger, state, style, animate, transition,} from '@angular/animations';
@Component({
selector: 'app-info-window',
animations: [
trigger('rotation', [
state('straight', style({ transform: 'rotate(0)' })),
state('rotate', style({ transform: 'rotate(180deg)' })),
transition('rotated => straight', animate('400ms ease-out')),
transition('straight => rotated', animate('400ms ease-in'))
]),
],
templateUrl: './info-window.component.html',
styleUrls: ['./info-window.component.css']
})
export class InfoWindowComponent implements OnInit {
liked = false;
Я импортировал модуль BrowserAnimationsModule в приложении. Что я делаю не так?