2

There is a similar thread else where, but it focues on gameprogramming which I find a little different to regular gui applications with some 'extra sugar'.

What would be the right approach for driving small gui-animations (like expanding/collapsing panels, glowing buttons etc)?

Would it be best to setup a timer to fire at regular intervals, or would it be better to use the idle-event?

How does WPF drive its animations?

I know there are a lot of opinions on whats best out there, so lets collect them all :-)

UPDATE: Ok. I think this came out a little unclear. I'm not using WPF, and I'm not interested in how you trigger an animation in WPF. What I'm after, is a discussion about why a time is better or worse then using an onidle event to drive the animation. Not start it, drive it.

Community
  • 1
  • 1
Vegar
  • 12,828
  • 16
  • 85
  • 151
  • So we got penalized for giving straight forward answers because you didn't clarify the question? Maybe next time you could clarify the question and then wait some period of time before down-voting the answers. I'm sorry my answer wasn't helpful. – Josh G May 06 '09 at 12:37
  • Well, to be honest, I can't see why it should be any need of clearify anything. If you read the complete question, and take a look at the other thread mentioned, it should be quite clear that I'm not interessted in how I can make storyboards in blend. But by all means - I can wait with the downvote... – Vegar May 06 '09 at 12:46
  • Sorry, I didn't check out the other thread. Maybe that would have cleared it up. I added a new answer that may be slightly more appropriate. Feel free to down-vote this one if it is not helpful... I know that it is at least on topic now! :-) – Josh G May 06 '09 at 12:51
  • Yes, I find this answer much more to topic. thumbs up :-) – Vegar May 06 '09 at 13:45

2 Answers2

1

How you drive your animation should be based on your processing priorities.

If you use a timer, you will get called more consistently. This can put you in competition with more important processes for processing power. Driving by OnIdle allows other processes to take charge, but it also means that the animation could get starved.

The correct choice depends your specific priorities.

I'm not sure how WPF handles this, but it would be important to base the animation on the absolute start time rather than incrementing the animation on each call because the animation may not get called at regular intervals.

Josh G
  • 14,068
  • 7
  • 62
  • 74
0

Maybe I'm getting it wrong but why do you need timer/idle-event if WPF supports animations natively? You may want to take a look at the Animation Overview article at MSDN: http://msdn.microsoft.com/en-us/library/ms752312.aspx

arconaut
  • 3,227
  • 2
  • 27
  • 36