很好玩的滾動效果

很好玩的滾動效果
                                 

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>
發佈了211 篇原創文章 · 獲贊 22 · 訪問量 37萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章