tailieunhanh - Foundation Silverlight 3 Animation- P4

Foundation Silverlight 3 Animation- P4: Silverlight has really come a long way since I started using it. It’s kind of interesting to look back a mere two years (roughly) and think about how the workflow has changed. Of even more interest is the staggering speed at which new features are being added. In the time I’ve been using Silverlight, it has grown from a somewhat limited toolset to an ever-more-impressive technology that has really started to come into its own. | STORYBOARDS AND ANIMATIONS Keyframe animations are containers that hold keyframe definitions. If you are using Blend each time a keyframe is created on the timeline a corresponding entry is made into an animation container. Like the DoubleAnimation type DoubleAnimationUsingKeyFrames animations also define TargetName and TargetProperty values. However the length of the animation is determined by the keyframes within the animation not by a duration value. BeginTime is specified to tell Silverlight when the animation should start. In this example BeginTime is 00 00 00 so it will start with no delay when called. Within the DoubleAnimationUsingKeyFrames container is an EasingDoubleKeyFrame KeyTime definition that defines a keyframe at .5 seconds and specifies that the value of the X Translate transform should be 150. Color Color animations are animations that change colors over time. Instead of manipulating values of type double color animations change the hex values that define a color. Like animations that use double color animations also come in two varieties ColorAnimation and ColorAnimationUsingKeyFrames. With color values in Silverlight hex values are preceded by a value representing the alpha transparency of the color being defined. For example FFFF0000 is 100 opaque red while 7FFF0000 is 50 red. If the alpha transparency value is left off of a hex color Silverlight will assume the color to be 100 opaque. The ColorFromTo project for Chapter 3 contains an example ColorAnimation. Open the project and press F5 to run it. When you move the mouse over the red ellipse it will begin to turn dark blue. If the mouse leaves the ellipse it will turn back to red. Each of the two color animations happens over .5 seconds and as with the DoubleAnimation example the From attribute is omitted from the ColorAnimation to give a smooth animation effect. Storyboard x Name TurnBlue ColorAnimation RedEllipse . .