How do I apply an animation without using a storyboard ?

Platform: WPF| Category : Animation, 3D Graphics

Animations can be applied without using the StoryBoard. BeginAnimation() method can be used to apply animations instead of StoryBoard. This method can be used when simple animations are applied to a property of a control.

The following code snippet animates the width of the TextBlock using the ’BeginAnimation’ method.

[C#]

DoubleAnimation Dblanimation = new DoubleAnimation();
Dblanimation.From = 25;
Dblanimation.To = 50;
Dblanimation.Duration = new Duration(TimeSpan.FromSeconds(3));
tb.BeginAnimation(TextBlock.WidthProperty, Dblanimation);

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.