[haiku-3rdparty-dev] Re: Animating view size / position advice

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Thu, 01 Sep 2011 12:08:20 +0200

On 01.09.2011 12:03, hey68 you wrote:
I would like to animate a change in a BView's size and/or position
(using ResizeBy and MoveBy functions).

Is there a relatively simple way to do this? Using a pulse and/or
posting a BMessage etc.?

You can animate it synchronously in a loop. In the loop you should sleep a bit and call UpdateIfNeeded() on the window before doing so. If you want to keep your window responsive, you have to use messaging. Using pulse messages is not good, since there is only limited control over the frequency of messages. For a code example, you can look at ShowImageWindow animating the tool bar to appear and disappear. MediaPlayer showing/hiding the controls in fullscreen is another example, but a little harder to find perhaps.

Best regards,
-Stephan


Other related posts: