Drawing circle/ellipse on HTML5 canvas using mouse events

前端 未结 3 778
鱼传尺愫
鱼传尺愫 2020-12-06 15:34

I want something like ellipse option in paint for drawing on my canvas. I have achieved this partially. The problem is i am not able to get radius of circle, currently i hav

3条回答
  •  猫巷女王i
    2020-12-06 15:49

    Here's an example of how to drag-draw an oval.

    Demo: http://jsfiddle.net/m1erickson/3SFJy/

    enter image description here

    Example code using 2 Bezier curves to drag-draw an oval:

    
    
    
     
    
    
    
    
    
    
    
        

    Drag to create a circle or oval

提交回复
热议问题