Flex colorizer: using ColorTransform class to colorize objects at run-time
Senin, 18 Juli 2011
0
komentar
In this post I wanted to show you a nice trick how to colorize visual object at run-time.
Colorizing of the plain object (e.g. rectangle) is very simple:
var colorTransform:ColorTransform = new ColorTransform();
colorTransform.color = color;
target.transform.colorTransform = colorTransform;
But what if you need to colorize some complex object (e.g. image of the rooftop)?
Solution...
1. Prepare color layer (area that you want to colorize) and save it as a separate image
Colorizing of the plain object (e.g. rectangle) is very simple:
var colorTransform:ColorTransform = new ColorTransform();
colorTransform.color = color;
target.transform.colorTransform = colorTransform;
But what if you need to colorize some complex object (e.g. image of the rooftop)?
Solution...
1. Prepare color layer (area that you want to colorize) and save it as a separate image
2. Place color layer image over the original image with blendMode="normal"
3. Apply colorization for color layer image:
var colorTransform:ColorTransform = new ColorTransform();
colorTransform.color = color;
target.transform.colorTransform = colorTransform;
Results:
Baca Selengkapnya ....