The following is the problem of drawing a sine wave on Canvas with JavaScript,
In the answer, ① was the correct answer.

However, I think that ② is more correct.
I wonder if ① will be a sine wave.

Which is the true answer, ① or ②?

I would appreciate it if anyone could tell me.
Thanks for your cooperation.

-The function start () determines the start point of a straight line, and the function drawLine () draws a straight line.
-When drawing a straight line continuously, the function start () is called only once at the beginning.
-Variables that are not declared var are given specific initial values.

start (startX, startY);
for (var i = startX + pitch;i<endX;i + = pitch) {
acceleration = (startY --currentY) * ratio;
velocity + = acceleration;
currentY + = velocity;
drawLine (i, currentY);
start (startX, startY);
for (var i = pitch;i<= Math.PI * 2;i + = pitch) {
var x = (endX --startX) * (i/Math.PI/2) + startX;
var y = radius * Math.sin (i) + startY;
drawLine (x, y);