phoenix13

导航

 

http://samples.msdn.microsoft.com/Silverlight/SampleBrowser/index.htm#/   

Silverlight Documentation Samples

https://social.msdn.microsoft.com/Forums/silverlight/en-US/2a79ccc0-b012-4a7b-ad74-19a1500907fc/how-to-move-an-image-control-with-animation

how to MOVE an Image control with animation

http://www.c-sharpcorner.com/uploadfile/anavijai/silverlight-doubleanimation-example/

Silverlight DoubleAnimation Example

1. 

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" x:Class="SilverlightApplication1.MainPage"
    mc:Ignorable="d" Height="504.478" Width="940.299">

    <Grid x:Name="LayoutRoot" Background="Green">
        <Canvas Margin="0,-35,0,35">

            <Canvas.Resources>

                <Storyboard x:Name="storyboard1">
                    <DoubleAnimation
                      Storyboard.TargetName="image1"
                      Storyboard.TargetProperty="Opacity"
                      From="1.0" To="0.0" Duration="0:0:1" 
                      AutoReverse="True" 
                      RepeatBehavior="Forever" />
                </Storyboard>
                
                <Storyboard x:Name="storyboard2">
                    <DoubleAnimation 
                        Storyboard.TargetProperty="(Canvas.Left)" From="50" To="250"
                        Storyboard.TargetName="image1" Duration="0:0:0.5" />
                </Storyboard>

                <Storyboard x:Name="storyboard3">
                    <DoubleAnimation 
                        Storyboard.TargetProperty="(Canvas.Top)" From="50" To="250"
                        Storyboard.TargetName="image1" Duration="0:0:0.5" />
                </Storyboard>
            </Canvas.Resources>
            <Button x:Name="button1" Content="Generate" HorizontalAlignment="Left" Margin="473,55,0,0" VerticalAlignment="Top" Width="106" Height="56" Click="Button_Click_1"/>
            <Image x:Name="image1"  Source="/res/boss.png"  HorizontalAlignment="Left" Height="100" VerticalAlignment="Top" Width="100" Canvas.Left="261" Canvas.Top="285"/>
        </Canvas>
    </Grid>
</UserControl>

2. in cs code use begin() to call a storyboard

storyboard1.Begin();

 

posted on 2015-02-07 10:58  phoenix13  阅读(244)  评论(0编辑  收藏  举报