gpt4 book ai didi

ionic4 - 添加自定义加载动画Ionic 4

转载 作者:行者123 更新时间:2023-12-04 16:04:05 25 4
gpt4 key购买 nike

我想使用GIF或SVG动画为ionic 4应用程序创建自定义加载微调器。没有用HTML填充的“content”属性,因此在这种情况下如何用自定义SVG或GIF替换气泡SVG?

async presentLoading() {
const loading = await this.loadingController.create({
spinner: 'bubbles',
duration: 2000
});
return await loading.present();
}

最佳答案

作为ionic V4的官方文档,它不可能。但是您可以通过CSS使用技巧。

<ion-img>标记的allert intead的消息 key 内使用<img/>标记

const loading = await this.loadingController.create({
message: '<ion-img src="/assets/svg/shopping.svg" alt="loading..."></ion-img>',
cssClass: 'scale-down-center',
translucent: true,
showBackdrop: false,
spinner: null,
duration: 2000
});

创建自定义关键帧,您也可以使用此关键帧来生成自己的动画。
// CUSTOM ANIMATION KEYFRAMS********************
@-webkit-keyframes scale-down-center {
0% {
-webkit-transform: scale(1);
transform: scale(1);
}
100% {
-webkit-transform: scale(0.5);
transform: scale(0.5);
}
}
@keyframes scale-down-center {
0% {
-webkit-transform: scale(1);
transform: scale(1);
}
100% {
-webkit-transform: scale(0.5);
transform: scale(0.5);
}
}
// CUSTOM ANIMATION KEYFRAMS********************

创建自定义类
.scale-down-center {
-webkit-animation: scale-down-center 0.6s cubic-bezier(0.175, 0.885, 0.320, 1.275) infinite alternate both;
animation: scale-down-center 0.6s cubic-bezier(0.175, 0.885, 0.320, 1.275) infinite alternate both;
}

关于ionic4 - 添加自定义加载动画Ionic 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53922139/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com