myMovie.filters = [ new ColorMatrixFilter(getSaturationMatrix(0) ]
private function getSaturationMatrix(value:Number):Array {
var nRed:Number = 0.3086;
var nGreen:Number = 0.6094;
var nBlue:Number = 0.0820;
var nA:Number = (1 - value) * nRed + value;
var nB:Number = (1 - value) * nGreen;
var nC:Number = (1 - value) * nBlue;
var nD:Number = (1 - value) * nRed;
var nE:Number = (1 - value) * nGreen + value;
var nF:Number = (1 - value) * nBlue;
var nG:Number = (1 - value) * nRed;
var nH:Number = (1 - value) * nGreen;
var nI:Number = (1 - value) * nBlue + value;
return [nA, nB, nC, 0, 0, nD, nE, nF, 0, 0, nG, nH, nI, 0, 0, 0, 0, 0, 1, 0];
}
To turn off the greyscale:
myMovie.filters = [ ]
No comments:
Post a Comment