是否有一种方法可以在动画键上侦听与状态匹配的元素的更改?
例如,如果我们有以下元素:
<div id="first-div" @fadeInOut></div>
<div id="second-div" @fadeInOut @shaking></div>
<div id="third-div" @shaking></div>我想听听哪个元素当前有fadeInOut动画,并确定它是在执行:enter还是:leave。
类似于:
animations.on('fadeInOut').subscribe((el) => {
// el will tell us which element is animation and it's having which state.
});发布于 2021-11-29 11:43:02
我们可以使用动画触发器回叫听动画阶段。
component.html
<div id="first-div" (@fadeInOut.start)="captureStartEvent($event)" @fadeInOut>
</div>component.ts
captureStartEvent(event: AnimationEvent) {
}https://stackoverflow.com/questions/70143676
复制相似问题