动画:
从一个状态过度到另一个状态
State:定义状态
Transition:定义如何过渡
Animate函数:规定具体如何过渡,如时间,过渡的速度等
animate有多个重载形式
app.module.ts:
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
app.component.ts:
port { trigger, state, transition,style } from "@angular/animations";
animations:[
trigger('square',
[state('green',style({
'background-color':'green',
'height':'100px',
// 'transform':translate
})),
state('red',style({
'background-color':'red','height':'50px'})),
transition('green => red',animate(