OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head></head> |
| 4 <body> |
| 5 <canvas id="mycanvas" width="300" height="150"></canvas> |
| 6 <script> |
| 7 var canvas = document.getElementById('mycanvas'); |
| 8 var ctx = canvas.getContext('2d'); |
| 9 |
| 10 var r; |
| 11 var anticlockwise = true; |
| 12 ctx.beginPath(); |
| 13 for (r = 200; r >= 10; r -= 20) { |
| 14 ctx.moveTo(150 + r, 75); |
| 15 ctx.ellipse(150, 75, r, r * 1.2, 0, 0, Math.PI * 2, anticlockwise); |
| 16 ctx.closePath(); |
| 17 anticlockwise = !anticlockwise; |
| 18 } |
| 19 ctx.fillStyle = 'rgba(0, 255, 0, 1)'; |
| 20 ctx.strokeStyle = 'rgba(0, 255, 0, 1)'; |
| 21 ctx.fill(); |
| 22 ctx.stroke(); |
| 23 </script> |
| 24 </body> |
| 25 </html> |
OLD | NEW |