views:

127

answers:

2

Is there a good sample how to make a color "fading out" demo effect, something like this:

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

check out blog.greensock.com TweenFilterLite classes are perfect for this

A: 

I agree with Daniel : gtween, tweener and all the others does the work with ease.

If you want to custimize it you can get great use of getters and setters though (this is often used for more complex situations but may be interesting) :

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;
}

Examples :

Simple :

brightness = 0;

Random linear :

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

Interactive and eased :

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

etc.

Theo.T
I am trying to adjust color of TextField() - but there is no .brightness?
Tom
To use it like explained above, you need to extend the TextField class adding the brightness getter/setter.
Theo.T