OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head></head> |
| 4 <body> |
| 5 <canvas id="mycanvas" width="400" height="400"></canvas> |
| 6 <script> |
| 7 var canvas = document.getElementById('mycanvas'); |
| 8 var ctx = canvas.getContext('2d'); |
| 9 ctx.lineWidth = 4; |
| 10 |
| 11 // moveTo + empty ellipse (swing == 0) |
| 12 ctx.translate(0, 20); |
| 13 ctx.save(); |
| 14 ctx.beginPath(); |
| 15 ctx.moveTo(20, 0); |
| 16 ctx.ellipse(80, 0, 10, 20, Math.PI / 6, -Math.PI / 2, -Math.PI / 2, true); |
| 17 ctx.stroke(); |
| 18 ctx.restore(); |
| 19 |
| 20 // moveTo + empty ellipse (radiusX == 0) |
| 21 ctx.translate(0, 20); |
| 22 ctx.save(); |
| 23 ctx.beginPath(); |
| 24 ctx.moveTo(20, 0); |
| 25 ctx.ellipse(80, 0, 0, 20, Math.PI / 6, -Math.PI / 2, Math.PI / 2, false); |
| 26 ctx.stroke(); |
| 27 ctx.restore(); |
| 28 |
| 29 // moveTo + empty ellipse (radiusY == 0) |
| 30 ctx.translate(0, 20); |
| 31 ctx.save(); |
| 32 ctx.beginPath(); |
| 33 ctx.moveTo(20, 0); |
| 34 ctx.ellipse(80, 0, 10, 0, Math.PI / 6, -Math.PI / 2, Math.PI / 2, false); |
| 35 ctx.stroke(); |
| 36 ctx.restore(); |
| 37 |
| 38 // empty ellipse (swing == 0) + lineTo |
| 39 ctx.translate(0, 20); |
| 40 ctx.save(); |
| 41 ctx.beginPath(); |
| 42 ctx.ellipse(20, 0, 10, 20, Math.PI / 6, -Math.PI / 2, -Math.PI / 2, false); |
| 43 ctx.lineTo(80, 0); |
| 44 ctx.stroke(); |
| 45 ctx.restore(); |
| 46 |
| 47 // empty ellipse (radiusX == 0) + lineTo |
| 48 ctx.translate(0, 20); |
| 49 ctx.save(); |
| 50 ctx.beginPath(); |
| 51 ctx.ellipse(20, 0, 0, 20, Math.PI / 6, -Math.PI / 2, Math.PI / 2, false); |
| 52 ctx.lineTo(80, 0); |
| 53 ctx.stroke(); |
| 54 ctx.restore(); |
| 55 |
| 56 // empty ellipse (radiusY == 0) + lineTo |
| 57 ctx.translate(0, 20); |
| 58 ctx.save(); |
| 59 ctx.beginPath(); |
| 60 ctx.ellipse(20, 0, 10, 0, Math.PI / 6, -Math.PI / 2, Math.PI / 2, false); |
| 61 ctx.lineTo(80, 0); |
| 62 ctx.stroke(); |
| 63 ctx.restore(); |
| 64 |
| 65 </script> |
| 66 </body> |
| 67 </html> |
OLD | NEW |