wpf 文字动态动画效果

 
  
< Window.Background >
< LinearGradientBrush EndPoint ="0.5,1" StartPoint ="0.5,0" >
< GradientStop Color ="Black" Offset ="0" />
< GradientStop Color ="#FF666666" Offset ="1" />
</ LinearGradientBrush >
</ Window.Background >
< Window.Resources >
< DrawingBrush x:Key ="MyWireBrushResource"
Viewport
="0,0,10,10" ViewportUnits ="Absolute" TileMode ="Tile" >
< DrawingBrush.Drawing >
< DrawingGroup >
< DrawingGroup.Children >
< GeometryDrawing Geometry ="M0,0 L1,0 1,0.1, 0,0.1Z" Brush ="#66CCCCFF" />
< GeometryDrawing Geometry ="M0,0 L0,1 0.1,1, 0.1,0Z" Brush ="#66CCCCFF" />
</ DrawingGroup.Children >
</ DrawingGroup >
</ DrawingBrush.Drawing >
</ DrawingBrush >
</ Window.Resources >



< StackPanel Margin ="40" >
< Border Name ="TextBorder" HorizontalAlignment ="Left"
Background
=" {StaticResource ResourceKey=MyWireBrushResource} "
VerticalAlignment
="Center" >
< TextBlock Name ="RealText" FontFamily ="Segoe UI" FontSize ="60px"
Margin
="40" Foreground ="White" > Windows 7
< TextBlock.TextEffects >
< TextEffect PositionCount ="1" x:Name ="MyTextEffect" >
< TextEffect.Transform >
< SkewTransform x:Name ="TextEffectSkewTransform" CenterX ="180"
CenterY
="30" >

</ SkewTransform >
</ TextEffect.Transform >
</ TextEffect >
</ TextBlock.TextEffects >

< TextBlock.Triggers >
< EventTrigger RoutedEvent ="TextBlock.Loaded" >
< BeginStoryboard >
< Storyboard >
< DoubleAnimation From ="0" To ="15" Duration ="0:0:0.25"
RepeatBehavior
="Forever"
AutoReverse
="True"
Storyboard.TargetName
="TextEffectSkewTransform"
Storyboard.TargetProperty
="AngleX" ></ DoubleAnimation >

< DoubleAnimation From ="0" To ="43" Duration ="0:0:0.5"
RepeatBehavior
="Forever"
AutoReverse
="True"
Storyboard.TargetName
="TextEffectSkewTransform"
Storyboard.TargetProperty
="AngleY" ></ DoubleAnimation >

< DoubleAnimation From ="30" To ="400" Duration ="0:0:13"
RepeatBehavior
="Forever"
AutoReverse
="True"
Storyboard.TargetName
="TextEffectSkewTransform"
Storyboard.TargetProperty
="CenterX" ></ DoubleAnimation >

< Int32AnimationUsingKeyFrames
Storyboard.TargetName ="MyTextEffect"
Storyboard.TargetProperty
="PositionStart" Duration ="0:0:13"
AutoReverse
="True" RepeatBehavior ="Forever" >
< Int32AnimationUsingKeyFrames.KeyFrames >
< DiscreteInt32KeyFrame Value ="0" KeyTime ="0:0:0" >
</
DiscreteInt32KeyFrame >
< DiscreteInt32KeyFrame Value ="1" KeyTime ="0:0:1" />
< DiscreteInt32KeyFrame Value ="2" KeyTime ="0:0:2" />
< DiscreteInt32KeyFrame Value ="3" KeyTime ="0:0:3" />
< DiscreteInt32KeyFrame Value ="4" KeyTime ="0:0:4" />
< DiscreteInt32KeyFrame Value ="5" KeyTime ="0:0:5" />
< DiscreteInt32KeyFrame Value ="6" KeyTime ="0:0:6" />
< DiscreteInt32KeyFrame Value ="7" KeyTime ="0:0:7" />
< DiscreteInt32KeyFrame Value ="8" KeyTime ="0:0:8" />
< DiscreteInt32KeyFrame Value ="9" KeyTime ="0:0:9" />
< DiscreteInt32KeyFrame Value ="10" KeyTime ="0:0:10" />
< DiscreteInt32KeyFrame Value ="11" KeyTime ="0:0:11" />
< DiscreteInt32KeyFrame Value ="12" KeyTime ="0:0:12" />
</ Int32AnimationUsingKeyFrames.KeyFrames >
</ Int32AnimationUsingKeyFrames >
</ Storyboard >
</ BeginStoryboard >
</ EventTrigger >
</ TextBlock.Triggers >
</ TextBlock >
</ Border >

< Rectangle Name ="ReflectedText" Height =" {Binding ElementName=TextBorder,Path=ActualHeight} "
Width
=" {Binding ElementName=TextBorder,Path=ActualWidth} " HorizontalAlignment ="Left"
VerticalAlignment
="Top" >
< Rectangle.OpacityMask >
< LinearGradientBrush StartPoint ="0.5,0" EndPoint ="0.5,1" >
< LinearGradientBrush.GradientStops >
< GradientStop Offset ="0.0" Color ="#66000000" ></ GradientStop >
< GradientStop Offset ="1.0" Color ="#00000000" ></ GradientStop >
</ LinearGradientBrush.GradientStops >
</ LinearGradientBrush >
</ Rectangle.OpacityMask >
< Rectangle.Fill >
< VisualBrush Visual =" {Binding ElementName=TextBorder} " >
< VisualBrush.RelativeTransform >
< TransformGroup >
< ScaleTransform ScaleX ="1" ScaleY ="-1" ></ ScaleTransform >
< TranslateTransform Y ="1" ></ TranslateTransform >
</ TransformGroup >
</ VisualBrush.RelativeTransform >
</ VisualBrush >
</ Rectangle.Fill >
</ Rectangle >
</ StackPanel >

本来想搞个demo下载的,不知道怎么添加进来,悲剧。。。

效果图:

2011070718183127.jpg

转载于:https://www.cnblogs.com/wpf123/archive/2011/07/07/2100369.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值