您的位置:首页 > 其它

Flex3学习轨迹:自定义缓动函数实现一个弹跳缓动动画

2012-03-12 11:22 691 查看
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" fontSize="12">
<!-- 自定义缓动函数 -->
<mx:Script>
<![CDATA[
private function myEasingFunction(t:Number, b:Number,c:Number, d:Number):Number
{
if ((t /= d) < (1 / 2.75))
{
return c * (7.5625 * t * t) + b;
}
else if (t < (2 / 2.75))
{
return c * (7.5625 * (t-=(1.5/2.75)) * t + .75) + b;
}
else if (t < (2.5 / 2.75))
{
return c * (7.5625 * (t-=(2.25/2.75)) * t + .9375) + b;
}
else
{
return c * (7.5625 * (t-=(2.625/2.75)) * t + .984375) + b;
}
}
]]>
</mx:Script>
<!-- 定义WipeLeft效果 -->
<mx:WipeLeft id="wipeLeft" target="{image}" moveEasingFunction="myEasingFunction" duration="5000" />
<mx:Panel width="400" height="300" title="创建自定义缓动函数"
horizontalAlign="center">
<mx:ApplicationControlBar dock="true" width="100%">
<mx:Button label="执行效果" click="wipeLeft.play();" />
</mx:ApplicationControlBar>
<mx:Image id="image" source="assets/logo.jpg"/>
</mx:Panel>
</mx:Application>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐