如何使用Angular 4动画进入多个状态?

问题描述 投票:4回答:1

我正在使用Angular 4动画,我想知道从初始状态到最终状态的最佳方式是什么,通过其他状态。如果我们以此为例(https://angular.io/guide/animations):

animations: [
  trigger('animationState', [
    state('stateOne', style({
      // some style
    })),
    state('stateTwo',   style({
      // some style
    })),
    transition('inactive => active', animate('100ms ease-in')),
    transition('active => inactive', animate('100ms ease-out'))
  ])
]

所以问题是,如果我添加第三个和第四个状态并且我将活动状态从“stateOne”切换到“stateTwo”,那么如何定义转换以使其自动通过其他类似的状态:stateOne => stateThird => stateFourth => stateTwo。有没有办法定义转换,以便在没有任何变通方法的情况下拥有此行为?

angular angular-animations
1个回答
0
投票

你可以使用角度键帧

https://angular.io/guide/animations#multi-step-animations-with-keyframes

我认为角度文档对此有最好的解释

© www.soinside.com 2019 - 2024. All rights reserved.