1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-03 19:12:11 -04:00

optimize some animations

This commit is contained in:
bbedward
2026-05-01 18:37:17 -04:00
committed by purian23
parent 7c9ca60e44
commit 386a2d0469
12 changed files with 79 additions and 110 deletions

View File

@@ -61,26 +61,22 @@ Item {
border.color: Theme.primary border.color: Theme.primary
opacity: 0 opacity: 0
SequentialAnimation on opacity { OpacityAnimator on opacity {
running: root.isRunning running: root.isRunning
loops: Animation.Infinite loops: Animation.Infinite
NumberAnimation { from: 0.8
from: 0.8 to: 0
to: 0 duration: 1500
duration: 1500 easing.type: Easing.OutQuad
easing.type: Easing.OutQuad
}
} }
SequentialAnimation on scale { ScaleAnimator on scale {
running: root.isRunning running: root.isRunning
loops: Animation.Infinite loops: Animation.Infinite
NumberAnimation { from: 0.5
from: 0.5 to: 1.5
to: 1.5 duration: 1500
duration: 1500 easing.type: Easing.OutQuad
easing.type: Easing.OutQuad
}
} }
} }
@@ -95,26 +91,22 @@ Item {
border.color: Theme.secondary border.color: Theme.secondary
opacity: 0 opacity: 0
SequentialAnimation on opacity { OpacityAnimator on opacity {
running: root.isRunning running: root.isRunning
loops: Animation.Infinite loops: Animation.Infinite
NumberAnimation { from: 0.8
from: 0.8 to: 0
to: 0 duration: 1500
duration: 1500 easing.type: Easing.OutQuad
easing.type: Easing.OutQuad
}
} }
SequentialAnimation on scale { ScaleAnimator on scale {
running: root.isRunning running: root.isRunning
loops: Animation.Infinite loops: Animation.Infinite
NumberAnimation { from: 0.3
from: 0.3 to: 1.3
to: 1.3 duration: 1500
duration: 1500 easing.type: Easing.OutQuad
easing.type: Easing.OutQuad
}
} }
} }

View File

@@ -449,7 +449,7 @@ Rectangle {
size: 24 size: 24
color: Qt.rgba(Theme.surfaceText.r || 0.8, Theme.surfaceText.g || 0.8, Theme.surfaceText.b || 0.8, 0.4) color: Qt.rgba(Theme.surfaceText.r || 0.8, Theme.surfaceText.g || 0.8, Theme.surfaceText.b || 0.8, 0.4)
RotationAnimation on rotation { RotationAnimator on rotation {
running: parent.visible running: parent.visible
loops: Animation.Infinite loops: Animation.Infinite
from: 0 from: 0

View File

@@ -178,7 +178,7 @@ Rectangle {
size: 32 size: 32
color: Theme.primary color: Theme.primary
RotationAnimation on rotation { RotationAnimator on rotation {
running: NetworkService.wifiToggling running: NetworkService.wifiToggling
loops: Animation.Infinite loops: Animation.Infinite
from: 0 from: 0
@@ -494,7 +494,7 @@ Rectangle {
size: 48 size: 48
color: Qt.rgba(Theme.surfaceText.r || 0.8, Theme.surfaceText.g || 0.8, Theme.surfaceText.b || 0.8, 0.3) color: Qt.rgba(Theme.surfaceText.r || 0.8, Theme.surfaceText.g || 0.8, Theme.surfaceText.b || 0.8, 0.3)
RotationAnimation on rotation { RotationAnimator on rotation {
running: wifiScanningOverlay.visible running: wifiScanningOverlay.visible
loops: Animation.Infinite loops: Animation.Infinite
from: 0 from: 0

View File

@@ -148,19 +148,16 @@ DankPopout {
opacity: enabled ? 1.0 : 0.5 opacity: enabled ? 1.0 : 0.5
onClicked: SystemUpdateService.checkForUpdates() onClicked: SystemUpdateService.checkForUpdates()
RotationAnimation { RotationAnimator on rotation {
target: refreshButton
property: "rotation"
from: 0 from: 0
to: 360 to: 360
duration: 1000 duration: 1000
running: SystemUpdateService.isChecking
loops: Animation.Infinite loops: Animation.Infinite
running: SystemUpdateService.isChecking
onRunningChanged: { onRunningChanged: {
if (!running) { if (!running)
refreshButton.rotation = 0; refreshButton.rotation = 0;
}
} }
} }
} }

View File

@@ -73,20 +73,17 @@ BasePill {
return root.isActive ? Theme.primary : Theme.surfaceText; return root.isActive ? Theme.primary : Theme.surfaceText;
} }
RotationAnimation { RotationAnimator on rotation {
id: rotationAnimation id: rotationAnimation
target: statusIcon
property: "rotation"
from: 0 from: 0
to: 360 to: 360
duration: 1000 duration: 1000
running: root.isChecking
loops: Animation.Infinite loops: Animation.Infinite
running: root.isChecking
onRunningChanged: { onRunningChanged: {
if (!running) { if (!running)
statusIcon.rotation = 0; statusIcon.rotation = 0;
}
} }
} }
} }
@@ -130,20 +127,17 @@ BasePill {
return root.isActive ? Theme.primary : Theme.surfaceText; return root.isActive ? Theme.primary : Theme.surfaceText;
} }
RotationAnimation { RotationAnimator on rotation {
id: rotationAnimationHorizontal id: rotationAnimationHorizontal
target: statusIconHorizontal
property: "rotation"
from: 0 from: 0
to: 360 to: 360
duration: 1000 duration: 1000
running: root.isChecking
loops: Animation.Infinite loops: Animation.Infinite
running: root.isChecking
onRunningChanged: { onRunningChanged: {
if (!running) { if (!running)
statusIconHorizontal.rotation = 0; statusIconHorizontal.rotation = 0;
}
} }
} }
} }

View File

@@ -192,7 +192,7 @@ Item {
onTriggered: refreshButtonTwo.isRefreshing = false onTriggered: refreshButtonTwo.isRefreshing = false
} }
NumberAnimation on rotation { RotationAnimator on rotation {
running: refreshButtonTwo.isRefreshing running: refreshButtonTwo.isRefreshing
from: 0 from: 0
to: 360 to: 360
@@ -930,7 +930,7 @@ Item {
onTriggered: refreshButton.isRefreshing = false onTriggered: refreshButton.isRefreshing = false
} }
NumberAnimation on rotation { RotationAnimator on rotation {
running: refreshButton.isRefreshing running: refreshButton.isRefreshing
from: 0 from: 0
to: 360 to: 360

View File

@@ -1025,7 +1025,7 @@ Item {
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.9) color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.9)
} }
RotationAnimation on rotation { RotationAnimator on rotation {
running: pam.passwd.active && !root.unlocking running: pam.passwd.active && !root.unlocking
loops: Animation.Infinite loops: Animation.Infinite
duration: Anims.durLong duration: Anims.durLong

View File

@@ -525,13 +525,13 @@ Column {
SequentialAnimation on opacity { SequentialAnimation on opacity {
running: textArea.activeFocus running: textArea.activeFocus
loops: Animation.Infinite loops: Animation.Infinite
PropertyAnimation { OpacityAnimator {
from: 1.0 from: 1.0
to: 0.0 to: 0.0
duration: 650 duration: 650
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
PropertyAnimation { OpacityAnimator {
from: 0.0 from: 0.0
to: 1.0 to: 1.0
duration: 650 duration: 650

View File

@@ -344,11 +344,7 @@ Item {
return I18n.tr("%1 exists but is not included in config. Custom keybinds will not work until this is fixed.").arg(bindsFile); return I18n.tr("%1 exists but is not included in config. Custom keybinds will not work until this is fixed.").arg(bindsFile);
if (warningBox.showWarning) { if (warningBox.showWarning) {
const count = warningBox.status.overriddenBy; const count = warningBox.status.overriddenBy;
return I18n.ntr( return I18n.ntr("%1 DMS bind may be overridden by config binds that come after the include.", "%1 DMS binds may be overridden by config binds that come after the include.", count).arg(count);
"%1 DMS bind may be overridden by config binds that come after the include.",
"%1 DMS binds may be overridden by config binds that come after the include.",
count
).arg(count);
} }
return ""; return "";
} }
@@ -543,13 +539,11 @@ Item {
StyledText { StyledText {
text: { text: {
if (KeybindsService.loading) if (KeybindsService.loading)
return I18n.tr("Shortcuts"); return I18n.tr("Shortcuts");
const count = keybindsTab._filteredBinds.length; const count = keybindsTab._filteredBinds.length;
return count === 1 return count === 1 ? I18n.tr("Shortcut (%1)").arg(count) : I18n.tr("Shortcuts (%1)").arg(count);
? I18n.tr("Shortcut (%1)").arg(count) }
: I18n.tr("Shortcuts (%1)").arg(count);
}
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium font.weight: Font.Medium
color: Theme.surfaceText color: Theme.surfaceText
@@ -569,7 +563,7 @@ Item {
color: Theme.primary color: Theme.primary
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
RotationAnimation on rotation { RotationAnimator on rotation {
from: 0 from: 0
to: 360 to: 360
duration: 1000 duration: 1000

View File

@@ -36,36 +36,36 @@ Item {
function normalizePinList(value) { function normalizePinList(value) {
if (Array.isArray(value)) if (Array.isArray(value))
return value.filter(v => v) return value.filter(v => v);
if (typeof value === "string" && value.length > 0) if (typeof value === "string" && value.length > 0)
return [value] return [value];
return [] return [];
} }
function getPinnedWifiNetworks() { function getPinnedWifiNetworks() {
const pins = SettingsData.wifiNetworkPins || {} const pins = SettingsData.wifiNetworkPins || {};
return normalizePinList(pins["preferredWifi"]) return normalizePinList(pins["preferredWifi"]);
} }
function toggleWifiPin(ssid) { function toggleWifiPin(ssid) {
const pins = JSON.parse(JSON.stringify(SettingsData.wifiNetworkPins || {})) const pins = JSON.parse(JSON.stringify(SettingsData.wifiNetworkPins || {}));
let pinnedList = normalizePinList(pins["preferredWifi"]) let pinnedList = normalizePinList(pins["preferredWifi"]);
const pinIndex = pinnedList.indexOf(ssid) const pinIndex = pinnedList.indexOf(ssid);
if (pinIndex !== -1) { if (pinIndex !== -1) {
pinnedList.splice(pinIndex, 1) pinnedList.splice(pinIndex, 1);
} else { } else {
pinnedList.unshift(ssid) pinnedList.unshift(ssid);
if (pinnedList.length > maxPinnedWifiNetworks) if (pinnedList.length > maxPinnedWifiNetworks)
pinnedList = pinnedList.slice(0, maxPinnedWifiNetworks) pinnedList = pinnedList.slice(0, maxPinnedWifiNetworks);
} }
if (pinnedList.length > 0) if (pinnedList.length > 0)
pins["preferredWifi"] = pinnedList pins["preferredWifi"] = pinnedList;
else else
delete pins["preferredWifi"] delete pins["preferredWifi"];
SettingsData.set("wifiNetworkPins", pins) SettingsData.set("wifiNetworkPins", pins);
} }
LazyLoader { LazyLoader {
@@ -340,9 +340,7 @@ Item {
if (devices.length === 0) if (devices.length === 0)
return I18n.tr("No adapters"); return I18n.tr("No adapters");
if (connected === 0) if (connected === 0)
return devices.length === 1 return devices.length === 1 ? I18n.tr("%1 adapter, none connected").arg(devices.length) : I18n.tr("%1 adapters, none connected").arg(devices.length);
? I18n.tr("%1 adapter, none connected").arg(devices.length)
: I18n.tr("%1 adapters, none connected").arg(devices.length);
return I18n.tr("%1 connected").arg(connected); return I18n.tr("%1 connected").arg(connected);
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
@@ -658,16 +656,14 @@ Item {
SequentialAnimation { SequentialAnimation {
running: NetworkService.networkWiredInfoLoading running: NetworkService.networkWiredInfoLoading
loops: Animation.Infinite loops: Animation.Infinite
NumberAnimation { OpacityAnimator {
target: wiredLoadIcon target: wiredLoadIcon
property: "opacity"
to: 0.3 to: 0.3
duration: 400 duration: 400
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
NumberAnimation { OpacityAnimator {
target: wiredLoadIcon target: wiredLoadIcon
property: "opacity"
to: 1.0 to: 1.0
duration: 400 duration: 400
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
@@ -1046,16 +1042,14 @@ Item {
SequentialAnimation { SequentialAnimation {
running: NetworkService.isScanning running: NetworkService.isScanning
loops: Animation.Infinite loops: Animation.Infinite
NumberAnimation { OpacityAnimator {
target: scanningIcon target: scanningIcon
property: "opacity"
to: 0.3 to: 0.3
duration: 400 duration: 400
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
NumberAnimation { OpacityAnimator {
target: scanningIcon target: scanningIcon
property: "opacity"
to: 1.0 to: 1.0
duration: 400 duration: 400
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
@@ -1087,14 +1081,14 @@ Item {
let sorted = [...networks]; let sorted = [...networks];
sorted.sort((a, b) => { sorted.sort((a, b) => {
const aPinnedIndex = pinnedList.indexOf(a.ssid) const aPinnedIndex = pinnedList.indexOf(a.ssid);
const bPinnedIndex = pinnedList.indexOf(b.ssid) const bPinnedIndex = pinnedList.indexOf(b.ssid);
if (aPinnedIndex !== -1 || bPinnedIndex !== -1) { if (aPinnedIndex !== -1 || bPinnedIndex !== -1) {
if (aPinnedIndex === -1) if (aPinnedIndex === -1)
return 1 return 1;
if (bPinnedIndex === -1) if (bPinnedIndex === -1)
return -1 return -1;
return aPinnedIndex - bPinnedIndex return aPinnedIndex - bPinnedIndex;
} }
if (a.ssid === ssid) if (a.ssid === ssid)
return -1; return -1;
@@ -1297,7 +1291,7 @@ Item {
buttonSize: 28 buttonSize: 28
iconColor: isPinned ? Theme.primary : Theme.surfaceVariantText iconColor: isPinned ? Theme.primary : Theme.surfaceVariantText
onClicked: { onClicked: {
networkTab.toggleWifiPin(modelData.ssid) networkTab.toggleWifiPin(modelData.ssid);
} }
} }
@@ -1375,16 +1369,14 @@ Item {
SequentialAnimation { SequentialAnimation {
running: NetworkService.networkInfoLoading running: NetworkService.networkInfoLoading
loops: Animation.Infinite loops: Animation.Infinite
NumberAnimation { OpacityAnimator {
target: wifiInfoLoadIcon target: wifiInfoLoadIcon
property: "opacity"
to: 0.3 to: 0.3
duration: 400 duration: 400
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
NumberAnimation { OpacityAnimator {
target: wifiInfoLoadIcon target: wifiInfoLoadIcon
property: "opacity"
to: 1.0 to: 1.0
duration: 400 duration: 400
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
@@ -1866,16 +1858,14 @@ Item {
SequentialAnimation { SequentialAnimation {
running: VPNService.configLoading running: VPNService.configLoading
loops: Animation.Infinite loops: Animation.Infinite
NumberAnimation { OpacityAnimator {
target: vpnLoadIcon target: vpnLoadIcon
property: "opacity"
to: 0.3 to: 0.3
duration: 400 duration: 400
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
NumberAnimation { OpacityAnimator {
target: vpnLoadIcon target: vpnLoadIcon
property: "opacity"
to: 1.0 to: 1.0
duration: 400 duration: 400
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
@@ -1984,7 +1974,9 @@ Item {
checked: configData ? (configData.autoconnect || false) : false checked: configData ? (configData.autoconnect || false) : false
visible: !VPNService.configLoading && configData !== null visible: !VPNService.configLoading && configData !== null
onToggled: checked => { onToggled: checked => {
VPNService.updateConfig(modelData.uuid, {autoconnect: checked}); VPNService.updateConfig(modelData.uuid, {
autoconnect: checked
});
} }
} }

View File

@@ -458,7 +458,7 @@ Item {
enabled: !CupsService.loadingDevices enabled: !CupsService.loadingDevices
onClicked: CupsService.getDevices() onClicked: CupsService.getDevices()
RotationAnimation on rotation { RotationAnimator on rotation {
running: CupsService.loadingDevices running: CupsService.loadingDevices
loops: Animation.Infinite loops: Animation.Infinite
from: 0 from: 0
@@ -736,7 +736,7 @@ Item {
enabled: !CupsService.loadingPPDs enabled: !CupsService.loadingPPDs
onClicked: CupsService.getPPDs() onClicked: CupsService.getPPDs()
RotationAnimation on rotation { RotationAnimator on rotation {
running: CupsService.loadingPPDs running: CupsService.loadingPPDs
loops: Animation.Infinite loops: Animation.Infinite
from: 0 from: 0

View File

@@ -693,7 +693,7 @@ Item {
onTriggered: refreshButton.isRefreshing = false onTriggered: refreshButton.isRefreshing = false
} }
NumberAnimation on rotation { RotationAnimator on rotation {
running: refreshButton.isRefreshing running: refreshButton.isRefreshing
from: 0 from: 0
to: 360 to: 360