forked from: Interesting Static Texture
forked from Interesting Static Texture (diff: 9)
ActionScript3 source code
/**
* Copyright hacker_9m8qtizk ( http://wonderfl.net/user/hacker_9m8qtizk )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/a0dG
*/
// forked from shapevent's Interesting Static Texture
package {
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
public class Texture extends MovieClip {
private var canvas:BitmapData;
private var w:int;
private var w10:int;
private var size:int;
public function Texture(){
// init
canvas = new BitmapData(500,500,false, 0x000000);
addChild(new Bitmap(canvas));
scaleX = scaleY = 1;
w = canvas.width;
w10 = w * -25;
size = canvas.width * canvas.height;
for (var i:int = 0; i<size; i++){
var xp:int = i % w;
var yp:int = int(i*3 / w);
var c1:int = (255/8) * (Math.tan(xp* 2 *Math.PI/180 ) + Math.sin((yp*yp)/w10))
if (c1 < 0) c1 = 256 - c1
c1 = (c1 << 1 | c1)
canvas.setPixel(xp*5, yp*1.2, c1 <<16 | c1 <<8 | c1 );
}
var m:Matrix = new Matrix();
//m.scale(1,-1);
m.translate(0,canvas.height);
var clone:BitmapData = canvas.clone();
canvas.draw(clone, m, null, BlendMode.SUBTRACT);
clone.draw(canvas);
clone.applyFilter(clone, clone.rect, new Point(0,0), new BlurFilter(100,100,50));
canvas.draw(clone, null, null, BlendMode.ADD);
}
// private methods
}
}