Drawing API (angle formula)

:alien:

Alright, I suddenly have a lot of time on my hands, so I decided to start learning how to use the drawing API. I went through the simple tut on it here. That’s easy, I understand how it all works (dealt with moveTo and lineTo). Okay, but my question now is this: “What is the simplest mathematical formula for moving a line (or rather calculating a line to…) along an angle.” I’ve attached my source, albeit messy as I didn’t think I’d have a problem, and you can see I just made up some junk to get it to go -like- an angle. Anyway, the function which has all the vital stuff in it is on the first frame…shouldn’t be hard to find.

Anyway, thanks in advance,
–Elios

:alien:

angle = 40 ;
dtr = Math.PI / 180 ; // degrees to radians
long = 20 ;
startx = 50 ;
starty = 50 ;

this.lineStyle(0);
this.moveTo(startx,starty);

endx = startx + long * Math.cos (angle * dtr);
endy = starty + long * Math.sin (angle * dtr);

this.lineTo(endx,endy);[/As]

Thanks alot.

Later,
–Elios