Canvas in HTML5 does not directly provide a method to draw ellipses. The following is a summary of several drawing methods. Various methods have their own advantages and disadvantages, and are selected according to the situation. The parameters of each method are the same:
1.context is Canvas' 2D drawing environment object,
2.x is the horizontal coordinate of the center of the ellipse.
3.y is the vertical coordinate of the center of the ellipse.
4.a is the length of the horizontal half axis of the ellipse.
5.b is the length of the vertical half-axis of the ellipse.
Parameter equation methodThis method uses the parametric equations of the ellipse to draw an ellipse
Copy the code