HTML5 canvas with dynamic user input

后端 未结 2 745
野性不改
野性不改 2021-01-14 06:54

I will start off by admitting I have never used canvas before so I don\'t know if this is possible but I can\'t seem to find the solution.

I am trying to create a ca

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-14 07:27

    I looked up on google and there was an interesting tutorial/code which draws a regular polygon with n-sides & size. So I thought of making a function out of it, one of the technical problems I encountered is that when the canvas is drawed and I click to draw another canvas, the second canvas is "overwritten" on the first one. Luckily someone here solved this problem by clearing the canvas.

    So here's my code, you may change it to your needs:

    
    
    
       
       Regular Polygon
    
    
      
    
      

    Polygon drawer:

    Number of sides

    Size

    Color

    Width

提交回复
热议问题