路径动画不用多说,自然是让指定的对象沿某个路径进行移动啦。
老规矩,来看一个曲线运动的代码示例吧骚年们。
话说……春天来了,好想有个妹子呀,只有程序员,没有程序媛的么……
import QtQuick 2.3
import QtQuick.Window 2.2
Window {
visible: true
width: 500
height: 500
MouseArea {
anchors.fill: parent
onClicked: {
pathAnimation.start()
}
}
Rectangle{
id:rect
width: 100
height: 100
color: "black"
border.color: "black"
}
PathAnimation{
id:pathAnimation
target: rect
duration: 5000
orientationEntryDuration: 2000
orientationExitDuration: 2000
easing.type: Easing.InCubic
path: Path{
startX: 0
startY: 0
pathElements: PathArc{
x:360
y:0
useLargeArc: true
radiusX: 160
radiusY: 160
direction: PathArc.Counterclockwise
}
}
}
}