forked from: petal
/**
* Copyright ntaka206 ( http://wonderfl.net/user/ntaka206 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/jHus
*/
// forked from k3lab's petal
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.utils.getTimer;
import flash.geom.ColorTransform;
public class FlashTest extends Sprite {
private var canvas:BitmapData
private var color:ColorTransform = new ColorTransform(1, 1, 1, 1, -50, -35, -15);
public function FlashTest() {
canvas = new BitmapData(480, 480, false,0);
addChild(new Bitmap(canvas)) as Bitmap;
addEventListener(Event.ENTER_FRAME, update);
}
private function update(e:Event):void {
var a:Number = Math.sin( getTimer() / 1000000 ) * 1000000;
canvas.lock();
//canvas.fillRect(canvas.rect,0);
canvas.colorTransform(canvas.rect, color);
for(var i:int = 0; i < 10000; i++) {
var r:Number = 150 + 40 * Math.sin( a/1000 )* Math.sin( i/40 + Math.sin(a/500) * 1.5 )+ 120 * Math.sin( i*2 * Math.cos(a/1500000) + a/10000 );
canvas.setPixel(240 + r * Math.sin(i / 160), 240 + r * Math.cos(i / 160), 0xffffff);
}
canvas.unlock();
}
}
}