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

View File

@@ -449,7 +449,7 @@ Rectangle {
size: 24
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
loops: Animation.Infinite
from: 0

View File

@@ -178,7 +178,7 @@ Rectangle {
size: 32
color: Theme.primary
RotationAnimation on rotation {
RotationAnimator on rotation {
running: NetworkService.wifiToggling
loops: Animation.Infinite
from: 0
@@ -494,7 +494,7 @@ Rectangle {
size: 48
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
loops: Animation.Infinite
from: 0

View File

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

View File

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

View File

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

View File

@@ -1025,7 +1025,7 @@ Item {
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
loops: Animation.Infinite
duration: Anims.durLong

View File

@@ -525,13 +525,13 @@ Column {
SequentialAnimation on opacity {
running: textArea.activeFocus
loops: Animation.Infinite
PropertyAnimation {
OpacityAnimator {
from: 1.0
to: 0.0
duration: 650
easing.type: Easing.InOutQuad
}
PropertyAnimation {
OpacityAnimator {
from: 0.0
to: 1.0
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);
if (warningBox.showWarning) {
const count = warningBox.status.overriddenBy;
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);
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);
}
return "";
}
@@ -543,13 +539,11 @@ Item {
StyledText {
text: {
if (KeybindsService.loading)
return I18n.tr("Shortcuts");
const count = keybindsTab._filteredBinds.length;
return count === 1
? I18n.tr("Shortcut (%1)").arg(count)
: I18n.tr("Shortcuts (%1)").arg(count);
}
if (KeybindsService.loading)
return I18n.tr("Shortcuts");
const count = keybindsTab._filteredBinds.length;
return count === 1 ? I18n.tr("Shortcut (%1)").arg(count) : I18n.tr("Shortcuts (%1)").arg(count);
}
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
@@ -569,7 +563,7 @@ Item {
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
RotationAnimation on rotation {
RotationAnimator on rotation {
from: 0
to: 360
duration: 1000

View File

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

View File

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

View File

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