plasma: drop JS animations

can be done with QML code which most plasma packages use anyway, also
the 0.9 scaling is slightly more noticable than the 0.95 for arrow this
small and 0.9 is a value that other QML widgets use

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-05-21 21:41:01 +03:00
parent 2f78f4d890
commit b4da0cdf60
5 changed files with 15 additions and 114 deletions

View file

@ -23,7 +23,6 @@
import QtQuick 1.1
import org.kde.plasma.core 0.1 as PlasmaCore
import org.kde.plasma.extras 0.1 as PlasmaExtras
Item {
id: arrow_area
@ -34,8 +33,6 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: togglePopup()
onPressed: PlasmaExtras.PressedAnimation { targetItem: arrow_widget }
onReleased: PlasmaExtras.ReleasedAnimation { targetItem: arrow_widget }
}
PlasmaCore.SvgItem {
@ -129,7 +126,22 @@ Item {
target: arrow_widget
elementId: dialog.visible ? "down-arrow" : "up-arrow"
}
},
State {
name: "NORMAL"
PropertyChanges { target: arrow_widget; scale: 1.0 }
},
State {
name: "PRESSED"
PropertyChanges { target: arrow_widget; scale: 0.9 }
}
]
transitions: [
Transition {
NumberAnimation { properties: "scale"; duration: 50 }
}
]
}

View file

@ -1,5 +0,0 @@
.pragma library
// for direct feedback, such as tapping
var feedbackDuration = 50;

View file

@ -1,51 +0,0 @@
// -*- coding: iso-8859-1 -*-
/*
* Copyright 2011 Sebastian Kügler <sebas@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 1.0
import "Animations.js" as Animations
SequentialAnimation {
id: pressedAnimation
objectName: "pressedAnimation"
property Item targetItem
property int duration: Animations.feedbackDuration
// Fast scaling while we're animation == more FPS
ScriptAction { script: targetItem.smooth = false }
ParallelAnimation {
PropertyAnimation {
target: targetItem
properties: "opacity"
from: 1.0; to: 0.8
duration: pressedAnimation.duration;
easing.type: Easing.OutExpo;
}
PropertyAnimation {
target: targetItem
properties: "scale"
from: 1.0; to: 0.95
duration: pressedAnimation.duration;
easing.type: Easing.OutExpo;
}
}
ScriptAction { script: targetItem.smooth = true }
}

View file

@ -1,52 +0,0 @@
// -*- coding: iso-8859-1 -*-
/*
* Copyright 2011 Sebastian Kügler <sebas@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 1.0
import "Animations.js" as Animations
SequentialAnimation {
id: releasedAnimation
objectName: "releasedAnimation"
property Item targetItem
property int duration: Animations.feedbackDuration
// Fast scaling while we're animation == more FPS
ScriptAction { script: targetItem.smooth = false }
ParallelAnimation {
PropertyAnimation {
target: targetItem
properties: "opacity"
from: 0.8; to: 1.0
duration: releasedAnimation.duration;
easing.type: Easing.InExpo;
}
PropertyAnimation {
target: targetItem
properties: "scale"
from: 0.95; to: 1.0
duration: releasedAnimation.duration;
easing.type: Easing.InExpo;
}
}
ScriptAction { script: targetItem.smooth = true }
}

View file

@ -7,6 +7,3 @@ Paragraph 0.1 Paragraph.qml
PageRow 0.1 PageRow.qml
ScrollArea 0.1 ScrollArea.qml
Title 0.1 Title.qml
PressedAnimation 0.1 animations/PressedAnimation.qml
ReleasedAnimation 0.1 animations/ReleasedAnimation.qml