diff --git a/entry/src/main/ets/Components/LoadingView.ets b/entry/src/main/ets/Components/LoadingView.ets new file mode 100644 index 0000000000000000000000000000000000000000..c6ae0bf561e09ee1eb5e488d4b357d8b1627c8f0 --- /dev/null +++ b/entry/src/main/ets/Components/LoadingView.ets @@ -0,0 +1,31 @@ + +@Component +export default struct LoadingView { + private animTasker + @State rotateAngle: number = 0 + + aboutToAppear() { + this.animTasker = setInterval(() => { + this.rotateAngle = ((this.rotateAngle == 360) ? 0 : (this.rotateAngle + 1)) + }, 10) + } + + aboutToDisappear() { + clearInterval(this.animTasker) + } + + build() { + Stack({ alignContent: Alignment.Center }) { + Image($r('app.media.ic_loading')) + .width('50px') + .height('50px') + .objectFit(ImageFit.Fill) + .rotate({ + z: 1, + centerX: '50%', + centerY: '50%', + angle: this.rotateAngle, + }) + }.width('100%').height('100%').backgroundColor('#00000000') + } +} \ No newline at end of file