An interesting thing. I cannot create a polygon using a For loop

Anki works well when I don’t create polygon through the For loop.
The following figure


——————————————————————————-——
When I use the For loop and create a line chart on the canvas, it doesn’t work.
The following figure

——-——————————————————————————

——-——————————————————————————

Dae, can you tell me a way to avoid it?
I will go to learn the way by myself.
If the problem can’t be solved, I can use rectangles and ellipses, which is enough for me.
o(∩_∩)o

1 Like

Maybe replacing 2k with 2 * k would work. Unlike math, 2k is not k multiplied by 2 in programming languages.

Just FYI, when asking technical questions like this, I would recommend that you post your code in text format rather than an image. That way it will be easier for those trying to help you to test the code, and you will probably have a better chance of getting an answer. When doing so, please enclose your code in triple backticks, as follows:

```
<script>
    var canvas = document.getElementById("text100");
    canvas.width = 500;
    ...
    ...
</script>
```
2 Likes

Oh. It works.
Thank you for your reply.
:smiley:
I was so careless.
Thank you. thank you.
Because of you, I accelerated the final step of template making.
Have a nice day.
:smiling_face_with_three_hearts:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.