| 71 | } |
| 72 | |
| 73 | draw_shape(ctx, x, y, width, height, fill, stroke) { |
| 74 | var left = parseInt(x); |
| 75 | var top = parseInt(y); |
| 76 | |
| 77 | ctx.beginPath(); |
| 78 | ctx.moveTo(left + width * 0.512, top + height / 2); |
| 79 | ctx.bezierCurveTo( |
| 80 | left + width * 51.2 / 100, top + height * 28.4 / 100, |
| 81 | left + width * 71.5 / 100, top + height * 10.1 / 100, |
| 82 | left + width * 100 / 100, top + height * 3.1 / 100 |
| 83 | ); |
| 84 | ctx.bezierCurveTo( |
| 85 | left + width * 92 / 100, top + height * 1.1 / 100, |
| 86 | left + width * 83.4 / 100, top + height * 0 / 100, |
| 87 | left + width * 74.4 / 100, top + height * 0 / 100 |
| 88 | ); |
| 89 | ctx.bezierCurveTo( |
| 90 | left + width * 33.3 / 100, top + height * 0 / 100, |
| 91 | left + width * 0 / 100, top + height * 22.4 / 100, |
| 92 | left + width * 0 / 100, top + height * 50 / 100 |
| 93 | ); |
| 94 | ctx.bezierCurveTo( |
| 95 | left + width * 0 / 100, top + height * 77.6 / 100, |
| 96 | left + width * 33.3 / 100, top + height * 100 / 100, |
| 97 | left + width * 74.4 / 100, top + height * 100 / 100 |
| 98 | ); |
| 99 | ctx.bezierCurveTo( |
| 100 | left + width * 83.4 / 100, top + height * 100 / 100, |
| 101 | left + width * 92 / 100, top + height * 98.9 / 100, |
| 102 | left + width * 100 / 100, top + height * 96.9 / 100 |
| 103 | ); |
| 104 | ctx.bezierCurveTo( |
| 105 | left + width * 71.5 / 100, top + height * 89.9 / 100, |
| 106 | left + width * 51.2 / 100, top + height * 71.6 / 100, |
| 107 | left + width * 51.2 / 100, top + height * 50 / 100 |
| 108 | ); |
| 109 | ctx.closePath(); |
| 110 | if (fill) { |
| 111 | ctx.fill(); |
| 112 | } |
| 113 | if (stroke) { |
| 114 | ctx.stroke(); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | } |
| 119 | |