mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
0b5e1f700d
commit
38ac6ed35f
2 changed files with 11 additions and 0 deletions
|
@ -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());
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace Animations {
|
|||
void moveTo(QObject *obj, qreal x, qreal y);
|
||||
void moveTo(QObject *obj, const QPointF &pos);
|
||||
void animDelete(QObject *obj);
|
||||
void scaleTo(QObject *obj, qreal scale);
|
||||
}
|
||||
|
||||
#endif // ANIMATIONFUNCTIONS_H
|
||||
|
|
Loading…
Add table
Reference in a new issue