べ、別にお前のためじゃないんだからな!
/**
* Copyright bkzen ( http://wonderfl.net/user/bkzen )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/u9AU
*/
// forked from yooKo's forked from: flash on 2009-2-27
package
{
import flash.display.*;
import flash.filters.*;
import flash.text.*;
import flash.events.*;
import flash.geom.*;
import org.libspark.betweenas3.BetweenAS3;
[SWF (backgroundColor = "0xFFFFFF", frameRate = "30", width = "465", height = "465")]
public class main extends Sprite
{
private var first: eyeball;
private var obj: eyeball;
private var mousePoint: Point;
private var objs: int;
private function add(o:eyeball):void
{
o.x = Math.random() * stage.stageWidth;
o.y = Math.random() * stage.stageHeight;
if (first) obj = obj.next = o;
else obj = first = o;
BetweenAS3.delay(
BetweenAS3.serial(
BetweenAS3.addChild(o, this),
BetweenAS3.to(o, { x: o.defaultX, y: o.defaultY, cnt: 100 }, 0.5)
), objs++ * 0.01
).play();
}
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);
var dx: int = stage.stageWidth - 350 >> 1, dy: int = stage.stageHeight - 340 >> 1;
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 + dx, iy * 10 + dy, 4, 20));
}
}
mousePoint = new Point(mouseX, mouseY);
mouseChildren = mouseEnabled = false;
addEventListener(Event.ENTER_FRAME, frame);
}
private function frame(e:Event):void
{
mousePoint.x = mouseX, mousePoint.y = mouseY;
var o: eyeball = first;
do { o.run(mousePoint); }
while (o = o.next);
}
}
}
import flash.display.*;
import flash.geom.Point;
class eyeball extends Sprite
{
public var defaultX: uint, defaultY: uint;
public var cnt: int;
private var r:uint;
private var s: uint;
private var dpoint: Point;
public var next: eyeball;
function eyeball(color:uint, arg_x:uint, arg_y:uint, arg_r:uint, arg_s:uint)
{
dpoint = new Point( defaultX = arg_x, defaultY = arg_y );
r = arg_r;
s = arg_s;
graphics.beginFill(color, 0.75);
graphics.drawCircle(0, 0, r);
graphics.endFill();
}
public function run(mousePoint: Point): void
{
if (cnt < 99) return;
var dist: Number = Point.distance(dpoint, mousePoint);
var p: Point = Point.polar((dist < s) ? dist : s, -Math.atan2(defaultX - mousePoint.x, defaultY - mousePoint.y) - 90 * Math.PI / 180);
x = p.x + defaultX, y = p.y + defaultY;
}
}