HTML Canvas - Dotted stroke around circle

前端 未结 5 1884
陌清茗
陌清茗 2021-01-02 17:06

I do know there is no native support for doing dotted stroke lines rendered on a canvas, but I have seen the clever ways people have been able to generate support for this.<

5条回答
  •  無奈伤痛
    2021-01-02 17:41

    If all else fails you can always loop a variable from 0 to 2*pi, skipping every step items and drawing on every other step items points at sin(angle)*radius+centerx, cos(angle)*radius+centery.

    There you go, home-made dotted circle :)

提交回复
热议问题