provide an AbilityDefinition for Animations

--this way both containers and applets can use
the same infrastructure and properties
pull/15/head
Michail Vourlakos 5 years ago
parent b1f5e169ee
commit 82f007e4bf

@ -43,7 +43,7 @@ Item{
readonly property bool isShown: (solidBackground.opacity > 0) || (overlayedBackground.opacity > 0)
property int animationTime: 6*animations.speedFactor.current*animations.shortDuration
property int animationTime: 6*animations.speedFactor.current*animations.duration.small
property int screenEdgeMargin: root.screenEdgeMarginEnabled ? root.localScreenEdgeMargin - shadowsSvgItem.screenEdgeShadow : 0

@ -52,7 +52,7 @@ Item{
property int maskFloatedGap: maskIsFloating ? Math.max(0, root.localScreenEdgeMargin - root.panelShadow) : 0
property int animationSpeed: LatteCore.WindowSystem.compositingActive ?
(editModeVisual.inEditMode ? editModeVisual.speed * 0.8 : animations.speedFactor.normal * 1.62 * animations.longDuration) : 0
(editModeVisual.inEditMode ? editModeVisual.speed * 0.8 : animations.speedFactor.normal * 1.62 * animations.duration.large) : 0
property bool inLocationAnimation: latteView && latteView.positioner && latteView.positioner.inLocationAnimation
property bool inSlidingIn: false //necessary because of its init structure

@ -23,12 +23,14 @@ import org.kde.plasma.plasmoid 2.0
import org.kde.latte.core 0.2 as LatteCore
import org.kde.latte.private.app 0.1 as LatteApp
import org.kde.latte.abilities.components.animations 0.1 as AnimationComponents
import org.kde.latte.abilities.definitions 0.1 as AbilityDefinition
Ability {
AbilityDefinition.Animations {
property Item container: null
property Item settings: null
property Item publicApi: null
//DEPRECATED
//C1 property bool animationsEnabled: -> active
//C11 property int animationsNeedBothAxis:0 //animations need space in both axes, e.g zooming a task
@ -44,52 +46,41 @@ Ability {
//C7 property int durationTime -> speedFactor.current
//C6 property int animationTime -> duration.proposed
//C20 root.shortDuration -> animations.shortDuration
//C21 root.longDuration -> animations.longDuration
//C20 root.shortDuration -> animations.duration.small
//C21 root.longDuration -> animations.duration.large
//parabolic
//C3 property int animationStep -> hoverPixelSensitivity
//C4 property int animationsZoomFactor -> minZoomFactor
readonly property bool active: plasmoid.configuration.animationsEnabled && LatteCore.WindowSystem.compositingActive
//! animations tracking
readonly property Item needBothAxis: AnimationComponents.Tracker{}
readonly property Item needLength: AnimationComponents.Tracker{}
readonly property Item needThickness: AnimationComponents.Tracker{}
active: plasmoid.configuration.animationsEnabled && LatteCore.WindowSystem.compositingActive
//! animations properties
readonly property int shortDuration: LatteCore.Environment.shortDuration
readonly property int longDuration: LatteCore.Environment.longDuration
hasThicknessAnimation: (needBothAxis.count>0) || (needThickness.count>0)
readonly property bool hasThicknessAnimation: (needBothAxis.count>0) || (needThickness.count>0)
duration.large: LatteCore.Environment.longDuration
duration.proposed: speedFactor.current * 2.8 * duration.large
duration.small: LatteCore.Environment.shortDuration
readonly property Item duration: AnimationComponents.Duration {
proposed: speedFactor.current * 2.8 * longDuration
}
speedFactor.normal: 1.0
speedFactor.current: {
if (!active || plasmoid.configuration.durationTime === 0) {
return 0;
}
readonly property Item speedFactor: AnimationComponents.SpeedFactor {
normal: 1.0
current: {
if (!active || plasmoid.configuration.durationTime === 0) {
return 0;
}
if (plasmoid.configuration.durationTime === 1 ) {
return 0.75;
} else if (plasmoid.configuration.durationTime === 2) {
return normal;
} else if (plasmoid.configuration.durationTime === 3) {
return 1.15;
}
return normal;
if (plasmoid.configuration.durationTime === 1 ) {
return 0.75;
} else if (plasmoid.configuration.durationTime === 2) {
return speedFactor.normal;
} else if (plasmoid.configuration.durationTime === 3) {
return 1.15;
}
return speedFactor.normal;
}
//! animations related to parabolic effect
/////!!!!!!
property int hoverPixelSensitivity: {
hoverPixelSensitivity: {
if (!settings || settings.sensitivity === LatteApp.Settings.HighMouseSensitivity) {
return 1;
} else if (settings.sensitivity === LatteApp.Settings.MediumMouseSensitivity) {
@ -99,12 +90,12 @@ Ability {
}
}
property real minZoomFactor : {
minZoomFactor : {
if (!active || !LatteCore.WindowSystem.compositingActive) {
return 1;
}
/* if (latteApplet && (animationLauncherBouncing || animationWindowInAttention || animationWindowAddedInGroup)) {
/* if (latteApplet && (animationLauncherBouncing || animationWindowInAttention || animationWindowAddedInGroup)) {
return 1.65;
}*/

@ -291,7 +291,7 @@ Item {
NumberAnimation {
id: translAnim
duration: animations.longDuration
duration: animations.duration.large
easing.type: Easing.InOutQuad
target: translation
properties: "x,y"
@ -1204,7 +1204,7 @@ Item {
target: wrapper.clickedEffect
property: "brightness"
to: -0.35
duration: animations.longDuration
duration: animations.duration.large
easing.type: Easing.OutQuad
}
}
@ -1213,7 +1213,7 @@ Item {
target: wrapper.clickedEffect
property: "brightness"
to: 0
duration: animations.longDuration
duration: animations.duration.large
easing.type: Easing.OutQuad
}
}

@ -671,7 +671,7 @@ Item{
visible: !indicators.info.providesHoveredAnimation
Behavior on opacity {
NumberAnimation { duration: animations.speedFactor.current*animations.longDuration }
NumberAnimation { duration: animations.speedFactor.current*animations.duration.large }
}
}

@ -19,7 +19,7 @@
import QtQuick 2.7
import org.kde.latte.abilities.components 0.1 as AbilityComponents
import org.kde.latte.abilities.definitions 0.1 as AbilityDefinition
import "../../../code/AppletIdentifier.js" as AppletIdentifier
@ -52,7 +52,7 @@ Item{
//! END OF PROPERTIES
//! BEGIN OF PUBLIC PROPERTIES SET THROUGH LATTEBRIDGE.ACTIONS
readonly property Item requires: AbilityComponents.AppletRequirements{}
readonly property Item requires: AbilityDefinition.AppletRequirements{}
//! END OF PUBLIC PROPERTIES SET THROUGH LATTEBRIDGE.ACTIONS
property bool windowsTrackingEnabledSent: false

@ -235,7 +235,7 @@ MouseArea {
Timer {
id: hideTimer
interval: animations.longDuration * 2
interval: animations.duration.large * 2
onTriggered: {
if (!tooltipMouseArea.containsMouse) {
tooltip.visible = false;
@ -364,7 +364,7 @@ MouseArea {
enabled: !configurationArea.pressed
NumberAnimation {
id: xAnim
duration: animations.longDuration
duration: animations.duration.large
easing.type: Easing.InOutQuad
}
}
@ -372,27 +372,27 @@ MouseArea {
id: yAnim
enabled: !configurationArea.pressed
NumberAnimation {
duration: animations.longDuration
duration: animations.duration.large
easing.type: Easing.InOutQuad
}
}
Behavior on width {
enabled: !configurationArea.pressed
NumberAnimation {
duration: animations.longDuration
duration: animations.duration.large
easing.type: Easing.InOutQuad
}
}
Behavior on height {
enabled: !configurationArea.pressed
NumberAnimation {
duration: animations.longDuration
duration: animations.duration.large
easing.type: Easing.InOutQuad
}
}
Behavior on opacity {
NumberAnimation {
duration: animations.longDuration
duration: animations.duration.large
easing.type: Easing.InOutQuad
}
}

@ -41,7 +41,7 @@ Item{
readonly property int settingsThickness: settingsOverlay.thickness
property int speed: LatteCore.WindowSystem.compositingActive ? animations.speedFactor.normal*3.6*animations.longDuration : 10
property int speed: LatteCore.WindowSystem.compositingActive ? animations.speedFactor.normal*3.6*animations.duration.large : 10
property int thickness: visibilityManager.thicknessEditMode + root.editShadow
property int rootThickness: visibilityManager.thicknessZoomOriginal + root.editShadow //- visibilityManager.thicknessEditMode
property int editLength: root.isHorizontal ? (root.behaveAsPlasmaPanel ? root.width - container.maxIconSize/4 : root.width)://root.maxLength) :

@ -1786,7 +1786,7 @@ Item {
//! zoom-in animations will have ended.
Timer{
id:directRenderDelayerForEnteringTimer
interval: 3.2 * animations.speedFactor.current * animations.shortDuration
interval: 3.2 * animations.speedFactor.current * animations.duration.small
}
//! It is used in order to slide-in the latteView on startup

@ -19,14 +19,14 @@
import QtQuick 2.0
import org.kde.latte.abilities.components 0.1 as AbilityComponent
import org.kde.latte.abilities.definitions 0.1 as AbilityDefinition
AbilityComponent.AppletRequirements{
AbilityDefinition.AppletRequirements {
id: requirements
readonly property bool isActive: bridge !== null
property Item bridge: null
readonly property bool isActive: bridge !== null
onIsActiveChanged: {
if (isActive) {
bridge.applet.activeIndicatorEnabled = requirements.activeIndicatorEnabled;

@ -1,5 +0,0 @@
module org.kde.latte.abilities.components.animations
Duration 0.1 Duration.qml
SpeedFactor 0.1 SpeedFactor.qml
Tracker 0.1 Tracker.qml

@ -1,3 +0,0 @@
module org.kde.latte.abilities.components
AppletRequirements 0.1 AppletRequirements.qml

@ -0,0 +1,71 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import "./animations" as AnimationsTypes
Item {
property bool active: false
property bool hasThicknessAnimation: false
//! animations properties
property int shortDuration: 250
property int longDuration: 500
readonly property alias duration: _duration
readonly property alias speedFactor: _speedFactor
//! animations tracking
readonly property alias needBothAxis: _bothAxis
readonly property alias needLength: _needLength
readonly property alias needThickness: _needThickness
//! animations related to parabolic effect
property int hoverPixelSensitivity: 1
property real minZoomFactor : 1.0
//! Grouped Properties Structures
AnimationsTypes.SpeedFactor {
id: _speedFactor
normal: 1.0
current: 1.0
}
AnimationsTypes.Duration {
id: _duration
large: 500
proposed: 1000
small: 250
}
AnimationsTypes.Tracker {
id: _bothAxis
}
AnimationsTypes.Tracker {
id: _needLength
}
AnimationsTypes.Tracker {
id: _needThickness
}
}

@ -20,5 +20,7 @@
import QtQuick 2.7
Item {
property int proposed: 700
property int large: 500
property int proposed: 1000
property int small: 250
}

@ -0,0 +1,5 @@
module org.kde.latte.abilities.definitions
Animations 0.1 Animations.qml
AppletRequirements 0.1 AppletRequirements.qml
Loading…
Cancel
Save