ActionScript 3.0 Cookbook: Solutions for Flash Platform and Flex Application Developers
Problem
You want to make a digital negative from a display object. Solution
Use a digital negative matrix and apply it with a ColorMatrixFilter object. Discussion
You can use a digital negative matrix in conjunction with a flash.filters.ColorMatrixFilter object to apply the matrix. The digital negative matrix is as follows: -1 0 0 0 255 0 -1 0 0 255 0 0 -1 0 255 0 0 0 1 0
The following example applies a digital negative effect to a display object: sampleSprite.filters = [new ColorMatrixFilter([-1, 0, 0, 0, 255, 0, -1, 0, 0, 255, 0, 0, -1, 0, 255, 0, 0, 0, 1, 0])]; You can also use the ascb.filters.ColorMatrixArrays.DIGITAL_NEGATIVE constant, as shown here: sampleSprite.filters = [new ColorMatrixFilter(ColorMatrixArrays.DIGITAL_NEGATIVE)]; |
Категории