Sep
29
2008

Javascript & the Unit Circle

Whilst cleaning up the mess that is my www directory I found this old demo I made a few years back. I think at the time I wanted to figure out how to position HTML elements in a perfect(ish) circle. It’s not something I’d seen done before or since, probably because it’s a pretty impractical way of positioning HTML. Oh well, I remember having fun doing the coding and figuring out the maths, it also looks quite pretty too.

The trigonometry behind the script is know in maths as the unit circle. Using these rules you can determine where on the xy axis an object should be placed to follow the circumference of a circle.

The code was done a while back, before I was programming OO javascript or using libraries. As such, no guarantees it’ll work and won’t crash your browser!

Take a look at the Unit Circle animation here…

One Comment

  1. Ruben

    Hi:

    Please I would like get the example

    Thanks

Leave a comment