Animations have moved here

from plasma-mobile/components/mobilecomponents
This commit is contained in:
Sebastian Kügler 2012-03-30 00:33:29 +02:00
parent fb99635369
commit ec53236725
9 changed files with 264 additions and 0 deletions

View File

@ -40,5 +40,7 @@ install(FILES qml/Heading.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/
install(FILES qml/Paragraph.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/extras)
install(FILES qml/Title.qml DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/extras)
install(DIRECTORY qml/animations/ DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/extras)
#install platform overrides -- enable as we use this feature for plasmaextras
#install(DIRECTORY platformcomponents/touch/ DESTINATION ${PLUGIN_INSTALL_DIR}/platformimports/touch/org/kde/plasma/extras)

View File

@ -34,6 +34,8 @@ AppBackgroundProvider::AppBackgroundProvider()
QImage AppBackgroundProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
{
Q_UNUSED(size)
Q_UNUSED(requestedSize)
QString search = QLatin1Literal("desktoptheme/") % Plasma::Theme::defaultTheme()->themeName() % QLatin1Literal("/appbackgrounds/") % id % ".png";
search = KStandardDirs::locate("data", search);
return QImage(search);

View File

@ -0,0 +1,38 @@
// -*- 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: activateAnimation
objectName: "activateAnimation"
property Item targetItem
property int duration: Animations.normalDuration/5
// Fast scaling while we're animation == more FPS
ScriptAction { script: targetItem.smooth = false }
PressedAnimation { targetItem: activateAnimation.targetItem }
ReleasedAnimation { targetItem: activateAnimation.targetItem }
ScriptAction { script: targetItem.smooth = true }
}

View File

@ -0,0 +1,8 @@
.pragma library
// a normal animation
var normalDuration = 250;
// for direct feedback, such as tapping
var feedbackDuration = 50;

View File

@ -0,0 +1,52 @@
// -*- 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: appearAnimation
objectName: "appearAnimation"
property Item targetItem
property int duration: Animations.normalDuration
// Fast scaling while we're animation == more FPS
ScriptAction { script: { targetItem.smooth = false; targetItem.visible = true; } }
ParallelAnimation {
PropertyAnimation {
target: targetItem
properties: "opacity"
from: 0; to: 1.0
duration: appearAnimation.duration;
easing.type: Easing.InExpo;
}
PropertyAnimation {
target: targetItem
properties: "scale"
from: 0.8; to: 1.0
duration: appearAnimation.duration;
easing.type: Easing.InExpo;
}
}
ScriptAction { script: targetItem.smooth = true }
}

View File

@ -0,0 +1,53 @@
// -*- 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: disappearAnimation
objectName: "disappearAnimation"
property Item targetItem
property int duration: Animations.normalDuration
ScriptAction { script: targetItem.smooth = false; }
ParallelAnimation {
PropertyAnimation {
properties: "opacity"
duration: disappearAnimation.duration
target: disappearAnimation.targetItem
easing.type: Easing.OutExpo;
}
PropertyAnimation {
properties: "scale"
target: disappearAnimation.targetItem
duration: disappearAnimation.duration * 0.6
easing.type: Easing.OutExpo;
}
}
ScriptAction {
script: {
targetItem.smooth = true;
targetItem.visible = false;
}
}
}

View File

@ -0,0 +1,51 @@
// -*- 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

@ -0,0 +1,52 @@
// -*- 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

@ -4,3 +4,9 @@ App 0.1 App.qml
Heading 0.1 Heading.qml
Paragraph 0.1 Paragraph.qml
Title 0.1 Title.qml
ActivateAnimation 0.1 ActivateAnimation.qml
AppearAnimation 0.1 AppearAnimation.qml
DisappearAnimation 0.1 DisappearAnimation.qml
PressedAnimation 0.1 PressedAnimation.qml
ReleasedAnimation 0.1 ReleasedAnimation.qml