flash on 2013-7-3
/**
* Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/6beC
*/
package {
import flash.events.Event;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
stage.addEventListener(Event.ENTER_FRAME, onEnter);
}//ctor
public var t:Number = 0;
public function onEnter(e:Event):void
{
var ax:Number;
var ay:Number;
var bx:Number;
var by:Number;
var cx:Number;
var cy:Number;
var kx:Number;
var ky:Number;
var u:Number;
ax = 30;
ay = 130;
bx = 320;
by = 150;
cx = 300;
cy = 50;
cx = stage.mouseX;
cy = stage.mouseY;
graphics.clear();
graphics.lineStyle(2, 0);
graphics.drawCircle(ax, ay, 8);
graphics.drawCircle(bx, by, 8);
graphics.drawCircle(cx, cy, 8);
t += 0.01;
if (t > 0.1) { t = 0; }
for (u = (Math.cos(t)*Math.sin(t)); u < 1; u += 0.1)
{
var mx:Number;
var my:Number;
var hx:Number;
var hy:Number;
mx = ax + (bx - ax) * u;
my = ay + (by - ay) * u;
hx = bx + (cx - bx) * u;
hy = by + (cy - by) * u;
kx = mx + (hx - mx) * u;
ky = my + (hy - my) * u;
//kx = (mx + hx) * u;
//ky = (my + hy) * u;
graphics.moveTo(mx, my);
graphics.lineTo(kx, ky);
graphics.moveTo(hx, hy);
graphics.lineTo(kx, ky);
graphics.drawCircle(mx, my, 4);
graphics.drawCircle(hx, hy, 4);
graphics.beginFill(0, 1);
graphics.drawCircle(kx, ky, 8);
graphics.endFill();
}
}//onenter
}//classend
}