Posted By

Activetuts on 01/13/11


Tagged


Versions (?)

Who likes this?

17 people have marked this snippet as a favorite

chus
elbjoern
EderChrono
toxin20
jasongrandelli
leadingmannigel
ichnoweb
kure69
AndrewPotter
JaaQ
im3der
elderhsouza
scottwatkins
jbyerson
timr
coutlasssupreme
flashdeveloper


Converting Between Radians and Degrees


 / Published in: ActionScript 3
 

URL: http://enva.to/e4ig6z

When dealing with equations involving angles you will often be dealing in radians and not degrees. Display objects in Flash use degrees when dealing with their rotation property so we need a way to convert between the two. These helper function are useful for accomplishing just that; one for converting radians to degrees and the other degrees to radians.

  1. function degrees(radians:Number):Number
  2. {
  3. return radians * 180/Math.PI;
  4. }
  5.  
  6. function radians(degrees:Number):Number
  7. {
  8. return degrees * Math.PI / 180;
  9. }

Report this snippet  

You need to login to post a comment.