2 * Copyright 2007 Aaron Seigo <aseigo@kde.org>
3 * 2007 Alexis Ménard <darktears31@gmail.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Library General Public License as
7 * published by the Free Software Foundation; either version 2, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details
15 * You should have received a copy of the GNU Library General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #include <QGraphicsItem>
29 Animator::Animator(QObject
*parent
)
39 int Animator::framesPerSecond(Plasma::Phase::Animation animation
) const
45 int Animator::framesPerSecond(Plasma::Phase::Movement movement
) const
51 int Animator::framesPerSecond(Plasma::Phase::ElementAnimation animation
) const
57 int Animator::duration(Plasma::Phase::Animation
) const
62 int Animator::duration(Plasma::Phase::Movement movement
) const
65 case Phase::FastSlideIn
:
66 case Phase::FastSlideOut
:
76 int Animator::duration(Plasma::Phase::ElementAnimation
) const
81 Phase::CurveShape
Animator::curve(Plasma::Phase::Animation
) const
83 return Phase::EaseInOutCurve
;
86 Phase::CurveShape
Animator::curve(Plasma::Phase::Movement
) const
88 return Phase::EaseInOutCurve
;
91 Phase::CurveShape
Animator::curve(Plasma::Phase::ElementAnimation
) const
93 return Phase::EaseInOutCurve
;
96 QPixmap
Animator::elementAppear(qreal frame
, const QPixmap
& pixmap
)
102 QPixmap
Animator::elementDisappear(qreal frame
, const QPixmap
& pixmap
)
105 QPixmap
pix(pixmap
.size());
106 pix
.fill(Qt::transparent
);
111 void Animator::appear(qreal frame
, QGraphicsItem
* item
)
117 void Animator::disappear(qreal frame
, QGraphicsItem
* item
)
123 void Animator::activate(qreal frame
, QGraphicsItem
* item
)
129 void Animator::slideIn(qreal progress
, QGraphicsItem
*item
, const QPoint
&start
, const QPoint
&destination
)
131 double x
= start
.x() + (destination
.x() - start
.x()) * progress
;
132 double y
= start
.y() + (destination
.y() - start
.y()) * progress
;
136 void Animator::slideOut(qreal progress
, QGraphicsItem
*item
, const QPoint
&start
, const QPoint
&destination
)
139 double x
= start
.x() + (destination
.x() - start
.x()) * progress
;
140 double y
= start
.y() + (destination
.y() - start
.y()) * progress
;
144 } // Plasma namespace
146 #include "animator.moc"