Sepia
Posted by mitien in snippets and tips on 06 24th, 2010 | no responses
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...






















// Set sepia properties
var sepia = new flash.filters.ColorMatrixFilter();
sepia.matrix = [0.3930000066757202, 0.7689999938011169,
0.1889999955892563, 0, 0, 0.3490000069141388,
0.6859999895095825, 0.1679999977350235, 0, 0,
0.2720000147819519, 0.5339999794960022,
0.1309999972581863, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1];


использование - приметить фильтер к клипу


import flash.display.BitmapData;
import flash.geom.Rectangle;</code></code>

var myBitmap:BitmapData;
var myBitmapEffect:BitmapData;

// Create a new rectangle from 0,0
rect = new Rectangle(0, 0, pos, myBitmap.height);
// Set sepia properties
var sepia = new flash.filters.ColorMatrixFilter();
sepia.matrix = [0.3930000066757202, 0.7689999938011169, 0.1889999955892563, 0, 0, 0.3490000069141388, 0.6859999895095825, 0.1679999977350235, 0, 0, 0.2720000147819519, 0.5339999794960022, 0.1309999972581863, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1];
// Apply sepia
myBitmapEffect.applyFilter(myBitmap,rect, new Point(0, 0), sepia);
// copyPixels
myBitmapEffect.copyPixels(myBitmap,new Rectangle(pos, 0, myBitmap.width-pos, myBitmap.height),new Point(pos,0));
//Assign to stage
mc.attachBitmap(myBitmapEffect, 1, "auto", false);

No Comments

No comments yet.

Sorry, the comment form is closed at this time.