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.
21 #include "animationdriver.h"
24 #include <QGraphicsItem>
29 AnimationDriver::AnimationDriver(QObject
*parent
)
35 AnimationDriver::~AnimationDriver()
39 int AnimationDriver::animationFps(Plasma::Animator::Animation animation
) const
45 int AnimationDriver::movementAnimationFps(Plasma::Animator::Movement movement
) const
51 int AnimationDriver::elementAnimationFps(Plasma::Animator::Animation animation
) const
57 int AnimationDriver::animationDuration(Plasma::Animator::Animation
) const
62 int AnimationDriver::movementAnimationDuration(Plasma::Animator::Movement movement
) const
65 case Animator::FastSlideInMovement
:
66 case Animator::FastSlideOutMovement
:
76 int AnimationDriver::elementAnimationDuration(Plasma::Animator::Animation
) const
81 Animator::CurveShape
AnimationDriver::animationCurve(Plasma::Animator::Animation
) const
83 return Animator::EaseInOutCurve
;
86 Animator::CurveShape
AnimationDriver::movementAnimationCurve(Plasma::Animator::Movement
) const
88 return Animator::EaseInOutCurve
;
91 Animator::CurveShape
AnimationDriver::elementAnimationCurve(Plasma::Animator::Animation
) const
93 return Animator::EaseInOutCurve
;
96 QPixmap
AnimationDriver::elementAppear(qreal progress
, const QPixmap
&pixmap
)
102 QPixmap
AnimationDriver::elementDisappear(qreal progress
, const QPixmap
&pixmap
)
105 QPixmap
pix(pixmap
.size());
106 pix
.fill(Qt::transparent
);
111 void AnimationDriver::itemAppear(qreal frame
, QGraphicsItem
*item
)
117 void AnimationDriver::itemDisappear(qreal frame
, QGraphicsItem
*item
)
123 void AnimationDriver::itemActivated(qreal frame
, QGraphicsItem
*item
)
129 void AnimationDriver::itemSlideIn(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 AnimationDriver::itemSlideOut(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 "animationdriver.moc"