Animation programming for Windows Phone 7 Animation

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.