TIP: Understanding animations and storyboards - Online Free Computer Tutorials.

'Software Development, Games Development, Mobile Development, iOS Development, Android Development, Window Phone Development. Dot Net, Window Services,WCF Services, Web Services, MVC, MySQL, SQL Server and Oracle Tutorials, Articles and their Resources

Wednesday, July 20, 2011

TIP: Understanding animations and storyboards

Animations are something that many do not take in serious considerations, just because too often in the development of applications they are considered something incidental. Nevertheless it is really important to know the matter because there are many cases where an animation is something that make your application more pleasant and effective. Also, you may have the need of take advantage of the VisualStateManager so knowing animations and storyboards become something crucial, no matter if we have a very powerful allied named Blend.

In Silverlight, the concept of creating an animation is simple and may be resumed in a short sentence: take a dependency property and change its value along time. First of all you have to be aware that, only Dependency Properties can be affected by an animation because of their special behavior. Second you have also to know that, depending on the type of the target property you have to use a specific type of animation. So, if you want to animate the Width property of a rectangle you have to use an animation that is capable of manipulating a value of type double. A limited number of types are available in Silverlight, but it is demonstrated that they suffice for the most of the cases. Here is the available types:

DoubleAnimation: can be used for animate properties of type double. It is the type that solve the great number of cases.

ColorAnimation: It is capable of animate a color, changing the value along a gradient calculated at runtime. Important to note that it apply to the type Color and not to a Brush

PointAnimation: It animates a Point structure. It is useful to make objects move along a path.

Side by side with linear animations - I call them with this name because the variation of the value follow a linear scale - there are a complete set of key frame animations that are able to express the variation of the value over a series of "chunks" that define a complex path. So, as and example, with a DoubleAnimationUsingKeyFrames you can start from a value, move linearly to another one and continue with another again and so on. Keyframes are interesting for coordinating the flow of complex animations.

Doing an animation is simple. After the choice of the type you are targeting you have to setup some values that tell how the animation must work. An animation has an huge number of properties you can use to tune its behavior but for the sake of this post I resume the most important in the following table:

Read More....

No comments:

Post a Comment