我想在一个组件中定义多个动画触发器。这可能吗?
例如一个用于进入场景,一个用于悬停。或者我是否需要为这种情况定义两个组件(父子)?
item.compoent.ts
// removed the import and class part for better readability
@Component({
selector: 'item',
templateUrl: './item.template.html',
styleUrls: ['./item.style.scss'],
animations: [
// page load animation
trigger('slideIn', [
state('in', style({
opacity: 1,
transform: 'translateY(0)'
})),
transition('void => *', [
style({
transform: 'translateY(100%)',
opacity: 0
}),
animate('0.5s 100ms ease-in')
])
]),
// <--- this fails
// hover animation
trigger('fadeIn', [
state('over', style({
opacity: 1
})),
transition('void => *', [
style({
opacity: 0
}),
animate('0.5s 100ms ease-in')
])
],
})
item.template.html
<div class="item" [@slideIn]="enterState">
<div class="info">
SOME INFO
</div>
<div class="info-on-hover" [@fadeIn]="hoverState">
SOME INFO
</div>
</div>
哦,有人应该创建标签“angular2-animation”
问候