HarmonyOS ImageAnimator组件加载帧图片,动画显示过程中一直有锯齿,怎样才能消除

ImageAnimator组件设置一系列帧图图片,动画加载过程中存在锯齿,动画停止后显示的图片也存在锯齿, 不清晰,ImageAnimator已设置width和height为40。(图片真实宽高为160px * 160px)

build() {
  Stack({ alignContent: Alignment.Center }) {
    ImageAnimator()
      .images(TableCardUtil.isDarkMode() ?
        (this.switchState ? SwitchAnimateType.switchDarkOff : SwitchAnimateType.switchDarkOn) :
        (this.switchState ? SwitchAnimateType.switchLightOff : SwitchAnimateType.switchLightOn))
      .duration(2000)
      .state(this.animationStatus)
      .reverse(false)
      .fillMode(FillMode.Both)
      .width('100%')
      .height('100%')
      .enabled((this.item['status'] === 'offline') ? false : true)
      .opacity((this.item['status'] === 'offline') ? 0.4 : 1)
      .align(Alignment.End)
      .onClick(() => {
        this.animationStatus = AnimationStatus.Running;
      })
      .onStart(() => {
        if (!this.isUpdate || this.item['activeStatus'] !== 0 || this.item['status'] !== 'online') {
          // 未关联devId时为默认卡片,不响应点击事件
          this.animationStatus = AnimationStatus.Initial;
          return;
        }
        // 下发指令
        this.switchState = (this.item['switchInfo'] === null ? false :
          ((this.item['switchInfo'] as Record<string, number>)['data'] === 1));
        this.switchControl(this.item['deviceId'] as string);
        this.updateIconStatus(true);
      })
      .onFinish(() => {
        this.switchState = !this.switchState;
        this.animationStatus = AnimationStatus.Initial;
      })
  }
  .width(40)
  .height(40)
}
HarmonyOS
2024-12-26 13:36:44
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
put_get

ImageAnimator没有抗锯齿功能,想要抗锯齿只能点对点,不能出现下采样或者差值,保证图多大,image就有多大。

分享
微博
QQ
微信
回复
2024-12-26 15:35:56
相关问题
怎样才能把apk转化成鸿蒙应用?
6995浏览 • 1回复 待解决
怎样才能跳转到应用市场界面?
1191浏览 • 2回复 待解决
HarmonyOS获取图片旋转值一直报错
635浏览 • 1回复 待解决
HarmonyOS 动画过程中UI残留
249浏览 • 1回复 待解决
HarmonyOS webview加载html string一直闪退
199浏览 • 1回复 待解决
自动签名失败一直加载怎么回事?
6578浏览 • 2回复 待解决
png图片使用Image组件加载出现锯齿
1946浏览 • 1回复 待解决
PolarDB控制台一直加载中怎么回事?
3511浏览 • 1回复 待解决
HarmonyOS 获取定位一直失败
210浏览 • 1回复 待解决