当div增长时,我试图用Angular做动画。 像这样的东西: `
animations: [
trigger('heightChange', [
state('close', style({height: '300px'})),
state('expanded', style({height: '380px'})),
transition('close => expanded', animate('250ms ease-in')),
transition('expanded => close', animate('250ms ease-out'))
])
]
`
这个例子正是我想要的,但只是在这个高度的一个div中。我想在不止一个div中使用这个动画,其中不同的近距离和扩展高度。
我试过了(但当然它没有用):
`
animations: [
trigger('heightChange', [
state('close', style({height: '*'})),
state('expanded', style({height: '*'})),
transition('close => expanded', animate('250ms ease-in')),
transition('expanded => close', animate('250ms ease-out'))
])
]
`
我可以这样做吗?
好的,我找到了解决方案,也许对任何人都有帮助: 它起作用,至少现在......
animations: [
trigger('heightChange', [
transition('close <=> expanded', [
style({height: '!'}),
animate(250, style({height: '*'}))
]),
])
]