对于演示页面,我想使用 Angular 动画逐个元素显示页面内容
我的目标是制作一个动画来隐藏我的内容,并为每个元素制作一个动画,但我的内容被很好地隐藏了(:self),但其他动画直到动画结束时才产生效果,此时我的所有内容都同时出现
animations : [
trigger('homeAnimations', [
transition(':enter', [
query(':self',[
style({opacity:0})
]),
query('#presentation h1', [
animate('2s', style({ opacity: 1 }))
], { optional: true }),
query('#presentation h2', [
animate('2s', style({ opacity: 1 }))
], { optional: true }),
query('#presentation p', [
animate('2s', style({ opacity: 1 }))
], { optional: true }),
query('#btn1', [
animate('2s', style({ opacity: 1 }))
], { optional: true }),
query('#btn2', [
animate('2s', style({ opacity: 1 }))
], { optional: true }),
query('#btn3', [
animate('2s', style({ opacity: 1 }))
], { optional: true }),
])
])
],
如果您的元素是的子元素
:self
,则如果父元素不可见,则子元素将不会显示。解决方案:首先隐藏子项: