Skip to content

Commit 2f8de93

Browse files
tsic404robertkill
authored andcommitted
chore: Reimplement notification animation
log: as title
1 parent 12e1b4b commit 2f8de93

File tree

3 files changed

+62
-130
lines changed

3 files changed

+62
-130
lines changed

panels/dock/taskmanager/package/AppItem.qml

Lines changed: 61 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,7 @@ Item {
165165
name: root.iconName
166166
sourceSize: Qt.size(Dock.MAX_DOCK_TASKMANAGER_ICON_SIZE, Dock.MAX_DOCK_TASKMANAGER_ICON_SIZE)
167167
anchors.centerIn: parent
168-
scale: iconScale
169-
BeatAnimation {
170-
id: beatAnimation
171-
target: icon
172-
baseScale: iconScale
173-
loops: Animation.Infinite
174-
running: root.attention
175-
}
168+
scale: Panel.rootObject.isDragging ? iconScale : iconScale
176169

177170
LaunchAnimation {
178171
id: launchAnimation
@@ -204,20 +197,68 @@ Item {
204197
loops: 1
205198
running: false
206199
}
200+
}
201+
202+
// TODO: value can set during debugPanel
203+
Repeater {
204+
model: 5
205+
Rectangle {
206+
id: rect
207+
required property int index
208+
property var originSize: Dock.MAX_DOCK_TASKMANAGER_ICON_SIZE * 1.2 * iconScale
209+
210+
visible: root.attention && !Panel.rootObject.isDragging
211+
width: originSize * (index - 1)
212+
height: width
213+
radius: width / 2
214+
color: Qt.rgba(1, 1, 1, 0.1)
215+
216+
anchors.centerIn: icon
217+
z: -1
218+
opacity: Math.min(3 - width / originSize, blendColorAlpha(D.DTK.themeType === D.ApplicationHelper.DarkType ? 0.25 : 1.0))
219+
220+
function blendColorAlpha(fallback) {
221+
var appearance = DS.applet("org.deepin.ds.dde-appearance")
222+
if (!appearance || appearance.opacity < 0 || appearance.opacity > fallback || appearance.opacity < fallback)
223+
return fallback
224+
return appearance.opacity
225+
}
226+
227+
SequentialAnimation {
228+
running: root.attention && !Panel.rootObject.isDragging
229+
loops: Animation.Infinite
207230

208-
Connections {
209-
target: Panel.rootObject
210-
function onPressedAndDragging(isDragging) {
211-
if (isDragging) {
212-
beatAnimation.stop()
213-
icon.scale = Qt.binding(function() {
214-
return root.iconScale
215-
})
216-
} else {
217-
beatAnimation.running = Qt.binding(function() {
218-
return root.attention
219-
})
231+
// 弹出
232+
ParallelAnimation {
233+
NumberAnimation { target: rect; property: "width"; from: Math.max(originSize * (index - 1), 0); to: originSize * (index); duration: 1200 }
234+
ColorAnimation { target: rect; property: "color"; from: Qt.rgba(1, 1, 1, 0.4); to: Qt.rgba(1, 1, 1, 0.1); duration: 1200 }
235+
NumberAnimation { target: icon; property: "scale"; from: iconScale; to: iconScale * 1.15; duration: 1200; easing.type: Easing.OutElastic; easing.amplitude: 1; easing.period: 0.2 }
220236
}
237+
238+
// 收缩
239+
ParallelAnimation {
240+
NumberAnimation { target: rect; property: "width"; from: originSize * (index); to: originSize * (index + 1); duration: 1200 }
241+
ColorAnimation { target: rect; property: "color"; from: Qt.rgba(1, 1, 1, 0.4); to: Qt.rgba(1, 1, 1, 0.1); duration: 1200 }
242+
NumberAnimation { target: icon; property: "scale"; from: iconScale * 1.15; to: iconScale; duration: 1200; easing.type: Easing.OutElastic; easing.amplitude: 1; easing.period: 0.2 }
243+
}
244+
245+
// 停顿
246+
ParallelAnimation {
247+
NumberAnimation { target: rect; property: "width"; from: originSize * (index + 1); to: originSize * (index + 2); duration: 1200 }
248+
ColorAnimation { target: rect; property: "color"; from: Qt.rgba(1, 1, 1, 0.4); to: Qt.rgba(1, 1, 1, 0.1); duration: 1200 }
249+
}
250+
}
251+
252+
D.BoxShadow {
253+
visible: rect.visible
254+
anchors.fill: rect
255+
z: -2
256+
shadowBlur: 20
257+
shadowColor : Qt.rgba(0, 0, 0, 0.05)
258+
shadowOffsetX : 0
259+
shadowOffsetY : 0
260+
cornerRadius: rect.radius
261+
hollow: true
221262
}
222263
}
223264
}

panels/dock/taskmanager/package/BeatAnimation.qml

Lines changed: 0 additions & 110 deletions
This file was deleted.

panels/dock/taskmanager/package/TaskManager.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ ContainmentItem {
4141
required property string menus
4242
required property list<string> windows
4343
keys: ["text/x-dde-dock-dnd-appid", "text/x-dde-launcher-dnd-desktopId"]
44+
z: attention ? -1 : 0
4445

4546
// TODO: 临时溢出逻辑,待后面修改
4647
// 1:4 the distance between app : dock height; get width/height≈0.8

0 commit comments

Comments
 (0)