繁体   English   中英

使用AS3.0轻松流畅

[英]Easing smooth using AS3.0

我想知道当鼠标使用AS3.0悬停一个对象时是否有一种减轻缩放效果的方法。 我知道您可以使用movieclips做到这一点,但我只想使用AS3.0来使我的文件尽可能紧凑!

我现在使用的代码非常简单。

import flash.events.MouseEvent;

my_mc.addEventListener(MouseEvent.MOUSE_OVER, mouse_over);
my_mc.addEventListener(MouseEvent.MOUSE_OUT, mouse_out);

function mouse_over(evt:MouseEvent){
    my_mc.width = 200;
    my_mc.height = 200;
}

function mouse_out(evt:MouseEvent){
    my_mc.width = 90;
    my_mc.height = 90;
}

使用补间。 我建议您看看TweenLite 您的代码如下所示:

function mouse_over(evt:MouseEvent){
    TweenLite.to(my_mc, {width:200, height:200, ease:Cubic.easeInOut});
}

function mouse_out(evt:MouseEvent){
    TweenLite.to(my_mc, {width:90, height:90, ease:Cubic.easeInOut});
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM