summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/animationfunctions.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-06-08 12:22:45 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-08 12:42:51 -0700
commit38ac6ed35fc4e3a99cbf1ea1ae271ddea7a06661 (patch)
treeed93b9b6286677e2b1629c01da2ec5bdb701653a /qt-ui/profile/animationfunctions.cpp
parent0b5e1f700d28ab4dca9a39423aaf71f2c66b8ff7 (diff)
downloadsubsurface-38ac6ed35fc4e3a99cbf1ea1ae271ddea7a06661.tar.gz
Add a scaleTo animation
ScaleTo animation will scale or shrinks an graphical element in an animated way. This is going primarelly to be used on the pictures on the profile, but can be used on anything else later. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/animationfunctions.cpp')
-rw-r--r--qt-ui/profile/animationfunctions.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/qt-ui/profile/animationfunctions.cpp b/qt-ui/profile/animationfunctions.cpp
index bd08a22ee..c680e11a5 100644
--- a/qt-ui/profile/animationfunctions.cpp
+++ b/qt-ui/profile/animationfunctions.cpp
@@ -36,6 +36,16 @@ namespace Animations {
}
}
+ void scaleTo(QObject *obj, qreal scale)
+ {
+ QPropertyAnimation *animation = new QPropertyAnimation(obj, "scale");
+ animation->setDuration(prefs.animation);
+ animation->setStartValue(obj->property("scale").toReal());
+ animation->setEndValue(QVariant::fromValue(scale));
+ animation->setEasingCurve(QEasingCurve::InCubic);
+ animation->start(QAbstractAnimation::DeleteWhenStopped);
+ }
+
void moveTo(QObject *obj, const QPointF &pos)
{
moveTo(obj, pos.x(), pos.y());