Canvas.left ="240" Canvas.top ="180" RendertransformOrigin ="0.5,0.5"
MouseEnter ="Flower_MouseEnter" MouseLeave ="Flower_MouseLeave" OpacityMask =" {x:Null} " >
< Image.Rendertransform >
< transformGroup >
< Scaletransform />
< Skewtransform />
< Rotatetransform />
< Translatetransform />
</ transformGroup >
</ Image.Rendertransform >
< Image.Effect >
< BlurEffect /> <!--为该图片添加了模糊效果-->
</ Image.Effect >
</ Image > 可以通过两个动画来处理,一个完成将图片缩放比例进行放大( ScaleX,ScaleY:1-->2)同时改变其模糊值为0( Radius:5-->0),另一个动画则相反。 < Storyboard x:name ="Flower_Enter" >
< DoubleAnimation BeginTime ="00:00:00" Storyboard.Targetname ="Flower" Duration ="00:00:00.50" To ="2"
Storyboard.TargetProperty ="(UIElement.Rendertransform).(transformGroup.Children)[0].(Scaletransform.ScaleX)" >
</ DoubleAnimation >
< DoubleAnimation BeginTime ="00:00:00" Storyboard.Targetname ="Flower" Duration ="00:00:00.50" To ="2"
Storyboard.TargetProperty ="(UIElement.Rendertransform).(transformGroup.Children)[0].(Scaletransform.ScaleY)" >
</ DoubleAnimation >
< DoubleAnimation BeginTime ="00:00:00" Storyboard.Targetname ="Flower" Duration ="00:00:00.50" To ="0"
Storyboard.TargetProperty ="(UIElement.Effect).(BlurEffect.Radius)" >
</ DoubleAnimation >
</ Storyboard >
< Storyboard x:name ="Flower_Level" >
< DoubleAnimation BeginTime ="00:00:00" Storyboard.Targetname ="Flower" Duration ="00:00:00.50" To ="1"
Storyboard.TargetProperty ="(UIElement.Rendertransform).(transformGroup.Children)[0].(Scaletransform.ScaleX)" >
</ DoubleAnimation >
< DoubleAnimation BeginTime ="00:00:00" Storyboard.Targetname ="Flower" Duration ="00:00:00.50" To ="1"
Storyboard.TargetProperty ="(UIElement.Rendertransform).(transformGroup.Children)[0].(Scaletransform.ScaleY)" >
</ DoubleAnimation >
< DoubleAnimation BeginTime ="00:00:00" Storyboard.Targetname ="Flower" Duration ="00:00:00.5000000" To ="5"
Storyboard.TargetProperty ="(UIElement.Effect).(BlurEffect.Radius)" >
</ DoubleAnimation >
</ Storyboard > 通过鼠标事件(MouseEnter,MouseLeave)动态的触发上面定义的两个动画的执行就可以达到预期的目的,如下代码: private voID Flower_MouseEnter( object sender, System.windows.input.MouseEventArgs e)
{
// Todo: Add event handler implementation here.
this .Flower_Enter.Begin();
}
private voID Flower_MouseLeave( object sender, System.windows.input.MouseEventArgs e)
{
// Todo: Add event handler implementation here.
this .Flower_Level.Begin();
} 二、阴影效果(DropShadowEffect) Silverlight中应用阴影效果和模糊效果一样的简单,通添加模糊效果一样的方式实现对元素添加阴影效果处理,需要关注的就是设置阴影效果的相关属性。 BlurRadius:模糊半径
color:填充颜色
Direction:方向
Opacity:透明度
ShadowDepth:阴影深度 通过以上几个属性选项的设置就可以完成阴影效果的设计,由于其设计过程非常简单,详细如下图所示: 对应生成的XAML代码如下: < Image Height ="240" x:name ="Flower" WIDth ="320" Canvas.left ="240" Canvas.top ="180"
Source ="yellowFlower.jpg" Stretch ="Fill" Cursor ="Hand" >
< Image.Effect >
< DropShadowEffect x:name ="FlowerShadow"
BlurRadius ="18"
ShadowDepth ="27"
Opacity ="0.6"
Direction ="321" />
</ Image.Effect >
</ Image > 推荐资源: MSDN: http://msdn.microsoft.com/zh-cn/library/cc189090(VS.95).aspx http://www.silverlight.net/learn/quickstarts/animations/ http://blog.csdn.net/ghj1976/archive/2009/12/22/5056916.aspx 《Function Silverlight 3 Animation》----本篇中使用的示例素材选自此书 总结
以上是内存溢出为你收集整理的Silverlight & Blend动画设计系列七:模糊效果(BlurEffect)与阴影效果(DropShadowEffect)全部内容,希望文章能够帮你解决Silverlight & Blend动画设计系列七:模糊效果(BlurEffect)与阴影效果(DropShadowEffect)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)