/*
 * $该文件功能说明$
 * EZOpenSDK
 *
 * Created by junecheng on 2024/8/15.
 * Copyright (c) 2024年 Ezviz. All rights reserved.
 */
@Component
export default struct ProgressView {
  @Prop rotateValue: number = 0
  @Prop isShowLoading: boolean = false

  build() {
    // 显示加载中动画
    Column({ space: 15 }) {
      Progress({ value: 100, total: 100, type: ProgressType.ScaleRing })
        .color(Color.Blue)
        .value(100)
        .width(40)
        .height(40)
        .style({ strokeWidth: 8, scaleCount: 20, scaleWidth: 2 })
        .rotate({ angle: this.rotateValue })
        .animation({
          duration: 950,
          curve: Curve.Linear,
          delay: 0,
          iterations: -1, // 设置-1表示动画无限循环
          playMode: PlayMode.Reverse,
          onFinish: () => {
            //console.info('play end')
          }
        })
      //
      // Text('Loading...')
      //   .fontSize(10)
      //   .fontColor(Color.Black)
      //   .margin({ top: 0 })
    }
    .visibility(this.isShowLoading ? Visibility.Visible : Visibility.Hidden)
    .width('100%')
    .height('100%')
    .justifyContent(FlexAlign.Center)
    .alignItems(HorizontalAlign.Center)
    .backgroundColor($r('app.color.loading_bg'))
  }
}