Rect
♥0 |
Line 52 |
Modified 2012-10-29 21:57:18 |
MIT License
archived:2017-03-20 14:25:54
ActionScript3 source code
/**
* Copyright Maeda_addevent ( http://wonderfl.net/user/Maeda_addevent )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/5uGS
*/
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.geom.Point;
[SWF(width=465,height=465,backgroundColor=0xFFFFFF,frameRate=60)]
public class FB00017 extends Sprite {
public var sw:Number=stage.stageWidth;
public var sh:Number=stage.stageHeight;
public var _mySprite:mySprite;
public var speed:Number=3;
public function FB00017() {
stage.addEventListener(Event.ENTER_FRAME,xEnter);
}
public function xEnter(e:Event):void {
var _myCol:Number=Math.random()*0xFFFFFF;
_mySprite=new mySprite(_myCol);
_mySprite.x=sw/2;
_mySprite.y=sh-10;
addChild(_mySprite);
}
}
}
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.BlurFilter;
class mySprite extends Sprite {
public var myFil:BlurFilter=new BlurFilter(2,2,2);
public var _px:Number=Math.random()*465;
public var _py:Number=-25;//Math.random()*155;
public var _speed:Number=Math.random()*8;
public var _s:Number=Math.random()*20+5;
public var myCol:Number;
public function mySprite(_myCol:Number):void {
myCol=_myCol;
this.graphics.beginFill(myCol,1);
this.graphics.drawRect(0,0,_s,_s);
this.graphics.endFill();
addEventListener(Event.ENTER_FRAME,xEnter);
}
public function xEnter(e:Event):void {
var r:Number=Math.atan2(_py-this.y,_px-this.x)*180/Math.PI;
this.x+=_speed*Math.cos(r/180*Math.PI);
this.y+=_speed*Math.sin(r/180*Math.PI);
this.rotation += 1;
if (this.y<_py) {
this.graphics.clear();
parent.removeChild(this);
this.removeEventListener(Event.ENTER_FRAME, xEnter);
}
}
}