ParallelAnimation QML Type
使动画可以并行运行。更多
Import Statement: | import QtQuick |
Inherits: |
详细说明
SequentialAnimation 和 ParallelAnimation 类型允许同时运行多个动画。在SequentialAnimation 中定义的动画会一个接一个地运行,而在 ParallelAnimation 中定义的动画会同时运行。
下面的动画同时运行两个数字动画。通过同时激活x
和y
属性,Rectangle 移动到 (50,50)。
import QtQuick Rectangle { id: rect width: 100; height: 100 color: "red" ParallelAnimation { running: true NumberAnimation { target: rect; property: "x"; to: 50; duration: 1000 } NumberAnimation { target: rect; property: "y"; to: 50; duration: 1000 } } }
与其他动画类型一样,ParallelAnimation 可以多种方式应用,包括转换、行为和属性值源。 Qt Quick 文档 中的动画和过渡显示了多种创建动画的方法。
注意: 一旦动画被分组到SequentialAnimation 或 ParallelAnimation 中,就不能单独启动和停止;SequentialAnimation 或 ParallelAnimation 必须作为一个组来启动和停止。
另请参阅 SequentialAnimation, Qt Quick 中的动画和过渡,以及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.