PDA

Click to See Complete Forum and Search --> : How NOT to do animation in WPF


chris128
Dec 22nd, 2009, 10:40 AM
Noticed this tutorial in the VBWire News section of the vbforums site: http://visualbasic.about.com/od/usingvbnet/a/wpfintro6.htm
and after reading it the first thing I thought was why on earth would you use a timer to animate something in WPF... so I commented on the article and low and behold, a week later this article appears :) http://visualbasic.about.com/b/2009/12/19/wpf-animation.htm

So if anyone was going to follow the first article when trying to animate something in WPF... DONT! :)

DeanMc
Dec 25th, 2009, 07:29 PM
I agree this is terrible!

RobDog888
Dec 27th, 2009, 12:41 PM
Cool, he actually admitted his mistake. :thumb: Chris!

DeanMc
Dec 27th, 2009, 12:43 PM
Ha ha, we should complain more but fair play to the author! Anyone who has the guff to admit there wrong is clearly trying there best!

RobDog888
Dec 27th, 2009, 12:53 PM
I was wrong once :D

I like the animation in SL as its all xaml

Nightwalker83
Dec 28th, 2009, 12:54 AM
Just a thought but maybe you could post your way of achieving this so that if the article changes again people will know the correct way to do this.

RobDog888
Dec 28th, 2009, 01:06 AM
Maybe he would post a link to your correct technique but I doubt it. Why drive traffic away from their site

Nightwalker83
Dec 28th, 2009, 03:40 AM
Maybe he would post a link to your correct technique but I doubt it. Why drive traffic away from their site

That's one reason why I think chris 128 should post his code, etc in this thread Also, it would make the thread appear useful rather than talking about mistake someone wrote in an article.

chris128
Jan 4th, 2010, 09:17 AM
That's one reason why I think chris 128 should post his code, etc in this thread Also, it would make the thread appear useful rather than talking about mistake someone wrote in an article.

Well the way I would do it is exactly how he did it in the article that he posted after I pointed out the mistake :) (which I already linked to in my original post but here it is again: http://visualbasic.about.com/od/learnvbnet/a/wpfintro7.htm )

Here's my slightly slimmed down version anyway:

Dim myDoubleAnimation As New DoubleAnimation
myDoubleAnimation.To = 0.0
myDoubleAnimation.Duration = New Duration(TimeSpan.FromSeconds(5))
Label1.BeginAnimation(Label.OpacityProperty, myDoubleAnimation)

Note that my example just decreases the label's opacity to 0 over 5 seconds, where as in the other developer's article he uses the AutoReverse and RepeatBehavior properties to make it loop and keep fading the label in and out of visibility