Blendmode Emboss

Actionscript:
  1. var canvas:BitmapData = new BitmapData(500, 500, true, 0xFFFFFFFF);
  2. var color:BitmapData= new BitmapData(500, 500, true, 0x81666666);
  3. var over:BitmapData = new BitmapData(500, 500, true, 0xFF000000);
  4. addChild(new Bitmap(canvas, "auto", true));
  5. var circle:Shape = new Shape();
  6. circle.graphics.beginFill(0xFFFFFF,1);
  7. circle.graphics.drawCircle(0,0,50);
  8. var m:Matrix = new Matrix();
  9. m.tx = 0;
  10. m.ty = 1;
  11. addEventListener(Event.ENTER_FRAME, onLoop);
  12. function onLoop(evt:Event):void {
  13.     circle.x = mouseX;
  14.     circle.y = mouseY;
  15.     canvas.draw(circle, circle.transform.matrix);
  16.     canvas.copyPixels(color, color.rect, new Point(0,0), null, null, true);
  17.     over.copyPixels(canvas, canvas.rect, new Point(0,0), null, null, true);
  18.     canvas.draw(over, m, null, BlendMode.SCREEN);
  19.     over.applyFilter(over, over.rect, new Point(-2,-2), new BlurFilter(10,10,1));
  20.     canvas.draw(over, m, null, BlendMode.SUBTRACT);
  21. }

Grayscale emboss technique. More info here.

This entry was posted in Uncategorized and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*