Add easing animations when zooming in and out on focus
This commit is contained in:
parent
cfba504e3c
commit
742fa0e4ca
|
|
@ -44,12 +44,20 @@ Node {
|
||||||
id: displays
|
id: displays
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function displayAtIndex(index) {
|
||||||
|
if (index < 0 || index >= screens.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return breezyDesktopDisplays.objectAt(index);
|
||||||
|
}
|
||||||
|
|
||||||
Repeater3D {
|
Repeater3D {
|
||||||
|
id: breezyDesktopDisplays
|
||||||
model: screens.length
|
model: screens.length
|
||||||
delegate: BreezyDesktopDisplay {
|
delegate: BreezyDesktopDisplay {
|
||||||
screen: screens[index]
|
screen: screens[index]
|
||||||
monitorPlacement: monitorPlacements[index]
|
monitorPlacement: monitorPlacements[index]
|
||||||
|
property real monitorDistance: effect.allDisplaysDistance
|
||||||
property real screenRotationY: displays.radianToDegree(monitorPlacement.rotationAngleRadians.y)
|
property real screenRotationY: displays.radianToDegree(monitorPlacement.rotationAngleRadians.y)
|
||||||
property real screenRotationX: displays.radianToDegree(monitorPlacement.rotationAngleRadians.x)
|
property real screenRotationX: displays.radianToDegree(monitorPlacement.rotationAngleRadians.x)
|
||||||
|
|
||||||
|
|
@ -65,10 +73,9 @@ Node {
|
||||||
eulerRotation.x: screenRotationX
|
eulerRotation.x: screenRotationX
|
||||||
position: {
|
position: {
|
||||||
// camera looks along the negative Z axis
|
// camera looks along the negative Z axis
|
||||||
let positionVector = displays.nwuToEusVector(monitorPlacement.centerNoRotate);
|
const positionVector =
|
||||||
if (focusedMonitorIndex === index) {
|
displays.nwuToEusVector(monitorPlacement.centerNoRotate)
|
||||||
positionVector = positionVector.times(effect.focusedDisplayDistance / effect.allDisplaysDistance);
|
.times(monitorDistance / effect.allDisplaysDistance);
|
||||||
}
|
|
||||||
|
|
||||||
// position vector is only translated in flat directions, without rotations applied, so apply them here
|
// position vector is only translated in flat directions, without rotations applied, so apply them here
|
||||||
const rotationMatrix = Qt.matrix4x4();
|
const rotationMatrix = Qt.matrix4x4();
|
||||||
|
|
@ -96,9 +103,65 @@ Node {
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(`\t\t\tBreezy - Next focused monitor index: ${focusedIndex}`);
|
console.log(`\t\t\tBreezy - Next focused monitor index: ${focusedIndex}`);
|
||||||
if (focusedIndex !== breezyDesktop.focusedMonitorIndex)
|
if (focusedIndex !== breezyDesktop.focusedMonitorIndex) {
|
||||||
|
zoomOutAnimation.stop();
|
||||||
|
zoomInAnimation.stop();
|
||||||
|
zoomOnFocusSequence.stop();
|
||||||
|
if (focusedIndex === -1) {
|
||||||
|
zoomOutAnimation.target = breezyDesktop.displayAtIndex(breezyDesktop.focusedMonitorIndex);
|
||||||
|
zoomOutAnimation.start();
|
||||||
|
} else {
|
||||||
|
if (breezyDesktop.focusedMonitorIndex === -1) {
|
||||||
|
zoomInAnimation.target = breezyDesktop.displayAtIndex(focusedIndex);
|
||||||
|
zoomInAnimation.start();
|
||||||
|
} else {
|
||||||
|
zoomInSeqAnimation.target = breezyDesktop.displayAtIndex(focusedIndex);
|
||||||
|
zoomOutSeqAnimation.target = breezyDesktop.displayAtIndex(breezyDesktop.focusedMonitorIndex);
|
||||||
|
zoomOnFocusSequence.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
breezyDesktop.focusedMonitorIndex = focusedIndex;
|
breezyDesktop.focusedMonitorIndex = focusedIndex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
id: zoomOutAnimation
|
||||||
|
property: "monitorDistance"
|
||||||
|
from: effect.focusedDisplayDistance
|
||||||
|
to: effect.allDisplaysDistance
|
||||||
|
duration: 150
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
id: zoomInAnimation
|
||||||
|
property: "monitorDistance"
|
||||||
|
from: effect.allDisplaysDistance
|
||||||
|
to: effect.focusedDisplayDistance
|
||||||
|
duration: 300
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
id: zoomOnFocusSequence
|
||||||
|
running: false
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
id: zoomOutSeqAnimation
|
||||||
|
property: "monitorDistance"
|
||||||
|
from: effect.focusedDisplayDistance
|
||||||
|
to: effect.allDisplaysDistance
|
||||||
|
duration: 150
|
||||||
|
}
|
||||||
|
PauseAnimation { duration: 50 }
|
||||||
|
NumberAnimation {
|
||||||
|
id: zoomInSeqAnimation
|
||||||
|
property: "monitorDistance"
|
||||||
|
from: effect.allDisplaysDistance
|
||||||
|
to: effect.focusedDisplayDistance
|
||||||
|
duration: 300
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue