flag
学校の課題なら、自分で勉強しないと意味ないんじゃ?
/**
* Copyright tananuka13 ( http://wonderfl.net/user/tananuka13 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/6DTn
*/
// forked from ProjectNya's 学校の課題なら、自分で勉強しないと意味ないんじゃ?
////////////////////////////////////////////////////////////////////////////////
// 学校の課題なら、自分で勉強しないと意味ないんじゃ?
// forked from nitoyon's Hello World!!! [http://wonderfl.net/c/nCFQ]
// forked from awef's flash on 2009-2-27 [http://wonderfl.net/c/tuwf]
////////////////////////////////////////////////////////////////////////////////
package{
import flash.display.*;
import flash.text.*;
import flash.filters.*;
import flash.geom.*;
import flash.events.*;
import caurina.transitions.Tweener;
public class Main extends Sprite {
private var bd:BitmapData;
private var circles:Array;
private var completed:uint = 0;
public function Main() {
var tf:TextField = new TextField();
tf.textColor = 0x000000;
tf.text = "Hello\nWorld!!!";
tf.autoSize = "left";
bd = new BitmapData(tf.width, tf.height, false, 0x3399ff);
bd.draw(tf);
bd.applyFilter(bd, bd.rect, new Point(), new BlurFilter());
bd.draw(tf);
circles = new Array();
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.dx = circle.x = i*10;
circle.dy = circle.y = j*10;
circles.push(circle);
Tweener.addTween(
randomize(addChild(circle)),
{
x: i * 10,
y: j * 10,
alpha: 1,
delay: (i + j) * .2 * Math.random(),
time: 1,
onComplete: complete
}
);
}
}
}
private function randomize(d:DisplayObject):DisplayObject {
d.x = 400 * Math.random();
d.y = 300 * Math.random();
d.alpha = 0;
return d;
}
private function complete():void {
completed ++;
if (completed > bd.width*bd.height - 1) {
addEventListener(Event.ENTER_FRAME, update, false, 0, true);
}
}
private function update(evt:Event):void {
for (var n:uint = 0; n < circles.length; n++) {
var circle:Circle = circles[n];
circle.run();
}
}
}
}
import flash.display.Sprite;
import flash.geom.Point;
class Circle extends Sprite{
public var dx:uint;
public var dy:uint;
public var r:uint = 4;
public var s:uint = 20;
private var c:uint = Math.round(Math.random() * 255 * 255 * 255);
public function Circle(color:uint):void {
graphics.beginFill(color);
graphics.drawCircle(0, 0, 6);
graphics.endFill();
}
public function run():void {
var dist:Number = Point.distance(new Point(dx, dy), new Point(stage.mouseX, stage.mouseY));
var p:Point = Point.polar((dist < s)? dist : s, -Math.atan2(dx - stage.mouseX, dy - stage.mouseY) - 90 * Math.PI / 180);
x = dx + p.x;
y = dy + p.y;
}
}