我试图用动态列表在我的应用程序中错开动画.我想动画进入和离开,如果可能的话,但只会让你进入工作.
animations: [ trigger('slideIn',[ transition(':enter',[ style({ transform: 'translate3d(0,-10px,0)',opacity: 0 }),animate('0.1s',style({ transform: 'translate3d(0,opacity: 1 })) ]) ]) ]
上面是我无法运行的动画代码,下面是我如何将其实现到模板中.
<ion-content [@listAnimation]="eventsList?.length"> <ion-list> <event-item *ngFor="let item of eventsList" [item]="item"></event-item> </ion-list> <empty-list [list]="eventsList" [message]="'There are no event items to display.'"></empty-list> <ion-infinite-scroll [enabled]="infiniteScroll === null" (ionInfinite)="doInfinite($event)"> <ion-infinite-scroll-content></ion-infinite-scroll-content> </ion-infinite-scroll> </ion-content>
请让我知道我哪里出错了.
解决方法
我自己还没有做过任何动画,但根据:
https://www.yearofmoo.com/2017/06/new-wave-of-animation-features.html#space-things-out-with-stagger
https://www.yearofmoo.com/2017/06/new-wave-of-animation-features.html#space-things-out-with-stagger
你的代码应该是这样的:
animations: [ trigger('listAnimation',[ transition('* => *',[ // remember that :enter is a special // selector that will return each // newly inserted node in the ngFor list query(':enter',[ style({ transform: 'translate3d(0,opacity: 0 }),style({ transform: 'translate3d(0,opacity: 1 })) ]) ]) ]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。