我使用Angular动画创建了一个元素(div.parent
),它的运行效果非常好。但是当我给它添加一个子元素并尝试同时对子元素进行动画时,其中一个动画就无法正常运行(只会瞬间切换到新的状态)。
Stackblitz: https://stackblitz.com/edit/angular-2tbwu8
Markup:
<div [@theParentAnimation]="state" class="parent">
<div [@theChildAnimation]="state" class="child">
</div>
</div>
动画:trigger( 'theParentAnimation', [
state( 'down', style( {
transform: 'translateY( 100% ) translateZ( 0 )',
} ) ),
transition( '* <=> *', [
group( [
query( ':self', [
animate( '0.9s cubic-bezier(0.55, 0.31, 0.15, 0.93)' ),
] ),
query( '@theChildAnimation', animateChild() ),
] ),
] ),
] ),
trigger( 'theChildAnimation', [
state( 'down', style( {
transform: 'translateY( 100% ) translateZ( 0 )',
} ) ),
transition( '* <=> *', [
animate( '0.9s cubic-bezier(0.55, 0.31, 0.15, 0.93)' ),
] ),
] ),