Copy link to clipboard
Copied
Hello
I'd like to create a line that follows two constraints:
1. its pivot point is the line end which is fixed on a star
2. the second end follows a path - an arc of a circle
additionally, a small circles follows the same arc in the same pace.
thank you
Copy link to clipboard
Copied
var p:MovieClip = new MovieClip();
addChild(p);
var ctr:Point = new Point(300,300);
var perimeterPt:Point = new Point();
var rad:int = 200;
var angle:int = 270;
var fac:Number = Math.PI/180;
var t:Timer = new Timer(30,0);
t.addEventListener(TimerEvent.TIMER,drawF);
t.start();
function drawF(e:TimerEvent):void{
with(p.graphics){
clear();
lineStyle(0)
perimeterPt.x = ctr.x+rad*Math.cos(angle*fac);
perimeterPt.y = ctr.x+rad*Math.sin(angle*fac);
moveTo(pivot_mc.x,pivot_mc.y);
lineTo(perimeterPt.x,perimeterPt.y);
circle.x = perimeterPt.x;
circle.y = perimeterPt.y;
angle++;
}
}