Ajax Control Toolkit Animation 想说爱你不容易
来源:互联网 发布:算法导论第九章答案 编辑:程序博客网 时间:2024/06/12 01:10
Ajax control Toolkit Animation效果很酷,可以节省我们很多的开发时间。但是昨天发现了Animation缺乏灵活性的一点,这让我们一度陷入被动.
下面是示例代码里面的一段:
<ajaxToolkit:AnimationExtender id="OpenAnimation" runat="server" TargetControlID="btnInfo">
<Animations>
<OnClick>
<Sequence>
<%-- Disable the button so it can't be clicked again --%>
<EnableAction Enabled="false" />
<%-- Position the wire frame on top of the button and show it --%>
<ScriptAction Script="Cover($get('ctl00_SampleContent_btnInfo'), $get('flyout'));" />
<StyleAction AnimationTarget="flyout" Attribute="display" Value="block"/>
<%-- Move the wire frame from the button's bounds to the info panel's bounds --%>
<Parallel AnimationTarget="flyout" Duration=".3" Fps="25">
<Move Horizontal="150" Vertical="-50" />
<Resize Width="260" Height="280" />
<Color PropertyKey="backgroundColor" StartValue="#AAAAAA" EndValue="#FFFFFF" />
</Parallel>
<%-- Move the info panel on top of the wire frame, fade it in, and hide the frame --%>
<ScriptAction Script="Cover($get('flyout'), $get('info'), true);" />
<StyleAction AnimationTarget="info" Attribute="display" Value="block"/>
<FadeIn AnimationTarget="info" Duration=".2"/>
<StyleAction AnimationTarget="flyout" Attribute="display" Value="none"/>
<%-- Flash the text/border red and fade in the "close" button --%>
<Parallel AnimationTarget="info" Duration=".5">
<Color PropertyKey="color" StartValue="#666666" EndValue="#FF0000" />
<Color PropertyKey="borderColor" StartValue="#666666" EndValue="#FF0000" />
</Parallel>
<Parallel AnimationTarget="info" Duration=".5">
<Color PropertyKey="color" StartValue="#FF0000" EndValue="#666666" />
<Color PropertyKey="borderColor" StartValue="#FF0000" EndValue="#666666" />
<FadeIn AnimationTarget="btnCloseParent" MaximumOpacity=".9" />
</Parallel>
</Sequence>
</OnClick>
</Animations>
</ajaxToolkit:AnimationExtender>
我们注意一下Move效果,现在Horizontal Vertical的偏移量都是固定值,我们当然希望可以用一个灵活的方式来设定这个值,最简单的:
function a()
{ return 200;}
然后修改代码 <Move Horizontal="return a();" Vertical="-50" />,运行,页面报错:参数无效
同样的问题出现在了Resize上面,查看页面源代码:
[{/"AnimationName/":/"Move/",/"Horizontal/":/"return a();/",/"Vertical/":/"-50/",/"AnimationChildren/":[]},{/"AnimationName/":/"Resize/",/"Width/":/"260/",/"Height/":/"280/",/"AnimationChildren/":[]},
这个问题让Ajax Control toolkit Animation的可用性大大降低,有多少东西是一成不变的呢???
下面是示例代码里面的一段:
<ajaxToolkit:AnimationExtender id="OpenAnimation" runat="server" TargetControlID="btnInfo">
<Animations>
<OnClick>
<Sequence>
<%-- Disable the button so it can't be clicked again --%>
<EnableAction Enabled="false" />
<%-- Position the wire frame on top of the button and show it --%>
<ScriptAction Script="Cover($get('ctl00_SampleContent_btnInfo'), $get('flyout'));" />
<StyleAction AnimationTarget="flyout" Attribute="display" Value="block"/>
<%-- Move the wire frame from the button's bounds to the info panel's bounds --%>
<Parallel AnimationTarget="flyout" Duration=".3" Fps="25">
<Move Horizontal="150" Vertical="-50" />
<Resize Width="260" Height="280" />
<Color PropertyKey="backgroundColor" StartValue="#AAAAAA" EndValue="#FFFFFF" />
</Parallel>
<%-- Move the info panel on top of the wire frame, fade it in, and hide the frame --%>
<ScriptAction Script="Cover($get('flyout'), $get('info'), true);" />
<StyleAction AnimationTarget="info" Attribute="display" Value="block"/>
<FadeIn AnimationTarget="info" Duration=".2"/>
<StyleAction AnimationTarget="flyout" Attribute="display" Value="none"/>
<%-- Flash the text/border red and fade in the "close" button --%>
<Parallel AnimationTarget="info" Duration=".5">
<Color PropertyKey="color" StartValue="#666666" EndValue="#FF0000" />
<Color PropertyKey="borderColor" StartValue="#666666" EndValue="#FF0000" />
</Parallel>
<Parallel AnimationTarget="info" Duration=".5">
<Color PropertyKey="color" StartValue="#FF0000" EndValue="#666666" />
<Color PropertyKey="borderColor" StartValue="#FF0000" EndValue="#666666" />
<FadeIn AnimationTarget="btnCloseParent" MaximumOpacity=".9" />
</Parallel>
</Sequence>
</OnClick>
</Animations>
</ajaxToolkit:AnimationExtender>
我们注意一下Move效果,现在Horizontal Vertical的偏移量都是固定值,我们当然希望可以用一个灵活的方式来设定这个值,最简单的:
function a()
{ return 200;}
然后修改代码 <Move Horizontal="return a();" Vertical="-50" />,运行,页面报错:参数无效
同样的问题出现在了Resize上面,查看页面源代码:
[{/"AnimationName/":/"Move/",/"Horizontal/":/"return a();/",/"Vertical/":/"-50/",/"AnimationChildren/":[]},{/"AnimationName/":/"Resize/",/"Width/":/"260/",/"Height/":/"280/",/"AnimationChildren/":[]},
这个问题让Ajax Control toolkit Animation的可用性大大降低,有多少东西是一成不变的呢???
- Ajax Control Toolkit Animation 想说爱你不容易
- Ajax Control Toolkit Animation 想说爱你不容易
- Ajax Control Toolkit Animation问题解决
- Ajax Control Toolkit Animation问题解决
- 部署Ajax Control Toolkit
- AJAX Control Toolkit
- AJAX Control Toolkit 使用
- AJAX Control Toolkit 安装
- Ajax Control Toolkit
- AJAX Control Toolkit:图解Ajax Control Tool
- AJAX Control Toolkit 10920发布
- AJAX Control Toolkit的安装
- 5.25安装 Ajax control toolkit
- Ajax Control Toolkit 34个服务器端控件
- Ajax Control Toolkit 34个服务器端控件
- ★ Ajax Control Toolkit 服务器端控件集锦
- Ajax Control Toolkit 34个服务器端控件
- ASP.NET AJAX Control Toolkit 控件说明
- 晚安,北京!
- [本周]----我们共同关注:Ajax 那点事
- [本周] 随手记下 Asp.net 5种页面转向方法
- [本周]随手记下 Asp.net中Application Session Cookie ViewState Cache Hidden
- Ajax Control Toolkit Animation问题解决
- Ajax Control Toolkit Animation 想说爱你不容易
- 【下载】 修复Vista文件拷贝缓慢的更新补丁KB931770
- 细数Ajax Control Toolkit Version 1.0.10606.0的16个变化
- 送给所有关注Prototype的朋友们
- 月末谢礼--送大家开机关机声音【下载】
- 生日快乐!
- 【完整版】Prototype实战教程 1-16
- 只羡鸳鸯不羡仙
- 定场诗