2009-03-03 65 views
0

是否有一個良好的樣本如何使顏色「淡出」演示效果,像這樣:使用colorTransformer使顏色淡出效果

colorTransformer.redMultiplier = colorTransformer.redMultiplier -.2 ; 
colorTransformer.greenMultiplier = colorTransformer.greenMultiplier -.2 ; 
colorTransformer.blueMultiplier = colorTransformer.blueMultiplier -.2 ; 

回答

0

我同意丹尼爾:gtween,中間人和所有的其他人的工作與緩解

如果你想custimize它,你可以得到大量使用getter和setter雖然(這通常用於更復雜的情況,但也很有趣):

private var _brightness:Number = 1; 

public function set brightness(value:Number):void 
{ 
    _brightness = value 
    this.colorTransform = new ColorTransform(value,value,value); 
} 

public function get brightness():Number 
{ 
    return _brightness; 
} 

例子:

很簡單:

brightness = 0;

隨機線性:

brightness -= Math.random() * .02;

互動,並放寬:

brightness += ((stage.mouseY/stage.stageHeight)-brightness) * .9;

+0

我想調整的TextField()的顏色 - 但沒有.brightness? – Tom 2009-03-05 08:55:31