很好玩的滚动效果

                 很好玩的滚动效果
                                  周银辉

role.PNG

你可以粘贴以下代码到XMLPad以查看动画效果:
< Window
    
xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x
="http://schemas.microsoft.com/winfx/2006/xaml"
    xml:lang
="zh-CN"
    xmlns:System
="clr-namespace:System;assembly=mscorlib"
    x:Name
="Window"
    Title
="Window1"
    Width
="640"  Height ="480" >

    
< Window .Resources >
        
< Storyboard  x:Key ="Timeline1"  RepeatBehavior ="Forever" >
            
< DoubleAnimationUsingKeyFrames  BeginTime ="00:00:00"  Storyboard.TargetName ="rectangle"  Storyboard.TargetProperty ="(Shape.StrokeDashOffset)" >
                
< SplineDoubleKeyFrame  KeyTime ="00:00:00"  Value ="100" />
                
< SplineDoubleKeyFrame  KeyTime ="00:00:00.5000000"  Value ="10" />
            
</ DoubleAnimationUsingKeyFrames >
        
</ Storyboard >
    
</ Window.Resources >
    
< Window .Triggers >
        
< EventTrigger  RoutedEvent ="FrameworkElement.Loaded"  SourceName ="rectangle" >
            
< BeginStoryboard  Storyboard ="{StaticResource Timeline1}" />
        
</ EventTrigger >
    
</ Window.Triggers >

    
< Grid  x:Name ="LayoutRoot" >
        
< Grid  Margin ="125,0,291,68"  VerticalAlignment ="Bottom"  Height ="113" >
            
< Rectangle  Fill ="{x:Null}"  Stroke ="#FF000000"  StrokeDashCap ="Square"  StrokeDashOffset ="100"  StrokeEndLineCap ="Square"  StrokeLineJoin ="Miter"  StrokeStartLineCap ="Flat"  StrokeThickness ="5"  x:Name ="rectangle" >
                
< Rectangle .StrokeDashArray >
                    
< System:Double > 0 </ System:Double >
                    
< System:Double > 2 </ System:Double >
                
</ Rectangle.StrokeDashArray >
            
</ Rectangle >
            
< Button  Margin ="2,2,2,2"  Content ="Button" />
        
</ Grid >
    
</ Grid >
</ Window >




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值