有谁知道如何实现线性动画,例如在进度条中,很少有线条在条中从左到右或以任何其他方式无限移动?我将仅使用 QtQuick2 原语,而不使用任何其他 C++ 组件,很高兴看到任何可以满足此要求的答案。另外,我知道如何为动画设置无限循环,但实际问题是如何在无限循环中将矩形/线条行从 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 }
}
}
关于javascript - QtQuick2-QML-创建无限动线动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30835454/