Ajax Control Toolkit Animation 想说爱你不容易

本文探讨了AjaxControlToolkit中AnimationExtender组件在实现动态效果时遇到的灵活性问题,特别是对于Move和Resize动画属性无法使用动态值的情况。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

None.gif AjaxcontrolToolkitAnimation效果很酷,可以节省我们很多的开发时间。但是昨天发现了Animation缺乏灵活性的一点,这让我们一度陷入被动dot.gif.
None.gif下面是示例代码里面的一段:
None.gif
< ajaxToolkit:AnimationExtender id ="OpenAnimation" runat ="server" TargetControlID ="btnInfo" >
None.gif
< Animations >
None.gif
< OnClick >
None.gif
< Sequence >
ExpandedBlockStart.gifContractedBlock.gif
<% dot.gif --Disablethebuttonsoitcan'tbeclickedagain--%>
InBlock.gif
<EnableActionEnabled="false"/>
InBlock.gif
ExpandedBlockEnd.gif
<%--Positionthewireframeontopofthebuttonandshowit--
%>
ExpandedBlockStart.gifContractedBlock.gif
< ScriptAction Script ="Cover($get('ctl00_SampleContent_btnInfo'),$get('flyout'));" /> dot.gif
InBlock.gif
<StyleActionAnimationTarget="flyout"Attribute="display"Value="block"/>
InBlock.gif
InBlock.gif
<%--Movethewireframefromthebutton'sboundstotheinfopanel'sbounds--%>
InBlock.gif
<ParallelAnimationTarget="flyout"Duration=".3"Fps="25">
InBlock.gif
<MoveHorizontal="150"Vertical="-50"/>
InBlock.gif
<ResizeWidth="260"Height="280"/>
InBlock.gif
<ColorPropertyKey="backgroundColor"StartValue="#AAAAAA"EndValue="#FFFFFF"/>
InBlock.gif
</Parallel>
InBlock.gif
InBlock.gif
<%--Movetheinfopanelontopofthewireframe,fadeitin,andhidetheframe--%>
InBlock.gif
<ScriptActionScript="Cover($get('flyout'),$get('info'),true);"/>
InBlock.gif
<StyleActionAnimationTarget="info"Attribute="display"Value="block"/>
InBlock.gif
<FadeInAnimationTarget="info"Duration=".2"/>
InBlock.gif
<StyleActionAnimationTarget="flyout"Attribute="display"Value="none"/>
InBlock.gif
InBlock.gif
<%--Flashthetext/borderredandfadeinthe"close"button--%>
InBlock.gif
<ParallelAnimationTarget="info"Duration=".5">
InBlock.gif
<ColorPropertyKey="color"StartValue="#666666"EndValue="#FF0000"/>
InBlock.gif
<ColorPropertyKey="borderColor"StartValue="#666666"EndValue="#FF0000"/>
InBlock.gif
</Parallel>
InBlock.gif
<ParallelAnimationTarget="info"Duration=".5">
InBlock.gif
<ColorPropertyKey="color"StartValue="#FF0000"EndValue="#666666"/>
InBlock.gif
<ColorPropertyKey="borderColor"StartValue="#FF0000"EndValue="#666666"/>
InBlock.gif
<FadeInAnimationTarget="btnCloseParent"MaximumOpacity=".9"/>
InBlock.gif
</Parallel>
InBlock.gif
</Sequence>
InBlock.gif
</OnClick>
InBlock.gif
</Animations>
InBlock.gif
</ajaxToolkit:AnimationExtender>
InBlock.gif我们注意一下Move效果,现在HorizontalVertical的偏移量都是固定值,我们当然希望可以用一个灵活的方式来设定这个值,最简单的:
InBlock.gif
functiona()
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{return200;}
InBlock.gif然后修改代码
<MoveHorizontal="returna();"Vertical="-50"/>,运行,页面报错:参数无效
InBlock.gif同样的问题出现在了Resize上面,查看页面源代码:
ExpandedSubBlockStart.gifContractedSubBlock.gif[
dot.gif{\"AnimationName\":\"Move\",\"Horizontal\":\"returna();\",\"Vertical\":\"-50\",\"AnimationChildren\":[]},dot.gif{\"AnimationName\":\"Resize\",\"Width\":\"260\",\"Height\":\"280\",\"AnimationChildren\":[]},
InBlock.gif这个问题让AjaxControltoolkitAnimation的可用性大大降低,有多少东西是一成不变的呢???
InBlock.gif
InBlock.gif
坚强2002和你一起回头再说...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值