flash on 2013-11-12
/**
* Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/yP7k
*/
package {
import flash.filters.BlurFilter;
import flash.events.Event;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
canvas = new BitmapData(128,128,false,0);
pic = new Bitmap(canvas);
addChild(pic);
pic.filters = [new BlurFilter()];
stage.addEventListener(Event.ENTER_FRAME, onEnter);
}//ctor
public var canvas:BitmapData;
public var pic:Bitmap;
public var ang:Number = 0;
public function onEnter(e:Event):void
{
var i:int;
var k:int;
var mw:int;
var mh:int;
var yt:int;
var t:Number;
mw = canvas.width;
mh = canvas.height;
canvas.lock();
ang += 0.08;
t = 0;
t = ang;
var cx:Number;
var cy:Number;
var cw:Number;
var cw1:Number;
var cw2:Number;
var cw3:Number;
var v1:Number;
var v2:Number;
var cr:int;
var cg:int;
var cb:int;
var c:uint;
v1 = 0.5 * Math.sin(t*0.2);
v2 = 0.5 * Math.cos(t*0.33);
var iw:Number;
var ih:Number;
iw = 1/mw;
ih = 1/mh;
cr = 0;
cg = 0;
cb = 0;
c = 0;
cw = 0;
cx = 0;
cy = 0;
cw1 = 0;
cw2 = 0;
cw3 = 0;
for (i = 0; i < mh; i++)
{
yt = i*mw;
for (k = 0; k < mw; k++)
{
cx = k*iw;
cy = i*ih;
// cy = i*ih-0.5 + v2;{
// cx = k*iw-0.5+v1;
//cw = Math.sin(Math.sin(Math.sqrt((cx*cx+cy*cy)+1)+t)*3.1415 );
//cw = Math.sin(cx*10+ t)*Math.cos(cy*10+t);
cw = Math.sin(cx);
cw +=Math.cos(cy);
cw +=Math.sin(cx+cy+t)*0.2;
cw +=Math.cos(cx+cy+t)*0.4;
cw += 0.4*Math.cos(Math.sqrt(20*(cx*cx+cy*cy+t+1)) );
cw += 0.8*Math.sin((Math.sin((cx+cy)*12+t*0.4)*Math.cos((cx*cy)*9+t*0.2)));
cw1 = Math.sin(cw*6*3.1415+t*0.01)
cw2 = Math.sin(cw*4*3.1415)
cw3 = Math.sin(cw*5*3.1415+t)
cr = 128+(cw1 * 128) & 0xFF;
cg = 128+(cw2 * 128) & 0xFF;
cb = 128+(cw3 * 128) & 0xFF;
c = (cr<<16)|(cg<<8)|(cb);
canvas.setPixel(k,i,c);
}//nextk
}//nexti
canvas.unlock();
}//onenter
}//classend
}