为什么我的动画不会播放? [英] Why won't my animation won't play?

查看:71
本文介绍了为什么我的动画不会播放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新手和我正在浏览帮助文件和Victor Gaudiosos书。按照所有步骤操作,但动画将无法播放。

我正在Vista盒子上,运行Blend 3的试用版并已经验证了SL3的安装。

动画播放在Blend但在测试应用时却没有。最严重的加重。

本产品需求文档!

以下是代码:

< UserControl
  xmlns =" < a href ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> http://schemas.microsoft.com/winfx/2006/xaml/presentation "
  xmlns:x =" http://schemas.microsoft.com/winfx/2006/xaml " ;
&NBSP; X:类= QUOT; SilverlightApplication5.MainPage"
&NBSP;宽度=" 640"高度="480"> < UserControl.Resources>
  < Storyboard x:Name =" Storyboard1">
     ;< DoubleAnimationUsingKeyFrames BeginTime =" 00:00:00" Storyboard.TargetName = QUOT;椭圆" Storyboard.TargetProperty ="(UIElement.RenderTransform)。(TransformGroup.Children)[3]。(TranslateTransform.X)">
    < EasingDoubleKeyFrame KeyTime =" 00 :00:00"值=" 0" />    < EasingDoubleKeyFrame KeyTime =" 00:00:01"值=" -23" />    < EasingDoubleKeyFrame KeyTime =" 00:00:02"值=" 293.75" />    < EasingDoubleKeyFrame KeyTime =" 00:00:03"值=" 396.8330078125" />    < EasingDoubleKeyFrame KeyTime =" 00:00:04"值=" 189.41700744628906" />    < EasingDoubleKeyFrame KeyTime =" 00:00:05"值=" 0" />   < / DoubleAnimationUsingKeyFrames>   < DoubleAnimationUsingKeyFrames BeginTime =" 00:00:00" Storyboard.TargetName = QUOT;椭圆" Storyboard.TargetProperty ="(UIElement.RenderTransform)。(TransformGroup.Children)[3]。(TranslateTransform.Y)">
    < EasingDoubleKeyFrame KeyTime =" 00 :00:00"值=" 0" />    < EasingDoubleKeyFrame KeyTime =" 00:00:01"值=" 161" />    < EasingDoubleKeyFrame KeyTime =" 00:00:02"值=" 189.75" />    < EasingDoubleKeyFrame KeyTime =" 00:00:03"值=" -72.5" />    < EasingDoubleKeyFrame KeyTime =" 00:00:04"值=" 100.75" />    < EasingDoubleKeyFrame KeyTime =" 00:00:05"值= QUOT; 0" />
&NBSP;&NBSP;&NBSP;< / DoubleAnimationUsingKeyFrames>
&NBSP;&NBSP;< /故事板>
&NBSP;< /UserControl.Resources>

Newbie and I'm going through the help files and the Victor Gaudiosos book. Followed all steps but animation won't play.

I'm on a Vista box, running trial version of Blend 3 and have verified SL3 installed.

Animation plays in Blend but not when testing the app. MOST aggravating.

This product NEEDS documentation!

Here's the code:

<UserControl
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 x:Class="SilverlightApplication5.MainPage"
 Width="640" Height="480">
 <UserControl.Resources>
  <Storyboard x:Name="Storyboard1">
   <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
    <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
    <EasingDoubleKeyFrame KeyTime="00:00:01" Value="-23"/>
    <EasingDoubleKeyFrame KeyTime="00:00:02" Value="293.75"/>
    <EasingDoubleKeyFrame KeyTime="00:00:03" Value="396.8330078125"/>
    <EasingDoubleKeyFrame KeyTime="00:00:04" Value="189.41700744628906"/>
    <EasingDoubleKeyFrame KeyTime="00:00:05" Value="0"/>
   </DoubleAnimationUsingKeyFrames>
   <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
    <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
    <EasingDoubleKeyFrame KeyTime="00:00:01" Value="161"/>
    <EasingDoubleKeyFrame KeyTime="00:00:02" Value="189.75"/>
    <EasingDoubleKeyFrame KeyTime="00:00:03" Value="-72.5"/>
    <EasingDoubleKeyFrame KeyTime="00:00:04" Value="100.75"/>
    <EasingDoubleKeyFrame KeyTime="00:00:05" Value="0"/>
   </DoubleAnimationUsingKeyFrames>
  </Storyboard>
 </UserControl.Resources>

 < Grid x:Name =" LayoutRoot" Background =" White">
  < Ellipse x:Name =" ellipse"高度= QUOT; 75"的Horizo​​ntalAlignment = QUOT;左"余量= QUOT; 101,146,0,0" VerticalAlignment = QUOT;陀螺"宽度= QUOT; 75" StrokeThickness = QUOT; 4英寸RenderTransformOrigin = QUOT; 0.5,0.5">
&NBSP;&NBSP;&NBSP;< Ellipse.RenderTransform>
&NBSP;&NBSP;&NBSP;&NBSP;<的TransformGroup>
&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;< ScaleTransform />
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;< SkewTransform />
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;< RotateTransform />
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;< TranslateTransform />
&NBSP;&NBSP;&NBSP;&NBSP;< /的TransformGroup>
&NBSP;&NBSP;&NBSP; < /Ellipse.RenderTransform>
   < Ellipse.Fill>
    < RadialGradientBrush Center =" 0.388,0.388" GradientOrigin =" 0.388,0.388">     < GradientStop Color =" Black" Offset =" 0.677" />     < GradientStop Color =" White" />    < /放射渐变画笔>
&NBSP;&NBSP;&NBSP;< /Ellipse.Fill>
&NBSP;&NBSP;< /椭圆>
&NBSP;< /网格>
< / UserControl>

 <Grid x:Name="LayoutRoot" Background="White">
  <Ellipse x:Name="ellipse" Height="75" HorizontalAlignment="Left" Margin="101,146,0,0" VerticalAlignment="Top" Width="75" StrokeThickness="4" RenderTransformOrigin="0.5,0.5">
   <Ellipse.RenderTransform>
    <TransformGroup>
     <ScaleTransform/>
     <SkewTransform/>
     <RotateTransform/>
     <TranslateTransform/>
    </TransformGroup>
   </Ellipse.RenderTransform>
   <Ellipse.Fill>
    <RadialGradientBrush Center="0.388,0.388" GradientOrigin="0.388,0.388">
     <GradientStop Color="Black" Offset="0.677"/>
     <GradientStop Color="White"/>
    </RadialGradientBrush>
   </Ellipse.Fill>
  </Ellipse>
 </Grid>
</UserControl>

推荐答案

你需要有一些东西来启动你的故事板。 在不编辑文件后面的代码的情况下,最简单的方法是使用行为。
1.)在画板上的某处创建一个按钮。
2.)在资源库中搜索ControlStoryboardAction。 /> 3。)将此ControlStoryboardAction应用于按钮。
4。)将属性Storyboard设置为您创建的故事板。
5。)运行应用程序并单击按钮。
You need to have something start your storyboard.  The easiest way to do this without editing your code behind file is to use Behaviors.
1.) Create a button somewhere on the artboard.
2.) In the Asset library search for the ControlStoryboardAction.
3.) Apply this ControlStoryboardAction to the button.
4.) Set the property Storyboard to your storyboard that you created.
5.) Run the application and click on the button.


这篇关于为什么我的动画不会播放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆