组件fishcomponent.js的代码如下:
Home >Web Front-end >H5 Tutorial >HTML5 Canvas custom rounded rectangle and dotted line sample code_html5 tutorial skills
HTML5 Canvas custom rounded rectangle and dash line (RoundedRectangle and Dash Line)
Implements a demonstration of adding custom functions to the HTML Canvas 2d context drawing object, how to draw dashed lines and control the interval size of dashed lines, and learn to draw circles Corner Rectangle Tips.
The native functions provided in the HTML5 Canvas drawing object do not implement the functions of drawing rounded rectangles and dotted lines, but through the Object.prototype of the JavaScript language, these two functions can be added to the object CanvasRenderingContext2D. The code demonstration effect is as follows:
The code of component fishcomponent.js is as follows: