diff options
Diffstat (limited to 'desktop/companion/Figure.qml')
| -rw-r--r-- | desktop/companion/Figure.qml | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/desktop/companion/Figure.qml b/desktop/companion/Figure.qml index 3401168..285e2cb 100644 --- a/desktop/companion/Figure.qml +++ b/desktop/companion/Figure.qml @@ -44,6 +44,13 @@ Item { onSourceChanged: s.load(s.source) Component.onCompleted: s.load(s.source) + // The incoming frame fades in on top while the outgoing one stays + // opaque under it. Fading both at once left each near half opacity + // mid-swap, and she blinked see-through on every turn of the dj loop. + property real fade: 1 + NumberAnimation { id: fadeIn; target: s; property: "fade"; from: 0; to: 1; duration: 120 } + onFlipChanged: fadeIn.restart() + function ready(img) { if (img.status === Image.Error && String(img.source) !== s.fallback) { img.source = s.fallback; @@ -59,8 +66,14 @@ Item { target: s; property: "drop"; duration: 320 onFinished: s.settled(s.out) } + // Out from creation (a shell started with her hidden) never ran the drop, + // since a starting value fires no onOutChanged, and she was drawn in place + // with her clock stopped, frozen on whatever frame came next. The body + // below hides her until she is shown, and the first entrance starts from + // below like any other. onOutChanged: { dropAnim.stop(); + if (!s.out && s.drop === 0) s.drop = s.height + 24; dropAnim.to = s.out ? s.height + 24 : 0; dropAnim.easing.type = s.out ? Easing.InCubic : Easing.OutBack; dropAnim.start(); @@ -86,6 +99,7 @@ Item { Item { anchors.fill: parent + visible: !s.out || dropAnim.running opacity: 1 - s.drop / (s.height + 24) transform: Translate { x: s.shake; y: s.drop - s.bob } @@ -94,8 +108,8 @@ Item { width: implicitWidth / 2; height: implicitHeight / 2 anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter } smooth: true; mipmap: true; asynchronous: true - opacity: s.flip ? 0 : 1 - Behavior on opacity { NumberAnimation { duration: 120 } } + z: s.front === a ? 1 : 0 + opacity: s.front === a ? s.fade : s.fade < 1 ? 1 : 0 onStatusChanged: s.ready(a) } Image { @@ -103,8 +117,8 @@ Item { width: implicitWidth / 2; height: implicitHeight / 2 anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter } smooth: true; mipmap: true; asynchronous: true - opacity: s.flip ? 1 : 0 - Behavior on opacity { NumberAnimation { duration: 120 } } + z: s.front === b ? 1 : 0 + opacity: s.front === b ? s.fade : s.fade < 1 ? 1 : 0 onStatusChanged: s.ready(b) } } |
