我使用的是离子v5.6.13和角v12.1.1
我有一个动画,它从底部的.fadeInBottom类消失在所有元素中。
它在iOS上运行得很好,但在安卓系统上,它有时会调用两次动画,我似乎看不出当它被触发两次时的模式。
animations.service.ts
async fadeInBottom() {
let elements = Array.from(document.getElementsByClassName('fadeInBottom'));
const animations = elements.map((el, i) => {
return this.animaitionCtrl.create()
.addElement(el)
.duration(150)
.delay(i * 25)
.fromTo('opacity', 0,1)
.fromTo('transform', 'translateY(30px)', 'none')
.play();
});
await Promise.all(animations)
return true;
}动画在页面中被调用。
async ionViewDidEnter() {
await this.animationsService.fadeInBottom();
}发布于 2021-09-22 14:15:26
在使用“不透明度”时,我有时会在android上看到双动画。我不知道这会成功,但是试着
.fadeInBottom{
opacity: 0;
}作为默认值的css文件中要动画的所有元素。
除此之外,我更愿意使用@keyframe制作css文件中的所有动画,您可以在这里更多地了解它:https://developer.mozilla.org/es/docs/Web/CSS/@keyframes
https://stackoverflow.com/questions/69285651
复制相似问题