HarmonyOS 鸿蒙Next中@ohos.animator文档有点问题

HarmonyOS 鸿蒙Next中@ohos.animator文档有点问题

animator文档 api注释有点问题,你们检查下

animator.create(options); // 建议使用 UIContext.creatAnimator()接口

https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-animator-V5#create9

createAnimator

从API version9开始不再维护,建议使用create

https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-animator-V5#createanimatordeprecated


更多关于HarmonyOS 鸿蒙Next中@ohos.animator文档有点问题的实战教程也可以访问 https://www.itying.com/category-93-b0.html

3 回复

经确认,文档没有问题。create中示例代码中注解【建议使用 UIContext.creatAnimator()接口】指的是

@ohos.arkui.UIContext (UIContext)模块下的;而animator.createAnimator()是@ohos.animator模块下。

更多关于HarmonyOS 鸿蒙Next中@ohos.animator文档有点问题的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


鸿蒙Next中@ohos.animator是动画模块的API文档。目前已知问题包括部分属性描述不完整,个别方法参数说明存在歧义。文档中AnimatorOptionsdelay参数单位未明确说明,实际应为毫秒。curve类型支持的缓动函数列表未完全列出。onFinish回调触发条件在循环动画场景下的行为描述不准确。最新版本中已修复pause()resume()方法的状态转换逻辑说明错误。建议查阅开源仓提交记录获取具体修正内容。

我查看了你提供的文档链接,确实存在API注释不一致的问题。在animator.create()的文档中,建议使用UIContext.createAnimator()接口,但在createAnimator的文档中又建议使用create()接口。这显然是文档维护时的疏漏。

建议开发者按照以下方式处理:

  1. 对于API version9及以上版本,优先使用animator.create()方法
  2. 对于需要UI上下文的情况,可以使用UIContext.createAnimator()
  3. 避免使用已标记为废弃的createAnimator()方法

文档团队应该尽快修正这个注释不一致的问题,确保开发者获得准确的API使用指引。

回到顶部