forked from: Hello World 2!!!
// forked from nitoyon's Hello World 2!!!
// forked from nitoyon's Hello World!!!
package{
import flash.display.*;
import flash.text.*;
import flash.filters.*;
import flash.geom.*;
import caurina.transitions.Tweener;
public class Foo extends Sprite{
private var bd:BitmapData;
public function Foo():void{
var tf:TextField = new TextField();
tf.textColor = 0x000000;
tf.text = "あsだs\nsdfsdf";
tf.autoSize = "left";
bd = new BitmapData(tf.width, tf.height, false, 0xff9933);
bd.draw(tf);
bd.applyFilter(bd, bd.rect, new Point(), new BlurFilter());
bd.draw(tf);
for(var i:int = 0; i < bd.width; i++){
for(var j:int = 0; j < bd.height; j++){
var circle:Circle = new Circle(bd.getPixel(i, j));
circle.realx = i * 10; circle.realy = j * 10;
circle.x = circle.realx + Math.random() * 300 - 150;
circle.y = circle.realy + Math.random() * 300 - 150;
circle.alpha = 0;
addChild(circle);
Tweener.addTween(
circle, {
x: circle.realx, y: circle.realy, alpha: 1, time: 1,
delay: Math.sqrt(i + j) * Math.random()
}
);
}
}
}
}
}
import flash.display.Sprite;
import caurina.transitions.Tweener;
import flash.filters.GlowFilter;
class Circle extends Sprite{
public var realx:int;
public var realy:int;
public function Circle(color:uint):void{
graphics.beginFill(color);
graphics.drawCircle(0, 0, 6);
graphics.endFill();
mouseEnabled = true;
var self:Circle = this;
addEventListener("mouseOver", function(e:*):void{
self.parent.addChild(self);
filters = [new GlowFilter(0xffffff, .5)];
Tweener.addTween(self, {
x: realx + Math.random() * 40 - 20,
y: realy + Math.random() * 40 - 20,
time: .5,
onComplete: function():void{
Tweener.addTween(self, {
x: self.realx, y: self.realy, time: .5,
transition: 'easeOutSine',
onComplete: function():void{
filters = [];
}
});
}
});
});
}
}