forked from: flash on 2009-2-27
/**
* Copyright selflash ( http://wonderfl.net/user/selflash )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/iSxc
*/
package
{
import flash.display.*;
import flash.filters.*;
import flash.text.*;
import flash.events.*;
import flash.geom.*;
public class main extends Sprite
{
private var obj:Array = new Array();
private function add(o:DisplayObject):void
{
obj.push(o);
stage.addChild(o);
}
function main()
{
var tf:TextField = new TextField();
tf.textColor = 0x000000;
tf.text = "Hello\nWorld!!!";
tf.autoSize = "left";
var bd:BitmapData = new BitmapData(tf.width, tf.height, false, 0x3399ff);
bd.draw(tf);
bd.applyFilter(bd, bd.rect, new Point(), new BlurFilter());
bd.draw(tf);
for(var ix:uint = 0; ix < 35; ix++)
{
for(var iy:uint = 0; iy < 34; iy++)
{
add(new eyeball(bd.getPixel(ix, iy), ix * 10 + 5, iy * 10 + 5, 4, 20));
}
}
stage.addEventListener(Event.ENTER_FRAME, frame);
}
private function frame(e:Event):void
{
for(var i:String in obj)
{
obj[i].run();
}
}
}
}
import flash.display.*;
import flash.geom.Point;
class eyeball extends Shape
{
private var defaultX:uint;
private var defaultY:uint;
private var r:uint;
private var s:uint;
//private var c:uint = Math.round(Math.random() * 255 * 255 * 255);
function eyeball(color:uint, arg_x:uint, arg_y:uint, arg_r:uint, arg_s:uint)
{
defaultX = arg_x;
defaultY = arg_y;
x = arg_x;
y = arg_y;
r = arg_r;
s = arg_s;
graphics.beginFill(color, 0.75);
graphics.drawCircle(0, 0, r);
graphics.endFill();
}
public function run():void
{
var dist:Number = Point.distance(new Point(defaultX, defaultY), new Point(stage.mouseX, stage.mouseY));
var p:Point = Point.polar((dist < s)? dist : s, -Math.atan2(defaultX - stage.mouseX, defaultY - stage.mouseY) - 90 * Math.PI / 180);
x = defaultX + p.x;
y = defaultY + p.y;
}
}