Interesting Texture #3

Actionscript:
  1. var canvas:BitmapData = new BitmapData(1500,1000,false, 0x000000);
  2. addChild(new Bitmap(canvas));
  3. scaleX = scaleY = .5;
  4.  
  5. var w:int = canvas.width;
  6. var w10:int = w * 80;
  7. var convert:Number = Math.PI/180;
  8. var size:int = canvas.width * canvas.height;
  9. for (var i:int = 0; i<size; i++){
  10.     var xp:int = i % w;
  11.     var yp:int = int(i / w);
  12.     var xp2:int = xp * 2;
  13.     var c1:int = (255/8) * (Math.cos(xp2 * convert) - Math.sin(yp*(xp2 + 500)/w10));
  14.     if (c1 <0) c1 = 256 - c1;
  15.     c1 = (c1 <<2 | c1) ;
  16.     canvas.setPixel(xp, yp, c1 <<15 | c1 <<9 | c1 );
  17. }
  18. var m:Matrix = new Matrix();
  19. m.scale(1,-1);
  20. m.translate(0,canvas.height);
  21. var clone:BitmapData = canvas.clone();
  22. canvas.draw(clone, m, null, BlendMode.SUBTRACT);
  23. clone.draw(canvas);
  24. clone.applyFilter(clone, clone.rect, new Point(0,0), new BlurFilter(10,10,1));
  25. canvas.draw(clone, null, null, BlendMode.ADD);
  26. var gray:ColorMatrixFilter = new ColorMatrixFilter([1, 0.55, 0.55, 0,0,0.55, 0.9, 0.55, 0,0,0.55, 0.55, 0.550,0, 0,0,0,1,0]);
  27. canvas.applyFilter(canvas, canvas.rect, new Point(0,0), gray);

Soon I'll work on a real-time variation. For now, here is one more still...

This entry was posted in BitmapData, pixel manipulation, setPixel 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 *

*
*