RE: sliding panel




From: Kevin DeKorte
I'd like to create a panel that slides out of the way, little
animation kinda thing and I had something working but gtk really
didn't slide it out of the way it just showing the first and then
the last. Now I understand that due to performance that not every
panel change should be drawn but any idea how I can do this...

Anything like this that I've ever done, I've handled as a time-based animation.

Essentially, you grab yourself a sub-second timer, make a note of the current time, decide how long you want 
the slide animation to take, and then tell the thing to redraw itself.

The redraw checks the time again, figures out where it is in the animation period, and redraws itself 
appropriately.  Finally, if the animation isn't finished, you issue another redraw to begin the next frame 
(you can also request the redraw via a timer if it's running too fast).

It gets a little more complicated if the animation includes moving or resizing the window, which itself may 
well trigger a redraw, and you shouldn't get any redraws if the window is covered, so it helps to have a 
timer to kill the animation when it's supposed to be finished (usually set it a little past when the 
animation is supposed to have finished naturally).

Anyhow, that's one idea that usually works for me.  And I've got a system which frequently freezes for 10 
seconds half way through an animation, so it seems reasonably robust.  :)


Fredderic

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]