码迷,mamicode.com
首页 > Web开发 > 详细

silverlight animation example

时间:2015-02-07 11:29:34      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:

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();

 

silverlight animation example

标签:

原文地址:http://www.cnblogs.com/phoenix13suns/p/4278515.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!