How to continuously fade a BitmapData to a certain color?

Posted by Cay on Stack Overflow See other posts from Stack Overflow or by Cay
Published on 2009-10-11T05:23:46Z Indexed on 2010/04/04 7:43 UTC
Read the original article Hit count: 321

I'm drawing stuff on a bitmapData and I need to continuously fade every pixel to 0x808080 while still drawing (its for a DisplacementMapFilter)... I think this illustrates my problem:
http://www.ventdaval.com/lab/grey.swf

The simpler approach I tried was drawing a semi-transparent grey box on it, but it never reaches a single color (i.e. 0x808081 will never be turned to 0x808080)... The same kind of thing happens with a ColorMatrixFilter trying to progressively reduce the saturation and/or contrast. (the example above is applying a filter with -10 contrast every frame).

I'm trying paletteMap now, and I'm sensing this could be the way to go, but I haven't been able to get it... any ideas?

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about bitmapdata