任何人都可以将其转换为c#代码吗?

时间:2011-05-18 09:46:11

标签: c# wpf easing-functions

<Window.Resources>
    <Storyboard x:Key="AnimateTarget">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Transform"             
                                       Storyboard.TargetProperty="ScaleX">
            <EasingDoubleKeyFrame KeyTime="0:0:0"            
                                  Value="0.0" />
            <EasingDoubleKeyFrame KeyTime="0:0:3"      
                                  Value="2.0">
                <EasingDoubleKeyFrame.EasingFunction>
                    <ElasticEase EasingMode="EaseOut"           
                                 Oscillations="13"               
                                 Springiness="8" />
                </EasingDoubleKeyFrame.EasingFunction>
            </EasingDoubleKeyFrame>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Transform"     
                                       Storyboard.TargetProperty="ScaleY">
            <EasingDoubleKeyFrame KeyTime="0:0:0"               
                                  Value="0.0" />
            <EasingDoubleKeyFrame KeyTime="0:0:0"             
                                  Value="2.0">
                <EasingDoubleKeyFrame.EasingFunction>
                    <ElasticEase EasingMode="EaseOut"         
                                 Oscillations="13"                
                                 Springiness="8" />
                </EasingDoubleKeyFrame.EasingFunction>
            </EasingDoubleKeyFrame>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>
</Window.Resources>

谢谢:)

2 个答案:

答案 0 :(得分:3)

看看:

http://msdn.microsoft.com/en-us/library/ms605709.aspx

将来如果你想要答案,试着至少尝试手头的任务......当你遇到困难时,发布你卡住的地方,展示你做过/尝试过的事情。

答案 1 :(得分:0)

试试这个快速入门:

当您的XAML打开像

这样的XML元素时
<ABC SomeAttrib=SomeValue >
  <Child ChildProp=ChildVal />
</ABC>

你可以通过

在代码中做类似的事情
  • 为每个Element-Tag调用构造函数 var abc = new ABC()
  • 为每个XML-Attribute设置属性 abc.SomeAttrib=SomeValue;
  • 将子节点添加到其父节点的内容(或某些项集合) abc.Content = new Child {ChildProp=ChildVal};

注意:元素<EasingDoubleKeyFrame.EasingFunction>实际上是一个属性,即“EasingDoubleKeyFrame”类型的某个实例的属性“EasingFunction”,不会被此愚弄。