Ajax ControlToolkit - AnimationExtender动画语法(笔记)
淡入淡出(渐隐渐显)FadeIn/FadeOut
搭配AnimationTarget、Duration与Fps,让控件有淡入淡出的效果:
<Sequence>
<FadeOut AnimationTarget="Img1" Duration=".5" Fps="30" />
<FadeIn AnimationTarget="Img2" maximumOpacity="0.3" />
</Sequence>
也可搭配maximumOpacity与minimumOpacity,其意义如下:
maximumOpacity:在FadeIn(淡入)的动画中的最终的透明度。
minmumOpacity:在FadeOut(淡出)动画中的最终的透明度。
淡入淡出脉动效果 Pulse
这个会连续的执行FadeOut与FadeIn,造成有点像是闪烁或者是脉动的效果:
<Sequence>
<Pulse AnimationTarget="Img1" duration="0.1" Iterations="5" />
</Sequence>
Iterations:闪烁(脉动)次数
也可搭配maximumOpacity与minimumOpacity。
改变大小 Resize
搭配AnimationTarget、Duration与Fps,将特定大小的控件,以动画的方式改变到指定的长宽:
<Sequence>
<Resize AnimationTarget="Img1" Width="30" Height="40" />
<Resize AnimationTarget="Img1" Width="300" Height="400" />
</Sequence>
Width:最终高度
Height:最终宽度
图文放大缩小 Scale
搭配AnimationTarget、Duration与Fps,将特定控件(图形或者文字)的大小改变到指定的倍率:
<Sequence>
<Scale AnimationTarget="Img1" scaleFactor="0.5" center="false" />
<Scale AnimationTarget="Img1" scaleFactor="2.5" center="ture" />
</Sequence>
scaleFactor:放大倍率(0.5为缩小一半、2.5为放大一倍半)
center:放大或者缩小的过程中,AnimationTarget是否要居中。(如果选择要居中,须将AnimationTarget的style.position设为absolute。)
如果需要缩放文字,scaleFont须为true。
<Sequence>
<Scale AnimationTarget="Pnl1" scaleFactor="0.5" scaleFont="true" center="true" />
</Sequence>
移动 move
搭配AnimationTarget、Duration与Fps,将特定控件移动到指定的X、Y位置,或是移动至相应的位置:
<Sequence>
<Move AnimationTarget="Img1" Horizontal="100" Vertical="-150" relative="true" />
</Sequence>
relative:X,Y指定的是相对位置还是绝对位置。为ture时是相对位置。
备注:为避免无法移动,需要预先将AnimationTarget的Style.Position设为Absolute。
变色 Color
搭配StartValue、EndValue、Property与PropertyKey,将AnimationTarget的颜色由StartValue改变至EndValue,而AnimationTarget的哪一个颜色要被改变,则由Property与PropertyKey来决定。
<Sequence>
<Color AnimationTarget="Pnl1" StartValue="#33000" EndValue="#FF000" Property="style" PropertyKey="BackgroundColor" />
</Sequence>
PropertyKey所指定的属性,区分大小写!
调整长度 Length
搭配StartValue、EndValue、Property与PropertyKey,将AnimationTarget的某个属性由StartValue改变至EndValue,而AnimationTarget的哪一个颜色要被改变,则由Property与PropertyKey来决定。
<Sequence>
<Length AnimationTarget="Pnl1" StartValue="1" EndValue="20" Property="style" PropertyKey="borderWidth" />
</Sequence>