QtQuick2 - QML - 创建无限动线动画
QtQuick2 - QML - create infinite moving line animation
有谁知道如何实现线性动画,例如在进度条中,很少有线条在进度条中从左到右或以任何其他方式无限移动?我将只使用 QtQuick2 原语,不使用任何额外的 C++ 组件,很高兴看到任何符合此要求的答案。另外,我知道如何为动画设置无限循环,但实际问题是如何在无限循环中将 rectangles/lines 行从 letf 移动到右边,我无法想象这种方法。
类似的东西?
Rectangle {
width: 400
height: 30
anchors.centerIn: parent
border.color: "grey"
border.width: 1
clip: true
Rectangle {
id: runner
property double percent: 0.2
width: parent.width * percent
height: parent.height
color: "orange"
NumberAnimation on x { from: runner.width * (-1); to: 400; duration: 2000; loops: Animation.Infinite }
}
}
有谁知道如何实现线性动画,例如在进度条中,很少有线条在进度条中从左到右或以任何其他方式无限移动?我将只使用 QtQuick2 原语,不使用任何额外的 C++ 组件,很高兴看到任何符合此要求的答案。另外,我知道如何为动画设置无限循环,但实际问题是如何在无限循环中将 rectangles/lines 行从 letf 移动到右边,我无法想象这种方法。
类似的东西?
Rectangle {
width: 400
height: 30
anchors.centerIn: parent
border.color: "grey"
border.width: 1
clip: true
Rectangle {
id: runner
property double percent: 0.2
width: parent.width * percent
height: parent.height
color: "orange"
NumberAnimation on x { from: runner.width * (-1); to: 400; duration: 2000; loops: Animation.Infinite }
}
}