WarpDrive.qml Example File
locationdiagnostics/assets/WarpDrive.qml
import bb.cascades 1.0
Container {
id: root
property int frequency: 0
signal frequencyChanged(int frequency)
Container {
horizontalAlignment: HorizontalAlignment.Fill
layout: DockLayout {}
ImageView {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Top
imageSource: "asset:///images/compass_base.png"
}
ImageView {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Top
imageSource: "asset:///images/compass_pointer.png"
animations: [
FadeTransition {
id: fadeout
fromOpacity: 1
toOpacity: .5
duration: root.frequency + 200
onEnded: {
fadein.play();
}
},
FadeTransition {
id: fadein
duration: fadeout.duration
fromOpacity: .5
toOpacity: 1
onEnded: {
rotate.play();
}
},
RotateTransition {
id: rotate
fromAngleZ: 0
toAngleZ: 360
easingCurve: StockCurve.CubicOut
duration: fadeout.duration
onEnded: {
fadeout.play();
}
}
]
}
onCreationCompleted: {
fadeout.play();
fadeout.duration = root.frequency + 200;
}
}
Label {
horizontalAlignment: HorizontalAlignment.Center
text: (root.frequency == 0 ? qsTr ("Frequency") : qsTr ("Frequency: %1s").arg(root.frequency))
textStyle {
base: SystemDefaults.TextStyles.BodyText
}
}
Slider {
horizontalAlignment: HorizontalAlignment.Center
fromValue: 1
toValue: 500
value: root.frequency
onValueChanged: {
root.frequencyChanged(Math.floor(value))
}
}
}