flash on 2015-7-10
/**
* Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/fNBW
*/
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 gt:int = 0;
public var cx:Number = 230;
public var cy:Number = 230;
public var cz:Number = 0;
public var ca:Number = 0;
public function onEnter(e:Event):void
{
graphics.clear();
graphics.lineStyle(2, 0);
var mx:Number; var my:Number;
mx = stage.mouseX; my = stage.mouseY;
var r:Number;
var ax:Number; var ay:Number;
ax=cx;ay=cy; r= 16;
// graphics.drawCircle(ax,ay, r);
graphics.lineStyle();
graphics.beginFill(0, 0.5);
graphics.drawEllipse(ax-r*0.5, ay-r*0.25+8, r, r*0.5);
graphics.endFill();
graphics.lineStyle(2,0);
var ang:Number; var u:Number;
var d:Number; var d2:Number;
ang = Math.atan2(my-ay, mx-ax);
u = gt*0.1;
d = Math.sin(u);
d2 = Math.sin(u+3.1415);
var nx:Number; var ny:Number;
nx = Math.cos(ang); ny = Math.sin(ang);
// graphics.moveTo(ax+nx*r,ay+ny*r);
// graphics.lineTo(ax+nx*-r,ay+ny*-r);
var kz:Number; var sa:Number;
var kx:Number; var ky:Number;
kx = ax+ny*r; ky = ay+nx*-r;
// graphics.drawCircle(kx,ky,8);
kx += nx*d*r; ky+=ny*d*r;
// graphics.drawCircle(kx,ky,8);
graphics.lineStyle();
graphics.beginFill(0, 0.5);
graphics.drawEllipse(kx-r*0.5, ky-r*0.25+8, r, r*0.5);
graphics.endFill();
graphics.lineStyle(2,0);
d = Math.sin(u+1.57);
if (d < 0) {d=0;}
graphics.drawCircle(kx,ky+d*-16,8);
cz= d*16;
kx = ax+ny*-r; ky = ay+nx*r;
//graphics.drawCircle(kx,ky,8);
kx += nx*d2*r; ky+=ny*d2*r;
//graphics.drawCircle(kx,ky,8);
graphics.lineStyle();
graphics.beginFill(0, 0.5);
graphics.drawEllipse(kx-r*0.5, ky-r*0.25+8, r, r*0.5);
graphics.endFill();
graphics.lineStyle(2,0);
d = Math.sin(u+1.57+3.1415);
if (d < 0) {d=0;}
graphics.drawCircle(kx,ky+d*-16,8);
cz += d*16;
cz = cz/2;
cz += 16;
graphics.drawCircle(cx,cy-cz, r);
graphics.drawCircle(cx+nx*r,cy-cz+ny*r, r*0.5);
graphics.drawCircle(cx+nx*r*1.8,cy-cz+ny*r*1.8, r*0.45);
if (gt % 16 == 0) { ca = ang;}
cx += Math.cos(ca);
cy += Math.sin(ca);
gt+=1;
}//onenter
}//classend
}