KWin/Animations: Difference between revisions

From KDE Community Wiki
 
(44 intermediate revisions by 4 users not shown)
Line 113: Line 113:
! Shape
! Shape
|-
|-
| Show dashboard
| Darken background
| 500
| 500
| -
| EaseInOutCurve
|-
|-
| Hide dashboard
| Un-Darken background
| 500
| 500
| -
| EaseInOutCurve
|}
|}


=== desktopgrid ===
=== desktopgrid ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Zoom duration
| 300
| EaseInOutCurve
|}
=== dialogparent ===
=== dialogparent ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Darken parent window
| 300
| EaseInOutCurve
|}
=== diminactive ===
=== diminactive ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Darken inactive windows
| 250
| EaseInOutCurve
|}
=== dimscreen ===
=== dimscreen ===
{| class="wikitable"
{| class="wikitable"
Line 141: Line 174:
|}
|}
=== explosion ===
=== explosion ===
No timeline.
=== fade ===
=== fade ===
(javascript plugin)
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Fade window in
| 150
| Linear
|-
| Fade window out
| 150
| Linear
|}
=== fadedesktop ===
=== fadedesktop ===
(javascript plugin)
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Fade between virtual desktop
| 250
| Linear
|}
=== fallapart ===
=== fallapart ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Close windows
| 1000
| EaseInOutCurve
|}
=== flipswitch ===
=== flipswitch ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Show/Hide flip effect
| 200
| EaseInOutCurve
|-
| Switch windows
| 200
| EaseInCurve
|}
=== glide ===
=== glide ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Open window
| 350
| EaseOutCurve
|-
| Close window
| 350
| EaseInCurve
|}
=== highlightwindow ===
=== highlightwindow ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Highlight window
| 150
| unknown
|}
=== invert ===
=== invert ===
No timeline.
=== login ===
=== login ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Fade desktop in
| 2000
| EaseInOutCurve
|}
=== logout ===
=== logout ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Logout animation
| 2000
| unknown
|}
=== lookingglass ===
=== lookingglass ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| magnifies screen
| 500
| EaseInOutCurve
|}
=== magiclamp ===
=== magiclamp ===
{| class="wikitable"
{| class="wikitable"
Line 168: Line 318:


=== magnifier ===
=== magnifier ===
none
=== minimizeanimation ===
=== minimizeanimation ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Minimize window
| 250
| EaseInCurve
|-
| Unminimize window
| 250
| EaseInOutCurve
|}
=== mousemark ===
=== mousemark ===
none
=== outline ===
=== outline ===
none
=== presentwindows ===
=== presentwindows ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Present in
| 150
| unknown
|-
| Present out
| 150
| unknown
|}
=== resize ===
=== resize ===
none
=== scalein ===
=== scalein ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Scale windows in
| 250
| EaseInOutCurve
|}
=== screenshot ===
=== screenshot ===
none
=== sheet ===
=== sheet ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| show modal dialogs
| 500
| EaseInOutCurve
|}
=== showfps ===
=== showfps ===
none
=== showpaint ===
=== showpaint ===
none
=== slide ===
=== slide ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Slide windows
| 250
| EaseInOutCurve
|}
=== slideback ===
=== slideback ===
none
=== slidingpopups ===
=== slidingpopups ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Slide popup in
| 250
| EaseInOutCurve
|-
| Slide popup out
| 250
| EaseInOutCurve
|}
=== snaphelper ===
=== snaphelper ===
{| class="wikitable"
|-
! Animation
! Duration
! Shape
|-
| Show Snap Helper
| 250
| LinearCurve
|-
| Hide Snap Helper
| 250
| LinearCurve
|}
=== startupfeedback ===
=== startupfeedback ===
none
=== taskbarthumbnail ===
=== taskbarthumbnail ===
none
=== thumbnailaside ===
=== thumbnailaside ===
none
=== trackmouse ===
=== trackmouse ===
none
=== translucency ===
=== translucency ===
none<br>
translucency/translucency.h:25:#include <QtCore/QTimeLine> (unused include)
=== windowgeometry ===
=== windowgeometry ===
=== windowstrip ===
none
 
=== wobblywindows ===
=== wobblywindows ===
none
=== zoom ===
=== zoom ===
{| class="wikitable"
{| class="wikitable"

Latest revision as of 06:40, 7 October 2012

There are many different animations in the KWin effects. The animations differ in animation duration and the kind of animation. The idea is to have this in a more consistent way by e.g. all fade animations having the same duration and animation behavior.

To be able to do so, it is first required to gather all the animation data.

How to Find the Animation

All animations are defined in the effects source code which are located in kwin/effects in the kde-workspace git repository. Most of the animations use one or many QTimeLine for controlling the animation. These are mostly defined in variables called timeline. To find the animations which are going on one can look into a method called prePaintScreen which gets the time since the last rendered frame. There is some code which adds the time to the QTimeLine. For example in the DimScreenEffect this looks like the following:

void DimScreenEffect::prePaintScreen(ScreenPrePaintData& data, int time)
{
    if (mActivated && activateAnimation && !effects->activeFullScreenEffect())
        timeline.setCurrentTime(timeline.currentTime() + time);
    if (mActivated && deactivateAnimation)
        timeline.setCurrentTime(timeline.currentTime() - time);
    if (mActivated && effects->activeFullScreenEffect())
        timeline.setCurrentTime(timeline.currentTime() - time);
    if (mActivated && !activateAnimation && !deactivateAnimation && !effects->activeFullScreenEffect() && timeline.currentValue() != 1.0)
        timeline.setCurrentTime(timeline.currentTime() + time);
    effects->prePaintScreen(data, time);
}

From this we see that only one animation in variable "timeline" is defined.

Finding the Animation Duration

The animation duration is somewhere in the effect defined. In most cases it is either a hardcoded value or comes from a configuration value, which also includes the default hardcoded. If you have your variable look for a code section like:

variableName.setDuration(animationTime(250));

Which would tell us that the duration is 250 msec. For a configurable duration it can look like:

rotationDuration = animationTime(CubeConfig::rotationDuration() != 0 ? CubeConfig::rotationDuration() : 500);
timeLine.setDuration(rotationDuration);

This would tell us that the default animation duration is 500 msec.

Finding the Curve Shape

Each QTimeLine has either a CurveShape or a QEasingCurve assigned which describes how the animation looks like over time. If the animation uses a CurveShape you can find a code fragment looking like:

variableName.setCurveShape(QTimeLine::EaseInOutCurve);

This would tell us, that it is using an EaseInOutCurve.

If it uses a QEasingCurve it should look like:

variableName.setEasingCurve(QEasingCurve::InOutQuad);

This would tell us it is using an InOutQuad.

If there is no call for setting either the CurveShape or the EasingCurve on the QTimeLine the default behavior is a EaseInOutCurve.

Effects

Please use the following table if an effect uses an animation:

Animation Duration Shape
What gets animated (e.g. fade windows, dim windows) Duration in msec CurveShape or EasingCurve

blur

none

boxswitch

Can be ignored, scheduled for removal

coverswitch

Animation Duration Shape
Switch Windows 200 EaseInOutCurve

cube

Animation Duration Shape
Horizontal Rotation 500 EaseInOutCurve
Vertical Rotation 500 EaseInOutCurve

cubeslide

Animation Duration Shape
Slide Rotation 500 EaseInOutCurve

dashboard

Animation Duration Shape
Darken background 500 EaseInOutCurve
Un-Darken background 500 EaseInOutCurve

desktopgrid

Animation Duration Shape
Zoom duration 300 EaseInOutCurve

dialogparent

Animation Duration Shape
Darken parent window 300 EaseInOutCurve

diminactive

Animation Duration Shape
Darken inactive windows 250 EaseInOutCurve

dimscreen

Animation Duration Shape
Dim windows 250 EaseInOutCurve
Undim windows 250 EaseInOutCurve

explosion

No timeline.

fade

(javascript plugin)

Animation Duration Shape
Fade window in 150 Linear
Fade window out 150 Linear

fadedesktop

(javascript plugin)

Animation Duration Shape
Fade between virtual desktop 250 Linear

fallapart

Animation Duration Shape
Close windows 1000 EaseInOutCurve

flipswitch

Animation Duration Shape
Show/Hide flip effect 200 EaseInOutCurve
Switch windows 200 EaseInCurve

glide

Animation Duration Shape
Open window 350 EaseOutCurve
Close window 350 EaseInCurve

highlightwindow

Animation Duration Shape
Highlight window 150 unknown

invert

No timeline.

login

Animation Duration Shape
Fade desktop in 2000 EaseInOutCurve

logout

Animation Duration Shape
Logout animation 2000 unknown

lookingglass

Animation Duration Shape
magnifies screen 500 EaseInOutCurve

magiclamp

Animation Duration Shape
Minimize window 250 LinearCurve
Unminimize window 250 LinearCurve

magnifier

none

minimizeanimation

Animation Duration Shape
Minimize window 250 EaseInCurve
Unminimize window 250 EaseInOutCurve

mousemark

none

outline

none

presentwindows

Animation Duration Shape
Present in 150 unknown
Present out 150 unknown

resize

none

scalein

Animation Duration Shape
Scale windows in 250 EaseInOutCurve

screenshot

none

sheet

Animation Duration Shape
show modal dialogs 500 EaseInOutCurve

showfps

none

showpaint

none

slide

Animation Duration Shape
Slide windows 250 EaseInOutCurve

slideback

none

slidingpopups

Animation Duration Shape
Slide popup in 250 EaseInOutCurve
Slide popup out 250 EaseInOutCurve

snaphelper

Animation Duration Shape
Show Snap Helper 250 LinearCurve
Hide Snap Helper 250 LinearCurve

startupfeedback

none

taskbarthumbnail

none

thumbnailaside

none

trackmouse

none

translucency

none
translucency/translucency.h:25:#include <QtCore/QTimeLine> (unused include)

windowgeometry

none

wobblywindows

none

zoom

Animation Duration Shape
Zoom effect 500 EaseInOutCurve