forked from: forked from: forked from: code on 2008-12-18
second time on wonderfl
circles orbit circles
the blue circles' orbit depends upon mouseX, mouseY;
draw sprite to bitmap data, apply blur filter.
// forked from hacker_man's forked from: forked from: code on 2008-12-18
// forked from modernCarpentry's forked from: code on 2008-12-18
// forked from modernCarpentry's code on 2008-12-18
// second time on wonderfl
// circles orbit circles
// the blue circles' orbit depends upon mouseX, mouseY;
// draw sprite to bitmap data, apply blur filter.
package
{
import flash.display.Sprite;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.BlendMode;
import flash.events.Event;
import flash.geom.Rectangle;
import flash.geom.Point;
import flash.filters.BlurFilter;
public class OrbitDraw extends Sprite
{
//count
private var c:Number = 90;
//orbit radius
private var or:Number = 100;
//circle radius
private var r:Number = 900;
//blur filter
private var blur:BlurFilter
//bitmap fun
private var bd:BitmapData;
//display object to draw onto bitmap data
private var dob:Sprite;
public function OrbitDraw()
{
stage.align = "TOP_LEFT";
stage.scaleMode = "noScale";
bd = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0);
var bm:Bitmap = new Bitmap(bd);
addChild(bm);
blur = new BlurFilter(0, 0);
dob = new Sprite();
addEventListener(Event.ENTER_FRAME, frame);
}
private function frame(event:Event):void
{
c+= .07;
dob.graphics.clear();
bd.lock();
var cx:Number = mouseX + Math.cos(c) * or;
var cy:Number = mouseY + Math.sin(c) * or;
dob.graphics.beginFill(0x000000);
dob.graphics.drawCircle(cx, cy, r)
cx = cx + Math.cos(-2*c)*or;
cy = cy + Math.sin(-2*c)*or;
dob.graphics.beginFill(0xffffff);
dob.graphics.drawCircle(cx, cy, r/2);
cx = cx + Math.cos(4*c)*or/2;
cy = cy + Math.sin(4*c)*or/2;
dob.graphics.beginFill(0x000000);
dob.graphics.drawCircle(cx, cy, r/4);
cx = cx + Math.cos(-8*c)*or/4;
cy = cy + Math.sin(-8*c)*or/4;
dob.graphics.beginFill(0xffffff);
dob.graphics.drawCircle(cx, cy, r/6);
bd.draw(dob);
bd.applyFilter(bd, new Rectangle(0,0, stage.stageWidth, stage.stageHeight), new Point(), blur)
bd.unlock();
}
}
};