summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Lange <klange@ogunderground.com>2008-02-06 19:54:44 -0500
committerKevin Lange <klange@ogunderground.com>2008-02-06 19:54:44 -0500
commit2d382841aa91148cc10a99b3a77b285f3ac46b18 (patch)
treead5652cd9ced69ec5c29b679f473923d5e590795
parentac9f048fc65e5412c911b16e6b5a9b66f781981b (diff)
downloadwiitrack-2d382841aa91148cc10a99b3a77b285f3ac46b18.tar.gz
wiitrack-2d382841aa91148cc10a99b3a77b285f3ac46b18.tar.bz2
Slight animation update for mid-animation focus switching
-rw-r--r--wiitrack.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/wiitrack.c b/wiitrack.c
index 58ae195..7d5889b 100644
--- a/wiitrack.c
+++ b/wiitrack.c
@@ -175,21 +175,29 @@ static void WTPreparePaintScreen (CompScreen *s, int msSinceLastPaint) {
if (!windowIs3D (w))
continue;
maxDepth--;
+ float tempDepth = 0.0f - ((float)maxDepth * (float)wiitrackGetWindowDepth(s) / 100.0);
if (!wtw->isAnimating) {
- wtw->newDepth = 0.0f - ((float)maxDepth * (float)wiitrackGetWindowDepth(s) / 100.0);
+ wtw->newDepth = tempDepth;
if (wtw->zDepth != wtw->newDepth) {
wtw->oldDepth = wtw->zDepth;
wtw->isAnimating = TRUE;
wtw->timeRemaining = 0;
}
} else {
- wtw->timeRemaining++;
- float dz = (float)(wtw->oldDepth - wtw->newDepth) * (float)wtw->timeRemaining / wiitrackGetFadeTime (s);
- wtw->zDepth = wtw->oldDepth - dz;
- if (wtw->timeRemaining >= wiitrackGetFadeTime (s)) {
- wtw->isAnimating = FALSE;
- wtw->zDepth = wtw->newDepth;
- wtw->oldDepth = wtw->newDepth;
+ if (wtw->newDepth != tempDepth) {
+ wtw->newDepth = tempDepth;
+ wtw->oldDepth = wtw->zDepth;
+ wtw->isAnimating = TRUE;
+ wtw->timeRemaining = 0;
+ } else {
+ wtw->timeRemaining++;
+ float dz = (float)(wtw->oldDepth - wtw->newDepth) * (float)wtw->timeRemaining / wiitrackGetFadeTime (s);
+ wtw->zDepth = wtw->oldDepth - dz;
+ if (wtw->timeRemaining >= wiitrackGetFadeTime (s)) {
+ wtw->isAnimating = FALSE;
+ wtw->zDepth = wtw->newDepth;
+ wtw->oldDepth = wtw->newDepth;
+ }
}
}
} else {