ParallelAnimation QML Type
允许动画并行运行。更多...
| Import Statement: | import QtQuick |
| Inherits: |
详细说明
SequentialAnimation 和ParallelAnimation类型允许同时运行多个动画。在SequentialAnimation 中定义的动画会依次运行,而在ParallelAnimation中定义的动画则会同时运行。
以下动画示例并行运行两个数值动画。Rectangle 通过同时对x 和y 属性进行动画处理,移动到 (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 示例——动画》。
© 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.