Animate Silverlight 2 object from 1 line of code

Posted by Corey on March 14, 2008 at 2:35 am.

In a previous post about how to create animations dynamically, I showed how to add StoryBoards from C#. I have extracted this logic into a class called SLAnimator. This allows you to do an animation from one line code, and a nice thing about this approach is it still uses the built in Silverlight Animation system.

Here is an example of the code to call the animation.
SLAnimator.Animate(this, rect, 100, 100, 100,1,1);
Parameters:

  • Container element
  • UIElement to animate
  • Time of animation in milliseconds
  • X of destination
  • Y of destination
  • ScaleX
  • ScaleY

This animation API is at it’s infancy, so I will continue updating as time permits. Feel free to download the class and give me your feed back.

Enjoy!

Links:
Download the source
Working example


Get Microsoft Silverlight

2 Responses to “Animate Silverlight 2 object from 1 line of code”

  •  

    [...] for Width and Height.  Check out the code and the example.  For more information here is the initial post.   I will add more documentation after getting a few more animations in the [...]

  • Just what I was looking for! I was searching for free classified advertising and classified related articles when I came across your website post on Yahoo. This is exactly what I was looking for. Thanks for the share. I’ve bookmarked this post for future reference :-) Nice article - Catch Ya

Leave a Reply