WEB开发网
开发学院图形图像Flash Silverlight开发实践--My Album(源) 阅读

Silverlight开发实践--My Album(源)

 2009-04-08 12:01:20 来源:WEB开发网   
核心提示: 其中利用了一些简单的变化效果,创建了第一个元素,Silverlight开发实践--My Album(源)(2),接下来的11个元素基本上是一样的,要修改的就是相对于主Canves的位置和相应的x:Name的值,图片放大一倍--> <Storyboard x:Name="

其中利用了一些简单的变化效果。创建了第一个元素,接下来的11个元素基本上是一样的,要修改的就是相对于主Canves的位置和相应的x:Name的值。

然后就是给每一个图片对象添加4个Storyboard:

鼠标经过故事板,鼠标移出故事板,鼠标第一次单击故事板,鼠标再次单击故事板。

当然,这个工作最好用Blend来搞定。

            <!--鼠标进入时,图片放大一倍-->
            <Storyboard x:Name="mouseEnter0">
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="album0"
                                               Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">                   
                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"></SplineDoubleKeyFrame>
                    <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1.1"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="album0"
                                               Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"></SplineDoubleKeyFrame>
                    <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1.1"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>  
            </Storyboard>
            <!--鼠标移出时,图片变回原大小-->
            <Storyboard x:Name="mouseLeave0">
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="album0"
                                               Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"></SplineDoubleKeyFrame>
                    <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1.1"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="album0"
                                               Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"></SplineDoubleKeyFrame>
                    <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1.1"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>
            <!--鼠标左键单击时,设置图片为画布大小-->
            <Storyboard x:Name="PicZoomIn0">
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="album0" Duration="00:00:00.0010000"
                                               Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.1"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="album0" Duration="00:00:00.0010000"
                                               Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.1"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="album0"
                                               Storyboard.TargetProperty="(FrameworkElement.Width)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="170"></SplineDoubleKeyFrame>
                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="300"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="album0"
                                               Storyboard.TargetProperty="(FrameworkElement.Height)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="130"></SplineDoubleKeyFrame>
                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="300"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
               
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Image0"
                                               Storyboard.TargetProperty="(FrameworkElement.Width)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="300"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Image0"
                                               Storyboard.TargetProperty="(FrameworkElement.Height)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="300"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>
            <!--鼠标再次单击是,图片变回原来大小-->
            <Storyboard x:Name="PicZoomOut0">
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="album0" Duration="00:00:00.0010000"
                                               Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.1"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="album0" Duration="00:00:00.0010000"
                                               Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.1"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="album0"
                                               Storyboard.TargetProperty="(FrameworkElement.Width)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="170"></SplineDoubleKeyFrame>
                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="170"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="album0"
                                               Storyboard.TargetProperty="(FrameworkElement.Height)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00" Value="130"></SplineDoubleKeyFrame>
                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="130"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>

                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Image0"
                                               Storyboard.TargetProperty="(FrameworkElement.Width)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="160"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Image0"
                                               Storyboard.TargetProperty="(FrameworkElement.Height)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="120"></SplineDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>

Tags:Silverlight 开发 实践

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接