Qt Quick Timeline 概述

时间线可用于对项目进行动画处理并定义其行为。在特定时间点,仅能有一个时间线处于活动状态。

对项目属性进行动画处理,可使其值经过中间值过渡,而非立即变为目标值。例如,要移动场景中的某个项目,可以对控制该项目位置的 x 和 y 属性进行动画处理,使该项目在移动至目标位置的过程中,其位置在关键帧处发生变化。 同样,您可以在关键帧处更改对象的颜色和缩放属性,使其看起来仿佛正在靠近或远离。

Qt Design Studio 包含一个用于创建基于关键帧的动画的时间轴编辑器。

<span translate=Qt Design Studio 中带关键帧的时间轴编辑器" src="images/timeline-editor.png" title="Qt Design Studio 中带关键帧的时间轴编辑器"/>

Qt Quick 允许你在State 对象中声明各种UI状态。这些状态由相对于基础状态的属性变化构成,是组织UI逻辑的有效方式。过渡(Transitions)是可与项目关联的对象,用于定义当属性因状态变化而改变时,其动画效果。你可以在Qt Design Studio 中将时间轴动画与状态绑定。

Qt Design Studio 中的时间轴设置面板

© 2026 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.