HarmonyOS Image配置的图片如何旋转

HarmonyOS
2024-12-25 13:38:40
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
Excelsior_abit

可参考示例如下:

import { curves } from '@kit.ArkUI'

@Entry
@Component
struct Page030 {
  @State rotateValue: number = 0

  build() {
    Column() {
      Button('测试').onClick(() => {
        this.rotateValue = 360
      })
      Image($r("app.media.app_icon"))
        .width('200lpx')
        .height('200lpx')
        .rotate({ angle: this.rotateValue })
        .animation(this.rotateValue != 0 ? {
          duration: 2000,
          curve: curves.springMotion(),
          playMode: PlayMode.Normal,
          onFinish: (() => {
            console.info('----onFinish this.rotateValue', this.rotateValue)
            if (this.rotateValue == 360) {
              this.rotateValue = 0
            }
          })
        } : undefined)
    }
    .width('100%')
    .height('100%')
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
分享
微博
QQ
微信
回复
2024-12-25 16:06:09
相关问题
如何实现图片裁剪、旋转
1401浏览 • 1回复 待解决
HarmonyOS 图片旋转角度问题
539浏览 • 1回复 待解决
HarmonyOS Image加载图片
650浏览 • 1回复 待解决
HarmonyOS Image如何显示base64图片
1291浏览 • 1回复 待解决
HarmonyOS预加载Image组件图片
1384浏览 • 1回复 待解决
Image组件如何加载沙盒内图片
3420浏览 • 1回复 待解决
Image组件如何读入沙箱内图片
3918浏览 • 1回复 待解决
HarmonyOS Image图片无法加载
952浏览 • 1回复 待解决
HarmonyOS image如何图片裁剪成圆形
598浏览 • 1回复 待解决
HarmonyOS获取图片旋转值一直报错
1194浏览 • 1回复 待解决
HarmonyOS Image加载图片不出现
915浏览 • 1回复 待解决
HarmonyOS Image组件加载图片报错
858浏览 • 1回复 待解决
HarmonyOS Image加载网络图片
737浏览 • 1回复 待解决