forked from: forked from: forked from: アステロイド (eye version)
sorry about the bad formatting...
/**
* Copyright pipeep ( http://wonderfl.net/user/pipeep )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/8LwP
*/
// forked from pipeep's forked from: forked from: アステロイド (eye version)
// forked from makc3d's forked from: アステロイド (eye version)
// forked from 178ep3's アステロイド (eye version)
// sorry about the bad formatting...
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Point;
import flash.geom.ColorTransform;
import flash.filters.BlurFilter;
public class stepLine extends Sprite
{
private var step:uint=4;
private var rp:Point;
private var motionBlur:Bitmap;
public function stepLine()
{
stage.quality = "low";
motionBlur = new Bitmap(new BitmapData(stage.stageWidth, stage.stageHeight));
var n:uint = stage.stageWidth / step;
for(var i:uint=0; i<n; i++)
{
with(this.graphics)
{
lineStyle(1,0x000000,0.5);
moveTo(0,i*step);
lineTo(i*step,stage.stageHeight);
moveTo(stage.stageWidth,i*step);
lineTo(i*step,0);
if (i % 2 == 0) {
lineStyle(1,0x007FFF,0.5);
drawCircle (
stage.stageWidth * (0.5 + 0.1 * Math.sin (2 * i * Math.PI / n)),
stage.stageHeight * (0.5 + 0.1 * Math.cos (2 * i * Math.PI / n)),
stage.stageWidth / 6
);
}
}
}
//var bData:BitmapData = new BitmapData(width, height);
//bData.draw(this);
//var bMap:Bitmap = new Bitmap(bData);
//addChild(bMap);
//this.graphics.clear();
rp = new Point(width/2, height/2);
new flash.display.MovieClip().addEventListener("enterFrame", function funct( event:Event ):void { setProperty2("rotation", rotation+1); setProperty2("scaleX", scaleX+.01); setProperty2("scaleY", scaleY+.01); renderMotionBlur();} );
}
public function setProperty2(prop:String, n:Number):void
{
var a:Point = this.parent.globalToLocal(this.localToGlobal(rp));
this[prop] = n;
var b:Point = this.parent.globalToLocal(this.localToGlobal(rp));
this.x -= b.x - a.x;
this.y -= b.y - a.y;
}
private function renderMotionBlur():void {
addChildAt(motionBlur, 0);
motionBlur.bitmapData.draw(this);
var cTransform:ColorTransform = new ColorTransform();
cTransform.alphaMultiplier = 0.8;
motionBlur.bitmapData.colorTransform(motionBlur.bitmapData.rect, cTransform);
motionBlur.bitmapData.applyFilter(motionBlur.bitmapData, motionBlur.bitmapData.rect, new Point(), new BlurFilter(3, 3));
parent.addChildAt(motionBlur, 0); //stay on bottom
}
}
}