JavaScript code for fanning elements in a circular pattern