1.4K Star 7.3K Fork 7.8K

OpenHarmony/docs

设置图片绕中心旋转,预览器显示效果绕上边缘中心旋转,真机设备运行正常

已完成
任务
创建于  
2022-04-14 21:10

【任务描述】
设置图片绕中心旋转,预览器查看效果
【解决方案】
我希望图片绕中心旋转,但实际绕上边缘中心旋转。
【任务来源】

@Entry
@Component
struct Index {
  @State private angle:number = 0
  @State private imageSize:number = 1
  @State private speed:number = 5
  @State private interval:number = 0

  @Builder
  DescribeText(text:string,speed:number){
    Column(){
    Text(text + speed.toFixed(1))
      .margin(30)
      .fontSize(20)
      .fontWeight(FontWeight.Bold)
  }
  }

  build() {
    Flex({direction:FlexDirection.Column,wrap:FlexWrap.NoWrap,justifyContent:FlexAlign.Center,alignItems:ItemAlign.Center,alignContent:FlexAlign.Center}){
      Image($r('app.media.icon'))
      .objectFit(ImageFit.Contain)
      .height(150)
      .width(150)
      .margin({top:50,bottom:150,right:16})
      .rotate({x:0,y:0,z:1,angle:this.angle,centerX:'50%',centerY:'50%'})
      .scale({x:this.imageSize,y:this.imageSize})

      Text('速度:'+ this.speed.toFixed(1))
      .fontSize(20)
      .margin({top:30})
      .fontWeight(FontWeight.Bold)

      Slider({
        value:this.speed,
        min:1,
        max:10,
        step:1,
        style:SliderStyle.OutSet
      })
      .showTips(true)
      .blockColor(Color.Brown)
      .onChange((value:number) =>{
      this.speed = value
      })

      Text('缩放大小:'+ this.imageSize.toFixed(1))
        .fontSize(20)
        .margin({top:30})
        .fontWeight(FontWeight.Bold)

      Slider({
        value:this.imageSize,
        min:0.5,
        max:2.5,
        step:0.1,
        style:SliderStyle.OutSet
      })
        .showTips(true)
        .blockColor(Color.Brown)
        .onChange((value:number) =>{
          this.imageSize = value
        })
    }
    .width('100%')
    .height('100%')




  }
  speedChange(){
    var that = this
    this.interval = setInterval(function(){
      that.angle += that.speed
    },15)
  }


  onPageShow(){
    this.speedChange()
  }
}

评论 (4)

huachengtao2023 创建了任务 3年前
LiAn 任务状态待办的 修改为进行中 3年前
LiAn 负责人设置为LiAn 3年前
展开全部操作日志

开发者好,该问题为预览器功能缺失。

请问在跟踪了吗

MerryLiu为预览器相关负责人,已通知跟踪。

LiAn 添加了
 
product-issue
标签
3年前
LiAn 添加协作者LiAn 3年前
LiAn 负责人LiAn 修改为MerryLiu 3年前
LiAn 取消协作者LiAn 3年前
LiAn 任务状态进行中 修改为已完成 3年前
aiyongfu 修改了标题 3年前

登录 后才可以发表评论

状态
负责人
项目
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
预计工期 (小时)
开始日期   -   截止日期
-
置顶选项
优先级
里程碑
分支
参与者(2)
LiAn-HelloCrease huachengtao2023-rain-and-clouds
其他
1
https://gitee.com/openharmony/docs.git
git@gitee.com:openharmony/docs.git
openharmony
docs
docs

搜索帮助