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: Roll Up =========================
41
const float RollUpAnim::kDurationFactor = 1.67;
43
RollUpAnim::RollUpAnim (CompWindow *w,
44
WindowEvent curWindowEvent,
46
const AnimEffect info,
47
const CompRect &icon) :
48
Animation::Animation (w, curWindowEvent, kDurationFactor * duration, info,
50
GridAnim::GridAnim (w, curWindowEvent, kDurationFactor * duration, info,
56
RollUpAnim::initGrid ()
59
if (mCurWindowEvent == WindowEventShade ||
60
mCurWindowEvent == WindowEventUnshade)
69
float forwardProgress = progressEaseInEaseOut ();
70
bool fixedInterior = optValB (AnimationOptions::RollupFixedInterior);
72
CompRect outRect (mAWindow->savedRectsValid () ?
73
mAWindow->savedOutRect () :
74
mWindow->outputRect ());
76
int ox = outRect.x ();
77
int oy = outRect.y ();
78
int owidth = outRect.width ();
79
int oheight = outRect.height ();
81
GridModel::GridObject *object = mModel->objects ();
82
unsigned int n = mModel->numObjects ();
83
for (unsigned int i = 0; i < n; i++, object++)
85
// Executing shade mode
87
Point3d &objPos = object->position ();
89
if (i % 2 == 0) // object is at the left side
91
float objGridY = object->gridPosition ().y ();
97
else if (objGridY == 1)
100
(1 - forwardProgress) * (oy + oheight * objGridY) +
101
forwardProgress * (oy +
102
mDecorTopHeight + mDecorBottomHeight));
106
// find position in window contents
107
// (window contents correspond to 0.0-1.0 range)
108
float relPosInWinContents =
109
(objGridY * oheight -
110
mDecorTopHeight) / mWindow->height ();
112
if (relPosInWinContents > forwardProgress)
115
(1 - forwardProgress) * (oy + oheight * objGridY) +
116
forwardProgress * (oy + mDecorTopHeight));
119
object->offsetTexCoordForQuadBefore ().
120
setY (-forwardProgress * mWindow->height ());
124
objPos.setY (oy + mDecorTopHeight);
126
object->offsetTexCoordForQuadAfter ().
127
setY ((forwardProgress - relPosInWinContents) *
132
else // object is at the right side
134
// Set y position to the y position of the object at the left
135
// on the same row (previous object)
136
objPos.setY ((object - 1)->position ().y ());
138
// Also copy offset texture y coordinates
139
object->offsetTexCoordForQuadBefore ().
140
setY ((object - 1)->offsetTexCoordForQuadBefore ().y ());
141
object->offsetTexCoordForQuadAfter ().
142
setY ((object - 1)->offsetTexCoordForQuadAfter ().y ());
145
float origx = ox + owidth * object->gridPosition ().x ();