用畫布canvas畫安卓logo

來源:互聯網
上載者:User

標籤:composite   眼睛   nbsp   glob   rip   IV   ext   set   fill   

  1 <!DOCTYPE html>  2 <html lang="en">  3   4 <head>  5     <meta charset="UTF-8">  6     <meta name="viewport" content="width=device-width, initial-scale=1.0">  7     <meta http-equiv="X-UA-Compatible" content="ie=edge">  8     <title>Document</title>  9     <style> 10         #cs { 11             border: 1px solid black; 12             background: black; 13         } 14     </style> 15 </head> 16  17 <body> 18     <canvas id="cs" width="500" height="500"> 19  20     </canvas> 21  22     <script> 23         let cs = document.getElementById(‘cs‘); 24         let ctx = cs.getContext(‘2d‘); 25         ctx.fillStyle = ‘green‘; 26         ctx.arc(200, 100, 50, 0, Math.PI, true); 27         ctx.globalCompositeOperation = ‘source-over‘; 28         ctx.fill(); 29         //眼睛 30         ctx.beginPath(); 31         ctx.arc(175, 80, 10, 0, Math.PI * 2, true); 32         ctx.arc(222, 80, 10, 0, Math.PI * 2, true) 33         ctx.fillStyle = ‘black‘; 34         ctx.fill(); 35         //耳朵 36         ctx.beginPath(); 37         ctx.lineCap = "round";//設定返回線條 38         ctx.lineWidth = 6; 39         ctx.moveTo(160, 35); 40         ctx.lineTo(175, 60); 41         ctx.strokeStyle = "green"; 42         ctx.stroke(); 43  44         ctx.beginPath(); 45         ctx.lineCap = "round";//設定返回線條 46         ctx.lineWidth = 6; 47         ctx.moveTo(238, 35); 48         ctx.lineTo(222, 60); 49         ctx.strokeStyle = "green"; 50         ctx.stroke(); 51  52         //中間身體 53         ctx.beginPath();     54         ctx.moveTo(150,110); 55         ctx.lineTo(150,200); 56         ctx.arcTo(150,210,160,210,10); 57         ctx.lineTo(240,210); 58         ctx.arcTo(250,210,250,200,10); 59         ctx.lineTo(250,110); 60         ctx.lineTo(150,110) 61         ctx.strokeStyle = "green"; 62         ctx.fillStyle=‘green‘; 63         ctx.fill(); 64         ctx.stroke(); 65         //兩隻手 66         ctx.beginPath(); 67         ctx.lineCap = "round";//設定返回線條 68         ctx.lineWidth = 20; 69         ctx.moveTo(130, 115); 70         ctx.lineTo(130, 160); 71         ctx.strokeStyle = "green"; 72         ctx.stroke(); 73  74         ctx.beginPath(); 75         ctx.lineCap = "round";//設定返回線條 76         ctx.lineWidth = 20; 77         ctx.moveTo(270, 115); 78         ctx.lineTo(270, 160); 79         ctx.strokeStyle = "green"; 80         ctx.stroke(); 81  82         //兩隻腳 83         ctx.beginPath(); 84         ctx.lineCap = "round";//設定返回線條 85         ctx.lineWidth = 22; 86         ctx.moveTo(180, 215); 87         ctx.lineTo(180, 250); 88         ctx.strokeStyle = "green"; 89         ctx.stroke(); 90  91         ctx.beginPath(); 92         ctx.lineCap = "round";//設定返回線條 93         ctx.lineWidth = 22; 94         ctx.moveTo(220, 215); 95         ctx.lineTo(220, 250); 96         ctx.strokeStyle = "green"; 97         ctx.stroke(); 98     </script> 99 </body>100 101 </html>

 

用畫布canvas畫安卓logo

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.