【问题标题】:Android lottie animation lagsAndroid 彩票动画滞后
【发布时间】:2018-12-31 18:28:06
【问题描述】:

我正在开发适用于 iOS 和 Android 的应用。启动画面有一个 JSON 动画。在 iOS 中,动画效果很好,但在 Android 中,相同的动画运行时有延迟。有人经历过吗?

注意事项: 动画没有任何图片资源。

我收到了一些错误日志,但它们似乎不相关,因为我已经尝试过其他运行没有滞后的动画并且它显示相同的错误。

这些是错误:

W/LOTTIE: Lottie doesn't support layer effects. If you are using them for  fills, strokes, trim paths etc. then try adding them directly as contents  in your shape.
Found: [Radial Shadow]
W/LOTTIE: Animation contains merge paths. Merge paths are only supported on KitKat+ and must be manually enabled by calling enableMergePathsForKitKatAndAbove().

【问题讨论】:

  • 嘿@Ofek Regev 我也偶然发现了同样的问题。当您从 AE 渲染动画合成时,您可能使用了 Lottie android SDK 目前不支持的 AE 效果/功能,例如“图层效果”。您需要修改您的构图并将这些图层效果替换为直接从 Illustrator 之类的工具导入的形状图层。
  • 在我们解决问题的时候,设计师告诉我他在 AE 中使用了一些遮罩,这可能导致了这个问题。无论如何感谢您的回答。
  • 我完全忽略了这个警告。

标签: android android-animation lottie


【解决方案1】:

正如您的警告消息所说,尝试设置enableMergePathsForKitKatAndAbove()

示例,在 xml 中 -

<com.airbnb.lottie.LottieAnimationView
    ...
    ...
    ...
    app:lottie_enableMergePathsForKitKatAndAbove="true"/>

或者,在 Java 中 -

lottieAnimationView.enableMergePathsForKitKatAndAbove(true);

【讨论】:

  • 另外,您可以尝试缩小动画以减少延迟。您创建这些动画 json 的原始资源是什么?
猜你喜欢
  • 2015-04-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-10-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多