Silverlight animation Overview
Http://msdn.microsoft.com/zh-cn/library/cc189019 (V = vs.95). aspx
Class inheritance relationship
Object
Dependencyobject (Abstract)
Timeline (Abstract)
Doubleanimation
Doubleanimationusingkeyframes
Coloranimation
Coloranimationusingkeyframes
Pointanimation
Pointanimationusingkeyframes
Objectanimationusingkeyframes
Storyboard class Introduction
Controls the animation through the timeline and provides the object and attribute target information for its subanimations.
System. Windows. Media. Animation
XAML
<Storyboard...>
Oneormorechildtimelines
</Storyboard>
XAML Value
Oneormorechildtimelines
One or more object elements of a class derived from timeline. This can be another storyboard or any of many animation types.
Storyboard can be used as a container for other animation objects (such as doubleanimation) and other storyboard objects. You can use the Interactive Method of the storyboard object to start, pause, continue, and stop the animation. You can use the begin, stop, pause, and resume methods to control the playing of the demo board (animation.
In this example, clicking the button will rotate
< Button Content = "Button that will rotate"
Grid. Row = "0"
Horizontalalignment = "Center"
Verticalalignment = "Center"
Rendertransformorigin = "0.5 0.5"
Click = "Onbuttonclick" >
< Button. rendertransform >
< Rotatetransform />
</ Button. rendertransform >
</ Button >
Using System;
Using System. Collections. Generic;
Using System. LINQ;
Using System. net;
Using System. windows;
Using System. Windows. controls;
Using System. Windows. documents;
Using System. Windows. input;
Using System. Windows. Media;
Using System. Windows. Media. animation;
Using System. Windows. shapes;
Using Microsoft. Phone. controls;
Namespace Clickandspin
{
Public Partial Class Mainpage: phoneapplicationpage
{
Public Mainpage ()
{
Initializecomponent ();
}
Void Onbuttonclick ( Object Sender, routedeventargs ARGs)
{
Button BTN = Sender As Button;
Rotatetransform = BTN. rendertransform As Rotatetransform;
// Create and define an animation
Doubleanimation anima = New Doubleanimation ();
Anima. From = 0 ; // Start Value
Anima. = 360 ; // End value
Anima. Duration = New Duration (timespan. fromseconds ( 0.5 )); // Duration
// Set storyboard attributes
Storyboard. settarget (anima, rotatetransform );
Storyboard. settargetproperty (anima, New Propertypath (rotatetransform. angleproperty ));
// Create a storyboard, add the animation to it, and then start the animation!
Storyboard = New Storyboard ();
Storyboard. Children. Add (anima );
Storyboard. Begin ();
}
}
}
Note:
Storyboard. settarget (timeline, target) Method
Silverlight causes the specified timeline to target the specified object.
Timeline
Type: system. Windows. Media. animation. Timeline
Time series with the specified dependency object as the target.
Target
Type: system. Windows. dependencyobject
The actual instance of the target object.
Storyboard. settargetproperty (element, PATH) Method
Silverlight enables the specified timeline to target the specified dependency attribute.
Element
Type: system. Windows. Media. animation. Timeline
The timeline associated with the specified dependency attribute.
Path
Type: system. Windows. propertypath
Specifies the path of the dependency attribute for animation processing.