Browse Source

Add color animation for activations color change

Alexey Edelev 5 years ago
parent
commit
444ef36ea0
1 changed files with 13 additions and 1 deletions
  1. 13 1
      gui/main.qml

+ 13 - 1
gui/main.qml

@@ -75,9 +75,21 @@ ApplicationWindow {
                                 anchors.fill: parent
                                 radius: 15
                                 color: "transparent"
+                                ColorAnimation {
+                                    id: anim
+                                    target: neuron
+                                    property: "color"
+                                    to: "#000000"
+                                    duration: 150
+                                }
+
                                 function updateColor() {
                                     var alpha = activation.value;
-                                    neuron.color = Qt.rgba(0, 1, 0, Math.max(0.08, alpha))
+                                    neuron.color = anim.to
+                                    anim.stop()
+                                    anim.from = anim.to
+                                    anim.to = Qt.rgba(0, 1, 0, Math.max(0.08, alpha))
+                                    anim.start()
                                 }
                                 Component.onCompleted: {
                                     visualizerModel.activationTrigger(layerIndex).updateLayer.connect(neuron.updateColor);