Following is the code for creating rounded corners in javascript:
https://jsbin.com/weqolonuku/edit?html,js,output
I\'ve implemented some maths to achieve this