flash on 2015-11-13
♥0 |
Line 34 |
Modified 2015-11-13 05:39:46 |
MIT License
archived:2017-03-30 11:41:59
ActionScript3 source code
/**
* Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/6OY6
*/
package {
import flash.text.TextField;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
deb = new TextField();
deb.width=320;deb.height=240;
deb.mouseEnabled=false;
addChild(deb);
var px:Number; var py:Number;
var ax:Number; var ay:Number;
var ta:Number;
ax =230;ay=230;
graphics.lineStyle(2,0);
graphics.drawCircle(ax,ay, 8);
var ta0:Number;
var i:int;
for (i=0;i<16;i+=1)
{
px = ax; py = ay;
ax+=8;
ay+=i*1;
//ay+=4;
ta = Math.atan2(py-ay, px-ax);
deb.appendText("\n"+ta);
if (i==0) {ta0 =ta;}
graphics.drawCircle(ax,ay, 8);
}//nexti
deb.text = ""+ta0 + "\n" + ta + "\n"+angDiff(ta0,ta);
}//ctor
public var deb:TextField;
public static function angDiff(a:Number, b:Number):Number
{ a -= b; if (a > 3.14) { a -= 6.28; } if (a < -3.14) { a += 6.28;} return a; }//angdiff
}//classend
}