1. 程式人生 > >很好玩的滾動效果

很好玩的滾動效果

nec href vertica ever get element 很好 -c lib

原文:很好玩的滾動效果

很好玩的滾動效果
周銀輝

技術分享圖片

你可以粘貼以下代碼到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>



很好玩的滾動效果