audio gradient bar length as a function of 0 to 1

This commit is contained in:
Faye Li Si Fi 2016-12-14 11:38:36 -08:00
parent 53263789a0
commit a651e19bdd

View file

@ -1,8 +1,11 @@
import QtQuick 2.0 import QtQuick 2.0
import QtGraphicalEffects 1.0
Item { Item {
id: tablet id: tablet
property double miclevel: 0.8
width: 480 width: 480
height: 720 height: 720
@ -36,7 +39,8 @@ Item {
anchors.left: parent.left anchors.left: parent.left
anchors.rightMargin: 30 anchors.rightMargin: 30
anchors.right: parent.right anchors.right: parent.right
spacing: 10 spacing: 5
Rectangle { Rectangle {
id: muteButton id: muteButton
width: 128 width: 128
@ -80,6 +84,7 @@ Item {
} }
} }
} }
Image { Image {
id: muteIcon id: muteIcon
width: 40 width: 40
@ -87,34 +92,45 @@ Item {
source: "../../../icons/tablet-mute-icon.svg" source: "../../../icons/tablet-mute-icon.svg"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
Rectangle {
id: audioBarBase Item {
color: "#333333" id: item1
radius: 5
width: 225 width: 225
height: 10 height: 10
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Rectangle { Rectangle {
id: audioBarColor id: audioBarBase
color: "#333333"
radius: 5 radius: 5
anchors.verticalCenterOffset: 0 anchors.fill: parent
}
Rectangle {
id: audioBarMask
width: parent.width * tablet.miclevel
color: "#333333"
radius: 5
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
anchors.top: parent.top
anchors.topMargin: 0
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 85 anchors.leftMargin: 0
anchors.verticalCenter: parent.verticalCenter }
rotation: -90 LinearGradient {
anchors.fill: audioBarMask
source: audioBarMask
start: Qt.point(0, 0)
end: Qt.point(225, 0)
gradient: Gradient { gradient: Gradient {
GradientStop { GradientStop {
position: 0 position: 0
color: "#00b8ff" color: "#00b8ff"
} }
GradientStop { GradientStop {
position: 1 position: 1
color: "#ff2d73" color: "#ff2d73"
} }
} }
width: parent.height
height: parent.width*0.8
} }
} }
} }
@ -199,6 +215,11 @@ Item {
target: muteIcon target: muteIcon
source: "../../../icons/tablet-unmute-icon.svg" source: "../../../icons/tablet-unmute-icon.svg"
} }
PropertyChanges {
target: tablet
miclevel: 0
}
} }
] ]
} }