Silverlight开发历程—动画(线性动画一些效果)

Silverlight开发历程—动画(线性动画一些效果),第1张

概述对特效的GlobalOffsetX进行动画 <Grid x:Name="LayoutRoot" Background="Gray" Loaded="LayoutRoot_Loaded"> <Grid.Resources> <Storyboard x:Name="myStoryboard"> <DoubleAnimation D

对特效的GlobalOffsetX进行动画

<GrID x:name="LayoutRoot" Background="Gray" Loaded="LayoutRoot_Loaded">        <GrID.Resources>            <Storyboard x:name="myStoryboard">                <DoubleAnimation Duration="0:0:3" Storyboard.Targetname="PlaneProjectionRotationX_1"                                 Storyboard.TargetProperty="RotationY" To="65" RepeatBehavior="Forever" autoReverse="True" />                <DoubleAnimation Duration="0:0:3" Storyboard.Targetname="PlaneProjectionRotationX_1"                                 Storyboard.TargetProperty="GlobalOffsetX" To="400" RepeatBehavior="Forever" autoReverse="True" />            </Storyboard>        </GrID.Resources>        <Canvas GrID.Row="1" margin="20"  WIDth="200" Height="200" Background="White">            <Canvas.Effect>                <DropShadowEffect />            </Canvas.Effect>        </Canvas>        <Image GrID.Row="1" margin="20" WIDth="200" Height="200" Source="../images/flower2.jpg">            <Image.Effect>                <DropShadowEffect />            </Image.Effect>            <Image.Projection>                <PlaneProjection x:name="PlaneProjectionRotationX_1"  />            </Image.Projection>        </Image>    </GrID>

C#:

 private voID LayoutRoot_Loaded(object sender,RoutedEventArgs e)        {            myStoryboard.Begin();        }


对特效的GlobalOffsetX进行动画

对特效的GlobalOffsetY进行动画

<GrID x:name="LayoutRoot" Background="Gray" Loaded="LayoutRoot_Loaded">        <GrID.Resources>            <Storyboard x:name="myStoryboard">                <DoubleAnimation Duration="0:0:3" Storyboard.Targetname="PlaneProjectionRotationX_1"                                 Storyboard.TargetProperty="RotationX" To="65" RepeatBehavior="Forever" autoReverse="True" />                <DoubleAnimation Duration="0:0:3" Storyboard.Targetname="PlaneProjectionRotationX_1"                                 Storyboard.TargetProperty="GlobalOffsetY" To="400" RepeatBehavior="Forever" autoReverse="True" />            </Storyboard>        </GrID.Resources>        <Canvas GrID.Row="1" margin="20"  WIDth="200" Height="200" Background="White">            <Canvas.Effect>                <DropShadowEffect />            </Canvas.Effect>        </Canvas>        <Image GrID.Row="1" margin="20" WIDth="200" Height="200" Source="../images/flower2.jpg">            <Image.Effect>                <DropShadowEffect />            </Image.Effect>            <Image.Projection>                <PlaneProjection x:name="PlaneProjectionRotationX_1"  />            </Image.Projection>        </Image>    </GrID>


C#:

 private voID LayoutRoot_Loaded(object sender,RoutedEventArgs e)        {            myStoryboard.Begin();        }

结果:



对特效的GlobalOffsetZ进行动画

GrID x:name="LayoutRoot" Background="Gray" Loaded="LayoutRoot_Loaded">        <GrID.Resources>            <Storyboard x:name="myStoryboard">                <DoubleAnimation Duration="0:0:3" Storyboard.Targetname="PlaneProjectionRotationX_1"                                 Storyboard.TargetProperty="RotationY" To="65" RepeatBehavior="Forever" autoReverse="True" />                <DoubleAnimation Duration="0:0:3" Storyboard.Targetname="PlaneProjectionRotationX_1"                                 Storyboard.TargetProperty="RotationZ" To="65" RepeatBehavior="Forever" autoReverse="True" />                <DoubleAnimation Duration="0:0:3" Storyboard.Targetname="PlaneProjectionRotationX_1"                                 Storyboard.TargetProperty="GlobalOffsetZ" To="400" RepeatBehavior="Forever" autoReverse="True" />            </Storyboard>        </GrID.Resources>        <Canvas GrID.Row="1" margin="20"  WIDth="200" Height="200" Background="White">            <Canvas.Effect>                <DropShadowEffect />            </Canvas.Effect>        </Canvas>        <Image GrID.Row="1" margin="20" WIDth="200" Height="200" Source="../images/flower2.jpg">            <Image.Effect>                <DropShadowEffect />            </Image.Effect>            <Image.Projection>                <PlaneProjection x:name="PlaneProjectionRotationX_1"  />            </Image.Projection>        </Image>    </GrID>

C# :

 private voID LayoutRoot_Loaded(object sender,RoutedEventArgs e)        {            myStoryboard.Begin();        }

结果:


下面的例子是矩形的高度作DoubleAnimation动画,在动画的过程中,高度连续跳动三次,如下代码:

<Canvas x:name="LayoutRoot" Background="White">        <!--声明一个矩形,然后让矩形的宽度从0到300来时行动画递增-->        <Rectangle x:name="rect" WIDth="200" Height="10">            <Rectangle.Fill>                <linearGradIEntBrush>                    <GradIEntStop Offset="0" color="White" />                    <GradIEntStop Offset="1" color="Green" />                </linearGradIEntBrush>            </Rectangle.Fill>        </Rectangle>        <Canvas.Triggers>            <!--创建动画触发器,Canvas.Loaded 在Canvas加载完成以后触发-->            <EventTrigger RoutedEvent="Canvas.Loaded">                <BeginStoryboard>                    <Storyboard >                        <!--声明一个Double动画 并指定他的动画是矩形的高度-->                        <DoubleAnimation From="10"  RepeatBehavior="Forever" To="300" Duration="0:0:3" Storyboard.Targetname="rect" Storyboard.TargetProperty="Height">                            <DoubleAnimation.EasingFunction>                                <BounceEase EasingMode="EaSEOut" Bounces="3" Bounciness="3" />                            </DoubleAnimation.EasingFunction>                        </DoubleAnimation>                    </Storyboard>                </BeginStoryboard>            </EventTrigger>        </Canvas.Triggers>    </Canvas>
总结

以上是内存溢出为你收集整理的Silverlight开发历程—动画(线性动画一些效果)全部内容,希望文章能够帮你解决Silverlight开发历程—动画(线性动画一些效果)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1071093.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存