KWinLibraries
KWin::TimeLine Class Reference
[KWin effects library]
#include <kwineffects.h>
Detailed Description
Wrapper class for using timelines in KWin effects.This class provides an easy and specialised interface for effects that want a non-linear timeline. Currently, most it does is wrapping QTimeLine. In the future, this class could help using physics animations in KWin.
KWin effects will usually use this feature by keeping one TimeLine per animation, for example per effect (when only one animation is done by the effect) or per windows (in the case that multiple animations can take place at the same time (such as minizing multiple windows with a short time offset. Increasing the internal time state of the TimeLine is done either by changing the 'current' time in the TimeLine, which is an int value between 0 and the duration set (defaulting to 250msec). The current time can also be changed by setting the 'progress' of the TimeLine, a double between 0.0 and 1.0. setProgress(), addProgress(), addTime(), removeTime() can all be used to manipulate the 'current' time (and at the same time progress) of the TimeLine.
The internal state of the TimeLine is determined by the duration of the TimeLine, int in milliseconds, defaulting. the 'current' time and the current 'progress' are interchangeable, both determine the x-axis of a graph of a TimeLine. The value() returned represents the y-axis in this graph.
m_TimeLine.setProgress(0.5) would change the 'current' time of a default TimeLine to 125 msec. m_TimeLine.value() would then return the progress value (a double between 0.0 and 1.0), which can be lower than 0.5 in case the animation should start slowly, such as for the EaseInCurve. In KWin effect, the prePaintWindow() or prePaintScreen() methods have int time as one of their arguments. This int can be used to increase the 'current' time in the TimeLine. The double the is subsequently returned by value() (usually in paintWindow() or paintScreen() methods can then be used to manipulate windows, or their positions.
Definition at line 1024 of file kwineffects.h.
Public Types | |
enum | CurveShape { EaseInCurve = 0, EaseOutCurve, EaseInOutCurve, LinearCurve, SineCurve } |
Public Member Functions | |
void | addProgress (const double progress) |
void | addTime (const int msec) |
int | duration () const |
double | progress () const |
void | removeTime (const int msec) |
void | setCurveShape (CurveShape curveShape) |
void | setDuration (const int msec) |
void | setProgress (const double progress) |
int | time () const |
TimeLine (const TimeLine &other) | |
TimeLine (const int duration=250) | |
double | value () const |
double | valueForTime (const int msec) const |
~TimeLine () |
Member Enumeration Documentation
The CurveShape describes the relationship between time and values.
We can pass some of them through to QTimeLine but also invent our own ones.
Definition at line 1035 of file kwineffects.h.
The documentation for this class was generated from the following files: