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 开发 实践

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