Drawing a spiral on an HTML canvas using JavaScript
The Archimedean spiral is expressed as r=a+b(angle). Convert that into x, y coordinate, it will be expressed as x=(a+b*angle)*cos(angle), y=(a+b*angle)*sin(angle). Then you can put angle in a for loop and do something like this: for (i=0; i< 720; i++) { angle = 0.1 * i; x=(1+angle)*Math.cos(angle); y=(1+angle)*Math.sin(angle); context.lineTo(x, y); } Note the above assumes a … Read more