文档开发者中心
我的
|

ArkUI (方舟UI框架)

Ability框架

HarmonyOS 5

使用 animation 动画时,当 iterations 为偶数, 且 playMode 为 Alternate 时,renderFit 不生效。

收起
自动换行
深色代码主题
复制
@Entry
@Component
struct Index {
  @State tWidth: number = 100
  @State tHeight: number = 100
  build() {
    Column() {
      Text('test')
        .onClick(() => {
          this.tWidth = 300
          this.tHeight = 300
        })
        .width(this.tWidth)
        .height(this.tHeight)
        .backgroundColor('red')
        // 这个配置失效了
        .renderFit(RenderFit.LEFT)
        .animation({
          duration: 1000,
          // 这里为偶数
          iterations: 2,
          // 这里配置为 Alternate
          playMode: PlayMode.Alternate,
          curve: Curve.Linear,
          onFinish() {
            console.log('动画结束')
          }
        })
    }
  }
}
点赞
收藏
回复
分享
举报
浏览179 发布于2024-07-22 06:51辽宁
全部评论
最多点赞
最新发布
最早发布
暂无评论
暂无评论
写回答
新增插入模板功能
一键使用模板,快速填写内容,轻松发帖~
知道了
  • 为了保障您的信息安全,请勿上传您的敏感个人信息(如您的密码等信息)和您的敏感资产信息(如关键源代码、签名私钥、调试安装包、业务日志等信息),且您需自行承担由此产生的信息泄露等安全风险。
  • 如您发布的内容为转载内容,请注明内容来源。

我要发帖子

了解社区公约,与您携手共创和谐专业的开发者社区。