lottietoqml
lottietoqml
是一个随 Qt 提供的命令行工具,可将 Lottie 文档转换为 QML 文件。然后,该 QML 文件可用作Qt Quick 应用程序的组件。
有关如何在应用程序中使用lottietoqml
的演示,请参阅lottietoqml 示例。
该工具目前处于技术预览阶段。它还不支持 Qt Lottie Animation支持的全部功能,预计会出现不兼容的变化。
概述
lottietoqml
工具可将 Lottie 文件转换为使用Qt Quick 基元的 QML 文件。由于Qt Quick 是硬件加速的,因此渲染动画的性能和占用的 CPU 时间可能比使用.NET Framework 3.0 中的内置软件渲染器更少。 Qt Lottie Animation.此外,Qt Quick 支持可缩放的矢量图形,因此生成的项目可以尽可能平滑地转换。
使用方法
lottietoqml
的基本用法是提供一个输入文件和一个输出文件:lottietoqml input.json output.qml
。它将读取input.json
文件,并在output.qml
中将其转换为相应的Qt Quick 场景,然后将其用作Qt Quick 应用程序的一部分。
此外,它还支持以下选项:
选项 | 选项 |
---|---|
-版权声明 <string | 在生成文件的开头添加 <string> 作为注释。 |
-c、-曲线渲染器 | 为 Qt Quick Shapes.这样就能在场景中生成平滑的反锯齿形状,而无需多重采样,但需要额外的成本。 |
-p,优化路径 | 在将路径提交到 QML 文件之前对路径进行优化,这样可能会加快路径的加载和渲染速度。 |
-轮廓-描边模式 | 描边填充形状的轮廓,而不是原始路径。 |
-t,-类型名称 <字符串 | 输出将使用类型名称 <string> 代替Shape 。使用自定义项可以覆盖Shape 项的默认行为。 |
-v, -view | 显示即将生成的Qt Quick 项目的预览。 |
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.