mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-03 02:52:07 -04:00
numerous animation improvements, convert a bunch of stuff to use
Animator, etc.
This commit is contained in:
@@ -28,7 +28,8 @@ Rectangle {
|
||||
|
||||
Behavior on scale {
|
||||
enabled: enableScaleAnimation && Theme.currentAnimationSpeed !== SettingsData.AnimationSpeed.None
|
||||
DankAnim {
|
||||
ScaleAnimator {
|
||||
easing.type: Easing.BezierSpline
|
||||
duration: 100
|
||||
easing.bezierCurve: Theme.expressiveCurves.standard
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ Row {
|
||||
|
||||
Behavior on opacity {
|
||||
enabled: root.userInteracted
|
||||
NumberAnimation {
|
||||
OpacityAnimator {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
@@ -205,7 +205,7 @@ Row {
|
||||
|
||||
Behavior on scale {
|
||||
enabled: root.userInteracted
|
||||
NumberAnimation {
|
||||
ScaleAnimator {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.emphasizedEasing
|
||||
}
|
||||
|
||||
@@ -45,7 +45,8 @@ ColumnLayout {
|
||||
|
||||
Behavior on rotation {
|
||||
enabled: Theme.currentAnimationSpeed !== SettingsData.AnimationSpeed.None
|
||||
DankAnim {
|
||||
RotationAnimator {
|
||||
easing.type: Easing.BezierSpline
|
||||
duration: Theme.shortDuration
|
||||
easing.bezierCurve: Theme.expressiveCurves.standard
|
||||
}
|
||||
@@ -88,7 +89,8 @@ ColumnLayout {
|
||||
|
||||
Behavior on opacity {
|
||||
enabled: Theme.currentAnimationSpeed !== SettingsData.AnimationSpeed.None
|
||||
DankAnim {
|
||||
OpacityAnimator {
|
||||
easing.type: Easing.BezierSpline
|
||||
duration: Theme.shortDuration
|
||||
easing.bezierCurve: Theme.expressiveCurves.standard
|
||||
}
|
||||
@@ -108,7 +110,8 @@ ColumnLayout {
|
||||
|
||||
Behavior on opacity {
|
||||
enabled: Theme.currentAnimationSpeed !== SettingsData.AnimationSpeed.None
|
||||
DankAnim {
|
||||
OpacityAnimator {
|
||||
easing.type: Easing.BezierSpline
|
||||
duration: Theme.shortDuration
|
||||
easing.bezierCurve: Theme.expressiveCurves.standard
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ Item {
|
||||
anchors.rightMargin: Theme.spacingS
|
||||
|
||||
Behavior on rotation {
|
||||
NumberAnimation {
|
||||
RotationAnimator {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ Item {
|
||||
opacity: (locationInput.getActiveFocus() && locationInput.text.length > 2) ? 1 : 0
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
OpacityAnimator {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
@@ -315,14 +315,14 @@ PanelWindow {
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
OpacityAnimator {
|
||||
duration: animationDuration
|
||||
easing.type: animationEasing
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
ScaleAnimator {
|
||||
duration: animationDuration
|
||||
easing.type: animationEasing
|
||||
}
|
||||
|
||||
@@ -273,13 +273,44 @@ Item {
|
||||
});
|
||||
}
|
||||
|
||||
property bool _animSyncQueued: false
|
||||
function _queueAnimSync() {
|
||||
if (_animSyncQueued)
|
||||
return;
|
||||
_animSyncQueued = true;
|
||||
Qt.callLater(() => {
|
||||
if (root && typeof root._flushAnimSync === "function")
|
||||
root._flushAnimSync();
|
||||
});
|
||||
}
|
||||
function _flushAnimSync() {
|
||||
_animSyncQueued = false;
|
||||
_syncPopoutAnim("x");
|
||||
_syncPopoutAnim("y");
|
||||
}
|
||||
|
||||
property bool _bodySyncQueued: false
|
||||
function _queueBodySync() {
|
||||
if (_bodySyncQueued)
|
||||
return;
|
||||
_bodySyncQueued = true;
|
||||
Qt.callLater(() => {
|
||||
if (root && typeof root._flushBodySync === "function")
|
||||
root._flushBodySync();
|
||||
});
|
||||
}
|
||||
function _flushBodySync() {
|
||||
_bodySyncQueued = false;
|
||||
_syncPopoutBody();
|
||||
}
|
||||
|
||||
onAlignedXChanged: _queueFullSync()
|
||||
onAlignedYChanged: _queueFullSync()
|
||||
onAlignedWidthChanged: _queueFullSync()
|
||||
onContentAnimXChanged: _syncPopoutAnim("x")
|
||||
onContentAnimYChanged: _syncPopoutAnim("y")
|
||||
onRenderedAlignedYChanged: _syncPopoutBody()
|
||||
onRenderedAlignedHeightChanged: _syncPopoutBody()
|
||||
onContentAnimXChanged: _queueAnimSync()
|
||||
onContentAnimYChanged: _queueAnimSync()
|
||||
onRenderedAlignedYChanged: _queueBodySync()
|
||||
onRenderedAlignedHeightChanged: _queueBodySync()
|
||||
onScreenChanged: _queueFullSync()
|
||||
onEffectiveBarPositionChanged: _queueFullSync()
|
||||
|
||||
@@ -676,8 +707,8 @@ Item {
|
||||
|
||||
blurX: trackBlurFromBarEdge ? contentContainer.x + (contentContainer.barRight ? _dxClamp : 0) : contentContainer.x + contentContainer.width * (1 - s) * 0.5 + Theme.snap(contentContainer.animX, root.dpr) - contentContainer.horizontalConnectorExtent * s
|
||||
blurY: trackBlurFromBarEdge ? contentContainer.y + (contentContainer.barBottom ? _dyClamp : 0) : contentContainer.y + contentContainer.height * (1 - s) * 0.5 + Theme.snap(contentContainer.animY, root.dpr) - contentContainer.verticalConnectorExtent * s
|
||||
blurWidth: (shouldBeVisible && contentWrapper.opacity > 0) ? (trackBlurFromBarEdge ? Math.max(0, contentContainer.width - Math.abs(_dxClamp)) : (contentContainer.width + contentContainer.horizontalConnectorExtent * 2) * s) : 0
|
||||
blurHeight: (shouldBeVisible && contentWrapper.opacity > 0) ? (trackBlurFromBarEdge ? Math.max(0, contentContainer.height - Math.abs(_dyClamp)) : (contentContainer.height + contentContainer.verticalConnectorExtent * 2) * s) : 0
|
||||
blurWidth: (shouldBeVisible && contentWrapper.publishedOpacity > 0) ? (trackBlurFromBarEdge ? Math.max(0, contentContainer.width - Math.abs(_dxClamp)) : (contentContainer.width + contentContainer.horizontalConnectorExtent * 2) * s) : 0
|
||||
blurHeight: (shouldBeVisible && contentWrapper.publishedOpacity > 0) ? (trackBlurFromBarEdge ? Math.max(0, contentContainer.height - Math.abs(_dyClamp)) : (contentContainer.height + contentContainer.verticalConnectorExtent * 2) * s) : 0
|
||||
blurRadius: Theme.isConnectedEffect ? Theme.connectedCornerRadius : Theme.connectedSurfaceRadius
|
||||
}
|
||||
|
||||
@@ -959,7 +990,7 @@ Item {
|
||||
|
||||
width: rollOutAdjuster.baseWidth + extraLeft + extraRight
|
||||
height: rollOutAdjuster.baseHeight + extraTop + extraBottom
|
||||
opacity: contentWrapper.opacity
|
||||
opacity: contentWrapper.publishedOpacity
|
||||
scale: contentWrapper.scale
|
||||
x: contentWrapper.x - extraLeft
|
||||
y: contentWrapper.y - extraTop
|
||||
@@ -1024,23 +1055,48 @@ Item {
|
||||
id: contentWrapper
|
||||
width: rollOutAdjuster.baseWidth
|
||||
height: rollOutAdjuster.baseHeight
|
||||
|
||||
property bool _renderActive: Theme.isDirectionalEffect || shouldBeVisible
|
||||
property bool _animating: false
|
||||
property real publishedOpacity: Theme.isDirectionalEffect ? 1 : (shouldBeVisible ? 1 : 0)
|
||||
|
||||
opacity: Theme.isDirectionalEffect ? 1 : (shouldBeVisible ? 1 : 0)
|
||||
visible: opacity > 0
|
||||
visible: _renderActive
|
||||
|
||||
scale: contentContainer.scaleValue
|
||||
x: Theme.snap(contentContainer.animX + (rollOutAdjuster.baseWidth - width) * (1 - scale) * 0.5, root.dpr)
|
||||
y: Theme.snap(contentContainer.animY + (rollOutAdjuster.baseHeight - height) * (1 - scale) * 0.5, root.dpr)
|
||||
|
||||
layer.enabled: contentWrapper.opacity < 1
|
||||
layer.enabled: _animating || (!Theme.isDirectionalEffect && publishedOpacity < 1)
|
||||
layer.smooth: false
|
||||
layer.textureSize: root.dpr > 1 ? Qt.size(Math.ceil(width * root.dpr), Math.ceil(height * root.dpr)) : Qt.size(0, 0)
|
||||
|
||||
Behavior on opacity {
|
||||
enabled: !Theme.isDirectionalEffect
|
||||
OpacityAnimator {
|
||||
duration: Math.round(Theme.variantDuration(animationDuration, shouldBeVisible) * Theme.variantOpacityDurationScale)
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: root.shouldBeVisible ? root.animationEnterCurve : root.animationExitCurve
|
||||
onRunningChanged: contentWrapper._animating = running
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on publishedOpacity {
|
||||
enabled: !Theme.isDirectionalEffect
|
||||
NumberAnimation {
|
||||
duration: Math.round(Theme.variantDuration(animationDuration, shouldBeVisible) * Theme.variantOpacityDurationScale)
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: root.shouldBeVisible ? root.animationEnterCurve : root.animationExitCurve
|
||||
onRunningChanged: if (!running && contentWrapper.publishedOpacity === 0)
|
||||
contentWrapper._renderActive = false
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
function onShouldBeVisibleChanged() {
|
||||
if (root.shouldBeVisible)
|
||||
contentWrapper._renderActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -527,7 +527,7 @@ Item {
|
||||
targetWindow: contentWindow
|
||||
readonly property real s: Math.min(1, contentContainer.scaleValue)
|
||||
readonly property bool trackBlurFromBarEdge: root.fluidStandaloneActive
|
||||
readonly property bool blurAlive: trackBlurFromBarEdge ? (contentContainer.revealWidth > 0 && contentContainer.revealHeight > 0) : (root.shouldBeVisible && contentWrapper.opacity > 0)
|
||||
readonly property bool blurAlive: trackBlurFromBarEdge ? (contentContainer.revealWidth > 0 && contentContainer.revealHeight > 0) : (root.shouldBeVisible && contentWrapper.publishedOpacity > 0)
|
||||
|
||||
blurX: trackBlurFromBarEdge ? contentContainer.x + contentContainer.revealX : contentContainer.x + contentContainer.width * (1 - s) * 0.5 + Theme.snap(contentContainer.animX, root.dpr)
|
||||
blurY: trackBlurFromBarEdge ? contentContainer.y + contentContainer.revealY : contentContainer.y + contentContainer.height * (1 - s) * 0.5 + Theme.snap(contentContainer.animY, root.dpr)
|
||||
@@ -595,9 +595,7 @@ Item {
|
||||
Item {
|
||||
id: contentContainer
|
||||
x: shadowBuffer + root.alignedX - root._surfaceBodyX
|
||||
y: root._fullHeight
|
||||
? (root.fluidStandaloneActive ? root.renderedAlignedY : root.alignedY)
|
||||
: shadowBuffer + (root.fluidStandaloneActive ? root.renderedAlignedY : root.alignedY) - root._surfaceBodyY
|
||||
y: root._fullHeight ? (root.fluidStandaloneActive ? root.renderedAlignedY : root.alignedY) : shadowBuffer + (root.fluidStandaloneActive ? root.renderedAlignedY : root.alignedY) - root._surfaceBodyY
|
||||
width: root.alignedWidth
|
||||
height: root.fluidStandaloneActive ? root.renderedAlignedHeight : root.alignedHeight
|
||||
|
||||
@@ -759,7 +757,7 @@ Item {
|
||||
id: shadowSource
|
||||
width: rollOutAdjuster.baseWidth
|
||||
height: rollOutAdjuster.baseHeight
|
||||
opacity: contentWrapper.opacity
|
||||
opacity: contentWrapper.publishedOpacity
|
||||
scale: root.fluidStandaloneActive ? 1 : contentWrapper.scale
|
||||
x: root.fluidStandaloneActive ? 0 : contentWrapper.x
|
||||
y: root.fluidStandaloneActive ? 0 : contentWrapper.y
|
||||
@@ -775,23 +773,52 @@ Item {
|
||||
id: contentWrapper
|
||||
width: rollOutAdjuster.baseWidth
|
||||
height: rollOutAdjuster.baseHeight
|
||||
|
||||
// _renderActive pins visibility/layer for the full transition; flipped true on shouldBeVisible rising,
|
||||
// false only after the close animation completes. publishedOpacity tracks Item.opacity but on the GUI
|
||||
// thread so consumers (WindowBlur, ElevationShadow, sibling rect) see interpolated values while the
|
||||
// visual runs on the render thread via OpacityAnimator.
|
||||
property bool _renderActive: Theme.isDirectionalEffect || shouldBeVisible
|
||||
property bool _animating: false
|
||||
property real publishedOpacity: Theme.isDirectionalEffect ? 1 : (shouldBeVisible ? 1 : 0)
|
||||
|
||||
opacity: Theme.isDirectionalEffect ? 1 : (shouldBeVisible ? 1 : 0)
|
||||
visible: opacity > 0
|
||||
visible: _renderActive
|
||||
scale: contentContainer.scaleValue
|
||||
transformOrigin: Item.Center
|
||||
x: Theme.snap(contentContainer.animX + (rollOutAdjuster.baseWidth - width) * (1 - contentContainer.scaleValue) * 0.5, root.dpr)
|
||||
y: Theme.snap(contentContainer.animY + (rollOutAdjuster.baseHeight - height) * (1 - contentContainer.scaleValue) * 0.5, root.dpr)
|
||||
|
||||
layer.enabled: contentWrapper.opacity < 1
|
||||
layer.enabled: _animating || (!Theme.isDirectionalEffect && publishedOpacity < 1)
|
||||
layer.smooth: false
|
||||
layer.textureSize: root.dpr > 1 ? Qt.size(Math.ceil(width * root.dpr), Math.ceil(height * root.dpr)) : Qt.size(0, 0)
|
||||
|
||||
Behavior on opacity {
|
||||
enabled: !Theme.isDirectionalEffect
|
||||
OpacityAnimator {
|
||||
duration: Math.round(Theme.variantDuration(root.animationDuration, root.shouldBeVisible) * Theme.variantOpacityDurationScale)
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: root.shouldBeVisible ? root.animationEnterCurve : root.animationExitCurve
|
||||
onRunningChanged: contentWrapper._animating = running
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on publishedOpacity {
|
||||
enabled: !Theme.isDirectionalEffect
|
||||
NumberAnimation {
|
||||
duration: Math.round(Theme.variantDuration(root.animationDuration, root.shouldBeVisible) * Theme.variantOpacityDurationScale)
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: root.shouldBeVisible ? root.animationEnterCurve : root.animationExitCurve
|
||||
onRunningChanged: if (!running && contentWrapper.publishedOpacity === 0)
|
||||
contentWrapper._renderActive = false
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
function onShouldBeVisibleChanged() {
|
||||
if (root.shouldBeVisible)
|
||||
contentWrapper._renderActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -808,7 +835,7 @@ Item {
|
||||
height: rollOutAdjuster.baseHeight
|
||||
x: root.fluidStandaloneActive ? 0 : contentWrapper.x
|
||||
y: root.fluidStandaloneActive ? 0 : contentWrapper.y
|
||||
opacity: contentWrapper.opacity
|
||||
opacity: contentWrapper.publishedOpacity
|
||||
scale: root.fluidStandaloneActive ? 1 : contentWrapper.scale
|
||||
visible: contentWrapper.visible
|
||||
radius: Theme.cornerRadius
|
||||
|
||||
@@ -23,7 +23,7 @@ ScrollBar {
|
||||
visible: policy !== ScrollBar.AlwaysOff
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
OpacityAnimator {
|
||||
duration: 160
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ Item {
|
||||
y: parent.midY - height / 2
|
||||
z: 3
|
||||
Behavior on x {
|
||||
NumberAnimation {
|
||||
XAnimator {
|
||||
duration: 80
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ Item {
|
||||
scale: active ? 1.05 : 1.0
|
||||
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
ScaleAnimator {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
@@ -278,7 +278,7 @@ Item {
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
OpacityAnimator {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ FocusScope {
|
||||
|
||||
Behavior on x {
|
||||
enabled: indicator.animationEnabled
|
||||
NumberAnimation {
|
||||
XAnimator {
|
||||
duration: Theme.mediumDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
@@ -168,14 +168,14 @@ Item {
|
||||
scale: (toggle.checked && toggle.enabled) ? 1 : 0.6
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
OpacityAnimator {
|
||||
duration: Anims.durShort
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Anims.emphasized
|
||||
}
|
||||
}
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
ScaleAnimator {
|
||||
duration: Anims.durShort
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Anims.emphasized
|
||||
|
||||
@@ -20,7 +20,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
OpacityAnimator {
|
||||
duration: standardAnimation.duration
|
||||
easing.type: standardAnimation["easing.type"]
|
||||
easing.bezierCurve: standardAnimation["easing.bezierCurve"]
|
||||
|
||||
@@ -40,7 +40,7 @@ Text {
|
||||
//renderType: Text.NativeRendering
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
OpacityAnimator {
|
||||
duration: standardAnimation.duration
|
||||
easing.type: standardAnimation["easing.type"]
|
||||
easing.bezierCurve: standardAnimation["easing.bezierCurve"]
|
||||
|
||||
Reference in New Issue
Block a user