libplasma
animator.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "animator.h"
00022
00023 #include <QPainter>
00024 #include <QGraphicsItem>
00025
00026 namespace Plasma
00027 {
00028
00029 Animator::Animator(QObject *parent)
00030 : QObject(parent),
00031 d(0)
00032 {
00033 }
00034
00035 Animator::~Animator()
00036 {
00037 }
00038
00039 int Animator::framesPerSecond(Plasma::Phase::Animation animation)
00040 {
00041 Q_UNUSED(animation)
00042 return 0;
00043 }
00044
00045 int Animator::framesPerSecond(Plasma::Phase::Movement movement)
00046 {
00047 Q_UNUSED(movement)
00048 return 20;
00049 }
00050
00051 int Animator::framesPerSecond(Plasma::Phase::ElementAnimation animation)
00052 {
00053 Q_UNUSED(animation)
00054 return 0;
00055 }
00056
00057 Phase::CurveShape Animator::curve(Plasma::Phase::Animation)
00058 {
00059 return Phase::EaseInOutCurve;
00060 }
00061
00062 Phase::CurveShape Animator::curve(Plasma::Phase::Movement)
00063 {
00064 return Phase::EaseInOutCurve;
00065 }
00066
00067 Phase::CurveShape Animator::curve(Plasma::Phase::ElementAnimation)
00068 {
00069 return Phase::EaseInOutCurve;
00070 }
00071
00072 QPixmap Animator::elementAppear(qreal frame, const QPixmap& pixmap)
00073 {
00074 Q_UNUSED(frame)
00075 return pixmap;
00076 }
00077
00078 QPixmap Animator::elementDisappear(qreal frame, const QPixmap& pixmap)
00079 {
00080 Q_UNUSED(frame)
00081 QPixmap pix(pixmap.size());
00082 pix.fill(Qt::transparent);
00083
00084 return pix;
00085 }
00086
00087 void Animator::appear(qreal frame, QGraphicsItem* item)
00088 {
00089 Q_UNUSED(frame)
00090 Q_UNUSED(item)
00091 }
00092
00093 void Animator::disappear(qreal frame, QGraphicsItem* item)
00094 {
00095 Q_UNUSED(frame)
00096 Q_UNUSED(item)
00097 }
00098
00099 void Animator::activate(qreal frame, QGraphicsItem* item)
00100 {
00101 Q_UNUSED(frame)
00102 Q_UNUSED(item)
00103 }
00104
00105 void Animator::frameAppear(qreal frame, QGraphicsItem* item, const QRegion& drawable)
00106 {
00107 Q_UNUSED(frame)
00108 Q_UNUSED(item)
00109 Q_UNUSED(drawable)
00110 }
00111
00112 void Animator::slideIn(qreal progress, QGraphicsItem *item, const QPoint &start, const QPoint &destination)
00113 {
00114 double x = start.x() + (destination.x() - start.x()) * progress;
00115 double y = start.y() + (destination.y() - start.y()) * progress;
00116 item->setPos(x, y);
00117 }
00118
00119 void Animator::slideOut(qreal progress, QGraphicsItem *item, const QPoint &start, const QPoint &destination)
00120 {
00121
00122 double x = start.x() + (destination.x() - start.x()) * progress;
00123 double y = start.y() + (destination.y() - start.y()) * progress;
00124 item->setPos(x, y);
00125 }
00126
00127 }
00128
00129 #include "animator.moc"