PaulSmith Perspective
PaulSmith.as
// forked from kadal's PaulSmith Version
// forked from kadal's PaulSmith
/* PaulSmith.as */
package {
import flash.display.Sprite;
import flash.display.Graphics;
import flash.display.DisplayObject;
import flash.events.TimerEvent;
import flash.utils.Timer;
import flash.events.Event;
import flash.filters.BlurFilter;
import net.hires.debug.Stats;
[SWF(backgroundColor="#FFFFFF", frameRate=30)]
public class PaulSmith extends Sprite {
private const SW:Number = stage.stageWidth;
private const SH:Number = stage.stageHeight;
// 収束点
private var gatherX:Number = SW * 0.95;
private var gatherY:Number = SH * 1/3;
public function PaulSmith() {
var timer:Timer = new Timer(100, 0);
timer.addEventListener(TimerEvent.TIMER, myPaul);
timer.start();
// addChild(new Stats());
}
private function myPaul(evt:TimerEvent):void {
var p:Paul = new Paul();
p.myWeight = Math.round(Math.random() * 5);
p.myX = 0;
p.myY = Math.round(Math.random() * SH*2)-SH/2;
p.myWidth = 1;
p.myColor = Math.random() * 0xFFFFFF;
addChild(p);
p.addEventListener(Event.ENTER_FRAME, extending);
}
private function extending(evt:Event):void{
var p:Object = evt.target;
p.graphics.clear();
p.graphics.beginFill(Math.random() * 0xFFFFFF);
p.graphics.moveTo(p.myX, p.myY - p.myWeight/2);
p.graphics.lineTo(gatherX, gatherY);
p.graphics.lineTo(p.myX, p.myY + p.myWeight/2);
p.graphics.endFill();
/*
var filters_array:Array = new Array();
var myBlur:BlurFilter = new BlurFilter(0, 2, 1);
filters_array.push(myBlur);
p.filters = filters_array;
*/
if(p.myWidth >= 1){
p.myWidth = 1;
} else {
p.myWidth *= 1.15;
}
if(p.myWidth >= 1){
p.removeEventListener(Event.ENTER_FRAME, extending);
}
}
}
}
import flash.display.Sprite;
class Paul extends Sprite {
public var myX:Number;
public var myY:Number;
public var myWeight:Number;
public var myWidth:Number;
public var myColor:Number;
public function Paul(){
}
}