- Element.RenderTransformOrigin = new Point(0.5, 0.5);
- Element.RenderTransform = new RotateTransform();
- DoubleAnimation da = new DoubleAnimation
- {
- From = 0,
- To = 360,
- Duration = TimeSpan.FromSeconds(0.5)
- };
- Storyboard.SetTarget(da, Element.RenderTransform);
- Storyboard.SetTargetProperty(da, new PropertyPath(RotateTransform.AngleProperty));
- Storyboard sb = new Storyboard();
- sb.Children.Add(da);
- sb.Begin();
Thursday, July 9, 2009
Minimum Code for Silverlight Rotation Animation
This is the minimum code for animate rotating a Silverlight element (a variable named Element):
Subscribe to:
Post Comments (Atom)
I needed to move an object, but using your code it was super easy! Been to about 20 sites before I stumbled on this one -- well done sir!
ReplyDeleteI totally agree. I had to search way to hard to find this simple example. Thanks!
ReplyDeleteSensational...had it working in seconds!
ReplyDeleteC# animated rotation
ReplyDelete