【发布时间】:2017-11-05 10:10:50
【问题描述】:
ProgressBar{
id:progressBar
width : parent.width * 0.80
height:parent.height * 0.05
anchors.bottom:parent.bottom
anchors.bottomMargin: (parent.height * 0.03)
anchors.left:parent.left
anchors.leftMargin: (parent.width * 0.05)
value : 0.5
background: Rectangle {
color: "#e6e6e6"
radius: 3
}
contentItem: Item {
Rectangle {
width: progressBar.visualPosition * parent.width
height: parent.height
radius: 2
color: "#17a81a"
gradient: Gradient {
GradientStop {
position: 0.0
SequentialAnimation on color {
loops: Animation.Infinite
ColorAnimation { from: "#14148c"; to: "#0E1533"; duration: 5000 }
ColorAnimation { from: "#0E1533"; to: "#14148c"; duration: 5000 }
}
}
GradientStop {
position: 1.0
SequentialAnimation on color {
loops: Animation.Infinite
ColorAnimation { from: "#14aaff"; to: "#437284"; duration: 5000 }
ColorAnimation { from: "#437284"; to: "#14aaff"; duration: 5000 }
}
}
}
}
}
}
我从未在 QML 中使用过动画,我尝试使用上述顺序动画,从上到下进行动画处理。但我需要它从左到右制作动画。
谁能帮我实现这个目标?
【问题讨论】:
-
你已经尝试了什么?一些代码?
-
@folibis 我已经添加了代码,请检查,我目前正在尝试使用顺序动画。
标签: qt qml progress-bar qtquick2 qtquickcontrols2