
import QtQuick 2.0
Item {
Rectangle {
id: rect
width: 100; height: 100
color: "red"
SequentialAnimation {
running: true
NumberAnimation { target: rect; property: "x"; to: 50; duration: 1000 }
PauseAnimation {
duration: 2000
}
NumberAnimation { target: rect; property: "y"; to: 50; duration: 1000 }
}
}
}
使用QtQuick进行动画效果实现
这段代码展示了如何在QtQuick中创建一个SequentialAnimation,使红色矩形在1秒内平移到x=50,然后暂停2秒,再在1秒内平移到y=50,实现了简单的2D动画效果。
216

被折叠的 条评论
为什么被折叠?



