2
* Animation plugin for compiz/beryl
6
* Copyright : (C) 2006 Erkin Bahceci
7
* E-mail : erkinbah@gmail.com
9
* Based on Wobbly and Minimize plugins by
11
* E-mail : davidr@novell.com>
13
* Particle system added by : (C) 2006 Dennis Kasprzyk
14
* E-mail : onestone@beryl-project.org
16
* Beam-Up added by : Florencio Guimaraes
17
* E-mail : florencio@nexcorp.com.br
19
* Hexagon tessellator added by : Mike Slegeir
20
* E-mail : mikeslegeir@mail.utexas.edu>
22
* This program is free software; you can redistribute it and/or
23
* modify it under the terms of the GNU General Public License
24
* as published by the Free Software Foundation; either version 2
25
* of the License, or (at your option) any later version.
27
* This program is distributed in the hope that it will be useful,
28
* but WITHOUT ANY WARRANTY; without even the implied warranty of
29
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30
* GNU General Public License for more details.
32
* You should have received a copy of the GNU General Public License
33
* along with this program; if not, write to the Free Software
34
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
39
// ===================== Effect: Glide =========================
41
GlideAnim::GlideAnim (CompWindow *w,
42
WindowEvent curWindowEvent,
44
const AnimEffect info,
45
const CompRect &icon) :
46
Animation::Animation (w, curWindowEvent, duration, info, icon),
47
TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
48
ZoomAnim::ZoomAnim (w, curWindowEvent, duration, info, icon)
52
Glide2Anim::Glide2Anim (CompWindow *w,
53
WindowEvent curWindowEvent,
55
const AnimEffect info,
56
const CompRect &icon) :
57
Animation::Animation (w, curWindowEvent, duration, info, icon),
58
TransformAnim::TransformAnim (w, curWindowEvent, duration, info, icon),
59
GlideAnim::GlideAnim (w, curWindowEvent, duration, info, icon)
64
GlideAnim::getParams (float *finalDistFac,
68
*finalDistFac = optValF (AnimationOptions::Glide1AwayPosition);
69
*finalRotAng = optValF (AnimationOptions::Glide1AwayAngle);
73
Glide2Anim::getParams (float *finalDistFac,
77
*finalDistFac = optValF (AnimationOptions::Glide2AwayPosition);
78
*finalRotAng = optValF (AnimationOptions::Glide2AwayAngle);
82
GlideAnim::getProgress ()
84
float forwardProgress = progressLinear ();
86
return progressDecelerate (forwardProgress);
90
GlideAnim::getFadeProgress ()
93
return ZoomAnim::getFadeProgress ();
95
return getProgress ();
99
GlideAnim::applyTransform ()
102
ZoomAnim::applyTransform ();
108
getParams (&finalDistFac, &finalRotAng, &thickness);
110
float forwardProgress;
112
getZoomProgress (&forwardProgress, 0, true);
114
forwardProgress = getProgress ();
116
float finalz = finalDistFac * 0.8 * DEFAULT_Z_CAMERA *
119
CompRect outRect (mAWindow->savedRectsValid () ?
120
mAWindow->savedOutRect () :
121
mWindow->outputRect ());
123
GLVector rotAxis (1, 0, 0, 0);
124
GLVector rotAxisOffset (outRect.x () + outRect.width () / 2.0f,
125
outRect.y () + outRect.height () / 2.0f,
127
GLVector translation (0, 0, finalz * forwardProgress, 0);
129
float rotAngle = finalRotAng * forwardProgress;
130
glideModRotAngle = fmodf (rotAngle + 720, 360.0f);
132
// put back to window position
133
mTransform.translate (rotAxisOffset);
135
perspectiveDistortAndResetZ (mTransform);
137
// animation movement
138
mTransform.translate (translation);
140
// animation rotation
141
mTransform.rotate (rotAngle, rotAxis);
143
// intentional scaling of z by 0 to prevent weird opacity results and
144
// flashing that happen when z coords are between 0 and 1 (bug in compiz?)
145
mTransform.scale (1.0f, 1.0f, 0.0f);
147
// place window rotation axis at origin
148
mTransform.translate (-rotAxisOffset);
152
GlideAnim::adjustDuration ()
156
mTotalTime *= kDurationFactor;
157
mRemainingTime = mTotalTime;
162
GlideAnim::prePaintWindow ()
164
if (90 < glideModRotAngle &&
165
glideModRotAngle < 270)
166
glCullFace (GL_FRONT);
170
GlideAnim::postPaintWindow ()
172
if (90 < glideModRotAngle &&
173
glideModRotAngle < 270)
174
glCullFace (GL_BACK);
178
GlideAnim::zoomToIcon ()
180
return ((mCurWindowEvent == WindowEventMinimize ||
181
mCurWindowEvent == WindowEventUnminimize) &&
182
optValB (AnimationOptions::Glide1ZoomToTaskbar));
186
Glide2Anim::zoomToIcon ()
188
return ((mCurWindowEvent == WindowEventMinimize ||
189
mCurWindowEvent == WindowEventUnminimize) &&
190
optValB (AnimationOptions::Glide2ZoomToTaskbar));