我正在做一個按鈕,其中有兩個過濾器,當用戶將光標放在它上面時(鼠標懸停),另外兩個過濾器在光標退出時補間過濾器。很基本的東西。AS3 Filter GlowIn不補間
這些過濾器是Glow和DropShadow。將光暈應用於文本,而將DropShadow應用於按鈕背景(簡單的矩形)。
這裏的問題是GlowIn的轉換不起作用。當鼠標懸停時,它立即以全alpha的形式應用濾鏡。雖然GlowOut可以工作。
雖然它被設置爲0.25倍,但爲了確保它完整5秒,我嘗試了它,但它仍然沒有工作,所以它不是一個計時問題。
這裏是我的代碼:
import caurina.transitions.Tweener;
import caurina.transitions.properties.FilterShortcuts;
import flash.filters.GlowFilter;
FilterShortcuts.init();
texto.mouseEnabled = false;
this.addEventListener(MouseEvent.MOUSE_OVER, FiltersIn);
this.addEventListener(MouseEvent.MOUSE_OUT, FiltersOut);
var glow = new GlowFilter(0xFFFFFF, 0, 5, 5, 3, 250);
texto.filters = [glow];
function FiltersIn(MouseEvent):void{
Tweener.addTween(this, {_DropShadow_distance:5, _DropShadow_alpha:1, _DropShadow_blurX:5, _DropShadow_blurY:5, time:0.25, transition:"easeOutCubic"});
Tweener.addTween(texto, {_Glow_alpha:100, time:0.25, transition:"easeOutCubic"});
}
function FiltersOut(MouseEvent):void{
Tweener.addTween(this, {_DropShadow_distance:0, _DropShadow_alpha:0, _DropShadow_blurX:0, _DropShadow_blurY:0, time:0.25, transition:"EaseInCubic"});
Tweener.addTween(texto, {_Glow_alpha:0, time:0.25, transition:"easeInCubic"});
}
工作,謝謝!解釋爲何發生的額外點。 – FoxLift