So I just typed each letter to see what the pattern was. Is there a reason you had the pattern rotate the other way after `m`?
abcdefghijklm...n..o..p..q..r..s..t..u..v..w..x..y..z..z.ab...z..c...z..d...z..e
etc.
i.e., `.` changes direction. Once you get to `z` you can continue appending additional `z`s to keep it going. I quit making the spiral here cos I realized the top comment is also a spiral, although theirs is in the other direction.
function rotateLine(position) {
if (position < halfabet) {
context.rotate((-90 \* Math.PI) / 180);
} else if (position > halfabet) {
context.rotate((90 \* Math.PI) / 180);
} else if (position === halfabet) {
context.rotate((180 \* Math.PI) / 180);
}
}